/* Seondol teaser landing. Mobile first, no external resources. */
:root {
  --ink: #0b0806;
  --umber: #3b2616;
  --bronze: #6b4a26;
  --blood: #c4160c;
  --ember: #ff5a1f;
  --gold: #e7c27a;
  --gold-deep: #9c7434;
  --bone: #f3e6d0;
  --mist: rgba(243, 230, 208, 0.72);
  /* Display face: carved Roman capitals; body: old-style book serif. Other scripts below. */
  --display: "Cinzel", "EB Garamond", "Palatino Linotype", Georgia, serif;
  --display-weight: 700;
  --body: "EB Garamond", "Palatino Linotype", Georgia, serif;
  --px: 0;
  --py: 0;
  --intro: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--ink); color-scheme: dark; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Faces for other scripts ---------- */
:lang(el), :lang(bg), :lang(vi) { --display: "EB Garamond", Georgia, serif; --display-weight: 700; }
:lang(ko) { --display: "Song Myung", "Nanum Myeongjo", "Batang", serif; --display-weight: 400; --body: "Nanum Myeongjo", "Noto Serif KR", "Batang", serif; }
:lang(ja) { --display: "Shippori Mincho B1", "Yu Mincho", "Hiragino Mincho ProN", serif; --display-weight: 800; --body: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; }
:lang(zh-Hant) { --display: "Noto Serif TC", "Songti TC", "PMingLiU", serif; --display-weight: 700; --body: "Songti TC", "PMingLiU", "Noto Serif TC", serif; }
:lang(th) { --display: "Noto Serif Thai", serif; --display-weight: 700; --body: "Noto Serif Thai", serif; }
:lang(ar) { --display: "Reem Kufi", "Amiri", serif; --display-weight: 700; --body: "Amiri", serif; }
:lang(he) { --display: "Frank Ruhl Libre", serif; --display-weight: 700; --body: "Frank Ruhl Libre", serif; }
/* Italics only exist for Latin, Greek and Cyrillic here. */
:lang(ko) .message, :lang(ja) .message, :lang(zh-Hant) .message, :lang(th) .message,
:lang(ar) .message, :lang(he) .message { font-style: normal; }

/* ---------- Waiting for fonts ---------- */
/* Until the fonts arrive (or 2.5 s pass) the intro stays on its first frame: invisible text can reflow without anyone seeing it. */
.fonts-pending .stage, .fonts-pending .stage *, .fonts-pending .topbar * { animation-play-state: paused !important; }

/* ---------- Selection ---------- */
/* The logo is a picture, not text: it cannot be selected or dragged out of the page. */
.logo, .logo img, .shockwave, .bg { -webkit-user-select: none; user-select: none; }
.logo img { -webkit-user-drag: none; pointer-events: none; }

