* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  background: #080e1c;
  color: #f8f3e7;
  font-synthesis: none;
  --muted: #c1cbdb;
  --accent: #f8d487;
  --accent-ink: #20170b;
  --line: #baceec30;
  --surface: #101d31;
  --display: Georgia, "Leelawadee UI", serif;
}

html[lang="th"] { --display: "Leelawadee UI", Tahoma, system-ui, sans-serif; }

body { margin: 0; font-size: 1rem; line-height: 1.65; }

body.moonlight {
  background: #0c1021;
  --muted: #ccd1e7;
  --line: #bac4f138;
  --surface: #151c34;
  --accent: #f3d7a2;
}

h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
a:focus-visible { outline: 3px solid #9fe3ff; outline-offset: 5px; }

.wrap { width: min(calc(100% - 28px), 1280px); margin-inline: auto; }

.skip {
  position: fixed;
  inset: 8px auto auto 8px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); background: #0a1121; }

.header-row {
  min-height: 66px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  padding-block: 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #f3f4fa;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.brand img { width: 26px; height: 29px; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 clamp(8px, 1.6vw, 22px);
}

.site-nav a, .site-nav [aria-current] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-underline-offset: .23em;
  white-space: nowrap;
}

.site-nav a:hover { color: var(--accent); }
.language-nav { display: inline-flex; align-items: center; gap: 6px; }
.language-nav a, .language-nav [aria-current] { min-width: 44px; padding-inline: 5px; }
.language-nav [aria-current] { color: var(--accent); font-weight: 700; }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  gap: clamp(1.65rem, 4vw, 3.35rem);
  margin-block: clamp(14px, 3vw, 36px) 0;
  padding: clamp(18px, 4.5vw, 66px);
  border: 1px solid var(--line);
  border-radius: clamp(14px, 2.2vw, 30px);
  background:
    radial-gradient(ellipse at 80% 47%, #274a73 0, #152c47 28%, transparent 62%),
    radial-gradient(ellipse at -10% 70%, #162a48 0, transparent 64%),
    #0a1325;
  box-shadow: 0 24px 70px #03081380;
}

.moonlight .hero {
  background:
    radial-gradient(ellipse at 85% 40%, #3c4b80 0, #233157 26%, transparent 64%),
    radial-gradient(ellipse at 10% 90%, #291e3e 0, transparent 52%),
    #10152a;
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: clamp(.65rem, 1.6vw, 1.15rem);
  min-width: 0;
}

.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--accent);
  font-weight: 700;
}

.hero-brand img {
  width: 42px;
  height: 42px;
  border: 1px solid #f8d48765;
  border-radius: 10px;
  background: #151d31;
}

.hero h1 {
  font: 700 clamp(2.7rem, 6.35vw, 5.5rem)/1.02 var(--display);
  letter-spacing: -.055em;
  text-wrap: balance;
}

html[lang="th"] .hero h1 { line-height: 1.14; letter-spacing: -.035em; }

.hero h1 span {
  display: block;
  margin-block-start: .38em;
  color: #dbe8fa;
  font: 600 clamp(1.05rem, 2.3vw, 1.65rem)/1.35 "Segoe UI", "Leelawadee UI", Tahoma, sans-serif;
  letter-spacing: 0;
}

.moonlight .hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  color: #fff1ce;
}

.hero-lead {
  max-width: 27ch;
  color: var(--accent);
  font-size: clamp(1.3rem, 2.7vw, 2.1rem);
  font-weight: 700;
  line-height: 1.4;
  text-wrap: balance;
}

