/* ============================================================================
   MonsterPin — "Umami Voyage 風味航海誌"
   An explorer's food journal. Paper, ink, stamps, hand-drawn routes.
   No gradients-as-crutch, no glass, no generic UI. One serif family, ink on paper.
   ============================================================================ */

/* ---- Fonts (loaded via <link> in <head>; CSP allows fonts.googleapis) ---- */

:root {
  /* Paper & ink */
  --paper:        #F6F0E4;
  --paper-deep:   #EDE3CF;
  --paper-card:   #FBF7EE;
  --ink:          #221E19;
  --ink-soft:     #5B5348;
  --ink-faint:    #8A8072;

  /* Stamp inks */
  --vermilion:    #C24A2C;
  --vermilion-dk: #9E3A20;
  --ocean:        #2F5D57;
  --ocean-dk:     #244A45;
  --amber:        #E0982F;

  --hairline:     rgba(34, 30, 25, .16);
  --hairline-2:   rgba(34, 30, 25, .28);

  /* Type */
  --serif: "Fraunces", "Noto Serif TC", "Noto Serif SC", Georgia, "Songti TC", serif;
  --hand:  "Caveat", "Noto Serif TC", cursive;

  --measure: 66ch;
  --page-max: 1180px;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-elastic: cubic-bezier(.5, 1.6, .4, 1);
}

/* zh gets slightly tighter display leading and no optical wonk */
:root[lang="zh-Hant"], :root[lang="zh-Hans"] {
  --serif: "Noto Serif TC", "Fraunces", Georgia, serif;
}
:root[lang="zh-Hans"] {
  --serif: "Noto Serif SC", "Noto Serif TC", "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  /* Paper grain: two layers of tiny turbulence, extremely subtle */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Rhythm & containers ---- */
.wrap { width: min(100% - 2.5rem, var(--page-max)); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }
section { padding-block: clamp(3.5rem, 9vw, 8rem); position: relative; }
.paper-deep { background-color: var(--paper-deep); }

/* ---- Type scale ---- */
h1, h2, h3 { font-weight: 500; line-height: 1.05; margin: 0 0 .5em; letter-spacing: -.01em; }
.display {
  font-size: clamp(2.9rem, 8vw, 6.8rem);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.025em;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 144;
}
.h-sec { font-size: clamp(2rem, 4.6vw, 3.5rem); font-weight: 550; letter-spacing: -.02em; }
.h-card { font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 550; }
p { margin: 0 0 1.1em; max-width: var(--measure); }
.lead { font-size: clamp(1.15rem, 2vw, 1.45rem); color: var(--ink-soft); line-height: 1.55; }
.ink-soft { color: var(--ink-soft); }
a { color: var(--vermilion-dk); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--vermilion); }

.hand { font-family: var(--hand); font-weight: 500; }
:root[lang="zh-Hant"] .hand, :root[lang="zh-Hans"] .hand { font-style: italic; font-family: var(--serif); }

/* ---- Stamp label (passport-style section marker) ---- */
.stamp {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--serif); font-weight: 600;
  font-size: .74rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--vermilion-dk);
  padding: .5rem 1rem .45rem;
  border: 1.5px solid var(--vermilion);
  border-radius: 2px;
  transform: rotate(-2.2deg);
  position: relative;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.stamp.ocean { color: var(--ocean-dk); border-color: var(--ocean); transform: rotate(1.8deg); }