/* Selected text: deep blood red with warm parchment letters, like ink on the logo. */
::selection { background: rgba(160, 18, 10, 0.85); color: #fff4dc; text-shadow: none; }
/* The headline is painted with a gold gradient through transparent letters; give the selection solid letters. */
.headline::selection { background: rgba(160, 18, 10, 0.85); color: #fff4dc; -webkit-text-fill-color: #fff4dc; }

/* ---------- Background ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg > * { position: absolute; }

/* Sky behind the painted scene (the canvas draws moon, mountains, mist, monolith, pines, cranes, embers). */
.bg__sky {
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 34%, rgba(122, 78, 40, 0.42), transparent 70%),
    linear-gradient(to bottom, #090605 0%, #140d08 30%, #2a1b10 58%, #1a110a 78%, #0b0806 100%);
}

.bg__scene { inset: 0; width: 100%; height: 100%; }
.bg__grain { inset: 0; background-size: 256px 256px; mix-blend-mode: overlay; opacity: 0.55; }

.bg__vignette {
  inset: 0;
  background:
    radial-gradient(ellipse 60% 38% at 50% 58%, rgba(8, 5, 3, 0.45), transparent 75%),
    radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(6, 4, 3, 0.85) 100%),
    linear-gradient(to bottom, rgba(6, 4, 3, 0.6), transparent 20%, transparent 80%, rgba(6, 4, 3, 0.78));
}

/* ---------- Top bar & language ---------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font: 600 0.95rem/1 var(--body);
  color: var(--bone);
  background: rgba(20, 14, 10, 0.5);
  border: 1px solid rgba(231, 194, 122, 0.28);
  border-radius: 999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  opacity: 0;
  animation: fade-up 0.8s 2.2s ease-out forwards;
}
.lang-btn:hover { border-color: var(--gold); background: rgba(59, 38, 22, 0.7); }
.lang-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.lang-btn svg { fill: none; stroke: var(--gold); stroke-width: 1.4; }

/* ---------- Stage ---------- */
.stage {
  grid-row: 2;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px max(16px, env(safe-area-inset-left)) 32px max(16px, env(safe-area-inset-right));
  gap: clamp(10px, 2.2vh, 20px);
}

.logo {
  margin: 0;
  width: min(92vw, 880px);
  line-height: 0;
  transform: translate3d(calc(var(--px) * 8px), calc(var(--py) * 6px), 0);
}
.is-ko .logo { width: min(84vw, 600px); }
.is-root .logo { width: min(90vw, 760px); }
.logo img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 26px rgba(255, 150, 60, 0.18));
  animation:
    slam 1.25s cubic-bezier(0.2, 0.9, 0.25, 1) both,
    float 9s 1.4s ease-in-out infinite;
}
.is-pulsing .logo img { animation: slam 1.25s cubic-bezier(0.2, 0.9, 0.25, 1) both, float 9s 1.4s ease-in-out infinite, flare 1.6s ease-out; }

.shockwave {
  position: fixed;
  z-index: 1;
  left: 50%;
  top: 38vh;
  width: 40vmin;
  height: 40vmin;
  margin: -20vmin 0 0 -20vmin;
  border-radius: 50%;
  border: 2px solid rgba(240, 190, 110, 0.75);
  box-shadow: 0 0 40px rgba(255, 150, 60, 0.5), inset 0 0 40px rgba(255, 150, 60, 0.35);
  opacity: 0;
  pointer-events: none;
}
.is-root .shockwave { top: 30vh; }
.is-pulsing .shockwave { animation: shock 1.6s cubic-bezier(0.1, 0.7, 0.3, 1); }

.eyebrow {
  margin: 4px 0 0;
  font: 600 clamp(0.74rem, 1.8vw, 0.95rem)/1.4 var(--display);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(231, 194, 122, 0.35);
  padding-inline-start: 0.42em; /* balance the trailing letter-spacing */
  opacity: 0;
  animation: fade-up 0.9s 1.25s ease-out forwards;
}
:lang(ko) .eyebrow, :lang(ja) .eyebrow, :lang(zh-Hant) .eyebrow, :lang(he) .eyebrow { letter-spacing: 0.18em; padding-inline-start: 0.18em; }
/* Joined (Arabic) and stacked-mark (Thai) scripts must not be letter-spaced. */
:lang(ar) .eyebrow, :lang(th) .eyebrow { letter-spacing: 0; padding-inline-start: 0; font-size: clamp(0.85rem, 2vw, 1rem); }

.divider { width: min(70vw, 420px); height: 1px; display: flex; justify-content: center; }
.divider span {
  display: block;
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, #fff3d6 50%, var(--gold) 70%, transparent);
  box-shadow: 0 0 10px rgba(231, 194, 122, 0.7);
  transform: scaleX(0);
  animation: unfold 1.1s 1.45s cubic-bezier(0.7, 0, 0.2, 1) forwards;
}

