/* ══════════════════════════════════════════════════════════════
   雷蒙三十 Brand Design System — Shared Variables
   Source of truth: Claude Design handoff bundle (2026-04-24).
   ui-gallery legacy token names preserved as aliases below — keeps
   index.html / gallery.html rendering identically without edits.
   ══════════════════════════════════════════════════════════════ */

/* Display face — 字魂扁桃體 (commercial license, 雷蒙三十 owns).
   Local-first for offline / Claude Design sandbox / faster repo clones,
   R2 CDN fallback for cache hits across multiple sites. */
@font-face {
  font-family: 'zihunbiantaoti';
  src: url('/assets/fonts/ZiHunBianTaoTi.woff2') format('woff2'),
       url('https://image.lifehacker.tw/brand/ZiHunBianTaoTi.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ═══════════════════════════════════════════════
     CANONICAL — Claude Design tokens
     ═══════════════════════════════════════════════ */

  /* ── Color : brand ── */
  --teal:            #21A4B1;  /* Brand primary · structure / emphasis */
  --teal-dark:       #007481;  /* Hover · primary-on-dark */
  --teal-soft:       #D6EEF1;  /* Pill bg, quote bg */
  --teal-softer:     #EBF7F8;  /* Section strips */

  --orange:          #E77E47;  /* CTA · action */
  --orange-dark:     #C8632F;  /* CTA hover */
  --orange-soft:     #FCE6D5;  /* Orange pill bg */

  --yellow:          #F6B85A;  /* Highlight · sun accent */
  --yellow-soft:     #FDECCB;

  /* ── Color : surface ── */
  --cover-bg:        #111111;  /* Cover / dark slide */
  --dark-bg:         #3A3A3A;  /* Dark content surface */
  --light-bg:        #F5F5F5;  /* Card container / strip bg */
  --paper:           #FDFDFD;  /* Main page bg */
  --white:           #FFFFFF;

  /* ── Color : ink ── */
  --ink:             #3A3A3A;  /* Body text on light */
  --ink-strong:      #111111;  /* Headline on light */
  --ink-muted:       #8A8A8A;  /* Meta, captions */
  --ink-on-dark:     #F5F5F5;  /* Body on dark bg */
  --ink-on-dark-mut: #A8A8A8;

  /* ── Color : semantic ── */
  --success:         #2F9E7E;
  --warning:         #E7A13F;
  --danger:          #D05555;
  --info:            var(--teal);

  /* ── Rules & overlays ── */
  --rule:            rgba(0,0,0,0.10);
  --rule-soft:       rgba(0,0,0,0.06);
  --grid-ink:        rgba(0,0,0,0.03);
  --grid-bg:         var(--paper);
  --grid-pattern:
    linear-gradient(var(--grid-ink) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-ink) 1px, transparent 1px);
  --grid-size: 12px 12px;

  /* ── Type : families ──
     英文前、中文後 — 中文字元會自然 fallback 到 Noto Sans TC，Latin
     由 Inter 承接。--font-en 保留為別名，給 handoff 程式碼呼叫。*/
  --font-display:  'zihunbiantaoti', 'Noto Sans TC', sans-serif;
  --font-sans:     'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en:       var(--font-sans);
  --font-mono:     'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* ── Type : slide scale (em-based) ── */
  --ms-fs-cover:     3.75em;   /* 60 @ 960 */
  --ms-fs-heading:   2.75em;   /* 44 */
  --ms-fs-subtitle:  2.125em;  /* 34 */
  --ms-fs-body:      1.75em;   /* 28 */
  --ms-fs-aux:       1.5em;    /* 24 */
  --ms-fs-meta:      1.25em;   /* 20 */

  /* ── Tracking & leading ── */
  --track-display:   0.02em;
  --lh-tight:        1.25;
  --lh-cozy:         1.5;
  --lh-body:         1.7;
  --lh-loose:        1.8;

  /* ── Spacing (8px rhythm) ── */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  80px;
  --space-10: 120px;

  /* ── Radii (em-based, for slide / card elements) ── */
  --r-sm:   0.25em;
  --r-md:   0.5em;   /* quote, code block */
  --r-lg:   0.75em;  /* slide container, cards */
  --r-xl:   1em;
  --r-pill: 999px;

  /* ── Shadow (subtle) ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 0.06em 0.19em rgba(0,0,0,0.08);

  /* ── Borders ── */
  --border-rule:   1px solid var(--rule);
  --border-soft:   1px solid var(--rule-soft);
  --accent-bar:    0.19em;  /* left bar on quotes */

  /* ── Motion ── */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:    cubic-bezier(0.55, 0, 1, 0.45);
  --ease-std:   cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:   140ms;
  --dur-med:    220ms;
  --dur-slow:   420ms;

  /* ═══════════════════════════════════════════════
     SEMANTIC — role-based aliases for AI / Claude Design
     Map brand-named tokens to functional roles. AI agents
     should prefer these (--brand / --action / --surface…)
     when generating new components — role intent is clearer
     than colour names and survives palette changes.
     ═══════════════════════════════════════════════ */

  /* Brand roles */
  --brand:           var(--teal);          /* structural · headline · framing */
  --brand-dark:      var(--teal-dark);     /* hover on light bg */
  --brand-soft:      var(--teal-soft);     /* pill · quote bg */
  --brand-softer:    var(--teal-softer);   /* section strip */
  --action:          var(--orange);        /* CTA · primary action */
  --action-dark:     var(--orange-dark);   /* CTA hover */
  --action-soft:     var(--orange-soft);   /* action pill bg */
  --highlight:       var(--yellow);        /* sun · positive · sparkle */
  --highlight-soft:  var(--yellow-soft);

  /* Surface roles */
  --surface:         var(--paper);         /* main page bg (#FDFDFD) */
  --surface-card:    var(--white);         /* elevated card */
  --surface-muted:   var(--light-bg);      /* sub-surface · code bg */
  --surface-dark:    var(--cover-bg);      /* dark hero / slide */

  /* Text roles */
  --text:            var(--ink);           /* body */
  --text-strong:     var(--ink-strong);    /* headline */
  --text-muted:      var(--ink-muted);     /* meta · caption */
  --text-on-dark:    var(--ink-on-dark);   /* body on dark */

  /* Divider roles */
  --divider:         var(--rule);
  --divider-soft:    var(--rule-soft);

  /* ═══════════════════════════════════════════════
     ALIASES — ui-gallery legacy names (v5.0 compat)
     index.html / gallery.html rely on these — don't remove.
     Note: --accent here = orange (legacy CTA meaning).
     For canonical CTA role use --action instead.
     ═══════════════════════════════════════════════ */

  /* Colors */
  --primary:        var(--teal);
  --primary-dark:   var(--teal-dark);
  --primary-light:  #2ec4d4;                 /* ui-gallery tone variant */
  --primary-glow:   rgba(33, 164, 177, 0.3);
  --accent:         var(--orange);
  --accent-dark:    var(--orange-dark);
  --accent-light:   var(--yellow);           /* F6B85A — same value */
  --accent-glow:    rgba(231, 126, 71, 0.3);
  --superindividual:       var(--accent);
  --superindividual-light: var(--accent-light);
  --superindividual-dark:  var(--accent-dark);

  /* Surface & text */
  --bg-cream:      #F7F5F0;                  /* Raymond CIS body — deliberately NOT aliased to --paper */
  --bg-neutral:    var(--light-bg);
  --bg-white:      var(--white);
  --bg-dark:       var(--cover-bg);
  --text-dark:     var(--ink);
  --text-medium:   #555555;                  /* mid-grey — between ink and ink-muted */
  --text-light:    var(--ink-muted);
  --border:        var(--rule);

  /* Radii & shadows — px-based for web UI (different scale from --r-* em) */
  --radius-sm:   8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  --shadow-soft:     0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-medium:   0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
  --shadow-card:     0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-strong:   0 16px 48px rgba(0,0,0,0.16), 0 8px 16px rgba(0,0,0,0.1);
  --shadow-elevated: 0 20px 60px rgba(0,0,0,0.15), 0 8px 20px rgba(0,0,0,0.1);

  /* Transition */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-cream);
  color: var(--text-dark);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(33, 164, 177, 0.2);
  color: var(--text-dark);
}

