/* Hinghoi pages: a night canal, firefly light, cream lantern paper. Generated pages link this file; edit here. */
@font-face {
  font-family: "Mali";
  src: url("fonts/mali-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night-0: #0a151c;
  --night-1: #0f1f28;
  --night-2: #16303a;
  --night-3: #1f3f49;
  --ink: #f4ead4;          /* cream text on night */
  --ink-soft: #c3cec9;     /* secondary text on night */
  --glow: #f6cf72;         /* firefly / lantern light: the one accent, it means "lit" */
  --glow-deep: #e7a94a;
  --paper: #fbf2dd;        /* lantern paper */
  --paper-ink: #2c2a33;
  --paper-soft: #5b5560;
  --line: rgba(244, 234, 212, 0.14);
  --radius: 26px;
  --wrap: 1100px;
  --gutter: clamp(16px, 4vw, 40px);
  --display: "Mali", ui-rounded, "Sukhumvit Set", "Thonburi", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Sukhumvit Set", "Thonburi", "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--night-0);
  color: var(--ink);
  font: 400 1.0625rem/1.75 var(--body);
  overflow-wrap: anywhere;
}
:lang(en) body, body:lang(en) { line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--glow); text-underline-offset: 3px; }
a:hover { color: #ffe3a1; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--paper); color: var(--paper-ink); padding: 8px 14px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.24; margin: 0 0 0.5em; text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 4.2vw, 2.75rem); }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.45rem); }
p { margin: 0 0 1em; }
.lede { font-size: clamp(1.08rem, 1.9vw, 1.25rem); color: var(--ink-soft); max-width: 38em; }
.ph { white-space: nowrap; } /* a phrase that should not break */
section[id] { scroll-margin-top: 76px; }

/* ---------- header ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px var(--gutter);
  background: linear-gradient(to bottom, rgba(10, 21, 28, 0.82), rgba(10, 21, 28, 0));
}
.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 1.15rem var(--display); }
.top .brand img { width: 34px; height: 34px; border-radius: 9px; }
.top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: 999px; font-size: 0.95rem; min-height: 44px; display: inline-flex; align-items: center; }
.top nav a:hover { background: rgba(244, 234, 212, 0.1); }
.top nav a.lang { border: 1px solid var(--line); }
@media (max-width: 640px) { .top nav a:not(.lang) { display: none; } }

/* ---------- fireflies (decor; static glows under Reduce Motion) ---------- */
.flies { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.flies i {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, #fff6c9 0 22%, var(--glow) 40%, rgba(246, 207, 114, 0) 72%);
  opacity: 0.85;
  animation: drift var(--d) ease-in-out var(--delay) infinite alternate, pulse calc(var(--d) * 0.45) ease-in-out var(--delay) infinite alternate;
}
@keyframes drift { to { transform: translate(var(--dx), var(--dy)); } }
@keyframes pulse { from { opacity: 0.2; } to { opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) { .flies i { animation: none; opacity: 0.6; } }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: grid; align-items: end; overflow: hidden; isolation: isolate; }
.hero .layer { position: absolute; inset: 0; z-index: -2; }
.hero .layer img { width: 100%; height: 100%; object-fit: cover; object-position: 66% 50%; }
.hero .layer.near { z-index: -1; }
.hero::after { /* night falls toward the text */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(10,21,28,0.25) 0%, rgba(10,21,28,0) 30%, rgba(10,21,28,0.55) 62%, var(--night-0) 100%);
}
.hero .flies { z-index: -1; }
.hero .copy { padding: 0 var(--gutter) clamp(36px, 7vh, 80px); max-width: var(--wrap); margin: 0 auto; width: 100%; }
.wordmark {
  font: 700 clamp(3.2rem, 11vw, 6.6rem)/1 var(--display); letter-spacing: 0.01em; margin: 0 0 0.28em;
  color: #fff3c4; text-shadow: 0 0 18px rgba(246, 207, 114, 0.75), 0 0 46px rgba(246, 207, 114, 0.35);
}
.hero .tag { font: 700 clamp(1rem, 2vw, 1.2rem) var(--display); color: var(--glow); margin-bottom: 0.6em; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3.3rem); max-width: 16em; }
.hero .lede { color: var(--ink); opacity: 0.92; }
.hero .note { color: var(--ink-soft); font-size: 0.95rem; margin-top: 14px; }

