/* =========================================================
   KĀLA — Interactive timeline with artifacts
   ========================================================= */
:root { --accent: #d6ad55; --accent-2: #f0d48c; --era-tint: #0b0a08; }
body { background: var(--era-tint); transition: background-color 1.4s ease; }

/* ---------- Hero ---------- */
.k-hero { position: relative; height: 100svh; min-height: 640px; overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.k-hero__bg { position: absolute; inset: -6%; z-index: -2; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.2vw; transform: rotate(-4deg) scale(1.12); opacity: 0.34; filter: saturate(0.55) contrast(1.05); }
.k-hero__bg .col { display: flex; flex-direction: column; gap: 1.2vw; will-change: transform; }
.k-hero__bg img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; }
.k-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(11,10,8,0.35) 0%, rgba(11,10,8,0.86) 62%, #0b0a08 100%); }
.k-hero__inner { text-align: center; padding: 0 var(--gutter); position: relative; }
.k-hero__ghost { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); font-family: var(--indic); font-size: clamp(160px, 34vw, 520px); line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(214, 173, 85, 0.16); white-space: nowrap; pointer-events: none; z-index: -1; }
.k-hero h1 { font-size: clamp(110px, 21vw, 330px); margin: 22px 0 10px; }
.k-hero h1 .char { display: inline-block; }
.k-hero__sub { font-family: var(--serif); font-size: clamp(20px, 2.4vw, 34px); font-style: italic; font-weight: 300; color: var(--paper-2); max-width: 30ch; margin: 0 auto; line-height: 1.25; }
.k-hero__meta { display: flex; justify-content: center; gap: clamp(20px, 5vw, 80px); margin-top: 44px; font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--paper-3); font-weight: 600; flex-wrap: wrap; }
.k-hero__meta b { display: block; font-family: var(--serif); font-size: 40px; letter-spacing: 0; color: var(--paper); font-weight: 300; text-transform: none; margin-bottom: 4px; }
.scroll-cue { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 10px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--paper-3); font-weight: 600; }
.scroll-cue i { width: 1px; height: 54px; background: linear-gradient(var(--accent), transparent); position: relative; overflow: hidden; }
.scroll-cue i::after { content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--paper); animation: cue 2.2s var(--ease-io) infinite; }
@keyframes cue { to { top: 110%; } }