.stamp::before { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; opacity: .35; border-radius: 1px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--serif); font-weight: 550; font-size: 1.02rem;
  padding: .82rem 1.5rem; border-radius: 2px;
  border: 1.5px solid var(--ink); cursor: pointer;
  text-decoration: none; transition: transform .18s var(--ease-out), background-color .2s, color .2s;
  line-height: 1;
}
.btn-primary { background: var(--vermilion); border-color: var(--vermilion-dk); color: #FBF7EE; }
.btn-primary:hover { background: var(--vermilion-dk); color: #FBF7EE; transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.btn-ocean { background: var(--ocean); border-color: var(--ocean-dk); color: #F6F0E4; }
.btn-ocean:hover { background: var(--ocean-dk); color: #F6F0E4; transform: translateY(-2px); }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(6px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 8px; box-shadow: 0 1px 0 var(--hairline-2); }
.brand b { font-weight: 600; font-size: 1.22rem; letter-spacing: -.02em; }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1.02rem; position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 1.5px; background: var(--vermilion); transition: right .25s var(--ease-out); }
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }
.header-tools { display: flex; align-items: center; gap: .9rem; }

/* Language switcher — ticket-stub toggle */
.lang-switch { display: inline-flex; border: 1.5px solid var(--hairline-2); border-radius: 3px; overflow: hidden; }
.lang-switch button {
  font-family: var(--serif); font-weight: 550; font-size: .82rem;
  padding: .34rem .6rem; background: transparent; border: 0; cursor: pointer; color: var(--ink-soft);
  border-right: 1px solid var(--hairline);
}
.lang-switch button:last-child { border-right: 0; }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.nav-toggle { display: none; background: none; border: 1.5px solid var(--hairline-2); border-radius: 3px; width: 42px; height: 38px; cursor: pointer; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { content: ""; display: block; width: 20px; height: 1.6px; background: var(--ink); margin: 0 auto; position: relative; }
.nav-toggle span::before { position: absolute; top: -6px; } .nav-toggle span::after { position: absolute; top: 6px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--hairline);
    padding: .5rem 1.25rem 1.25rem; transform: translateY(-120%); transition: transform .3s var(--ease-out);
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav a { padding: .85rem 0; width: 100%; border-bottom: 1px solid var(--hairline); }
}

/* ---- Hero ---- */
.hero { padding-block: clamp(3rem, 8vw, 6.5rem) clamp(3.5rem, 9vw, 7rem); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-eyebrow { margin-bottom: 1.4rem; }
.hero .display { margin-bottom: .35em; }
.hero .lead { max-width: 34ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.9rem; }
.hero-note { margin-top: 1.4rem; font-family: var(--hand); font-size: 1.35rem; color: var(--ocean-dk); transform: rotate(-1.5deg); }
.hero-art { position: relative; justify-self: center; max-width: 420px; }
.hero-art img.mascot { width: 100%; filter: drop-shadow(0 12px 22px rgba(34,30,25,.18)); }
.hero-art .compass { position: absolute; width: 42%; right: -6%; top: -8%; opacity: .92; animation: spin 90s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-art .compass { animation: none; } }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; text-align: left; } .hero-art { order: -1; max-width: 300px; } }

/* ---- Route line (SVG scrub-draw down the page) ---- */
.route-svg { position: absolute; left: 50%; top: 0; transform: translateX(-50%); height: 100%; width: 120px; pointer-events: none; z-index: 0; overflow: visible; }
.route-svg path { fill: none; stroke: var(--vermilion); stroke-width: 2.2; stroke-dasharray: 3 9; stroke-linecap: round; opacity: .55; }
@media (max-width: 860px) { .route-svg { display: none; } }

/* ---- Feature sections ---- */
.feature { position: relative; z-index: 1; }
.feature + .feature { border-top: 1px dashed var(--hairline); }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.feature:nth-child(even) .feature-media { order: 2; }
.feature-copy h2 { margin-top: .7rem; }
.feature-copy .marginalia { font-family: var(--hand); font-size: 1.4rem; color: var(--ocean-dk); transform: rotate(-1.4deg); display: inline-block; margin-top: .4rem; }
:root[lang="zh-Hant"] .marginalia, :root[lang="zh-Hans"] .marginalia { font-style: italic; }

/* Polaroid / journal frame for screenshots */
.polaroid {
  background: var(--paper-card); padding: .8rem .8rem 2.6rem; border: 1px solid var(--hairline);
  box-shadow: 0 10px 26px rgba(34,30,25,.14), 0 1px 0 rgba(255,255,255,.6) inset;
  transform: rotate(-2.4deg); max-width: 380px; margin-inline: auto; position: relative;
}
.feature:nth-child(even) .polaroid { transform: rotate(2deg); }
.polaroid img { width: 100%; display: block; border: 1px solid var(--hairline); }
.polaroid figcaption { position: absolute; left: 0; right: 0; bottom: .5rem; text-align: center; font-family: var(--hand); font-size: 1.28rem; color: var(--ink-soft); }
.polaroid::after { content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(3deg); width: 92px; height: 26px; background: color-mix(in srgb, var(--amber) 45%, transparent); border: 1px solid rgba(224,152,47,.5); }

@media (max-width: 760px) {
  .feature-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .feature:nth-child(even) .feature-media { order: 0; }
}

