/* ==========================================================================
   base.css — design tokens + reset + typography (shared across all pages)
   v3 · Kinfolk × Monocle warm editorial · Polish Phase P1
   ========================================================================== */

/* ---------- @font-face (self-hosted) -------------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/fraunces-900.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-weight: 300;
  font-style: italic;
  font-display: swap;
  src: url('../assets/fonts/fraunces-300italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/jetbrainsmono-variable.woff2') format('woff2-variations'),
       url('../assets/fonts/jetbrainsmono-variable.woff2') format('woff2');
}
/* Huninn 金萱(justfont · SIL OFL 1.1)· 繁中正文字型 · 已 subset 到站上實用字元(~1,900 字 · 369 KB) */
@font-face {
  font-family: 'Huninn';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../assets/fonts/huninn-subset.woff2') format('woff2');
  unicode-range: U+3000-303F, U+4E00-9FFF, U+3400-4DBF, U+FF00-FFEF, U+2000-206F;
}

/* ---------- design tokens ------------------------------------------------- */
:root {
  /* palette · locked */
  --ink: #0f1a14;
  --paper: #f4ede1;
  --accent: #d97e2b;
  --moss: #3e5c44;
  --warn: #c13a3a;

  /* paper layers */
  --surface: #faf6ec;
  --paper-3: #fcf9f0;

  /* rule system */
  --rule: rgba(15, 26, 20, 0.12);
  --hairline: rgba(15, 26, 20, 0.08);

  /* type stacks
     · Latin 走 Fraunces 900 / JetBrains Mono
     · 繁中走 Huninn(金萱 · justfont · SIL OFL)· unicode-range 讓 CJK 區段自動切過去
     · 系統字型作 fallback */
  --font-display: 'Fraunces', 'Huninn', 'Noto Serif TC', 'Songti TC', 'Source Han Serif TC', Georgia, serif;
  --font-body: 'Huninn', 'Noto Serif TC', 'PingFang TC', 'Source Han Serif TC', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-sans: 'Huninn', system-ui, -apple-system, 'PingFang TC', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, 'Huninn', monospace;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-editorial: cubic-bezier(0.19, 1, 0.22, 1);
  --dur-fast: 180ms;
  --dur-mid: 420ms;
  --dur-slow: 820ms;

  /* breakpoints */
  --bp-sm: 640px;
  --bp-md: 900px;
  --bp-lg: 1280px;

  /* spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --sp-10: 9rem;
}

/* ---------- reset --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, h1, h2, h3, h4, h5, h6, p, blockquote, figure, ul, ol, dl, dd, pre {
  margin: 0;
}

ul, ol { padding: 0; list-style: none; }

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- base body ----------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  letter-spacing: 0.01em;
}

/* 中文段落呼吸感 */
:lang(zh), :lang(zh-Hant), html[lang^="zh"] body {
  letter-spacing: 0.02em;
}

/* ---------- typography ---------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 7vw, 5rem); }
h2 { font-size: clamp(1.75rem, 4.5vw, 3rem); line-height: 1.08; }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); line-height: 1.15; letter-spacing: -0.015em; }

h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.14em; }

p {
  font-size: 1rem;
  line-height: 1.75;
  text-wrap: pretty;
}

/* ---------- display-xl · 開篇大字 ---------------------------------------- */
.display-xl {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.5rem, 14vw, 12rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.display-xl .ital,
.display-xl em {
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.02em;
}

/* ---------- eyebrow / kicker ---------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.62;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--moss);
}

/* ---------- section number (large italic) -------------------------------- */
.section-no {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(2.75rem, 6vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0.22;
  display: inline-block;
}

/* ---------- pullquote ----------------------------------------------------- */
.pullquote {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.375rem, 3vw, 2.125rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-left: clamp(1rem, 2vw, 1.5rem);
  border-left: 2px solid var(--accent);
  max-width: 34ch;
  margin: clamp(1.5rem, 3vw, 2.25rem) 0;
}
.pullquote cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--moss);
}

/* ---------- numerals / data chips ---------------------------------------- */
.tnum, var {
  font-family: var(--font-mono);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* highlight a single fact in body flow */
.fact {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(transparent 65%, rgba(217, 126, 43, 0.22) 65%);
  padding: 0 0.15em;
  white-space: nowrap;
}

.footnote {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.6;
}

.latin { font-family: var(--font-display); }
.zht {
  font-family: var(--font-display);
  font-feature-settings: 'palt' 1;
}

em {
  font-style: italic;
  font-weight: 300;
  font-family: var(--font-display);
}

/* ---------- utilities ----------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* rule · hairline system */
hr, .rule {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: var(--sp-6) 0;
}
.hairline {
  border: 0;
  height: 1px;
  background: var(--hairline);
  margin: 0;
}
.divider-numbered {
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}
.divider-numbered::before {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
  transform: translateY(-0.25em);
}

/* ---------- editorial link underline ------------------------------------- */
.link-draw {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size var(--dur-mid) var(--ease-editorial);
  padding-bottom: 1px;
}
.link-draw:hover,
.link-draw:focus-visible {
  background-size: 100% 2px;
}
a.link-reverse {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--dur-mid) var(--ease-editorial);
  padding-bottom: 1px;
}
a.link-reverse:hover,
a.link-reverse:focus-visible {
  background-size: 100% 1px;
}

/* ---------- images -------------------------------------------------------- */
picture, .img-wrap {
  display: block;
  overflow: hidden;
  background: var(--surface);
}
picture img, .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-editorial);
}
a:hover > picture img,
a:hover > .img-wrap img,
.img-hover:hover img {
  transform: scale(1.03);
}