/* ── Headings use display face (applies globally; index.html mostly overrides inline) ── */
/* Kept off by default — so existing index.html typography remains untouched. */

/* ── Shared Nav ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(247, 245, 240, 0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 32px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.95rem; color: var(--text-dark); text-decoration: none; }
.nav-brand img { height: 28px; }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-size: 0.82rem; font-weight: 500; color: var(--text-medium); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }
@media (max-width: 640px) { .nav-links { display: none; } }

/* ── Shared Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
section { padding: 100px 0; }
section:first-of-type { padding-top: 140px; }

/* ── Section Headers ── */
.section-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--primary);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(32px, 5vw, 48px); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.2;
  margin-bottom: 16px;
}
.section-desc {
  font-size: clamp(16px, 2vw, 18px); color: var(--text-medium);
  max-width: 600px; line-height: 1.7;
}

/* ── Shared Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: 50px; border: none; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  background: var(--text-dark); color: white;
  transition: var(--transition); text-decoration: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: 50px; border: 1px solid var(--border); cursor: pointer;
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  background: var(--bg-white); color: var(--text-dark);
  transition: var(--transition); text-decoration: none;
}
.btn-secondary:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

/* ── Divider ── */
.divider { width: 100%; height: 1px; background: var(--border); }

/* ── Animations ── */
@keyframes fadeOut { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-dark); color: white; padding: 12px 24px;
  border-radius: 50px; font-size: 0.82rem; font-weight: 500;
  opacity: 0; transition: all 0.3s ease; pointer-events: none; z-index: 200;
  box-shadow: var(--shadow-elevated);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Code Block ── */