.headline {
  margin: 0;
  max-width: 22ch;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(1.6rem, 5.2vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  text-wrap: balance;
  color: var(--bone);
  background: linear-gradient(90deg, #d9a95c 0%, #e7c27a 22%, #fff4dc 38%, #e7c27a 54%, #c99a52 76%, #d9a95c 100%);
  background-size: 200% 100%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.75));
  opacity: 0;
  animation: rise 1.2s 1.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards, shimmer 8s 3s linear infinite;
}
:lang(ko) .headline, :lang(ja) .headline, :lang(zh-Hant) .headline { max-width: 16em; line-height: 1.3; word-break: keep-all; }
:lang(th) .headline { line-height: 1.45; }

.message {
  margin: 0;
  max-width: 40rem;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-style: italic;
  line-height: 1.6;
  color: var(--mist);
  text-wrap: pretty;
  opacity: 0;
  animation: fade-up 1s 2.1s ease-out forwards;
}
:lang(ko) .message { word-break: keep-all; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  padding: 9px 18px;
  font: 700 0.8rem/1 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bone);
  border: 1px solid rgba(196, 22, 12, 0.6);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(196, 22, 12, 0.2), rgba(40, 20, 12, 0.5));
  box-shadow: 0 0 24px rgba(196, 22, 12, 0.22), inset 0 0 12px rgba(196, 22, 12, 0.18);
  opacity: 0;
  animation: fade-up 0.9s 2.45s ease-out forwards;
}
:lang(ko) .status, :lang(ja) .status, :lang(zh-Hant) .status, :lang(he) .status { letter-spacing: 0.08em; }
:lang(ar) .status, :lang(th) .status { letter-spacing: 0; }
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.7);
  animation: beacon 1.8s ease-out infinite;
}

