/* Nestura: ember style. Warm dark, no pure white, system serif (New York on Apple devices).
   Colour tokens come from SPEC.md section 20.1 (Day values). No external fonts or scripts. */

:root {
  color-scheme: dark;
  --bg: #110B07;
  --bg-raised: #1E140D;
  --surface: #26190F;
  --line: #3A2A1C;
  --text: #EBD9C1;
  --text-2: #A8927A;
  --text-3: #8E7A63;
  --ember: #E8893A;
  --ember-core: #FFB45E;
  --ember-deep: #B85A1E;
  --ember-dim: #6E3612;
  --sage: #7F8B6B;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 5vw, 56px);
  --max: 1120px;
  --r-card: 24px;
  --r-inner: 16px;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:lang(th) body, body:lang(th) { line-height: 1.9; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--ember); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--ember-core); }

:focus-visible {
  outline: 2px solid var(--ember-core);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
:lang(th) h1, :lang(th) h2, :lang(th) h3 { font-family: var(--sans); letter-spacing: 0; line-height: 1.45; }

p { margin: 0; text-wrap: pretty; }

.wrap { width: min(100%, var(--max)); margin-inline: auto; padding-inline: var(--gutter); }

/* Skip link */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--surface); color: var(--text); padding: 10px 16px; border-radius: 999px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Header */
.site-header { padding-block: 22px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand svg { width: 32px; height: 32px; }
.brand span { font-family: var(--serif); font-size: 1.375rem; letter-spacing: 0.01em; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--text-2); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: 0.9375rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--bg-raised); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border-radius: 999px;
  background: var(--ember-dim); color: var(--text);
  border: 1px solid rgba(232, 137, 58, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 180, 94, 0.18), 0 0 32px rgba(232, 137, 58, 0.14);
  font: 600 1rem/1.2 var(--sans); text-decoration: none;
}
.button:hover { color: var(--text); background: #7d3e16; }
.button svg { width: 18px; height: 18px; }
.button-quiet {
  background: transparent; border-color: var(--line); box-shadow: none; color: var(--text);
}
.button-quiet:hover { background: var(--bg-raised); }

.eyebrow {
  font: 600 0.8125rem/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ember);
}
:lang(th) .eyebrow, :lang(vi) .eyebrow, :lang(el) .eyebrow { letter-spacing: 0.04em; }

.muted { color: var(--text-2); }
.fine { color: var(--text-3); font-size: 0.875rem; }

/* Hero */
.hero { padding-block: clamp(32px, 6vw, 72px) clamp(64px, 10vw, 128px); }
.hero .wrap {
  display: grid; gap: clamp(40px, 6vw, 80px);
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center;
}
.hero h1 { font-size: clamp(2.5rem, 6.4vw, 5rem); line-height: 1.02; margin-block: 18px 24px; }
.hero .lede { font-size: clamp(1.125rem, 1.8vw, 1.3125rem); color: var(--text-2); max-width: 34ch; }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 36px; }

/* The arched window: a tall rectangle topped by a half circle (SPEC 22) */
.arch {
  position: relative; aspect-ratio: 3 / 4; width: 100%; max-width: 420px; justify-self: end;
  border-radius: 50% 50% var(--r-card) var(--r-card) / 37.5% 37.5% var(--r-card) var(--r-card);
  overflow: hidden; isolation: isolate;
  background:
    radial-gradient(60% 42% at 50% 64%, rgba(255, 180, 94, 0.30), transparent 70%),
    radial-gradient(90% 70% at 50% 72%, rgba(184, 90, 30, 0.38), transparent 75%),
    linear-gradient(180deg, #1a100a 0%, #140c07 60%, #110B07 100%);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 18px 40px rgba(0, 0, 0, 0.45);
}
.arch .nest { position: absolute; left: 50%; top: 58%; width: 80%; transform: translate(-50%, -50%); }
.arch .nest img { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55)); }
.arch .breath { animation: breathe 10s ease-in-out infinite; transform-origin: 50% 50%; }
.spark {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: var(--ember-core); box-shadow: 0 0 10px 2px rgba(255, 180, 94, 0.55);
  opacity: 0; animation: drift 14s linear infinite;
}
.spark:nth-child(1) { left: 22%; bottom: 18%; animation-delay: 0s; }
.spark:nth-child(2) { left: 64%; bottom: 24%; animation-delay: 3.5s; animation-duration: 17s; }
.spark:nth-child(3) { left: 42%; bottom: 12%; animation-delay: 7s; }
.spark:nth-child(4) { left: 76%; bottom: 30%; animation-delay: 10s; animation-duration: 19s; width: 3px; height: 3px; }
.spark:nth-child(5) { left: 33%; bottom: 34%; animation-delay: 12s; animation-duration: 16s; width: 3px; height: 3px; }

@keyframes drift {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 0.9; }
  70% { opacity: 0.5; }
  100% { transform: translate(14px, -150px); opacity: 0; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.82; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Sections */
section { padding-block: clamp(64px, 10vw, 128px); }
.section-head { max-width: 40rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 { font-size: clamp(2rem, 4.4vw, 3.25rem); line-height: 1.08; margin-top: 12px; }
.section-head p { margin-top: 18px; color: var(--text-2); font-size: 1.125rem; }

.statement { border-top: 1px solid var(--line); }
.statement .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: end; }
.statement h2 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.02; }
.statement p { color: var(--text-2); font-size: 1.1875rem; max-width: 36ch; }

/* Feature cards, offset for rhythm */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 28px 26px 30px;
}
.card .icon {
  width: 44px; height: 44px; border-radius: var(--r-inner); display: grid; place-items: center;
  background: rgba(110, 54, 18, 0.55); color: var(--ember); margin-bottom: 22px;
}
.card .icon svg { width: 22px; height: 22px; }
.card h3 { font-size: 1.5rem; line-height: 1.2; margin-bottom: 12px; }
.card p { color: var(--text-2); }

