/* Dreamoru, page two: the split stage. Cold steel and teal, one red accent.
   The mechanism lives in scrollcraft.css; nothing here restyles a [data-sc-*]
   selector. The seam position is one number, --split (0 to 100), written by
   dreamoru.js on the stage. */
:root {
  --sc-canvas:     #060C13;
  --sc-surface:    #0E1822;
  --sc-ink:        #E9F1F6;
  --sc-ink-soft:   #AFC0CD;
  --sc-accent:     #F2473A;
  --sc-accent-ink: #0B0F15;
  --sc-font-display: "Archivo", "Pretendard Variable", "Pretendard", system-ui, sans-serif;
  --sc-font-text:    "Pretendard Variable", "Pretendard", system-ui, sans-serif;
  --sc-shadow-color: 208 50% 3%;
  --line: #BFE4F7;            /* the colour of a drawn line */
  --gap: clamp(1.5rem, 3vw, 3rem);   /* air between the seam and copy */
  color-scheme: dark;
}

/* ------------------------------------------------------------ language -- */
:root[data-lang="ko"] [lang="en"],
:root[data-lang="en"] [lang="ko"] { display: none !important; }
:lang(ko), [lang="ko"] { word-break: keep-all; overflow-wrap: anywhere; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------ type ------ */
.display {
  margin: 0; font-family: var(--sc-font-display); font-weight: 800;
  line-height: 1.1; letter-spacing: -0.02em; color: var(--sc-ink); text-wrap: balance;
}
:root[data-lang="en"] .display { letter-spacing: -0.03em; line-height: 1.02; }
.display--hero { font-size: clamp(2.5rem, 6.2vw, 6.25rem); }
.display--lg   { font-size: clamp(2.2rem, 4.6vw, 4.5rem); }
.display--md   { font-size: clamp(1.8rem, 3.3vw, 3.2rem); line-height: 1.16; }
.display--peak { font-size: clamp(1.55rem, 3.3vw, 3.3rem); line-height: 1.24; text-wrap: initial; white-space: nowrap; }
:root[data-lang="en"] .display--peak { font-size: clamp(1.4rem, 2.9vw, 2.9rem); line-height: 1.14; }
/* The dream state of type: a drawn outline, nothing inside it yet. */
/* color carries the stroke colour (what actually paints); only the fill is empty. */
/* The inside is filled with the dark of the canvas, not left empty, so the
   drawing's own lines never show through the letters and fight the outline. */
.is-line {
  color: var(--line);
  -webkit-text-fill-color: color-mix(in oklab, var(--sc-canvas) 78%, transparent);
  -webkit-text-stroke: 1.6px var(--line);
  paint-order: stroke fill;
}

.lede {
  margin: var(--sc-5) 0 0; font-size: var(--sc-t-lg); line-height: 1.6;
  color: var(--sc-ink); max-width: 26em; text-wrap: pretty; font-weight: 500;
}
.body { margin: 0; color: var(--sc-ink); font-size: var(--sc-t-lg); line-height: 1.7; max-width: 26em; text-wrap: pretty; font-weight: 450; }
.body + .body { margin-top: var(--sc-4); color: var(--sc-ink-soft); }
.eyebrow { margin: 0 0 var(--sc-3); font-size: var(--sc-t-sm); letter-spacing: 0.04em; color: var(--sc-accent); font-weight: 600; }
.define { margin: 0 0 var(--sc-5); color: var(--sc-ink); font-size: var(--sc-t-sm); max-width: 34em; }
.define b { font-family: var(--sc-font-display); font-weight: 800; margin-right: 0.6em; font-size: 1.15em; }
.is-line ~ .define, .copy--span[aria-hidden] .define { color: var(--line); }

/* ------------------------------------------------------------ corners --- */
.skip {
  position: fixed; left: var(--sc-4); top: var(--sc-4); z-index: 100;
  padding: var(--sc-2) var(--sc-4); background: var(--sc-surface); border-radius: var(--sc-r-sm);
  transform: translateY(-300%);
}
.skip:focus-visible { transform: none; }

.mark {
  position: fixed; z-index: var(--sc-z-chrome); left: var(--sc-gutter); top: 1.35rem;
  display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--sc-ink);
  min-height: 2.75rem;
}
.mark__glyph { width: 1.8rem; height: auto; color: var(--sc-accent); }
.mark__word { font-family: var(--sc-font-display); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }

