/* Content and controls share one flow; short windows can scroll naturally. */
:root {
  --header: clamp(64px, 7.35svh, 84px);
  --ref: min(1vw, 1.777svh);
  --footer-height: clamp(56px, 8.7svh, 96px);
}

.header {
  height: var(--header);
  gap: clamp(20px, 5.6vw, 96px);
}

.wordmark { font-size: clamp(18px, calc(var(--ref) * 1.55), 26px); }

.hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  min-height: calc(100svh - var(--header));
  padding: 0;
}

.stage {
  inset: calc(-1 * var(--header)) 0 0;
  height: auto;
  min-height: 0;
  max-height: none;
}

.hero-content {
  position: relative;
  z-index: 6;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(20px, 2.7svh, 32px);
  width: 39vw;
  margin-left: 4.5vw;
  padding: clamp(24px, 7svh, 88px) 0 clamp(16px, 2.9svh, 32px);
}

.copy {
  --name-size: clamp(84px, calc(var(--ref) * 10.8), 208px);
  position: relative;
  inset: auto;
  width: calc(100% - 5.2vw);
  max-width: none;
  margin: 0 0 0 5.2vw;
  padding: 0;
}

.name-composition {
  position: relative;
  width: max-content;
  max-width: 100%;
  font-size: var(--name-size);
  margin-bottom: clamp(20px, 1.5vw, 28px);
}

.copy h1 {
  display: grid;
  grid-template-columns: max-content;
  row-gap: .08em;
  width: max-content;
  max-width: 100%;
  margin: 0;
  font-size: 1em;
  line-height: 1.02;
  letter-spacing: -.02em;
  transform: skewY(-4deg) scaleX(.97);
  transform-origin: left center;
}
:root[data-mode=night] .copy h1 { letter-spacing: -.015em; }
.name-composition .title-first,
.name-composition .title-second { display: block; margin: 0; }
.name-composition .title-stop { font-size: .32em; margin-left: .14em; vertical-align: .04em; }
.copy .signature {
  top: calc(var(--name-size) * .21);
  left: calc(var(--name-size) * 1.05);
  width: calc(var(--name-size) * 1.23);
  height: calc(var(--name-size) * .72);
  transform: none;
}
.slogan { max-width: 100%; white-space: normal; }
.primary { min-height: 44px; max-width: 100%; }

.hero-preview {
  position: relative;
  inset: auto;
  width: min(25.1vw, calc(var(--ref) * 25.1));
  max-width: 100%;
  margin: 0;
  flex-shrink: 0;
}

.preview-images { grid-template-columns: repeat(4, minmax(0, 1fr)); }
:root[data-mode=day] .preview-images { grid-template-columns: repeat(5, minmax(0, 1fr)); }
:root[data-mode=day] .preview-images button img { transform: none; }
:root[data-mode=night] .preview-images button:first-child img { transform: none; }
:root[data-mode=day] .preview-images button:not([aria-current=true]) { opacity: .88; filter: none; }
:root[data-mode=day] .preview-images button:hover,
:root[data-mode=day] .preview-images button[aria-current=true] { opacity: 1; filter: none; }
.preview-controls #preview-slideshow { font-size: 19px; line-height: 1; }
.preview-images button { height: clamp(48px, calc(var(--ref) * 5.1), 96px); }
.preview-controls { min-height: 32px; }
.preview-controls button { min-width: 32px; min-height: 32px; }

.eyebrow {
  position: absolute;
  top: calc(13.2svh - var(--header));
  right: var(--gutter);
  left: auto;
  z-index: 7;
}

.hero-footer {
  position: relative;
  inset: auto;
  flex: 0 0 var(--footer-height);
  height: var(--footer-height);
  min-height: 56px;
  margin: 0 var(--gutter);
}
.hero-footer:after, .preview-controls:before { pointer-events: none; }

/* Keep decorative details away from the footer when the window is shallow. */
.reference-rail { top: clamp(80px, 25svh, calc(100% - var(--footer-height) - 400px)); }
@media (min-width: 1101px) and (max-height: 620px) {
  .reference-rail { display: none; }
  .manifesto { top: 12%; }
}

@media (min-width: 701px) and (max-width: 1100px) {
  :root { --header: 64px; }
  .header { gap: 4vw; }
  .hero-content { width: 46vw; margin-left: 5vw; }
  .copy {
    --name-size: clamp(92px, min(13.6vw, 18.4svh), 165px);
    margin-left: 5vw;
    width: calc(100% - 5vw);
  }
  .name-composition { margin-bottom: 20px; }
  .slogan { font-size: clamp(.875rem, 1.35vw, 1rem); }
  .primary { margin-top: 20px; min-width: 215px; }
  .hero-preview { width: 35vw; }
  .preview-images button { height: clamp(52px, 6.5vw, 82px); }
  .edition, .edge-caption, .side-index, .manifesto { display: none; }
  .eyebrow {
    top: 24px;
    left: 24px;
    right: auto;
    writing-mode: vertical-rl;
    font-size: 12px;
    line-height: 1.8;
  }
  .eyebrow:before, .eyebrow:after, .hero-footer:after { display: none; }
}