/* ---------- How-to strip ---------- */
.howto { padding: clamp(80px, 12vw, 160px) var(--gutter) clamp(60px, 8vw, 100px); max-width: 1400px; margin: 0 auto; }
.howto__head { display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; align-items: end; margin-bottom: 64px; }
.howto h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(42px, 5.6vw, 84px); line-height: 0.98; }
.howto h2 em { color: var(--accent); }
.howto__steps { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.howto__step { padding: 30px 28px 10px 0; border-right: 1px solid var(--line); }
.howto__step:last-child { border-right: 0; }
.howto__step + .howto__step { padding-left: 28px; }
.howto__step .n { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 22px; }
.howto__step h3 { font-family: var(--serif); font-size: 28px; margin: 14px 0 8px; }
.howto__step p { color: var(--paper-3); font-size: 15px; }
@media (max-width: 860px) { .howto__head { grid-template-columns: 1fr; } .howto__steps { grid-template-columns: 1fr; } .howto__step { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 0 !important; } }

/* ---------- Horizontal journey ---------- */
.hz { position: relative; height: 100vh; overflow: hidden; }
.hz__track { display: flex; align-items: center; height: 100%; gap: 7vw; padding: 0 12vw 0 8vw; width: max-content; will-change: transform; }

.hz__start { flex: 0 0 auto; width: 46vh; }
.hz__start .big { font-family: var(--serif); font-weight: 300; font-size: 15vh; line-height: 0.85; }
.hz__start .big small { display: block; font-size: 4vh; font-style: italic; color: var(--accent); margin-top: 1.6vh; }
.hz__start p { color: var(--paper-3); margin-top: 3vh; font-size: 15px; max-width: 34ch; }
.hz__start .arrow-line { display: block; margin-top: 4vh; width: 30vh; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }

.era { flex: 0 0 auto; width: 78vh; max-width: 92vw; position: relative; padding-left: 4vh; border-left: 1px solid var(--line-2); }
.era__num { font-family: var(--serif); font-weight: 300; font-size: 34vh; line-height: 0.8; color: transparent; -webkit-text-stroke: 1.2px var(--accent); opacity: 0.85; letter-spacing: -0.02em; margin-left: -1vh; }
.era__native { position: absolute; right: 0; top: -4vh; font-family: var(--indic); font-size: 11vh; color: rgba(241, 232, 214, 0.06); pointer-events: none; white-space: nowrap; }
.era__span { margin-top: 3vh; }
.era__name { font-family: var(--serif); font-size: 6.4vh; line-height: 1; margin: 1.4vh 0 2.4vh; font-weight: 400; }
.era__intro { font-family: var(--serif); font-size: 2.45vh; line-height: 1.45; color: var(--paper-2); max-width: 46ch; font-weight: 300; }

.vitrine { flex: 0 0 auto; width: 44vh; position: relative; outline: none; perspective: 1400px; }
.vitrine__case { position: relative; aspect-ratio: 4 / 5; transform-style: preserve-3d; border-radius: 3px; }
.vitrine__frame { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; background: #15120e; box-shadow: 0 60px 90px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(214, 173, 85, 0.22); }
.vitrine__frame img { position: absolute; inset: -6% -10%; width: 120%; height: 112%; object-fit: cover; transition: transform 1.2s var(--ease-out), filter 1.2s var(--ease-out); filter: saturate(0.9) brightness(0.92); }
.vitrine:hover .vitrine__frame img, .vitrine:focus-visible .vitrine__frame img { transform: scale(1.06); filter: saturate(1.05) brightness(1.02); }
.vitrine__light { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 80% 55% at 50% -10%, rgba(255, 236, 190, 0.28), transparent 60%), linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.55)); mix-blend-mode: screen; }
.vitrine__glass { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.13) 45%, transparent 52%); background-size: 250% 100%; background-position: 120% 0; transition: background-position 1.3s var(--ease-out); border-radius: 3px; }
.vitrine:hover .vitrine__glass { background-position: -20% 0; }
.vitrine__plinth { height: 1.6vh; margin: 0 6%; background: linear-gradient(180deg, #2a241b, #14110d); transform: translateZ(0); box-shadow: 0 30px 40px -10px rgba(0,0,0,0.8); }
.vitrine__spot { position: absolute; left: 50%; top: -30vh; width: 70vh; height: 34vh; transform: translateX(-50%); background: radial-gradient(ellipse 30% 100% at 50% 0%, rgba(255, 230, 170, 0.11), transparent 70%); pointer-events: none; filter: blur(6px); }
.vitrine__label { margin-top: 3.2vh; display: grid; grid-template-columns: auto 1fr; column-gap: 2vh; align-items: baseline; }
.vitrine__no { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 2.2vh; }
.vitrine__title { font-family: var(--serif); font-size: 3.1vh; line-height: 1.08; font-weight: 400; }
.vitrine__sub { grid-column: 2; margin-top: 0.8vh; font-size: 1.45vh; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-3); font-weight: 600; }
.vitrine__badge { position: absolute; top: 14px; right: 14px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(11, 10, 8, 0.72); backdrop-filter: blur(8px); border: 1px solid rgba(214, 173, 85, 0.5); font-size: 10px; letter-spacing: 0.2em; font-weight: 700; color: var(--accent-2); transform: translateZ(40px); }
.vitrine__badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.vitrine:focus-visible .vitrine__frame { box-shadow: 0 0 0 2px var(--accent-2); }

.hz__end { flex: 0 0 auto; width: 70vh; padding-left: 4vh; border-left: 1px solid var(--line-2); }
.hz__end h3 { font-family: var(--serif); font-weight: 300; font-size: 9vh; line-height: 0.92; }
.hz__end h3 em { color: var(--accent); }
.hz__end p { color: var(--paper-2); font-family: var(--serif); font-size: 2.6vh; max-width: 36ch; margin: 3vh 0 4vh; }

/* ---------- Time ruler (fixed during the journey) ---------- */
.ruler { position: fixed; left: var(--gutter); right: var(--gutter); bottom: 26px; z-index: 700; pointer-events: none; opacity: 0; transform: translateY(20px); transition: opacity 0.6s, transform 0.6s var(--ease-out); }
.ruler.is-on { opacity: 1; transform: none; pointer-events: auto; }
.ruler__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.ruler__year { font-family: var(--serif); font-size: clamp(26px, 3vw, 42px); line-height: 1; font-weight: 300; height: 1.1em; overflow: hidden; position: relative; min-width: 12ch; }
.ruler__year span { display: block; }
.ruler__era { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); font-weight: 700; text-align: right; }
.ruler__bar { position: relative; height: 26px; }
.ruler__line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.ruler__fill { position: absolute; left: 0; top: 50%; height: 1px; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); box-shadow: 0 0 12px var(--accent); }
.ruler__tick { position: absolute; top: 0; height: 26px; transform: translateX(-50%); display: grid; place-items: center; }
.ruler__tick button { width: 26px; height: 26px; display: grid; place-items: center; font-size: 0; color: transparent; }
.ruler__tick button::before { content: ""; position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ink); border: 1px solid var(--paper-3); transition: all 0.4s; }
.ruler__tick span { position: absolute; bottom: 24px; white-space: nowrap; font-size: 12px; font-style: italic; font-family: var(--serif); color: var(--paper); opacity: 0; transform: translateY(6px); transition: opacity 0.4s, transform 0.4s; pointer-events: none; }
.ruler__tick:hover span { opacity: 0.7; transform: none; }
.ruler__tick.is-past button::before { background: var(--accent); border-color: var(--accent); }
.ruler__tick.is-current button::before { transform: scale(1.8); background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 14px var(--accent-2); }
.ruler__tick.is-current span { opacity: 1; transform: none; }
@media (max-width: 899px) { .ruler { display: none; } }