.corner {
  position: fixed; z-index: var(--sc-z-chrome); right: var(--sc-gutter); top: 1.45rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.lang {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--sc-r-pill);
  background: color-mix(in oklab, var(--sc-canvas) 60%, transparent);
  box-shadow: inset 0 0 0 1px var(--sc-hairline-strong);
}
.lang button {
  border: 0; background: transparent; cursor: pointer;
  min-width: 2.6rem; min-height: 2.1rem; padding: 0 0.6rem; border-radius: var(--sc-r-pill);
  font-size: var(--sc-t-xs); font-weight: 700; letter-spacing: 0.06em; color: var(--sc-ink);
  transition: background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out);
}
.lang button[aria-pressed="true"] { background: var(--sc-ink); color: var(--sc-accent-ink); }

.cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.5rem; border-radius: var(--sc-r-sm);
  background: var(--sc-accent); color: var(--sc-accent-ink);
  font-weight: 700; text-decoration: none; white-space: nowrap;
  box-shadow: var(--sc-e1);
  transition: transform 140ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
.cta:active { transform: scale(0.97); }
/* The corner copy of the action. It steps away at the close, where the same
   button already stands in the scene, so the page never shows it twice. */
.cta--top {
  min-height: 2.5rem; padding: 0 1rem; font-size: var(--sc-t-sm);
  opacity: var(--top-cta, 1); visibility: var(--top-cta-vis, visible);
  transition: opacity 200ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .cta:hover { background: #FF6A5C; } }

/* ------------------------------------------------------------ the stage - */
.stage {
  --split: 50;
  --sx: calc(var(--split) * 1%);
  overflow: clip; background: var(--sc-canvas);   /* position stays the engine's sticky */
}
.half { position: absolute; inset: 0; }
.half--dream { clip-path: inset(0 calc(100% - var(--sx)) 0 0); }
.half--real  { clip-path: inset(0 0 0 var(--sx)); }

.panel { position: absolute; inset: 0; visibility: hidden; will-change: transform; }
.panel__img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; transform: scale(var(--breath, 1)); transform-origin: 50% 55%;
}

/* Density only where copy sits: a column that starts at the seam. */
.shade { position: absolute; pointer-events: none; z-index: 1; }
.shade--col {
  top: 0; bottom: 0; left: var(--sx); width: 52%;
  background: linear-gradient(to right,
    color-mix(in oklab, var(--sc-canvas) 80%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 62%, transparent) 50%, transparent 100%);
}
/* The same idea on the drawing's side: a column that ends at the seam. */
.shade--dream {
  top: 0; bottom: 0; right: calc(100% - var(--sx)); width: 44%;
  background: linear-gradient(to left,
    color-mix(in oklab, var(--sc-canvas) 86%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 70%, transparent) 55%, transparent 100%);
}
/* The opening keeps the towers clear on both sides of the seam: its shade
   starts below the waterline, where the headline sits. */
@media (min-width: 861px) {
  .panel[data-beat="0"] .shade { top: 50%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 34%);
            mask-image: linear-gradient(to bottom, transparent 0%, #000 34%); }
  /* The English headline runs two lines and starts higher, so its shade does too. */
  :root[data-lang="en"] .panel[data-beat="0"] .shade { top: 47%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%);
            mask-image: linear-gradient(to bottom, transparent 0%, #000 16%); }
}
.shade--top {
  inset: 0 0 42% 0;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--sc-canvas) 78%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 60%, transparent) 55%, transparent 100%);
}
.shade--low {
  inset: 30% 0 0 0;
  background: linear-gradient(to top right,
    color-mix(in oklab, var(--sc-canvas) 90%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 60%, transparent) 34%, transparent 66%);
}

/* Copy is anchored to the seam, never to the page edge, so it travels with it. */
.copy { position: absolute; z-index: 2; }
.copy--dream {
  right: calc(100% - var(--sx) + var(--gap)); text-align: right;
  max-width: calc(var(--sx) - var(--gap) - var(--sc-gutter));
}
.copy--real {
  left: calc(var(--sx) + var(--gap));
  max-width: min(34rem, calc(100% - var(--sx) - var(--gap) - var(--sc-gutter)));
}
.copy--hero { top: 71vh; }
@media (min-width: 861px) { :root[data-lang="en"] .copy--hero { top: 55vh; } }   /* two-line headline in English */
.copy--mid  { top: 50%; translate: 0 -50%; }
.copy--low  { bottom: 12vh; }
/* The peak copy sits right of where the sweep comes to rest (30%), so the
   whole sentence ends up made. */