/* ---- Steps / how-it-works ---- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; margin-top: 2.5rem; }
.step { background: var(--paper-card); border: 1px solid var(--hairline); padding: 1.6rem; border-radius: 2px; position: relative; }
.step .num { font-family: var(--hand); font-size: 3rem; color: var(--vermilion); line-height: 1; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* ---- Pricing table ---- */
.ptable-wrap { overflow-x: auto; margin-top: 2.5rem; border: 1px solid var(--hairline); background: var(--paper-card); }
.ptable { width: 100%; border-collapse: collapse; min-width: 640px; }
.ptable th, .ptable td { padding: 1rem 1.15rem; text-align: left; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.ptable thead th { font-weight: 600; font-size: 1.05rem; border-bottom: 2px solid var(--hairline-2); }
.ptable thead th.pt-premium { color: var(--vermilion-dk); }
.ptable tbody th { font-weight: 500; color: var(--ink-soft); font-size: .98rem; }
.ptable .yes { color: var(--ocean-dk); font-weight: 600; }
.ptable .no  { color: var(--ink-faint); }
.pt-premium { background: color-mix(in srgb, var(--amber) 10%, transparent); }
.price-cards { display: none; }
@media (max-width: 700px) {
  .ptable-wrap { display: none; }
  .price-cards { display: grid; gap: 1.4rem; margin-top: 2rem; }
  .price-card { background: var(--paper-card); border: 1px solid var(--hairline); padding: 1.5rem; }
  .price-card.premium { border: 2px solid var(--vermilion); }
  .price-card ul { list-style: none; padding: 0; margin: 1rem 0 0; }
  .price-card li { padding: .5rem 0; border-bottom: 1px dashed var(--hairline); }
}

/* ---- Signature block (philosophy) ---- */
.sign-block { margin-top: 3rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.sign-svg path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hanko {
  width: 78px; height: 78px; display: grid; place-items: center;
  border: 3px solid var(--vermilion); color: var(--vermilion); border-radius: 4px;
  font-weight: 700; font-size: 1.5rem; transform: rotate(-4deg); background: color-mix(in srgb, var(--vermilion) 6%, transparent);
  font-family: var(--serif);
}

/* ---- Footer ---- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: 3.5rem 2.5rem; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer a { color: var(--paper); opacity: .82; text-decoration: none; display: inline-block; padding: .28rem 0; }
.site-footer a:hover { opacity: 1; color: var(--amber); }
.site-footer h4 { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; opacity: .6; font-weight: 600; margin: 0 0 .6rem; }
.footer-brand b { font-size: 1.3rem; }
.footer-brand p { opacity: .7; max-width: 32ch; margin-top: .6rem; }
.footer-bottom { border-top: 1px solid rgba(246,240,228,.16); margin-top: 2.5rem; padding-top: 1.4rem; font-size: .86rem; opacity: .6; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.ig-btn { display: inline-flex; align-items: center; gap: .5rem; border: 1.5px solid rgba(246,240,228,.4); padding: .5rem .9rem; border-radius: 2px; }
@media (max-width: 700px) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* ---- Wave / coastline divider ---- */
.coastline { display: block; width: 100%; height: 42px; }
.coastline path { fill: var(--paper-deep); }

/* ---- Consent banner (bespoke, journal-note styled) ---- */
.consent { position: fixed; z-index: 90; left: 1.25rem; bottom: 1.25rem; max-width: 400px;
  background: var(--paper-card); border: 1.5px solid var(--ink); box-shadow: 6px 8px 0 rgba(34,30,25,.18);
  padding: 1.4rem 1.4rem 1.2rem; transform: rotate(-.6deg); }
.consent[hidden] { display: none; }
.consent h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.consent p { font-size: .95rem; margin-bottom: .9rem; color: var(--ink-soft); }
.consent-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.consent .btn { padding: .6rem 1.05rem; font-size: .92rem; }
.consent .link-btn { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-family: var(--serif); font-size: .92rem; }
@media (max-width: 480px) { .consent { left: .75rem; right: .75rem; bottom: .75rem; max-width: none; } }

/* Preferences modal */
.consent-modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(34,30,25,.5); padding: 1.25rem; }
.consent-modal[hidden] { display: none; }
.consent-modal .panel { background: var(--paper-card); border: 1.5px solid var(--ink); max-width: 500px; width: 100%; padding: 2rem; box-shadow: 8px 10px 0 rgba(34,30,25,.25); max-height: 88vh; overflow-y: auto; }
.consent-cat { border: 1px solid var(--hairline); padding: 1rem 1.15rem; margin-bottom: 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.consent-cat h4 { margin: 0 0 .3rem; font-size: 1.05rem; font-weight: 550; }
.consent-cat p { font-size: .88rem; margin: 0; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--hairline-2); border-radius: 20px; transition: background .2s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: var(--paper); border-radius: 50%; transition: transform .2s; }
.switch input:checked + .track { background: var(--ocean); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .55; cursor: not-allowed; }

/* ---- reveal animation (JS adds .js-anim to <html>, then .in per element) ----
   Progressive enhancement: without JS (or if a renderer chokes on the opacity
   transition) content stays fully visible; hiding only happens once JS opts in. */
.reveal { opacity: 1; transform: none; }
html.js-anim .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
html.js-anim .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js-anim .reveal { opacity: 1; transform: none; transition: none; } }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--vermilion); outline-offset: 3px; }