/* Places: type as the picture */
.places { background: var(--bg-raised); border-block: 1px solid var(--line); }
.place-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 6vw, 96px);
}
.place-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-block: 16px; border-bottom: 1px solid var(--line);
}
.place-list .place { font-family: var(--serif); font-size: clamp(1.25rem, 2.2vw, 1.625rem); }
:lang(th) .place-list .place { font-family: var(--sans); }
/* text-3 is only 4.4:1 on bg-raised, so raised surfaces use text-2 for small print. */
.place-list .country { color: var(--text-2); font-size: 0.9375rem; white-space: nowrap; }
.callout .fine, .card .fine, .plan .fine { color: var(--text-2); }

/* System features */
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 24px; }
.feature { padding-top: 18px; border-top: 1px solid var(--line); }
.feature h3 { font-family: var(--sans); font-weight: 600; font-size: 1.0625rem; margin-bottom: 6px; }
.feature p { color: var(--text-2); font-size: 0.9688rem; }

/* Plans */
.plans { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.plan { border-radius: var(--r-card); padding: 32px 30px; border: 1px solid var(--line); }
.plan h3 { font-size: 1.75rem; margin-bottom: 14px; }
.plan p { color: var(--text-2); }
.plan-plus {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(184, 90, 30, 0.22), transparent 60%),
    var(--bg-raised);
  border-color: rgba(232, 137, 58, 0.35);
}

/* Privacy promise */
.promise { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 96px); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.ticks li { display: grid; grid-template-columns: 22px 1fr; gap: 14px; align-items: start; }
.ticks svg { width: 22px; height: 22px; color: var(--sage); margin-top: 3px; }
.policy-link { margin-top: 22px; }

/* Languages */
.langs { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.langs li {
  font-family: var(--serif); font-size: 1.25rem; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text);
}
.langs li:lang(th) { font-family: var(--sans); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 40px 56px; color: var(--text-3); font-size: 0.9375rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.lang-picker { display: inline-flex; align-items: center; gap: 10px; }
.lang-picker select {
  font: inherit; color: var(--text); background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px;
}

/* Long-form pages (privacy, support) */
.page { padding-block: clamp(24px, 4vw, 48px) clamp(64px, 8vw, 96px); }
.page .wrap { max-width: 760px; }
.page h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.05; margin-block: 12px 18px; }
.page h2 { font-size: 1.75rem; margin-block: 56px 14px; }
.page h3 { font-family: var(--sans); font-weight: 600; font-size: 1.125rem; margin-block: 28px 8px; }
.page p, .page li { color: var(--text-2); }
.page p + p { margin-top: 14px; }
.page ul { padding-left: 1.2em; margin: 12px 0 0; }
.page li + li { margin-top: 8px; }
.page strong { color: var(--text); font-weight: 600; }
.page .lede { font-size: 1.1875rem; color: var(--text-2); }

.callout {
  margin-top: 28px; padding: 22px 24px; border-radius: var(--r-card);
  background: var(--bg-raised); border: 1px solid var(--line);
}
.callout p { color: var(--text); }
.todo {
  margin-top: 18px; padding: 14px 18px; border-radius: var(--r-inner);
  border: 1px dashed var(--ember-deep); color: var(--ember-core); font-size: 0.9375rem;
}

/* Summaries in every language (privacy page) */
.summaries { display: grid; gap: 10px; margin-top: 24px; }
.summaries details {
  border: 1px solid var(--line); border-radius: var(--r-inner); background: var(--bg-raised);
}
.summaries summary {
  cursor: pointer; padding: 14px 18px; color: var(--text); font-weight: 600; list-style-position: inside;
}
.summaries details > div { padding: 0 18px 18px; }
.summaries details.mine { border-color: rgba(232, 137, 58, 0.5); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 18px 0; color: var(--text); font-weight: 600; font-size: 1.0625rem;
  list-style: none; display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ember); font-weight: 400; font-size: 1.375rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 0 20px; }

/* Shared-mix fallback */
.mix-page { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; }
.mix-main { display: grid; place-items: center; padding-block: 24px 64px; }
.mix-card { display: grid; gap: 28px; justify-items: center; text-align: center; max-width: 30rem; }
.mix-card .arch { max-width: 240px; justify-self: center; }
.mix-card h1 { font-size: clamp(2.25rem, 7vw, 3.25rem); line-height: 1.05; }
.mix-card p { color: var(--text-2); }

.i18n-note {
  display: none; margin: 0 auto; width: min(100% - 32px, var(--max));
  padding: 10px 16px; border-radius: var(--r-inner); background: var(--bg-raised);
  border: 1px solid var(--line); color: var(--text-2); font-size: 0.9375rem;
}
.i18n-note.shown { display: block; }

/* Wait briefly for a translation before showing text, without hiding it for long. */
html.i18n-pending body { opacity: 0; }
body { transition: opacity 0.25s ease; }

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

/* Layout below tablet width */
@media (max-width: 900px) {
  .hero .wrap, .statement .wrap, .promise { grid-template-columns: minmax(0, 1fr); }
  .arch { justify-self: center; max-width: 340px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .place-list { grid-template-columns: minmax(0, 1fr); }
  .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .site-nav a { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .spark, .arch .breath { animation: none; }
  .spark { opacity: 0.6; }
  body { transition: none; }
}

@media (prefers-contrast: more) {
  :root { --text-2: #C9B497; --text-3: #B29D82; --line: #5A4430; }
}

@media print {
  body { background: none; color: #1a1410; }
  .site-header nav, .site-footer, .skip, .arch { display: none; }
}