/* ---------- Mobile journey (vertical) ---------- */
@media (max-width: 899px) {
  .hz { height: auto; overflow: visible; }
  .hz__track { flex-direction: column; align-items: stretch; width: auto; padding: 0 var(--gutter) 60px; gap: 64px; }
  .hz__start, .era, .hz__end { width: auto; max-width: none; }
  .hz__start .big { font-size: 64px; } .hz__start .big small { font-size: 22px; }
  .era { padding-left: 18px; }
  .era__num { font-size: 150px; }
  .era__native { font-size: 64px; top: 0; }
  .era__name { font-size: 38px; }
  .era__intro { font-size: 19px; }
  .vitrine { width: auto; }
  .vitrine__title { font-size: 24px; } .vitrine__no { font-size: 17px; } .vitrine__sub { font-size: 11px; }
  .vitrine__plinth { height: 10px; }
  .vitrine__spot { display: none; }
  .hz__end h3 { font-size: 52px; } .hz__end p { font-size: 20px; }
}

/* ---------- Index / filter grid ---------- */
.index { padding: clamp(90px, 12vw, 170px) var(--gutter); max-width: 1500px; margin: 0 auto; }
.index__head { display: flex; justify-content: space-between; align-items: end; gap: 30px; flex-wrap: wrap; margin-bottom: 44px; }
.index__head h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(44px, 6vw, 90px); line-height: 0.95; }
.index__head h2 em { color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 22px; }
.card { cursor: pointer; outline: none; }
.card__img { aspect-ratio: 1; overflow: hidden; border-radius: 3px; background: var(--ink-3); position: relative; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease-out), filter 0.8s; filter: grayscale(0.35) brightness(0.9); }
.card:hover .card__img img, .card:focus-visible .card__img img { transform: scale(1.07); filter: none; }
.card:focus-visible .card__img { box-shadow: 0 0 0 2px var(--accent-2); }
.card__era { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-top: 14px; }
.card__title { font-family: var(--serif); font-size: 22px; line-height: 1.1; margin-top: 6px; }
.card__date { font-size: 13px; color: var(--paper-3); margin-top: 4px; }
.card.is-hidden { display: none; }