.code-block {
  background: #1e1e2e; color: #cdd6f4; border-radius: var(--radius-sm);
  padding: 16px; font-family: var(--font-mono); font-size: 0.72rem;
  line-height: 1.8; overflow-x: auto; position: relative;
}
.code-block .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.1); border: none; color: #cdd6f4;
  padding: 4px 10px; border-radius: 6px; font-size: 0.65rem; cursor: pointer;
  font-family: var(--font-mono); transition: background 0.2s;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Copy URL Button ── */
.copy-url-btn {
  flex-shrink: 0; padding: 8px 16px; border-radius: 50px; border: 1px solid var(--border);
  background: var(--bg-white); font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600;
  color: var(--text-dark); cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.copy-url-btn:hover { background: var(--text-dark); color: white; border-color: var(--text-dark); }
.copy-url-btn.copied { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Footer ── */
.footer {
  padding: 60px 0; text-align: center;
  border-top: 1px solid var(--border);
}
.footer p { font-size: 0.82rem; color: var(--text-light); }
.footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.footer a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   Brand utilities — quote + grid paper
   Usage: <blockquote class="brand">  <div class="bg-grid">
   ══════════════════════════════════════════════════════════════ */
blockquote.brand {
  font-style: normal;
  background: var(--light-bg);
  border-left: var(--accent-bar) solid var(--teal);
  border-radius: var(--r-md);
  padding: 1em 1.25em;
  color: var(--ink);
}
.bg-grid {
  background-color: var(--grid-bg);
  background-image: var(--grid-pattern);
  background-size: var(--grid-size);
}

/* Inside display-font headings, latin shouldn't re-switch font */
h1 .en, h2 .en, h3 .en, h4 .en { font-family: inherit; }
/* For non-heading text, Latin/numerals switch to Inter */
.en { font-family: var(--font-en); }