@media (max-width: 700px) {
  :root { --header: 68px; --gutter: 24px; }
  .header { margin: 0 20px; gap: 12px; }
  .wordmark { font-size: 21px; }
  .hero {
    min-height: calc(100svh - var(--header));
    min-height: calc(100dvh - var(--header));
    overflow: clip;
  }
  .stage { inset: 0 0 auto; height: calc(100% - clamp(78px, 14svh, 132px)); }
  .hero-content {
    flex: 1 0 auto;
    width: auto;
    margin: 0;
    padding: min(20svh, 50vw) 24px max(14px, env(safe-area-inset-bottom));
    gap: clamp(8px, 1.5svh, 16px);
    justify-content: flex-end;
  }
  .copy {
    --name-size: clamp(60px, 19.5vw, 108px);
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .name-composition { margin-bottom: 18px; }
  .copy h1 {
    display: block;
    line-height: 1.1;
    transform: skewY(-2.5deg);
  }
  .name-composition .title-first,
  .name-composition .title-second { display: inline; }
  .slogan { font-size: clamp(.875rem, 3.6vw, 1.125rem); min-height: 0; }
  .primary { min-width: min(225px, 100%); min-height: 47px; margin-top: 20px; }
  .copy .signature {
    top: calc(var(--name-size) * -.7);
    left: calc(var(--name-size) * .75);
    width: calc(var(--name-size) * 1.8);
    height: calc(var(--name-size) * .84);
  }
  .eyebrow {
    top: 25px;
    left: 24px;
    right: auto;
    writing-mode: vertical-rl;
    font-size: 12px;
    line-height: 1.8;
  }
  .hero-preview { width: 100%; max-width: 390px; margin: 0; }
  .preview-images button { height: 65px; }
  .preview-controls { margin-top: 12px; }
  .hero-footer {
    flex: 0 0 auto;
    height: auto;
    min-height: 88px;
    margin: 0 24px;
    padding: 12px 0 max(16px, env(safe-area-inset-bottom));
    justify-content: center;
    border: 0;
  }
  .hero-footer:after { display: none; }
  .mode-switch { position: relative; inset: auto; transform: none; }
}

@font-face {
  font-family: "Rethink Sans";
  src: url("assets/rethink-sans-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --text-body: 1rem;
  --text-label: .875rem;
  --text-caption: .75rem;
  --body-leading: 1.8;
  --heading-tracking: -.01em;
}

/* Localized system fonts supply the CJK glyphs missing from the Latin subset. */
html:lang(zh-CN) {
  --ui: "Rethink Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --editorial: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
}
html:lang(ja) {
  --ui: "Rethink Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
  --editorial: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", "Noto Serif CJK JP", serif;
}
html:lang(ko) {
  --ui: "Rethink Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif;
  --editorial: Batang, "AppleMyungjo", "Noto Serif CJK KR", serif;
}
html:lang(en) {
  --ui: "Rethink Sans", system-ui, sans-serif;
  --editorial: Georgia, "Times New Roman", serif;
  --body-leading: 1.65;
  --heading-tracking: -.045em;
}
.slogan, .eyebrow { font-family: var(--editorial); }
.slogan { letter-spacing: .025em; line-height: var(--body-leading); }
html:lang(ko) .slogan { letter-spacing: .015em; }
/* Long translations wrap between words; Chinese and Japanese may wrap at glyphs. */
html:lang(ja) .slogan { word-break: normal; line-break: strict; }
html:lang(ko) .slogan, html:lang(en) .slogan { word-break: keep-all; overflow-wrap: break-word; }
.primary, .mode-switch button { font-size: .8125rem; font-weight: 600; letter-spacing: .02em; }
.dialog-top h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); font-weight: 650; line-height: 1.3; }
.about-intro { font-size: var(--text-body); line-height: var(--body-leading); }
.about-personas p { font-size: var(--text-label); line-height: var(--body-leading); }
.language-switch button { font-size: var(--text-caption); }
.language-switch button:lang(zh-CN) { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.language-switch button:lang(ja) { font-family: "Yu Gothic", Meiryo, sans-serif; }
.language-switch button:lang(ko) { font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
.language-switch button:lang(en) { font-family: "Rethink Sans", system-ui, sans-serif; }

:root[data-mode=day] .preview-images { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.preview-images video, #gallery-thumbs video { width:100%; height:100%; object-fit:cover; }
.preview-video { position:relative; }
.preview-video span { position:absolute; inset:0; display:grid; place-items:center; color:white; font:24px Arial,sans-serif; text-shadow:0 1px 5px #000; }
.gallery-view video { display:block; max-width:100%; max-height:calc(100% - 30px); }
.gallery-view [hidden] { display:none; }
