/* The landing page. Everything here comes from the app: Ahma's chat, postage stamps, ink postmarks, lanterns and the ang pao. */
:root { --paper: #FFD978; --line: #1C1915; --seal: #D93A2B; --seal-deep: #A8281D; --postmark: #1D3A8A; }
@media (prefers-color-scheme: dark) { :root { --postmark: #9DB4F5; } }

section { padding-left: 20px; padding-right: 20px; }
h1, h2 { font-weight: 900; letter-spacing: -.035em; line-height: 1; margin: 0; }
h1 { font-size: clamp(54px, 8.4vw, 96px); }
h2 { font-size: clamp(38px, 5.6vw, 62px); }
.lede { color: var(--ink-soft); font-size: clamp(18px, 2vw, 21px); line-height: 1.4; font-weight: 700; margin: 16px 0 0; max-width: 29em; }

/* Lanterns hang from the top of the page, as they do on the mission map. */
.lanterns { position: absolute; top: 0; left: 0; right: 0; height: 0; pointer-events: none; }
.lantern { position: absolute; top: 0; width: 62px; transform-origin: 50% 0; animation: sway 5s ease-in-out infinite; }
.lantern.a { left: max(18px, calc(50% - 620px)); }
.lantern.b { right: max(18px, calc(50% - 620px)); width: 48px; animation-delay: -2.2s; }
@keyframes sway { 0%, 100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }

/* Hero: the pitch on one side, a real exchange with Ahma on the other. */
.hero {
  position: relative; max-width: 1120px; margin: 0 auto; min-height: 100svh;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
  padding-top: 120px; padding-bottom: 60px;
}
.hero .btn { margin-top: 34px; }
.small-print { color: var(--ink-soft); font-size: 15px; font-weight: 700; margin: 16px 0 0; }

.chat { position: relative; display: flex; flex-direction: column; scroll-margin-top: 34px; background: var(--surface); border-radius: 32px; padding: 18px; box-shadow: 0 24px 60px rgba(60, 40, 10, .13); }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.chat-head img { width: 46px; height: 46px; }
.chat-head b { display: block; font-weight: 900; font-size: 18px; line-height: 1.1; }
.chat-head small { color: var(--ink-soft); font-size: 14px; }
.log { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 196px; justify-content: flex-end; padding: 14px 0; }
.msg { max-width: 84%; border-radius: 22px; padding: 10px 14px; line-height: 1.2; animation: pop .28s var(--spring); }
@keyframes pop { from { transform: scale(.82); opacity: 0; } }
.msg strong { display: block; font-weight: 900; font-size: 19px; }
.msg small { font-size: 14px; font-weight: 700; opacity: .72; }
.msg.ahma strong { white-space: nowrap; }
.msg.ahma { background: var(--canvas); align-self: flex-start; border-bottom-left-radius: 6px; transform-origin: 0 100%; }
.msg.me { background: var(--green); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; transform-origin: 100% 100%; }
.msg.hoki { align-self: center; background: none; padding: 2px 8px; color: var(--ink-soft); font-size: 15px; font-weight: 800; text-align: center; text-wrap: balance; max-width: 100%; }
.replies { display: grid; gap: 8px; }
.reply {
  font: 900 18px/1.15 var(--font); color: var(--ink); text-align: left; cursor: pointer;
  background: var(--surface); border: 2px solid var(--hairline); border-radius: 18px; padding: 10px 14px;
  box-shadow: 0 3px 0 var(--hairline); transition: transform .1s, box-shadow .1s, border-color .15s;
}
.reply small { display: block; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
@media (hover: hover) { .reply:hover { border-color: var(--green); } }
.reply:active { transform: translateY(3px); box-shadow: none; }
.reply:focus-visible, .say:focus-visible, .again:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.replies .btn { margin: 18px 0 0; }
.again { font: 800 15px var(--font); min-height: 44px; color: var(--ink-soft); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 8px; justify-self: center; }

.earned { position: absolute; right: -22px; top: -30px; width: 124px; animation: slap .42s cubic-bezier(.2, 1.4, .4, 1); transform: rotate(7deg); pointer-events: none; }
.earned img { width: 100%; height: auto; filter: drop-shadow(0 8px 12px rgba(60, 40, 10, .25)); }
.earned span {
  position: absolute; left: -26px; bottom: -6px; width: 78px; height: 78px; display: grid; place-items: center;
  border: 3px solid var(--postmark); border-radius: 50%; outline: 1.5px solid var(--postmark); outline-offset: -8px;
  color: var(--postmark); font-size: 11px; font-weight: 900; line-height: 1.05; text-align: center; transform: rotate(-16deg); opacity: .85;
}
@keyframes slap { from { transform: scale(2.3) rotate(-10deg); opacity: 0; } }

/* How a mission goes: three screens, numbered with ink postmarks. */
.how { max-width: 1040px; margin: 0 auto; padding-top: 80px; padding-bottom: 80px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin: 44px 0 0; padding: 0; list-style: none; }
.steps li { margin: 0; }
.steps li:nth-child(2) { margin-top: 44px; }
.phone {
  aspect-ratio: 1206 / 2070; overflow: hidden; border-radius: 30px; background: var(--canvas);
  border: 7px solid var(--line); position: relative;
}
.phone img { width: 100%; height: auto; margin-top: -15.5%; /* cuts the status bar off cleanly */ }
.mark {
  width: 58px; height: 58px; margin: -30px 0 8px 14px; position: relative; display: grid; place-items: center; background: var(--canvas);
  border: 3px solid var(--postmark); border-radius: 50%; outline: 1.5px solid var(--postmark); outline-offset: -7px;
  color: var(--postmark); font-size: 22px; font-weight: 900; transform: rotate(-12deg);
}
.steps h3 { font-size: 24px; font-weight: 900; letter-spacing: -.02em; margin: 0; }
.steps p { color: var(--ink-soft); margin: 4px 0 0; font-weight: 700; font-size: 16px; line-height: 1.35; }

/* Phrases you can actually press. */
.phrases { max-width: 1040px; margin: 0 auto; padding-top: 50px; padding-bottom: 80px; display: grid; grid-template-columns: .9fr 1.1fr; gap: 44px; align-items: center; }
.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; background: var(--surface); border-radius: 22px; padding: 12px 12px 12px 18px; }
.row b { display: block; font-size: 20px; font-weight: 900; line-height: 1.2; }
.row small { color: var(--ink-soft); font-size: 15px; font-weight: 700; }
.say { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(62, 145, 80, .15); color: var(--green-ink); cursor: pointer; display: grid; place-items: center; }
.say svg { width: 20px; height: 20px; fill: currentColor; }
.say.on { background: var(--green); color: #fff; }
/* A bubble with a speaker: words on the left, button on the right, never overlapping. */
.msg:has(> .say) { display: grid; grid-template-columns: auto 36px; column-gap: 12px; align-items: center; }
.msg > strong, .msg > small { grid-column: 1; }
.msg > .say { grid-column: 2; grid-row: 1 / span 2; width: 36px; height: 36px; margin-right: -4px; }
.msg > .say svg { width: 17px; height: 17px; }

/* The stamp sheet: cream paper with real perforations, punched in the page colour. */
.sheet-wrap { padding-top: 10px; padding-bottom: 70px; }
.sheet {
  --hole: 11px; --pitch: 30px;
  position: relative; max-width: 1040px; margin: 0 auto; background: var(--paper); color: var(--line);
  padding: clamp(44px, 7vw, 76px) clamp(30px, 6vw, 70px); text-align: center;
}
.sheet::before, .sheet::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sheet::before {
  background:
    radial-gradient(circle, var(--page, var(--canvas)) var(--hole), transparent calc(var(--hole) + .5px)) 0 calc(var(--pitch) / -2) / var(--pitch) var(--pitch) repeat-x,
    radial-gradient(circle, var(--page, var(--canvas)) var(--hole), transparent calc(var(--hole) + .5px)) 0 calc(100% + var(--pitch) / 2) / var(--pitch) var(--pitch) repeat-x;
}
.sheet::after {
  background:
    radial-gradient(circle, var(--page, var(--canvas)) var(--hole), transparent calc(var(--hole) + .5px)) calc(var(--pitch) / -2) 0 / var(--pitch) var(--pitch) repeat-y,
    radial-gradient(circle, var(--page, var(--canvas)) var(--hole), transparent calc(var(--hole) + .5px)) calc(100% + var(--pitch) / 2) 0 / var(--pitch) var(--pitch) repeat-y;
}
.sheet .lede { color: #5A4A1E; margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(8px, 1.8vw, 16px); margin-top: 38px; }
.grid img { width: 100%; height: auto; transition: transform .25s var(--spring); }
@media (hover: hover) { .grid img:hover { transform: scale(1.1) rotate(-3deg); } }

/* The ang pao. */
.angpao-wrap { padding-bottom: 50px; }
.angpao {
  position: relative; max-width: 620px; margin: 0 auto; background: var(--seal); color: #FFF4E0;
  border-radius: 26px; padding: 104px 28px 46px; text-align: center; overflow: hidden;
  box-shadow: inset 0 0 0 7px var(--seal), inset 0 0 0 9px rgba(255, 194, 61, .75);
}
.angpao::before {
  content: ""; position: absolute; top: -130px; left: -5%; right: -5%; height: 220px;
  background: var(--seal-deep); border-radius: 0 0 50% 50%;
}
.fu {
  position: absolute; top: 46px; left: 50%; translate: -50% 0; width: 84px; height: 84px; display: grid; place-items: center;
  background: var(--gold); color: var(--seal-deep); border-radius: 50%; font-size: 44px; font-weight: 900;
  font-family: "PingFang TC", "Noto Sans TC", serif;
}
.angpao h2 { font-size: clamp(34px, 5.4vw, 52px); margin-top: 44px; color: #FFF4E0; }
.angpao p { font-weight: 700; margin: 12px auto 0; max-width: 24em; line-height: 1.35; }
.angpao .btn { margin-top: 30px; background: var(--gold); color: var(--line); box-shadow: 0 5px 0 #B07D00; }
.angpao .btn:active { box-shadow: 0 1px 0 #B07D00; }
.angpao .btn::before, .angpao .btn::after { display: none; }
.note { color: var(--ink-soft); font-size: 15px; text-align: center; margin: 26px auto 0; max-width: 34em; }
.note a { color: var(--ink); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 104px; min-height: 0; }
  .chat { max-width: 440px; width: 100%; justify-self: center; }
  .earned { right: -6px; width: 104px; }
  .phrases { grid-template-columns: 1fr; gap: 26px; }
    .grid { grid-template-columns: repeat(3, 1fr); }
  .lantern { width: 42px; }
  .lantern.b { display: none; }
  .lantern.a { left: auto; right: 14px; top: 58px; }
}

/* Tablets in portrait keep the three screens side by side, just closer together. */
@media (max-width: 860px) { .steps { gap: 20px; } }

@media (max-width: 640px) {
  h1 { font-size: clamp(48px, 14.4vw, 64px); }
  h2 { font-size: clamp(34px, 10vw, 44px); text-wrap: balance; }
  .lede { font-size: 18px; margin-top: 14px; text-wrap: pretty; }

  .hero { gap: 30px; padding-top: 92px; padding-bottom: 32px; }
  .hero .btn { display: flex; margin-top: 34px; }
  .small-print { font-size: 14px; margin-top: 15px; text-align: center; text-wrap: balance; }
  .lantern.a { top: 50px; }

  /* Ahma's question sits right under her name, so it's on the first screen. */
  .chat { max-width: none; padding: 14px; border-radius: 28px; box-shadow: 0 12px 34px rgba(60, 40, 10, .1); }
  .log { min-height: 0; padding: 14px 0 16px; }
  .reply { padding: 12px 14px; min-height: 48px; }
  .msg:has(> .say) { grid-template-columns: auto 44px; column-gap: 8px; padding: 8px 8px 8px 14px; }
  .msg > .say { width: 44px; height: 44px; margin-right: 0; }
  .earned { right: -8px; top: -36px; width: 88px; }
  .earned span { left: -22px; bottom: -8px; width: 62px; height: 62px; font-size: 9px; border-width: 2.5px; outline-offset: -7px; }

  /* The three screens become a strip you swipe, with the next one peeking in. */
  .how { padding-top: 48px; padding-bottom: 44px; }
  .steps {
    display: flex; gap: 16px; margin: 26px -20px 0; padding: 0 20px 4px; overflow-x: auto;
    scroll-snap-type: x mandatory; scroll-padding-inline: 20px; overscroll-behavior-x: contain; scrollbar-width: none;
  }
  .steps::-webkit-scrollbar { display: none; }
  .steps li { flex: 0 0 min(64vw, 270px); scroll-snap-align: start; }
  .steps li:nth-child(2) { margin-top: 0; }
  .phone { border-width: 6px; border-radius: 26px; }
  .mark { width: 52px; height: 52px; margin: -28px 0 6px 12px; }
  .steps h3 { font-size: 22px; }

  .phrases { padding-top: 32px; padding-bottom: 52px; gap: 22px; }
  .row { padding: 11px 11px 11px 18px; }

  .sheet-wrap { padding: 0 12px 44px; }
  .sheet { --hole: 9px; --pitch: 26px; padding: 44px 26px 46px; }
  .grid { gap: 12px; margin-top: 26px; }
  .grid img:nth-child(n + 10) { display: none; }

  .angpao-wrap { padding-bottom: 20px; }
  .angpao { padding: 100px 20px 36px; }
  .angpao .btn { display: flex; margin-top: 24px; }
  .note { margin-top: 20px; text-wrap: balance; }
  .note a { display: inline-block; padding: 10px 4px; margin: -10px -4px; }
}
@media (max-width: 359px) { .earned { width: 70px; right: -10px; } .earned span { left: -14px; width: 54px; height: 54px; font-size: 8px; } .msg strong { font-size: 18px; } }

/* The green page (tokens in style.css). Text that sits right on the green turns cream. */
body.home main > section > h2, body.home main > section > div > h2, .home .hero h1, .home .steps h3 { color: var(--on-page); }
.home main > section > .lede, .home main > section > div > .lede, .home .small-print, .home .steps p, .home .note { color: var(--on-page-soft); }
.home .note a { color: var(--on-page-soft); }
.home .note strong { color: var(--on-page); }

/* A warm glow behind the hero and a faint lattice, like light through a window screen. */
.home .hero::before {
  content: ""; position: absolute; inset: 0 -40vw; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 55% at 72% 48%, rgba(255, 194, 61, .22), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .07) 1.2px, transparent 1.6px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
  mask-image: linear-gradient(#000 70%, transparent);
}
.home main { position: relative; z-index: 0; overflow-x: clip; }
.eyebrow {
  display: inline-block; margin: 0 0 18px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 194, 61, .18); color: var(--gold); font-size: 15px; font-weight: 900; letter-spacing: .02em;
}

/* On green, the big button is cream so it still pops. Hoki's gold horns stay. */
.home .btn { background: var(--on-page); color: var(--page-deep); box-shadow: 0 5px 0 var(--page-dark); }
.home .btn:active { box-shadow: 0 1px 0 var(--page-dark); }
.home .chat .btn { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-deep); }
.home .chat { box-shadow: 0 30px 70px rgba(0, 30, 10, .3); }

/* Hoki sits on top of Ahma's chat, cheering you on. */
.hoki-perch { position: absolute; z-index: 1; left: 14px; top: -78px; width: 104px; height: auto; pointer-events: none; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.chat-head { padding-left: 96px; }
@media (max-width: 640px) { .hoki-perch { width: 80px; top: -60px; left: 10px; } .chat-head { padding-left: 76px; } .hero { gap: 64px; } }

/* Section bands: the darker brand green behind "How it works" and the stamp sheet, so the page has a rhythm. */
.band { background: var(--page-deep); box-shadow: 0 0 0 100vmax var(--page-deep); clip-path: inset(0 -100vmax); margin-top: 60px; margin-bottom: 60px; }
.mark { background: var(--on-page); }

/* What Philippine Hokkien is. */
.lannang { max-width: 1040px; margin: 0 auto; padding-top: 70px; padding-bottom: 30px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 38px; }
.fact { background: rgba(255, 255, 255, .08); border: 1.5px solid rgba(255, 255, 255, .14); border-radius: 26px; padding: 22px 22px 24px; }
.fact .han {
  display: inline-block; font-size: 30px; font-weight: 900; line-height: 1; color: var(--gold);
  font-family: var(--font), "PingFang TC", "Noto Sans TC", sans-serif; letter-spacing: .02em;
}
.fact h3 { margin: 14px 0 0; font-size: 23px; font-weight: 900; letter-spacing: -.02em; color: var(--on-page); }
.fact p { margin: 6px 0 0; color: var(--on-page-soft); font-weight: 700; line-height: 1.4; }
.fact b { color: var(--on-page); }

@media (max-width: 860px) { .facts { grid-template-columns: 1fr; gap: 12px; } .fact { padding: 18px 20px 20px; } .fact .han { font-size: 24px; } .fact h3 { margin-top: 10px; } }
@media (max-width: 640px) {
  .lannang { padding-top: 40px; padding-bottom: 10px; }
  .facts { margin-top: 24px; }
  .eyebrow { font-size: 14px; margin-bottom: 14px; }
  .home .hero .eyebrow { display: table; margin-inline: 0; }
}
.home .chat, .home .row, .home .nav { color: var(--ink); }
.home .sheet h2 { color: var(--line); }
.home .sheet .lede { color: #5A4A1E; }
.home .angpao .btn { background: var(--gold); color: var(--line); box-shadow: 0 5px 0 #B07D00; }
.home .angpao .btn:active { box-shadow: 0 1px 0 #B07D00; }