.copy--span { left: calc(30% + var(--gap)); top: clamp(6rem, 17vh, 10rem); right: var(--sc-gutter); }
.copy--close { left: max(var(--sc-gutter), calc(var(--sx) + var(--gap))); bottom: clamp(2.5rem, 8vh, 5.5rem); max-width: min(40rem, 80vw); }
.copy--dream .display { white-space: nowrap; }

.status {
  margin: var(--sc-5) 0 0; display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: var(--sc-t-sm); color: var(--sc-ink);
  padding: 0.45rem 0.9rem; border-radius: var(--sc-r-sm);
  background: color-mix(in oklab, var(--sc-surface) 82%, transparent);
  box-shadow: var(--sc-edge), inset 0 0 0 1px var(--sc-hairline);
}
.status__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--sc-accent); }
.copy--close .cta { margin-top: var(--sc-6); }
.foot {
  margin-top: var(--sc-7); display: flex; gap: var(--sc-5); flex-wrap: wrap;
  font-size: var(--sc-t-xs); color: var(--sc-ink-soft); letter-spacing: 0.02em;
}

.shade--phone { display: none; }

/* ------------------------------------------------------------ the seam -- */
.seam { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.seam__line {
  position: absolute; top: 0; bottom: 0; left: var(--sx); width: 1px; translate: -0.5px 0;
  background: color-mix(in oklab, var(--sc-ink) 78%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--sc-canvas) 35%, transparent);
}
.seam__side {
  position: absolute; bottom: 1.6rem;
  font-size: var(--sc-t-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--sc-ink); opacity: var(--side-on, 1); white-space: nowrap;
}
.seam__side--dream { right: calc(100% - var(--sx) + 0.9rem); color: var(--line); }
.seam__side--real  { left: calc(var(--sx) + 0.9rem); }

.seam__beats {
  position: absolute; left: max(var(--sx), 1.4rem); top: 50%; translate: -50% -50%;
  list-style: none; margin: 0; padding: 0; display: grid; pointer-events: auto;
  opacity: var(--beats-on, 1);   /* the marks leave with the seam at the close */
}
.seam__beats button {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border: 0; background: none; cursor: pointer; padding: 0; position: relative;
}
.seam__beats button::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--sc-canvas); box-shadow: inset 0 0 0 1.5px var(--sc-ink);
  transition: transform 180ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .seam__beats button:hover::before { transform: scale(1.35); } }
/* The playhead: one red mark that travels down the seam with the scroll. */
.seam__now {
  position: absolute; left: 50%; top: calc(1.375rem + var(--now, 0) * (100% - 2.75rem));
  width: 0.95rem; height: 0.95rem; border-radius: 50%; translate: -50% -50%;
  background: var(--sc-accent); box-shadow: 0 0 0 3px var(--sc-canvas); pointer-events: none;
}

.seam__grip {
  position: absolute; left: max(var(--sx), 1.4rem); top: 13%; translate: -50% -50%;
  width: 2.9rem; height: 2.9rem; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; cursor: ew-resize; pointer-events: auto;
  background: var(--sc-surface); color: var(--sc-ink);
  box-shadow: var(--sc-e2), inset 0 0 0 1px var(--sc-hairline-strong);
  touch-action: none; opacity: var(--grip-on, 1);
  transition: transform 140ms var(--sc-ease-out);
}
.seam__grip svg { width: 1.3rem; height: 1.3rem; }
.seam__grip:active { transform: scale(0.95); }

/* ------------------------------------------------------------ motion off */
@media (prefers-reduced-motion: reduce) {
  .panel { transform: none !important; transition: opacity 220ms var(--sc-ease-out); }
  .panel__img { transform: none; }
  .seam__beats button::before { transition: none; }
}

/* ------------------------------------------------------------ phone -----
   Not a shrink. The seam turns horizontal: the drawing is above it, the made
   thing below, and the two tracks travel sideways in opposite directions. */
@media (max-width: 860px) {
  :root { --gap: 2.3rem; }

  .mark { top: 0.85rem; }
  .corner { top: 0.95rem; gap: 0.4rem; }
  .lang button { min-width: 2.3rem; padding: 0 0.45rem; }
  .cta--top { min-height: 2.25rem; padding: 0 0.75rem; font-size: var(--sc-t-xs); }
}
/* The narrowest phones: the corner needs the room, so the mark keeps only its
   glyph (the link keeps its name for screen readers). */
