/* =========================================================
   鴻翔交通 — Design System (v3: green edition)
   Forest · sage · paper · editorial rhythm
   ========================================================= */

:root {
  /* Paper / ink palette — cooler paper to pair with green */
  --paper: #f2efe6;
  --paper-warm: #e8e6d8;
  --paper-cool: #f6f4ec;
  --ink: #161a16;
  --ink-soft: #2e332e;
  --ink-mute: #6b7268;
  --rule: #1a1f1a;
  --hairline: rgba(22, 26, 22, 0.12);

  /* Brand — green system (replaces red) */
  --red: #1f6b3a;          /* forest green — primary */
  --red-deep: #12431f;     /* deep forest — hover / depth */
  --gold: #8a9a5b;         /* sage / olive — accent */
  --line-green: #06c755;   /* LINE brand (unchanged) */

  /* Typography — Apple-style: SF Pro + PingFang */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "PingFang TC", "PingFang SC", "Helvetica Neue", "Noto Sans TC",
               "Microsoft JhengHei", sans-serif;
  --font-serif: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                "PingFang TC", "PingFang SC", "Helvetica Neue", "Noto Sans TC", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                  "PingFang TC", "PingFang SC", "Helvetica Neue", "Noto Sans TC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Scales */
  --shell: min(1320px, 92vw);
  --gutter: clamp(20px, 4vw, 48px);

  /* Unified section padding tokens */
  --sp-xs: clamp(32px, 5vw, 48px);
  --sp-sm: clamp(48px, 6vw, 72px);
  --sp-md: clamp(64px, 8vw, 100px);
  --sp-lg: clamp(80px, 10vw, 140px);

  /* Eyebrow spec */
  --eyebrow-size: 11px;
  --eyebrow-ls: 0.24em;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  letter-spacing: -0.01em;
  font-feature-settings: "palt" 1, "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- typography ---------- */
.mono { font-family: var(--font-mono); letter-spacing: 0; font-feature-settings: "tnum" 1; }

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  text-wrap: pretty;
}

h1, h2 { text-wrap: balance; letter-spacing: -0.028em; }

.serif { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.022em; }
.display { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.028em; font-style: normal; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

/* Responsive br control — disable handmade <br> on mobile */
@media (max-width: 768px) {
  .allow-mobile-br br { display: inline; }
  h1 br, h2 br { display: none; }
  h1 .allow-br, h2 .allow-br { display: inline; }
}

/* ---------- layout primitives ---------- */
.shell { width: var(--shell); margin-inline: auto; }

.rule { border-top: 1px solid var(--rule); }
.rule-hair { border-top: 1px solid var(--hairline); }

/* ---------- nav ---------- */
@media (max-width: 768px) { .nav-tagline { display: none !important; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--ink);
  transition: all 0.3s cubic-bezier(.2,.7,.2,1);
  background: transparent;
  color: var(--ink);
  min-height: 48px;
}
.btn:hover { background: var(--ink); color: var(--paper); }

.btn-red {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-red:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }

.btn-ink {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-ink:hover { background: var(--paper); color: var(--ink); }

.btn-arrow::after {
  content: "→";
  margin-left: 4px;
  transition: transform 0.3s;
}
.btn-arrow:hover::after { transform: translateX(4px); }

/* Mobile: CTA button groups go full-width */
@media (max-width: 768px) {
  .cta-stack { display: flex !important; flex-direction: column !important; gap: 10px !important; }
  .cta-stack .btn { width: 100%; padding: 16px 20px; font-size: 14px; }
}

/* ---------- tags / chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  border: 1px solid var(--hairline);
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.4);
}
.chip-red { border-color: var(--red); color: var(--red); }

/* ---------- number stamp ---------- */
.stamp {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 0.9;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* ---------- red seal ---------- */
.seal {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-family: var(--font-serif);
  font-weight: 700;
  color: #fff;
  background: var(--red);
  letter-spacing: 0.12em;
  transform: rotate(-4deg);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3);
  line-height: 1;
  text-align: center;
}
.seal-est { font-size: 0.22em; letter-spacing: 0.25em; opacity: 0.9; margin-bottom: 0.15em; }
.seal-year { font-size: 0.44em; letter-spacing: 0.02em; font-weight: 800; }

/* ---------- entry animations ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(.2,.7,.2,1), transform 0.9s cubic-bezier(.2,.7,.2,1);
}
[data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal].in { transition: none; opacity: 1; transform: none; }
}

/* ---------- placeholder ---------- */
.ph {
  background:
    repeating-linear-gradient(45deg, rgba(24,24,24,0.04) 0 8px, transparent 8px 16px),
    var(--paper-warm);
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
}

/* ---------- section spacing ---------- */
.section       { padding-block: var(--sp-lg); }
.section-tight { padding-block: var(--sp-md); }

/* ---------- responsive display headings ---------- */
.h-display {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-size: clamp(32px, 6.4vw, 88px);
}
@media (max-width: 768px) { .h-display { font-size: clamp(30px, 8vw, 44px); line-height: 1.1; } }

.h-section {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-size: clamp(28px, 4.5vw, 52px);
}
@media (max-width: 768px) { .h-section { font-size: clamp(24px, 6.2vw, 32px); } }

.h-tool {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-size: clamp(24px, 3vw, 36px);
}
@media (max-width: 768px) { .h-tool { font-size: clamp(22px, 5.5vw, 28px); } }

/* ---------- number list (editorial) ---------- */
.numlist { display: grid; gap: 0; }
.numlist-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid var(--hairline);
  align-items: start;
}
.numlist-row:last-child { border-bottom: 1px solid var(--hairline); }
.numlist-num {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 44px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.numlist-title { font-family: var(--font-serif); font-size: 22px; font-weight: 500; margin-bottom: 8px; }
.numlist-desc { font-size: 15px; color: var(--ink-soft); max-width: 48ch; line-height: 1.75; }

@media (max-width: 768px) {
  .numlist-row { grid-template-columns: 48px 1fr; gap: 14px; padding: 20px 0; }
  .numlist-row > .mono { display: none; }
  .numlist-num { font-size: 28px; }
  .numlist-title { font-size: 17px; line-height: 1.4; }
  .numlist-desc { font-size: 14px; }
}

/* ---------- line float ---------- */
.line-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 14px 18px;
  background: var(--line-green);
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-decoration: none;
  box-shadow: 0 12px 32px rgba(6,199,85,0.35);
  transition: transform 0.3s;
}
.line-float:hover { transform: translateY(-2px); }
.line-float svg { width: 20px; height: 20px; }

@media (max-width: 768px) {
  .line-float { right: 12px; bottom: 12px; padding: 10px 14px 10px 12px; font-size: 12px; }
  .line-float svg { width: 16px; height: 16px; }
}

/* ---------- chapter masthead (top of each page) ---------- */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}
.masthead > span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; }
.masthead > span:last-child { color: var(--ink-mute); letter-spacing: 0.2em; }
@media (max-width: 480px) {
  .masthead > span:last-child { font-size: 9px; letter-spacing: 0.15em; }
}

/* ---------- hero shared layout ---------- */
.page-hero { padding-top: clamp(100px, 14vw, 140px); padding-bottom: clamp(40px, 6vw, 60px); }

/* ---------- tool panels common ---------- */
.tool-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr !important; gap: 28px; } }

/* ---------- iframe / embedded ---------- */
iframe { max-width: 100%; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