/* store state: <html data-store="soon|live"> */
.store { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.store-live, .store-soon { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 22px; border-radius: 999px; font: 700 1.05rem var(--display); text-decoration: none; }
.store-live { background: var(--glow); color: #2a1e08; box-shadow: 0 0 28px rgba(246, 207, 114, 0.45); }
.store-live:hover { background: #ffdf8c; color: #2a1e08; }
.store-soon { border: 1.5px dashed rgba(246, 207, 114, 0.7); color: var(--glow); }
html[data-store="soon"] .store-live, html[data-store="live"] .store-soon { display: none; }
.store svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- sections ---------- */
.band { position: relative; padding: clamp(72px, 11vw, 120px) 0; }
.band.deep { background: linear-gradient(to bottom, var(--night-0), var(--night-1) 40%, var(--night-0)); }
.split { display: grid; gap: clamp(28px, 5vw, 64px); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 5fr 6fr; } .split.flip > :first-child { order: 2; } }
.points { list-style: none; padding: 0; margin: 1.2em 0 0; display: grid; gap: 12px; }
.points li { position: relative; padding-left: 30px; }
.points li::before { content: ""; position: absolute; left: 4px; top: 0.62em; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c9 0 25%, var(--glow) 45%, rgba(246,207,114,0) 75%); box-shadow: 0 0 10px var(--glow); }

/* a capture from the app, in a soft device-like frame (the capture is never painted on) */
.shot { margin: 0; }
.shot .frame { border-radius: 22px; overflow: hidden; border: 6px solid #0b1116; box-shadow: 0 30px 60px -24px rgba(0,0,0,0.8), 0 0 0 1px rgba(244,234,212,0.08); background: #0b1116; }
.shot.phone .frame { border-radius: 28px; border-width: 8px; }
.shot figcaption { color: var(--ink-soft); font-size: 0.9rem; margin-top: 12px; line-height: 1.6; }
.real { display: inline-block; font-size: 0.78rem; letter-spacing: 0.02em; color: var(--glow); border: 1px solid rgba(246,207,114,0.45); border-radius: 999px; padding: 1px 9px; margin-right: 6px; }
:lang(th) .real { letter-spacing: 0; }

/* ---------- try it: the canal stage ---------- */
.stage-wrap { margin-top: 28px; }
.stage { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--night-2);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,0.9), 0 0 0 1px var(--line); }
@media (max-width: 700px) { .stage { aspect-ratio: auto; height: min(72vw, 420px); margin: 0 calc(-1 * var(--gutter)); border-radius: 0; } }
.scene { position: absolute; top: 0; bottom: 0; left: 50%; aspect-ratio: 16 / 9; height: 100%; min-width: 100%; transform: translateX(-50%); }
.scene > img, .scene .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.who { position: absolute; left: var(--l); bottom: var(--b); width: var(--w); padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transform-origin: 50% 100%; touch-action: manipulation; }
.who img { width: 100%; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35)); }
.who::after { /* a bigger touch area than the drawing */ content: ""; position: absolute; inset: -14px; }
.who:focus-visible { outline-offset: 6px; border-radius: 18px; }
.who.moon { border-radius: 50%; aspect-ratio: 1; }
.who.moon img { display: none; }
.who .tag-card {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 8px);
  background: var(--paper); color: var(--paper-ink); border-radius: 18px; padding: 6px 16px 8px; text-align: center; white-space: nowrap;
  box-shadow: 0 0 20px rgba(246,207,114,0.6); opacity: 0; transition: opacity .35s ease, transform .35s ease; pointer-events: none; z-index: 4;
}
.who .tag-card b { display: block; font: 700 clamp(1.15rem, 2.6vw, 1.7rem)/1.2 var(--display); }
.who .tag-card span { display: block; font: 700 clamp(0.85rem, 1.8vw, 1.15rem)/1.2 var(--body); color: #2f6390; }
.who.low .tag-card { bottom: auto; top: -8px; transform: translate(-50%, -100%); }
.who:focus-visible .tag-card, .who.say .tag-card { opacity: 1; transform: translate(-50%, 0); }
.who.low:focus-visible .tag-card, .who.low.say .tag-card { transform: translate(-50%, -100%); }
html[data-words="off"] .who .tag-card { display: none; }
html[data-words="th"] .who .tag-card span { display: none; }
.who.hop { animation: hop .7s cubic-bezier(.3,.7,.4,1); }
.who.bob { animation: bob 1.2s ease-in-out; }
.who.glow img { animation: glowup 1.3s ease-in-out; }
@keyframes hop { 30% { transform: translateY(-14%) scale(1.03, 0.97); } 60% { transform: translateY(0) scale(0.98, 1.02); } }
@keyframes bob { 25% { transform: rotate(-2.5deg) translateY(-3%); } 70% { transform: rotate(2deg); } }
@keyframes glowup { 40% { filter: drop-shadow(0 0 22px #ffd772) brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .who.hop, .who.bob { animation: none; } .who.glow img { animation: none; filter: drop-shadow(0 0 18px #ffd772); } }
.wib-float { animation: float 7s ease-in-out infinite alternate; }
@keyframes float { to { transform: translate(-6%, -9%); } }
@media (prefers-reduced-motion: reduce) { .wib-float { animation: none; } }
.stage .near { z-index: 2; pointer-events: none; }
.stage .front { z-index: 3; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.controls .label { font-weight: 600; margin-right: 4px; }
.chip { min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); font: 600 1rem var(--body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--glow); border-color: var(--glow); color: #2a1e08; }
.hint { color: var(--ink-soft); font-size: 0.93rem; margin-top: 10px; }
.no-js .needs-js { display: none; }

/* ---------- the lantern: two real frames, dimmed by the visitor ---------- */
.lamp { position: relative; }
.lamp .frame { position: relative; }
.lamp .low { position: absolute; inset: 0; opacity: var(--dim, 0); transition: opacity .25s linear; }
.lamp .low img { width: 100%; height: 100%; }
.dimmer { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.dimmer label { font-weight: 600; }
.dimmer input[type=range] { flex: 1 1 200px; min-width: 0; accent-color: var(--glow); height: 44px; }
.no-js .lamp .low { position: static; opacity: 1; margin-top: 10px; }

/* ---------- bedtime band ---------- */
.bedtime { background: radial-gradient(120% 80% at 70% 10%, #2a2a3c 0%, #14161f 55%, #0b0c12 100%); }
.bedtime h2 { color: #ffe6b0; }
.bedtime .points li::before { background: radial-gradient(circle, #ffe9c7 0 25%, #f3b96a 45%, rgba(243,185,106,0) 75%); box-shadow: 0 0 10px #f3b96a; }

/* ---------- free story ---------- */
.book { display: grid; gap: clamp(24px, 4vw, 48px); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 860px) { .book { grid-template-columns: 1fr 1fr; } }
.cover { border-radius: 24px; overflow: hidden; box-shadow: 0 0 0 1px rgba(246,207,114,0.35), 0 0 60px -10px rgba(246,207,114,0.35), 0 40px 80px -40px #000; }
.badge-free { display: inline-block; font: 700 0.95rem var(--display); background: var(--glow); color: #2a1e08; border-radius: 999px; padding: 4px 14px; margin-bottom: 12px; }
.meta { color: var(--ink-soft); font-size: 0.95rem; }
.for-night { font: 700 1.1rem var(--display); color: var(--glow); }

/* ---------- the shelf ---------- */
.shelf { margin-top: 36px; display: grid; gap: 34px; }
.set { position: relative; padding: 22px 22px 0; }
.set header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; }
.set header h3 { margin: 0; }
.set .price { color: var(--glow); font-weight: 700; font-variant-numeric: tabular-nums; }
.set .theme { color: var(--ink-soft); font-size: 0.95rem; flex-basis: 100%; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-items: end; padding-bottom: 14px; }
.set::after { /* the wooden shelf board */ content: ""; display: block; height: 16px; margin: 0 -22px; border-radius: 6px;
  background: linear-gradient(#7a5233, #5a3a22 60%, #3e2716); box-shadow: 0 14px 22px -12px #000; }
.spine { position: relative; min-height: 190px; border-radius: 10px 14px 14px 10px; padding: 16px 14px 14px 20px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(90deg, rgba(0,0,0,0.25) 0 8px, transparent 8px), var(--c, #2d4a58); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 10px 18px -10px #000; }
.spine .t { font: 700 1.05rem/1.35 var(--display); color: #fff5dc; }
.spine .e { font-size: 0.82rem; color: rgba(255,245,220,0.9); line-height: 1.4; margin-top: 6px; }
.spine .state { align-self: flex-start; font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,0.3); color: #ffe9b3; margin-top: 12px; }
.spine.free { --c: linear-gradient(160deg, #22465a, #133040); box-shadow: 0 0 0 2px var(--glow), 0 0 26px -4px rgba(246,207,114,0.7); }
.spine.free .state { background: var(--glow); color: #2a1e08; }
.shelf-note { color: var(--ink-soft); font-size: 0.95rem; margin-top: 18px; max-width: 46em; }

/* ---------- grown-ups and privacy on lantern paper ---------- */
.paper { background: var(--paper); color: var(--paper-ink); border-radius: var(--radius); padding: clamp(22px, 4vw, 40px);
  box-shadow: 0 0 0 1px rgba(246,207,114,0.25), 0 30px 60px -30px #000; }
.paper a { color: #8a4b0f; }
.paper .points li::before { background: radial-gradient(circle, #ffd56a 0 40%, rgba(240,170,60,0.0) 72%); box-shadow: none; }
.paper .muted { color: var(--paper-soft); }
.facts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.facts li { background: var(--paper); color: var(--paper-ink); border-radius: 20px; padding: 18px 18px 18px 54px; position: relative; font-weight: 600; line-height: 1.5;
  box-shadow: 0 0 22px -6px rgba(246,207,114,0.45); }
.facts li::before { content: ""; position: absolute; left: 18px; top: 18px; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c9 0 25%, #f2b84f 50%, rgba(242,184,79,0) 75%); }

/* ---------- closing + footer ---------- */
.closing { text-align: center; overflow: hidden; isolation: isolate; }
.closing .flies { z-index: -1; }
.closing img.sleep { width: min(340px, 70vw); margin: 0 auto 18px; opacity: 0.95; }
footer.foot { border-top: 1px solid var(--line); padding: 34px 0 48px; color: var(--ink-soft); font-size: 0.92rem; }
footer.foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 14px; }
footer.foot nav a { color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- reading pages (support, privacy) ---------- */
.doc-hero { position: relative; padding: 120px 0 40px; overflow: hidden; isolation: isolate; }
.doc-hero .flies { z-index: -1; }
.doc-hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.doc { max-width: 760px; margin: 0 auto 80px; }
.doc .paper h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); margin-top: 1.6em; }
.doc .paper h2:first-child { margin-top: 0; }
.doc .paper ul { padding-left: 1.2em; }
.doc .paper li { margin-bottom: 0.45em; }
.doc .stamp { color: var(--ink-soft); font-size: 0.95rem; }
.doc .other { margin-top: 26px; color: var(--ink-soft); }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.toc a { display: inline-flex; min-height: 44px; align-items: center; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.ui { font-weight: 700; white-space: nowrap; } /* an on-screen label */

/* ---------- reveal on scroll (only when the script runs; the page is complete without it) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.2,.7,.2,1); }
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js [data-reveal] { transform: none; transition: opacity .4s ease; } }
.static [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
.static .flies i, .static .wib-float { animation: none !important; }

/* narrow screens: grid children may shrink; long English phrases may wrap (Thai phrases stay whole) */
.split > *, .book > * { min-width: 0; }
:lang(en) .ph { white-space: normal; }
.paper h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
.books { list-style: none; margin: 0; padding: 0 0 14px; }
@media (max-width: 560px) {
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .spine { min-height: 150px; padding: 12px 10px 12px 16px; }
  .spine .t { font-size: 0.98rem; }
  .set { padding: 18px 12px 0; }
  .set::after { margin: 0 -12px; }
}
html[data-store="soon"] .store-live-text, html[data-store="live"] .store-soon-text { display: none; }
.set .price.later { color: var(--ink-soft); font-weight: 600; }