.foot {
  grid-row: 3;
  position: relative;
  z-index: 2;
  padding: 0 16px max(14px, env(safe-area-inset-bottom));
  text-align: center;
  font: 600 0.75rem/1 var(--display);
  letter-spacing: 0.12em;
  color: rgba(243, 230, 208, 0.38);
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- Language lists ---------- */
.lang-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.lang-list a {
  display: block;
  padding: 10px 12px;
  font: 500 1.02rem/1.2 var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bone);
  text-decoration: none;
  border: 1px solid rgba(231, 194, 122, 0.14);
  border-radius: 8px;
  background: rgba(34, 22, 14, 0.55);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lang-list a:hover, .lang-list a:focus-visible { border-color: var(--gold); background: rgba(80, 52, 28, 0.6); color: #fff; outline: none; }
.lang-list a[aria-current="page"] { border-color: var(--blood); box-shadow: inset 0 0 0 1px var(--blood); }

.lang-menu--inline {
  width: min(100%, 980px);
  margin-top: 8px;
  opacity: 0;
  animation: fade-up 1s 1.6s ease-out forwards;
}

.lang-dialog {
  width: min(94vw, 900px);
  max-height: min(86vh, 860px);
  padding: 0;
  color: var(--bone);
  background: linear-gradient(180deg, #1c130c, #0d0907);
  border: 1px solid rgba(231, 194, 122, 0.3);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 60px rgba(160, 110, 50, 0.2);
  overflow: auto;
}
.lang-dialog::backdrop { background: rgba(6, 4, 3, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lang-dialog[open] { animation: pop 0.25s ease-out; }
.lang-dialog__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #18100a;
  border-bottom: 1px solid rgba(231, 194, 122, 0.18);
}
.lang-dialog__head p { margin: 0; font: 700 0.85rem/1 var(--display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
/* The cross is an SVG, not a "×" character: glyph metrics change with each language's font and pushed it off centre. */
.lang-dialog__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px; height: 34px;
  padding: 0;
  color: var(--bone);
  background: transparent;
  border: 1px solid rgba(231, 194, 122, 0.25);
  border-radius: 50%;
  cursor: pointer;
}
.lang-dialog__close svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.lang-dialog__close:hover { border-color: var(--gold); }
/* Regions as blocks flowing in columns; each block lists its languages. */
.lang-regions { columns: 3 220px; column-gap: 18px; }
.lang-dialog .lang-regions { padding: 14px 16px 6px; }
.lang-region { break-inside: avoid; margin: 0 0 14px; }
.lang-region__name {
  margin: 0 0 6px;
  padding-bottom: 5px;
  font: 700 0.72rem/1.2 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(231, 194, 122, 0.18);
}
:lang(ar) .lang-region__name, :lang(he) .lang-region__name, :lang(th) .lang-region__name { letter-spacing: 0.04em; }
.lang-region .lang-list { grid-template-columns: 1fr; gap: 4px; }
.lang-region .lang-list a { padding: 7px 10px; font-size: 0.95rem; }
.lang-menu--inline .lang-regions { text-align: start; }
@media (max-width: 600px) {
  .lang-region .lang-list { grid-template-columns: 1fr 1fr; }
}

/* ---------- Screen shake on pulse ---------- */
.is-pulsing .stage { animation: shake 0.5s 0.05s ease-out; }

/* ---------- Keyframes ---------- */
@keyframes slam {
  0% { opacity: 0; transform: scale(1.35); filter: blur(14px) brightness(2.2); }
  55% { opacity: 1; transform: scale(0.97); filter: blur(0) brightness(1.5) drop-shadow(0 0 40px rgba(255, 170, 70, 0.8)); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes flare {
  0% { filter: brightness(1) drop-shadow(0 8px 22px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 26px rgba(255, 150, 60, 0.18)); }
  18% { filter: brightness(1.35) drop-shadow(0 8px 22px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 48px rgba(255, 170, 70, 0.75)); }
  100% { filter: brightness(1) drop-shadow(0 8px 22px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 26px rgba(255, 150, 60, 0.18)); }
}
@keyframes shock {
  0% { opacity: 0.95; transform: scale(0.2); border-width: 6px; }
  100% { opacity: 0; transform: scale(4.2); border-width: 1px; }
}
/* only sideways and upwards: moving down would push past the page bottom for a moment and flash a scrollbar */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, -3px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, -3px); }
  80% { transform: translate(1px, -1px); }
}

@keyframes breathe { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }
@keyframes drift { from { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(1.12); } to { transform: rotate(360deg) scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* no letter-spacing here: changing it re-wraps the headline and shifts the whole block */
@keyframes rise { from { opacity: 0; transform: translateY(22px); filter: blur(6px); } to { opacity: 1; transform: none; } }
/* the image is 200% wide, so 0% → 200% shifts it by exactly one tile: the loop has no seam */
@keyframes shimmer { from { background-position: 0% 0; } to { background-position: 200% 0; } }
@keyframes unfold { to { transform: scaleX(1); } }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.7); } 100% { box-shadow: 0 0 0 12px rgba(255, 90, 31, 0); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Larger screens ---------- */
@media (min-width: 900px) {
  .topbar { padding-top: 22px; padding-inline-end: 28px; }
  .stage { gap: 20px; }
}

/* short laptop screens (e.g. 1280×720): keep everything on one screen, no scrollbar */
@media (max-height: 780px) and (min-width: 700px) {
  .logo { width: min(80vw, 720px); }
  .is-ko .logo { width: min(70vw, 480px); }
  .stage { gap: 12px; padding-block: 12px 20px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .topbar { position: absolute; inset-inline-end: 0; top: 0; }
  .logo { width: min(46vw, 440px); }
  .is-ko .logo { width: min(32vw, 300px); }
  .stage { gap: 6px; padding-block: 10px 8px; }
  .eyebrow { margin: 0; }
  .headline { font-size: clamp(1.2rem, 3.2vw, 1.8rem); max-width: 30ch; }
  .message { font-size: 0.9rem; line-height: 1.45; }
  .status { margin-top: 2px; padding: 7px 14px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  .shockwave { display: none; }
}