/* ---------- fonts-loaded reveal ------------------------------------------- */
html:not(.fonts-loaded) .hero-title,
html:not(.fonts-loaded) .display-xl,
html:not(.fonts-loaded) h1,
html:not(.fonts-loaded) h2 {
  opacity: 0;
}
html.fonts-loaded .hero-title,
html.fonts-loaded .display-xl,
html.fonts-loaded h1,
html.fonts-loaded h2 {
  opacity: 1;
  transition: opacity var(--dur-mid) var(--ease-out);
}

/* ---------- reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  picture img, .img-wrap img {
    transform: none !important;
  }
}

/* ---------- print -------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .eyebrow, .kicker, .section-no { opacity: 1; color: #444; }
}

/* ===== 320px 超小螢幕 (iPhone SE 1st gen) ===== */
@media (max-width: 320px) {
  :root { --text-base: 15px; }
  h1 { font-size: clamp(32px, 9vw, 48px); }
  .eyebrow { font-size: 11px; }
  .main-menu { gap: 8px; }
}

/* ===== 1440px+ 超大桌面 ===== */
@media (min-width: 1440px) {
  main, .site-header { max-width: 1280px; margin-inline: auto; }
  .hero-title { font-size: clamp(64px, 10vw, 220px); }
}

/* ===== 手機橫放 ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .hero { min-height: auto; padding-block: 2rem; }
  .day-hero, .place-hero { height: min-content; }
  .countdown-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
}

/* ===== 純觸控裝置 (no hover) ===== */
@media (hover: none) {
  .menu-card:hover, .meal-card:hover, .restaurant-card:hover { transform: none; }
  a:hover { text-decoration-thickness: auto; }
}

/* ===== 列印友善 ===== */
@media print {
  :root { --ink: #000; --paper: #fff; --accent: #333; }
  body { font-size: 11pt; line-height: 1.5; color: #000; background: #fff; }
  .site-header, nav, footer, .affiliate-cta, #map, .visited-check { display: none !important; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  img, picture { max-width: 50%; page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
  .day-timeline li { page-break-inside: avoid; }
}
