/* Site styles. All colours/fonts come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:lang(zh) body, body:lang(zh), :lang(ja) body, body:lang(ja), :lang(ko) body, body:lang(ko) { line-height: 1.85; letter-spacing: .01em; }
img, svg { max-width: 100%; height: auto; }
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .005em;
  margin: 0 0 .6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); }
h2 { font-size: clamp(1.55rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--on-accent); }

/* Layout */
.container { width: min(100% - 2rem, var(--content)); margin-inline: auto; }
.reading { width: min(100% - 2rem, var(--reading)); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--alt { background: var(--bg-alt); }
.section-head { max-width: 40rem; margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-block; margin-bottom: .7rem;
  color: var(--autumn); font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
:lang(zh) .eyebrow { letter-spacing: .2em; font-size: .9rem; }
.lead { font-size: clamp(1.1rem, 2.2vw, 1.28rem); color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .92rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: .75rem; min-height: 4.25rem; flex-wrap: wrap; }
.brand {
  display: inline-flex; align-items: center; gap: .6rem; margin-right: auto;
  color: var(--ink); text-decoration: none; min-width: 0;
}
.brand:hover { color: var(--ink); }
.brand img { width: 2.4rem; height: 2.4rem; flex: none; }
.brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.12rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.site-nav a {
  display: block; padding: .45rem .7rem; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: .96rem;
}
.site-nav a:hover { background: var(--surface-soft); }
.site-nav a[aria-current="page"] { background: var(--surface-soft); font-weight: 650; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.lang-toggle, .lang-select, .nav-toggle {
  min-height: 2.6rem; min-width: 2.6rem; padding: .35rem .8rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
}
.lang-toggle:hover, .lang-select:hover, .nav-toggle:hover { background: var(--surface-soft); }
.nav-toggle { display: none; }
html:not(.js) .lang-toggle, html:not(.js) .lang-select { display: none; }
.nav-toggle-bars { display: inline-block; width: 1.1rem; height: .8rem; vertical-align: middle; position: relative; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid currentColor; transform: translateY(-50%); }

@media (max-width: 60rem) {
  .header-actions .header-cta { display: none; }
}
@media (max-width: 52rem) {
  .js .nav-toggle { display: inline-flex; align-items: center; gap: .4rem; }
  .site-nav { order: 10; flex-basis: 100%; }
  .js .site-nav:not(.is-open) { display: none; }
  .site-nav ul { flex-direction: column; padding-bottom: .8rem; }
  .site-nav a { padding: .7rem .8rem; border-radius: var(--radius-sm); }
  .site-nav .header-cta-mobile { display: block; }
}
@media (max-width: 26rem) {
  .brand-name { font-size: 1rem; }
  .brand img { width: 2.1rem; height: 2.1rem; }
  .lang-toggle, .lang-select, .nav-toggle { padding-inline: .65rem; }
}
.header-cta-mobile { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.4rem; border-radius: 999px;
  border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: 1rem; line-height: 1.2; text-align: center;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-soft); }
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.btn--ghost:hover { background: var(--surface-soft); color: var(--ink); }
.btn--small { min-height: 2.6rem; padding: .45rem 1rem; font-size: .92rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Hero */
.hero { padding-block: clamp(2.2rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem); overflow: hidden; }
.hero-grid { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.hero h1 { margin-bottom: .45em; }
.hero .lead { max-width: 34rem; margin-bottom: 1.8rem; }
.hero-note { margin-top: 1rem; color: var(--muted); font-size: .94rem; }
.hero-art {
  margin: 0; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); background: var(--hero-sky-bottom);
  aspect-ratio: 5 / 4;
}
.hero-art svg { display: block; width: 100%; height: 100%; }

/* Hero SVG paint (driven by tokens so dark mode becomes a night garden) */
.h-sky-top { stop-color: var(--hero-sky-top); }
.h-sky-bottom { stop-color: var(--hero-sky-bottom); }
.h-orb { fill: var(--hero-orb); opacity: var(--hero-orb-opacity); }
.h-rainbow { fill: none; stroke-width: 9; opacity: var(--hero-rainbow-opacity); }
.h-rb1 { stroke: #e99b95; } .h-rb2 { stroke: #f5dd96; } .h-rb3 { stroke: #9fc58c; } .h-rb4 { stroke: #8cbeda; } .h-rb5 { stroke: #ad8eca; }
.h-star { fill: #fff6dc; opacity: var(--hero-star-opacity); }
.h-hill-far { fill: var(--hero-hill-far); }
.h-hill-mid { fill: var(--hero-hill-mid); }
.h-shade { fill: var(--hero-hill-shade); }
.h-ground { fill: var(--hero-ground); }
.h-ground-shade { fill: var(--hero-ground-shade); }
.h-tree { fill: var(--hero-tree-green); }
.h-tree-deep { fill: var(--hero-tree-deep); }
.h-tree-autumn { fill: var(--hero-tree-autumn); }
.h-tree-autumn-2 { fill: var(--hero-tree-autumn-2); }
.h-trunk { fill: var(--hero-trunk); }
.h-stone { fill: var(--hero-stone); stroke: var(--hero-stone-edge); stroke-width: 1.2; }
.h-memorial { fill: var(--hero-memorial); }
.h-memorial-top { fill: var(--hero-memorial-top); }
.h-wax { fill: var(--hero-wax); }
.h-wick { stroke: #4b3a2c; stroke-width: 1.4; stroke-linecap: round; }
.h-brick { fill: var(--hero-brick); }
.h-pink { fill: var(--hero-flower-pink); }
.h-white { fill: var(--hero-flower-white); }
.h-yellow { fill: var(--hero-flower-yellow); }
.h-leaf { fill: var(--hero-tree-green); }
.h-dog { fill: var(--hero-dog); }
.h-dog-shade { fill: var(--hero-dog-shade); }
.h-shadow { fill: var(--hero-shadow); }
.h-lamp { fill: var(--hero-lamp); }
.h-glow { opacity: var(--hero-glow-opacity); }
.h-lamp-glow { opacity: var(--hero-lamp-glow-opacity); }
.h-glow-inner { stop-color: #ffd58a; }
.h-glow-outer { stop-color: #ffd58a; stop-opacity: 0; }
.h-flame-outer { fill: #f2a640; }
.h-flame-inner { fill: #ffe7a8; }
.h-flame { transform-box: fill-box; transform-origin: 50% 100%; }

@media (prefers-reduced-motion: no-preference) {
  .h-flame { animation: flicker 3.2s ease-in-out infinite; }
  .h-glow { animation: glow 3.2s ease-in-out infinite; }
  .h-glow { transform-box: fill-box; transform-origin: 50% 50%; }
}
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  25% { transform: scale(.96, 1.05) rotate(-1.5deg); }
  50% { transform: scale(1.03, .96) rotate(1deg); }
  75% { transform: scale(.98, 1.03) rotate(-.6deg); }
}
@keyframes glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Cards & grids */
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.6rem); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 40rem) { .grid--2, .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 62rem) { .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.3rem, 3vw, 1.9rem); box-shadow: var(--shadow-soft);
}
.card h3 { margin-bottom: .45em; }
.card p:last-child { margin-bottom: 0; }
.card-icon {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem;
  border-radius: .95rem; background: var(--surface-soft); color: var(--accent);
}
.card-icon svg { width: 1.6rem; height: 1.6rem; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { position: relative; }
.step-num {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; margin-bottom: .9rem;
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem;
}

/* Story teaser */
.teaser { display: grid; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .teaser { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.pull-quote {
  margin: 0; padding: clamp(1.5rem, 4vw, 2.4rem);
  border-radius: var(--radius-lg); background: var(--autumn-soft);
  font-family: var(--font-heading); font-size: clamp(1.3rem, 2.8vw, 1.75rem); line-height: 1.45;
}
.pull-quote p { margin: 0; }
.pull-quote footer { margin-top: 1rem; font-family: var(--font-body); font-size: .95rem; color: var(--muted); }

/* Promise */
.promise-list { list-style: none; margin: 0; padding: 0; }
.promise-list li { display: flex; gap: .9rem; align-items: flex-start; }
.promise-list svg { flex: none; width: 1.6rem; height: 1.6rem; margin-top: .2rem; color: var(--accent); }
.promise-list h3 { font-size: 1.1rem; margin-bottom: .25em; }
.promise-list p { margin: 0; color: var(--muted); }

/* CTA band */
.cta-band {
  text-align: center; padding: clamp(2rem, 6vw, 3.5rem);
  border-radius: var(--radius-lg); background: var(--surface-soft); border: 1px solid var(--line);
}
.cta-band p { max-width: 36rem; margin-inline: auto; }
.cta-band .btn-row { justify-content: center; margin-top: 1.4rem; }

/* Page header (inner pages) */
.page-hero { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-hero .lead { max-width: 38rem; }

/* Long-form story */
.prose { font-size: clamp(1.08rem, 1.9vw, 1.2rem); line-height: 1.85; }
:lang(zh) .prose, :lang(ja) .prose { line-height: 2.05; }
:lang(ko) .prose { line-height: 1.95; word-break: keep-all; }
.prose p { margin-bottom: 1.3em; }
.prose h2 { margin-top: 2em; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: .5em; }
.story-dropcap::first-letter {
  float: left; font-family: var(--font-heading); font-size: 3.4em; line-height: .9;
  padding: .08em .12em 0 0; color: var(--autumn);
}
:lang(zh) .story-dropcap::first-letter, :lang(ja) .story-dropcap::first-letter, :lang(ko) .story-dropcap::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; }
.story-turn { font-family: var(--font-heading); font-size: 1.25em; text-align: center; margin-block: 2.2em; }
.story-close { font-family: var(--font-heading); font-size: 1.12em; }
.signature { margin-top: 2.5rem; text-align: right; font-family: var(--font-heading); font-size: 1.15em; color: var(--muted); }
.divider { display: block; width: 4rem; height: 1px; margin: 2.5rem auto; background: var(--line); border: 0; }

/* Photo placeholders */
.photo-row { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-block: 2rem 2.6rem; }
@media (min-width: 34rem) { .photo-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.photo-placeholder {
  margin: 0; display: grid; place-items: center; aspect-ratio: 4 / 5;
  border: 2px dashed var(--placeholder-border); border-radius: var(--radius);
  background: var(--surface); color: var(--muted); text-align: center; padding: 1rem;
  font-size: .9rem;
}
.photo-placeholder svg { width: 2.4rem; height: 2.4rem; margin: 0 auto .5rem; color: var(--sage); display: block; }
.placeholder-tag, .todo-badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px;
  background: var(--autumn-soft); color: var(--autumn); font-size: .78rem; font-weight: 700; letter-spacing: .04em;
}

/* Draft banner */
.draft-banner {
  margin-bottom: 2rem; padding: 1rem 1.2rem; border-radius: var(--radius);
  border: 2px dashed var(--placeholder-border); background: var(--autumn-soft); color: var(--ink);
}
.draft-banner strong { color: var(--autumn); }

/* FAQ */
.faq-list { display: grid; gap: .8rem; }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 1.1rem 3rem 1.1rem 1.3rem; position: relative;
  font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; border-radius: var(--radius);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: 1.3rem; top: 50%; width: .55rem; height: .55rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); transition: transform .2s ease;
}
.faq-item[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq-answer { padding: 0 1.3rem 1.2rem; color: var(--ink); }
.faq-answer p:last-child { margin-bottom: 0; }
.status-pill {
  display: inline-block; margin-left: .4rem; padding: .05rem .55rem; border-radius: 999px;
  background: var(--surface-soft); color: var(--accent); font-family: var(--font-body);
  font-size: .76rem; font-weight: 700; vertical-align: middle;
}

/* Grief resources */
.resource-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.resource-list li { padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.resource-list .resource-name { font-weight: 650; }
.callout {
  padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--surface-soft);
  border-left: 4px solid var(--accent);
}
.callout p:last-child { margin-bottom: 0; }

/* Forms */
.form { display: grid; gap: 1.3rem; }
.field { display: grid; gap: .4rem; }
.field label, .field legend { font-weight: 650; }
.field .hint { color: var(--muted); font-size: .9rem; margin: 0; }
.field input, .field select, .field textarea {
  width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
.field textarea { min-height: 10rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .92rem; font-weight: 600; margin: 0; }
.field-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.optional { font-weight: 400; color: var(--muted); font-size: .9rem; }
.hp-field { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.turnstile-slot:empty { display: none; }
.form-status { padding: 1rem 1.2rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-soft); }
.form-status:empty { display: none; }
.form-status--error { border-color: var(--danger); }
.form-status--success { border-color: var(--success); }
.form-status p:last-child { margin-bottom: 0; }
.form-card { max-width: 42rem; }

/* Donation */
.donate-group h3 { display: flex; align-items: center; gap: .5rem; }
.donate-buttons { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }

/* Footer */
.site-footer { margin-top: auto; padding-block: 3rem 2rem; background: var(--bg-alt); border-top: 1px solid var(--line); font-size: .95rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 48rem) { .footer-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); } }
.footer-brand p { color: var(--muted); max-width: 26rem; }
.footer-title { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; margin: 0 0 .6rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-bottom { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.footer-bottom p { margin: 0; }

/* 404 */
.notfound { text-align: center; padding-block: clamp(4rem, 12vw, 8rem); }
.notfound .btn-row { justify-content: center; }
.notfound-mark { width: 5rem; height: 5rem; margin: 0 auto 1.5rem; }

/* Reveal-on-scroll (only when JS is on and motion is OK) */
@media (prefers-reduced-motion: no-preference) {
  .reveal-ready .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
  .reveal-ready .reveal.is-visible { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* Small Australian flag beside the founder's signature (an SVG, because Windows does not render flag emoji). */
.flag-au { display: inline-block; width: 1.5em; height: .75em; vertical-align: -.05em; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / 12%); }

/* Language menu (replaces the old 中文/EN toggle). */
.lang-select, .lang-select:hover { appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 1.6rem; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - .85rem) 52%, calc(100% - .55rem) 52%; background-size: .3rem .3rem; background-repeat: no-repeat; }
.lang-select:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 2px; }