@media (max-width: 370px) {
  .mark__word { display: none; }
}
@media (max-width: 860px) {

  /* The opening on a phone: the seam crosses the towers (set in SEAM_TALL),
     so the photograph below it must stay clear. Its copy goes to the foot of
     the screen, over the dark water, and its shade rises from there. */
  .copy--real.copy--hero { top: auto; bottom: clamp(2rem, 7vh, 3.5rem); }
  .panel[data-beat="0"] .shade--col {
    top: auto; bottom: 0; height: 46%;
    background: linear-gradient(to top,
      color-mix(in oklab, var(--sc-canvas) 88%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 62%, transparent) 55%, transparent 100%);
  }

  .half--dream { clip-path: inset(0 0 calc(100% - var(--sx)) 0); }
  .half--real  { clip-path: inset(var(--sx) 0 0 0); }

  .copy--dream, .copy--real {
    left: var(--sc-gutter); right: var(--sc-gutter); text-align: left;
    max-width: none; translate: none;
  }
  .copy--dream { top: auto; bottom: calc(100% - var(--sx) + var(--gap)); }
  .copy--real  { top: calc(var(--sx) + var(--gap)); bottom: auto; }
  .copy--dream .display { white-space: normal; }
  .copy--span  { left: var(--sc-gutter); right: var(--sc-gutter); top: calc(34% + 2.4rem); }
  .display--peak, :root[data-lang="en"] .display--peak { white-space: normal; }
  .shade--dream { left: 0; right: 0; width: auto; top: auto; bottom: calc(100% - var(--sx)); height: 46%;
    background: linear-gradient(to top, color-mix(in oklab, var(--sc-canvas) 88%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 66%, transparent) 55%, transparent 100%); }
  .copy--close { left: var(--sc-gutter); right: var(--sc-gutter); top: auto; bottom: clamp(1.5rem, 5vh, 3rem); max-width: none; }
  .display--hero { font-size: clamp(2.4rem, 11.5vw, 3.4rem); }
  .display--peak { font-size: clamp(1.45rem, 6.4vw, 2rem); }
  .display--peak br, .display--md br { display: none; }
  .foot { margin-top: var(--sc-5); }

  .shade--col {
    left: 0; right: 0; width: auto; top: var(--sx); bottom: auto; height: 64%;
    background: linear-gradient(to bottom,
      color-mix(in oklab, var(--sc-canvas) 84%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 68%, transparent) 55%, transparent 100%);
  }
  .shade--top { inset: 26% 0 30% 0; background: linear-gradient(to bottom, transparent 0%,
      color-mix(in oklab, var(--sc-canvas) 90%, transparent) 26%, color-mix(in oklab, var(--sc-canvas) 78%, transparent) 62%, transparent 100%); }
  .shade--low { inset: 34% 0 0 0; background: linear-gradient(to top,
      color-mix(in oklab, var(--sc-canvas) 92%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 70%, transparent) 55%, transparent 100%); }

  .seam__line { left: 0; right: 0; width: auto; top: var(--sx); bottom: auto; height: 1px; translate: 0 -0.5px; }
  .seam__side { bottom: auto; left: var(--sc-gutter); right: auto; }
  .seam__side--dream { bottom: calc(100% - var(--sx) + 0.6rem); }
  .seam__side--real  { top: calc(var(--sx) + 0.6rem); }
  .seam__beats {
    left: auto; right: calc(var(--sc-gutter) - 0.9rem); top: max(var(--sx), 5rem); translate: 0 -50%;
    grid-auto-flow: column;
  }
  .seam__beats button { width: 2.1rem; }
  .seam__now { top: 50%; left: calc(1.05rem + var(--now, 0) * (100% - 2.1rem)); }
  .shade--phone { display: block; height: 20%; }
  .seam__grip { display: none; }   /* a finger on the seam would fight the scroll */

  /* Each plate re-centres on its subject. */
  .panel[data-beat="4"] .panel__img { object-position: 31% 50%; }   /* beat 0 is already centred on its tower */
  .panel[data-beat="1"] .panel__img { object-position: 24% 50%; }
  .panel[data-beat="3"] .panel__img { object-position: 74% 50%; }
}