/* ---------- Detail overlay ---------- */
.detail { position: fixed; inset: 0; z-index: 9100; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 0.75fr); background: #070605; visibility: hidden; }
.detail.is-open { visibility: visible; }
.detail__stage { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #1b1712, #070605 70%); touch-action: none; }
.detail__viewer { position: absolute; inset: 0; cursor: grab; }
.detail__viewer.is-drag { cursor: grabbing; }
.detail__imgwrap { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.detail__imgwrap img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.detail__imgwrap img.full { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s; }
.detail__imgwrap img.full.is-loaded { opacity: 1; }
.detail__3d { position: absolute; inset: 0; display: none; background: #0d0b09; }
.detail__3d iframe { width: 100%; height: 100%; border: 0; }
.detail__3d .offline { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--paper-3); padding: 40px; font-family: var(--serif); font-size: 22px; pointer-events: none; }
.detail.show-3d .detail__3d { display: block; }
.detail.show-3d .detail__viewer, .detail.show-3d .detail__zoom, .detail.show-3d .detail__res, .detail.show-3d .detail__hint { display: none; }
.detail__tabs { position: absolute; top: 22px; left: 22px; z-index: 5; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(11, 10, 8, 0.7); backdrop-filter: blur(10px); border: 1px solid var(--line-2); }
.detail__tabs button { padding: 8px 16px; border-radius: 999px; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 700; color: var(--paper-2); }
.detail__tabs button[aria-selected="true"] { background: var(--accent); color: var(--ink); }
.detail__zoom { position: absolute; left: 22px; bottom: 22px; z-index: 5; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(11, 10, 8, 0.7); backdrop-filter: blur(10px); border: 1px solid var(--line-2); }
.detail__zoom button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: var(--paper); }
.detail__zoom button:hover { background: rgba(241, 232, 214, 0.1); }
.detail__zoom output { min-width: 58px; text-align: center; font-size: 11px; letter-spacing: 0.1em; color: var(--paper-2); font-variant-numeric: tabular-nums; }
.detail__res { position: absolute; right: 22px; bottom: 22px; z-index: 5; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--paper-3); font-weight: 600; background: rgba(11,10,8,.6); padding: 8px 12px; border-radius: 999px; }
.detail__res .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; animation: pulse 1s infinite; }
.detail__res.is-loaded .dot { animation: none; background: #7fd18b; }
.detail__hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 4; font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--paper-3); pointer-events: none; transition: opacity 0.6s; white-space: nowrap; }

.detail__panel { position: relative; overflow-y: auto; overscroll-behavior: contain; background: var(--ink-2); border-left: 1px solid var(--line); padding: 96px clamp(28px, 3.4vw, 60px) 60px; }
.detail__close { position: absolute; top: 22px; right: 22px; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; transition: transform 0.6s var(--ease-out), background 0.4s; z-index: 6; }
.detail__close:hover { transform: rotate(90deg); background: var(--accent); color: var(--ink); }
.detail__close svg { width: 16px; height: 16px; }
.detail__era { display: flex; align-items: center; gap: 12px; }
.detail__title { font-family: var(--serif); font-size: clamp(36px, 3.3vw, 56px); line-height: 1; font-weight: 400; margin: 18px 0 10px; }
.detail__native { font-family: var(--indic); font-size: 22px; color: var(--accent-2); opacity: 0.85; }
.detail__date { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--paper-2); margin-top: 6px; }
.detail__summary { font-family: var(--serif); font-size: 23px; line-height: 1.4; color: var(--paper); margin: 30px 0; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 300; }
.detail__meta { display: grid; grid-template-columns: 110px 1fr; gap: 12px 18px; margin: 0 0 30px; font-size: 14px; }
.detail__meta dt { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--paper-3); font-weight: 700; padding-top: 3px; }
.detail__meta dd { margin: 0; color: var(--paper-2); }
.detail__body p { color: var(--paper-2); font-size: 16px; line-height: 1.75; }
.detail__look { margin: 34px 0; padding: 26px 24px; border: 1px solid rgba(214, 173, 85, 0.3); border-radius: 4px; background: linear-gradient(135deg, rgba(214, 173, 85, 0.07), transparent); }
.detail__look h4 { font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 14px; }
.detail__look ol { margin: 0; padding: 0; list-style: none; counter-reset: l; }
.detail__look li { counter-increment: l; position: relative; padding: 8px 0 8px 36px; font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--paper); }
.detail__look li::before { content: counter(l, lower-roman) "."; position: absolute; left: 0; top: 8px; color: var(--accent); font-style: italic; }
.detail__credit { font-size: 12px; color: var(--paper-3); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 18px; }
.detail__credit a { border-bottom: 1px solid var(--line-2); }
.detail__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.detail__nav button { flex: 1; text-align: left; padding: 16px 18px; border: 1px solid var(--line); border-radius: 4px; transition: border-color 0.4s, background 0.4s; }
.detail__nav button:hover { border-color: var(--accent); background: rgba(214, 173, 85, 0.06); }
.detail__nav button:last-child { text-align: right; }
.detail__nav small { display: block; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--paper-3); font-weight: 700; margin-bottom: 4px; }
.detail__nav span { font-family: var(--serif); font-size: 18px; }
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; grid-template-rows: 52vh 1fr; }
  .detail__panel { border-left: 0; border-top: 1px solid var(--line); padding: 30px var(--gutter) 60px; }
  .detail__close { top: 12px; right: 12px; position: fixed; background: rgba(11,10,8,.75); }
  .detail__hint { display: none; }
}