/* ---- pricing page ---- */
.story-page { padding-bottom: clamp(2rem, 5vw, 4rem); }
.story-mascot { display: block; width: min(62vw, 320px); height: auto; margin: 2rem auto 0; filter: drop-shadow(0 12px 22px rgba(34,30,25,.16)); }
.story-copy .stamp { margin-bottom: 1.1rem; }
.story-copy .h-card { margin-bottom: .8rem; }
.story-copy .marginalia { font-family: var(--hand); font-size: 1.38rem; color: var(--ocean-dk); display: inline-block; transform: rotate(-1.2deg); margin-top: .35rem; }
.price-footnote { margin-top: 1.4rem; color: var(--ink-soft); font-size: .95rem; }
.contact-grid { display: grid; grid-template-columns: 1fr .75fr; gap: clamp(2rem, 7vw, 5rem); align-items: center; }
.contact-list { margin-top: 2rem; }
.contact-list p { padding: 1rem 0; border-top: 1px dashed var(--hairline); }
.contact-list .ig-btn { color: var(--ink); border-color: var(--hairline-2); }
.contact-art { position: relative; justify-self: center; }
.contact-art img:first-child { width: min(68vw, 360px); height: auto; filter: drop-shadow(0 12px 22px rgba(34,30,25,.16)); }
.contact-pin { position: absolute; width: 34%; height: auto; right: -6%; bottom: 8%; transform: rotate(9deg); }
.legal-page { padding-block: clamp(3rem, 7vw, 5rem); border-bottom: 1px dashed var(--hairline); }
.page-content { width: min(100%, 820px); margin-inline: auto; background: var(--paper-card); border: 1px solid var(--hairline); padding: clamp(1.5rem, 4vw, 3rem); }
.legal-page h2 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 550; }
.legal-page h3 { font-size: 1.2rem; margin: 2rem 0 .6rem; font-weight: 550; }
.legal-page ul { padding-left: 1.4rem; color: var(--ink-soft); }
.legal-page li { margin-bottom: .45rem; }
.last-updated { color: var(--ink-faint); font-size: .95rem; }
.back-to-home { display: inline-flex; margin-top: 1.5rem; }
@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-art { order: -1; }
}

/* ---- spotlight: Foodie Walk Challenge (flagship feature, elevated weight) ---- */
.spotlight {
  background: color-mix(in srgb, var(--ocean) 8%, var(--paper));
  border-top: 1px dashed var(--hairline);
  border-bottom: 1px dashed var(--hairline);
  padding-block: clamp(4rem, 10vw, 7rem);
}
.spotlight-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.spotlight-title { font-size: clamp(2.2rem, 5.4vw, 4rem); margin-top: 1rem; }
.spotlight-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.3rem; margin: 2.2rem 0 1.6rem; }
.spotlight-step { background: var(--paper-card); border: 1px solid var(--hairline); padding: 1.3rem 1.2rem; position: relative; }
.spotlight-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--ocean); color: var(--paper);
  font-family: var(--serif); font-weight: 600; font-size: .95rem; margin-bottom: .6rem;
}
.spotlight-step h3 { margin: 0 0 .35rem; }
.spotlight-step p { font-size: .95rem; color: var(--ink-soft); margin: 0; }
.spotlight-media { max-width: 340px; margin-inline: auto; }
@media (max-width: 860px) {
  .spotlight-grid { grid-template-columns: 1fr; }
  .spotlight-steps { grid-template-columns: 1fr; }
  .spotlight-media { order: -1; max-width: 260px; }
}
