/* Our First Home. Brand: AH DAILY/brand/BRAND_GUIDE.md (paper, ink, coral, butter, sky, mint) */
@font-face { font-family: "Bricolage"; src: url("fonts/bricolage.woff") format("woff"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "ZCOOL"; src: url("fonts/zcool.woff") format("woff"); font-display: swap; }

:root {
  --paper: #fff5e6; --paper-2: #fbead0; --ink: #1f2a44; --coral: #ff6b4a; --butter: #ffd45c;
  --sky: #8fdaff; --mint: #bfe8c9; --muted: #5d6378; --night: #151b2e;
  --en: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --zh: "ZCOOL", "PingFang SC", "Noto Sans SC", sans-serif;
  --hand: "Caveat", cursive;
  --out: cubic-bezier(0.16, 1, 0.3, 1);
  --col: min(100vw, 460px);
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--en); font-size: 17px; line-height: 1.5;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .42 0 0 0 0 .25 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
  overflow-x: hidden;
}
::selection { background: var(--butter); color: var(--ink); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
a { color: inherit; text-underline-offset: 0.2em; }
.zh { font-family: var(--zh); font-weight: 400; letter-spacing: 0.02em; }
.hand { font-family: var(--hand); font-weight: 700; }
.wrap { width: var(--col); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- bio (link in bio) ---------- */
.bio { min-height: 100svh; display: flex; flex-direction: column; padding-top: 28px; padding-bottom: 22px; }
.bio-top { display: flex; align-items: center; gap: 16px; }
.polaroid {
  background: #fffdf8; padding: 8px 8px 30px; box-shadow: 0 10px 24px -12px rgba(31,42,68,.45), 0 2px 4px rgba(31,42,68,.08);
  position: relative; display: inline-block;
}
.polaroid img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.polaroid figcaption { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font: 700 19px/1 var(--hand); color: var(--ink); }
.tape { position: absolute; width: 64px; height: 20px; background: rgba(255, 212, 92, .78); top: -9px; left: 50%; transform: translateX(-50%) rotate(-4deg); }
.bio .polaroid { width: 112px; transform: rotate(-4deg); flex: none; }
.bio .polaroid img { aspect-ratio: 1; }
.bio h1 { margin: 0; font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: -0.04em; }
.bio .who { margin: 6px 0 0; font-size: 15px; color: var(--muted); line-height: 1.35; }
.bio .who .zh { display: block; color: var(--ink); font-size: 15px; white-space: nowrap; }

.links { margin: 26px 0 0; display: grid; gap: 10px; padding: 0; list-style: none; }
.btn {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 18px; border-radius: 16px;
  background: #fffdf8; text-decoration: none; font-weight: 600; font-size: 16px;
  box-shadow: 0 1px 0 rgba(31,42,68,.12), 0 6px 16px -10px rgba(31,42,68,.35);
  transition: transform .5s var(--out), box-shadow .5s var(--out);
}
.btn:active { transform: scale(.98); }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(31,42,68,.12), 0 12px 22px -12px rgba(31,42,68,.4); } }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn .sub { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.btn.hero { background: var(--coral); color: #fff; min-height: 64px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.btn.hero .sub { color: rgba(255,255,255,.85); }
.btn.soon { opacity: .55; pointer-events: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.swipe { margin-top: auto; padding-top: 28px; text-align: center; text-decoration: none; display: block; }
.swipe p { margin: 0; font: 700 26px/1.1 var(--hand); color: var(--coral); }
.swipe .zh { display: block; font-size: 15px; color: var(--muted); margin-top: 4px; font-family: var(--zh); }
.swipe svg { width: 46px; height: 64px; margin-top: 6px; animation: bob 2.4s var(--out) infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ---------- journey bar (where are we now) ---------- */
.journey {
  position: sticky; top: 0; z-index: 20; background: rgba(255,245,230,.9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(31,42,68,.08);
}
.journey ol { list-style: none; margin: 0 auto; padding: 10px 14px 9px; width: var(--col); display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.journey ol::before { content: ""; position: absolute; left: 10%; right: 10%; top: 17px; border-top: 2px dashed rgba(31,42,68,.22); }
.journey li { text-align: center; position: relative; font-size: 11px; line-height: 1.15; color: var(--muted); }
.journey .dot { display: block; width: 14px; height: 14px; margin: 0 auto 4px; border-radius: 50%; background: var(--paper); border: 2px solid rgba(31,42,68,.3); position: relative; }
.journey li.done .dot { background: var(--ink); border-color: var(--ink); }
.journey li.now .dot { background: var(--coral); border-color: var(--coral); }
.journey li.now { color: var(--ink); font-weight: 700; }
.journey .zh { display: block; font-size: 12px; }
.journey .here { position: absolute; top: -2px; left: 50%; transform: translate(14px, 0) rotate(-6deg); font: 700 15px/1 var(--hand); color: var(--coral); white-space: nowrap; }

/* ---------- chapters ---------- */
.chapter { padding: 72px 0 40px; }
.label {
  display: inline-block; background: var(--butter); color: var(--ink); padding: 6px 14px 5px; transform: rotate(-3deg);
  font-family: var(--zh); font-size: 18px; box-shadow: 0 4px 10px -6px rgba(31,42,68,.4);
}
.label .hand { font-size: 19px; margin-left: 6px; color: var(--ink); }
.big { margin: 18px 0 0; font-weight: 800; font-size: clamp(34px, 10vw, 44px); line-height: 1.02; letter-spacing: -0.04em; text-wrap: balance; }
.big .zh { display: block; font-size: 0.78em; color: var(--coral); letter-spacing: 0.02em; line-height: 1.2; margin-bottom: 6px; }
.body { margin: 16px 0 0; max-width: 34ch; color: var(--ink); }
.note { font: 700 21px/1.2 var(--hand); color: var(--muted); margin: 14px 0 0; }
.keys-pic { width: 70%; margin: 30px 0 0 auto; display: block; transform: rotate(3deg); }
.keys-pic img { object-position: 50% 30%; }

/* EP1 player */
.episode { margin: 34px auto 0; width: 78%; transform: rotate(-1.5deg); position: relative; }
.episode .frame { background: #fffdf8; padding: 9px 9px 46px; box-shadow: 0 18px 36px -18px rgba(31,42,68,.55), 0 2px 5px rgba(31,42,68,.1); }
.episode video, .episode .poster { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #ddd; border: 0; }
.episode .poster { position: relative; padding: 0; cursor: pointer; overflow: hidden; }
.episode .poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.2s var(--out); }
.episode .poster:active img { transform: scale(1.03); }
.play {
  position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; background: var(--coral);
  display: grid; place-items: center; box-shadow: 0 10px 22px -10px rgba(31,42,68,.6);
}
.play svg { width: 30px; height: 30px; margin-left: 4px; }
.episode .cap { position: absolute; left: 14px; right: 14px; bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.episode .cap b { font-weight: 800; letter-spacing: -0.02em; }
.episode .cap span { font: 700 18px/1 var(--hand); color: var(--muted); }
.sticker {
  position: absolute; z-index: 2; background: var(--coral); color: #fff; font-weight: 800; padding: 6px 12px; border-radius: 999px;
  transform: rotate(8deg); top: -14px; right: -14px; font-size: 14px; letter-spacing: -0.01em; box-shadow: 0 6px 14px -8px rgba(31,42,68,.6);
}

/* ---------- rooms ---------- */
.canvas-intro { padding: 70px 0 28px; text-align: center; }
.canvas-intro .big { font-size: clamp(30px, 9vw, 40px); }
.room { position: relative; height: 290svh; }
.stage { position: sticky; top: 0; height: 100svh; overflow: hidden; background: #e9e6df; }
.stage .fallback, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.stage canvas { opacity: 0; transition: opacity .6s var(--out); }
.room.gl-ready canvas { opacity: 1; }
.room.no-gl .fallback.plate { display: none; }
.stage .fallback.paint { display: none; }
.room.no-gl .fallback.paint { display: block; }
.room-label { position: absolute; top: 74px; left: 18px; z-index: 3; }
.beats { position: absolute; left: 0; right: 0; bottom: 76px; z-index: 3; width: var(--col); margin: 0 auto; padding: 0 18px; display: grid; gap: 10px; }
.bubble {
  justify-self: start; max-width: 88%; background: #fffdf8; padding: 11px 15px 10px; border-radius: 18px 18px 18px 4px;
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(14px) scale(.96); filter: blur(4px);
  transition: opacity .7s var(--out), transform .7s var(--out), filter .7s var(--out);
}
.bubble.on { opacity: 1; transform: none; filter: none; }
.bubble.him { justify-self: end; border-radius: 18px 18px 4px 18px; background: var(--sky); }
.bubble .zh { display: block; font-size: 19px; line-height: 1.3; }
.bubble .en { display: block; font-size: 14px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.bubble.him .en { color: #23405a; }
.bubble .who { font: 700 15px/1 var(--hand); color: var(--coral); display: block; margin-bottom: 3px; }
.state {
  position: absolute; left: 0; right: 0; bottom: 22px; z-index: 3; display: flex; justify-content: center; gap: 6px; padding: 0 12px;
}
.state span {
  font-size: 11px; font-weight: 600; padding: 5px 9px 4px; border-radius: 999px; background: rgba(21,27,46,.6); color: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); white-space: nowrap;
}
.state span.is { background: var(--butter); color: var(--ink); }
.stamp {
  position: absolute; top: 120px; right: 18px; z-index: 3; transform: rotate(9deg) scale(1.6); opacity: 0;
  border: 2.5px solid var(--coral); color: var(--coral); padding: 6px 12px 4px; border-radius: 8px; background: rgba(255,253,248,.85);
  font-weight: 800; letter-spacing: -0.01em; text-align: center; line-height: 1.1; transition: opacity .35s var(--out), transform .5s var(--out);
}
.stamp .zh { display: block; font-size: 14px; }
.stamp.on { opacity: 1; transform: rotate(9deg) scale(1); }
.hint { position: absolute; top: 50%; left: 0; right: 0; text-align: center; z-index: 3; font: 700 25px/1.1 var(--hand); color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.45); transition: opacity .5s var(--out); }
.hint.on { opacity: 0; }

/* hotspot */
.spot { position: absolute; z-index: 4; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 0; padding: 0; background: none; cursor: pointer; opacity: 0; transition: opacity .5s var(--out); pointer-events: none; }
.spot.on { opacity: 1; pointer-events: auto; }
.spot::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px #fff; }
.spot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #fff; animation: ping 2s var(--out) infinite; }
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.card {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; width: var(--col); margin: 0 auto; background: #fffdf8;
  border-radius: 22px 22px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 40px -20px rgba(31,42,68,.5);
  transform: translateY(105%); transition: transform .55s var(--out);
}
.card.open { transform: none; }
.card h3 { margin: 6px 0 0; font-weight: 800; font-size: 24px; letter-spacing: -0.03em; line-height: 1.1; }
.card h3 .zh { display: block; font-size: 17px; color: var(--coral); margin-bottom: 4px; }
.card dl { margin: 16px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; font-weight: 600; }
.card .later { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--paper); font-size: 14px; color: var(--muted); }
.card .close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.card .close svg { width: 16px; height: 16px; }

/* interlude between rooms */
.interlude { padding: 64px 0; }
.interlude .line { margin: 0; font-weight: 800; font-size: 26px; letter-spacing: -0.03em; line-height: 1.15; }
.interlude .line .zh { display: block; font-size: 21px; color: var(--coral); letter-spacing: 0.02em; margin-bottom: 4px; }
.interlude .line + .line { margin-top: 22px; }
.interlude .reply { text-align: right; }
.interlude .reply .zh { color: #2c7fb0; }
.interlude .beat { font: 700 22px/1.2 var(--hand); color: var(--muted); margin: 22px 0; text-align: center; }

/* ---------- night ending ---------- */
.night { background: var(--night); color: #eef0f7; padding: 90px 0 70px; position: relative; overflow: hidden; }
.night { transition: background-color 1.2s var(--out); }
.night.lit { background: var(--paper); color: var(--ink); }
.night.lit .stars, .night.lit .owl { opacity: 0; }
.night.flicker { animation: flick .9s steps(1) 1; }
@keyframes flick { 0% { background: var(--paper); } 18% { background: var(--night); } 30% { background: var(--paper); } 44% { background: var(--night); } 52% { background: #3a3f52; } 60%, 100% { background: var(--night); } }
.stars { position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='600'%3E%3Ccircle cx='48' cy='90' r='1.2' fill='%23fff' opacity='0.9'/%3E%3Ccircle cx='312' cy='60' r='1' fill='%23fff' opacity='0.8'/%3E%3Ccircle cx='256' cy='180' r='1.4' fill='%23fff' opacity='0.6'/%3E%3Ccircle cx='120' cy='240' r='1' fill='%23fff' opacity='0.7'/%3E%3Ccircle cx='352' cy='312' r='1.2' fill='%23fff' opacity='0.9'/%3E%3Ccircle cx='32' cy='396' r='1' fill='%23fff' opacity='0.6'/%3E%3Ccircle cx='200' cy='470' r='1.1' fill='%23fff' opacity='0.5'/%3E%3Ccircle cx='380' cy='520' r='0.9' fill='%23fff' opacity='0.7'/%3E%3Ccircle cx='150' cy='40' r='0.8' fill='%23fff' opacity='0.6'/%3E%3Ccircle cx='290' cy='420' r='1' fill='%23fff' opacity='0.5'/%3E%3C/svg%3E") repeat; }
.night .wrap { position: relative; }
.night .polaroid { width: 84%; display: block; margin: 0 auto; transform: rotate(-2deg); }
.night .polaroid img { aspect-ratio: 4 / 5; filter: brightness(.82) saturate(.9); }
.night .pair { position: absolute; font: 700 24px/1 var(--hand); color: var(--coral); top: 38%; right: 8%; transform: rotate(-8deg); }
.night .big { color: #fff; text-align: center; font-size: 30px; }
.night .big .zh { color: var(--butter); }
.next { margin: 40px auto 0; background: var(--ink); border: 1px dashed rgba(255,255,255,.3); border-radius: 18px; padding: 18px; text-align: center; }
.next .zh { display: block; font-size: 20px; color: #fff; }
.next .hand { color: var(--butter); font-size: 22px; }
.owl { display: block; margin: 26px auto 0; background: none; border: 0; color: rgba(255,255,255,.7); font: 700 20px/1 var(--hand); cursor: pointer; }

footer { background: var(--night); color: rgba(238,240,247,.8); padding: 10px 0 46px; font-size: 14px; }
footer .links .btn { background: rgba(255,255,255,.07); color: #fff; box-shadow: none; }
footer .fine { margin-top: 26px; line-height: 1.55; }
footer .fine .zh { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