.hero-intro {
  max-width: 48ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.75vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem 1.15rem;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  max-width: 100%;
  min-height: 62px;
  padding: 8px 14px 8px 10px;
  border: 1px solid #ffecbc;
  border-radius: 12px;
  background: linear-gradient(115deg, #ffeab0, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 26px #f8d47d35;
  text-decoration: none;
}

.buy-link:hover { background: #fff0c8; box-shadow: 0 6px 26px #f8d47d65; }

.buy-mark {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #23263a;
  color: #fff1ce;
}

.buy-mark > span {
  display: block;
  width: 12px;
  height: 16px;
  margin-inline-start: 3px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.buy-copy { display: grid; gap: 1px; line-height: 1.18; }
.buy-copy strong { font-size: 1.5rem; font-weight: 800; white-space: nowrap; }
.buy-arrow { margin-inline-start: .15rem; font-size: 1.24rem; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: .46rem;
  min-height: 44px;
  color: #e1efff;
  font-weight: 660;
  text-underline-offset: .22em;
}

.text-link:hover { color: var(--accent); }

.hero-media {
  min-width: 0;
  text-align: center;
}

.hero-scene {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: clamp(12px, 3vw, 26px) 0;
}

.hero-scene::before, .hero-scene::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.hero-scene::before {
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, #9ec8ff30, transparent 58%),
    repeating-radial-gradient(circle at 50% 48%, transparent 0 45px, #f3d79622 46px 47px, transparent 48px 69px);
  mask-image: radial-gradient(ellipse, #000 30%, transparent 72%);
}

.hero-scene::after {
  z-index: -1;
  inset: 15% 6% 16%;
  border: 1px solid #cddcfe36;
  box-shadow: 0 0 52px #bfc5fd28, inset 0 0 70px #cbc8ff18;
  transform: rotate(-24deg);
}

.hero-art {
  z-index: 1;
  display: block;
  border: 1px solid #eed29eab;
  border-radius: 13px;
  background: #101a2a;
  box-shadow: 0 20px 43px #0009, 0 0 0 4px #d1e1ff14;
}

.hero-art img { width: 100%; border-radius: 12px; }

.hero-chart {
  width: min(57%, 280px);
  margin-inline-end: 21%;
  transform: rotate(-5deg);
}

.hero-companion {
  position: absolute;
  inset-block-start: 16%;
  inset-inline-end: 6%;
  width: min(47%, 225px);
  border: 1px solid #edd49cb0;
  border-radius: 11px;
  box-shadow: 0 14px 36px #0009;
  transform: rotate(8deg);
}

.hero-poster { width: min(89%, 395px); }
.hero-media figcaption { margin-block-start: .6rem; color: var(--muted); }

.features {
  padding-block: clamp(2.6rem, 7vw, 5rem) 0;
  scroll-margin-top: 16px;
}

.section-title {
  font: 700 clamp(1.9rem, 4.8vw, 3.75rem)/1.2 var(--display);
  letter-spacing: -.035em;
  text-wrap: balance;
}

html[lang="th"] .section-title { line-height: 1.35; }

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.1rem;
  margin-block: .42rem 1.15rem;
}

.chapters {
  display: grid;
  gap: clamp(14px, 3vw, 27px);
}

.chapter {
  display: grid;
  align-items: center;
  gap: clamp(16px, 3.75vw, 56px);
  padding: clamp(17px, 3.4vw, 43px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: radial-gradient(ellipse at 100% 0, #20395c70, transparent 65%), var(--surface);
  scroll-margin-top: 16px;
}

.moonlight .chapter {
  background: radial-gradient(ellipse at 100% 0, #40395f65, transparent 65%), var(--surface);
}

.chapter-copy { display: grid; gap: .7rem; min-width: 0; }
.chapter-kicker { color: var(--accent); font-weight: 700; }

.chapter h3 {
  font: 700 clamp(1.55rem, 3.6vw, 3.15rem)/1.18 var(--display);
  letter-spacing: -.025em;
  text-wrap: balance;
}

html[lang="th"] .chapter h3 { line-height: 1.35; }
.chapter-copy p { max-width: 49ch; color: var(--muted); font-size: clamp(1rem, 1.65vw, 1.16rem); }

.chapter-visual { min-width: 0; text-align: center; }
.chapter-picture {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(10px, 2vw, 22px);
  border: 1px solid #c6d9fb4f;
  border-radius: 12px;
  background: radial-gradient(ellipse at 48% 52%, #415779, #0c1830 75%);
  box-shadow: inset 0 0 24px #0004;
  text-decoration: none;
}
.chapter-picture:hover { border-color: var(--accent); }
.chapter-picture img {
  inline-size: auto;
  max-inline-size: 100%;
  max-block-size: clamp(235px, 52vw, 420px);
  border-radius: 6px;
  object-fit: contain;
}
.chapter-visual figcaption { margin-block-start: .48rem; color: var(--muted); }

.tools, .buy-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .9rem 1.5rem;
  margin-block-start: clamp(18px, 4vw, 46px);
  padding: clamp(18px, 3.4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #101c2e;
}

.tools h2, .buy-panel h2 {
  color: #fff3d9;
  font: 700 clamp(1.45rem, 2.85vw, 2.35rem)/1.25 var(--display);
}

html[lang="th"] :is(.tools, .buy-panel) h2 { line-height: 1.4; }

.tools p, .buy-panel p { margin-block-start: .55rem; color: var(--muted); }
.tools p { max-width: 72ch; }
.buy-panel p { max-width: 55ch; }
.buy-panel { border-color: #ecd09852; background: linear-gradient(125deg, #1b2c47, #162037); }
.moonlight .buy-panel { background: linear-gradient(125deg, #252749, #17223e); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .55rem 1rem;
  margin-block-start: clamp(25px, 5vw, 55px);
  padding-block: .8rem 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: .22em; }
.footer-links a:hover { color: var(--accent); }

@media (min-width: 740px) {
  .wrap { width: min(calc(100% - 52px), 1280px); }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); }
  .chapter { grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); }
  .chapter:nth-child(even) .chapter-copy { grid-column: 2; grid-row: 1; }
  .chapter:nth-child(even) .chapter-visual { grid-column: 1; grid-row: 1; }
}

@media (max-width: 739px) {
  .hero { gap: .75rem; justify-items: start; }
  .hero-copy { display: contents; }
  .hero-media { width: 100%; }
  .hero-intro { order: 1; margin-block-start: .3rem; }
}

@media (max-width: 400px) {
  .brand { gap: 5px; }
  .brand img { width: 22px; height: 25px; }
  .header-row { gap: 0 8px; }
  .language-nav { gap: 3px; }
  .buy-link { min-height: 59px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero-media { animation: hero-enter .8s cubic-bezier(.15,.78,.2,1) both; }
  .buy-link, .chapter-picture { transition: box-shadow .2s, border-color .2s, background .2s; }

  @keyframes hero-enter {
    from { opacity: .55; transform: translateY(17px) scale(.985); }
    to { opacity: 1; transform: none; }
  }

  @supports (animation-timeline: view()) {
    .chapter-visual {
      animation: chapter-enter linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 28%;
    }

    @keyframes chapter-enter {
      from { opacity: .65; transform: translateY(14px); }
      to { opacity: 1; transform: none; }
    }
  }
}
