/* ============================================================
   Claude for Small Business · 台灣老闆導讀 — Reader's Edition
   Editorial typography system inspired by Anthropic brand
   ============================================================ */

:root {
  /* Palette */
  --cream:        #F0EEE6;
  --paper:        #FAF9F5;
  --paper-warm:   #F5F2E8;
  --ink:          #191919;
  --ink-soft:     #2A2A28;
  --muted:        #6B6B5E;
  --muted-light:  #9A9A8E;
  --rule:         rgba(25, 25, 25, 0.10);
  --rule-soft:    rgba(25, 25, 25, 0.06);
  --accent:       #CC785C;   /* Claude orange */
  --accent-dark:  #A8593E;
  --accent-tint:  rgba(204, 120, 92, 0.10);

  /* Type */
  --font-display: "Fraunces", "Noto Serif TC", "Source Han Serif TC", "PingFang TC", "Songti TC", Georgia, serif;
  --font-body:    "DM Sans", "Noto Sans TC", "Source Han Sans TC", "PingFang TC", "Helvetica Neue", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Scale */
  --step--1: clamp(0.83rem, 0.78rem + 0.20vw, 0.95rem);
  --step-0:  clamp(1.00rem, 0.93rem + 0.30vw, 1.15rem);
  --step-1:  clamp(1.20rem, 1.10rem + 0.50vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.30rem + 0.75vw, 1.85rem);
  --step-3:  clamp(1.80rem, 1.55rem + 1.20vw, 2.50rem);
  --step-4:  clamp(2.30rem, 1.90rem + 1.90vw, 3.50rem);
  --step-5:  clamp(3.00rem, 2.30rem + 3.20vw, 5.20rem);

  /* Layout */
  --max-text:     68ch;
  --sidebar-w:    280px;
  --gutter:       clamp(1.25rem, 2vw, 2.5rem);
  --page-pad:     clamp(1.5rem, 4vw, 4rem);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- Base ---------- */
html { font-size: 17px; }
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  font-feature-settings: "ss01", "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle paper grain via SVG noise */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Reading progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: var(--accent);
  z-index: 100;
  transition: width 0.1s ease-out;
}

/* ---------- Site chrome ---------- */
.skip-link{position:absolute;left:-9999px;top:0;z-index:200;}
.skip-link:focus{left:0;padding:0.6rem 1rem;background:var(--ink);color:var(--paper);border-radius:0 0 4px 0;}
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule-soft);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem var(--page-pad);
}
.brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 0.6rem;
}
.brand__mark {
  width: 22px; height: 22px;
  background: var(--accent);
  display: inline-block;
  border-radius: 2px;
  transform: rotate(45deg);
  position: relative;
}
.brand__mark::after {
  content: "";
  position: absolute; inset: 5px;
  background: var(--cream);
}
.brand__sep {
  color: var(--muted-light);
  margin: 0 0.1rem;
  font-weight: 400;
}
.brand__sub { color: var(--muted); font-style: italic; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
  background: var(--paper);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.lang-switch a {
  display: inline-flex; align-items: center;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.lang-switch a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}
.lang-switch a:hover:not([aria-current="page"]) { color: var(--ink); }

/* ---------- Header actions (GitHub star + language) ---------- */
.site-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.ghstar {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.ghstar:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.ghstar__logo { width: 16px; height: 16px; flex: none; }
.ghstar__star {
  color: var(--accent);
  transition: transform 0.18s ease, color 0.18s ease;
}
.ghstar:hover .ghstar__star {
  color: #F5C451; /* warm gold when the button inverts on hover */
  transform: scale(1.15) rotate(-8deg);
}
.ghstar__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-left: 0.2rem;
  padding-left: 0.55rem;
  border-left: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.ghstar__count[hidden] { display: none; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--page-pad) 6rem;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar / TOC ---------- */
.toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  padding: 2rem 0;
  font-size: 0.88rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.toc__label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.toc__list { list-style: none; margin: 0; padding: 0; }
.toc__item {
  position: relative;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule-soft);
  transition: border-color 0.2s ease;
}
.toc__item a {
  display: block;
  padding: 0.55rem 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 1.4;
}
.toc__item a:hover { color: var(--ink); }
.toc__item .toc__num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-right: 0.5rem;
  color: var(--muted);
}
.toc__item[data-active="true"] {
  border-left-color: var(--accent);
}
.toc__item[data-active="true"] a {
  color: var(--ink);
  font-weight: 600;
}
.toc__item[data-active="true"] .toc__num { color: var(--accent); }

.toc__cta {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
}
.toc__cta-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.toc__cta-title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
  margin: 0 0 0.6rem;
}
.toc__cta-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.toc__cta-link:hover { color: var(--accent-dark); }
.toc__cta-link::after { content: "→"; transition: transform 0.2s ease; }
.toc__cta-link:hover::after { transform: translateX(3px); }

/* ---------- Main column ---------- */
.main {
  min-width: 0;
  padding-top: 2rem;
  container-type: inline-size;
  container-name: main;
}
.section + .section { margin-top: 6rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 4rem 0 3rem;
  position: relative;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dark);
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 1.8rem;
}
.hero__eyebrow::before {
  content: ""; height: 1px; width: 36px; background: var(--accent);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: var(--step-5);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 1.5rem;
  color: var(--ink);
}
.hero__title em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  color: var(--accent);
}
.hero__lede {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.35;
  color: var(--ink-soft);
  max-width: 30ch;
  margin: 0 0 2.5rem;
  font-style: italic;
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
}
.hero__meta-item {
  display: flex; flex-direction: column; gap: 0.2rem;
}
.hero__meta-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__meta-value { font-weight: 500; }
.hero__actions {
  display: flex; flex-wrap: wrap; gap: 0.8rem;
  margin-top: 2.5rem;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover { background: var(--accent); }
.btn--secondary {
  border-color: var(--rule);
  background: var(--paper);
}
.btn--secondary:hover { border-color: var(--ink); }
.btn__arrow { transition: transform 0.2s ease; }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---------- Cross-link callout (under the hero) ---------- */
.hero__more {
  display: flex; align-items: baseline; gap: 0.5rem 0.8rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--paper);
  font-size: 0.9rem;
  color: var(--muted);
}
.hero__more strong { color: var(--ink); font-weight: 600; }
.hero__more a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.hero__more a:hover { color: var(--accent-dark); }
.hero__more a::after { content: " →"; }

/* ---------- Chapter heading ---------- */
.chapter__head {
  margin: 0 0 2.5rem;
  display: grid;
  gap: 0.6rem;
}
.chapter__num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dark);
  display: flex; align-items: center; gap: 0.7rem;
}
.chapter__num::before {
  content: ""; height: 1px; width: 28px; background: var(--accent);
}
.chapter__title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 96, "SOFT" 30;
  font-weight: 400;
  font-size: var(--step-4);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 22ch;
}
.chapter__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-1);
  color: var(--muted);
  margin: 0.4rem 0 0;
  max-width: 50ch;
}

/* Sub-section heading inside a chapter (full edition) */
.section-h {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
}

/* ---------- Prose ---------- */
.prose {
  max-width: var(--max-text);
  font-size: var(--step-0);
  line-height: 1.72;
}
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }
.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.prose a:hover { color: var(--accent-dark); }
.prose .dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  float: left;
  font-size: 4.6em;
  line-height: 0.85;
  padding: 0.18em 0.12em 0 0;
  color: var(--accent);
}

/* ---------- Product name highlight (Claude / Claude Code / Claude Cowork) ---------- */
.product {
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-tint);
  padding: 0.04em 0.4em;
  border-radius: 4px;
  white-space: nowrap;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* Keep the accent underline off product chips when they sit inside prose links */
.prose a .product { background: none; padding: 0; color: inherit; }
/* Light-up entrance: chips start with no fill, then the tint animates in on scroll */
.product.is-armed { background-color: transparent; }
.product.is-lit { animation: productLight 0.55s ease both; }
@keyframes productLight {
  0%   { background-color: transparent; }
  55%  { background-color: color-mix(in srgb, var(--accent) 30%, transparent); }
  100% { background-color: var(--accent-tint); }
}

/* ---------- Pull quote ---------- */
.pullquote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.3;
  color: var(--ink);
  padding: 2rem 0 2rem 1.5rem;
  border-left: 2px solid var(--accent);
  margin: 2.5rem 0;
  max-width: 38ch;
}
.pullquote__attr {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Stage card (Idea/MVP/Launch/Scale) ---------- */
.stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 3rem;
}
.stage__block {
  padding: 1.75rem 1.75rem 2rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  position: relative;
}
.stage__block-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.stage__block-label::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.stage__block h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-1);
  line-height: 1.25;
  margin: 0 0 0.8rem;
  letter-spacing: -0.01em;
}
.stage__block p, .stage__block li {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--ink-soft);
}
.stage__block ul, .stage__block ol {
  margin: 0; padding: 0; list-style: none;
}
.stage__block ul li,
.stage__block ol li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
}
.stage__block ul li::before {
  content: "";
  position: absolute; left: 0; top: 0.7em;
  width: 8px; height: 1px;
  background: var(--accent);
}
.stage__block ol { counter-reset: stagelist; }
.stage__block ol li {
  counter-increment: stagelist;
  padding-left: 2rem;
}
.stage__block ol li::before {
  content: counter(stagelist, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.7;
}

@container main (min-width: 680px) {
  .stage {
    grid-template-columns: 1fr 1fr;
  }
  .stage__block--wide { grid-column: 1 / -1; }
}

/* ---------- Challenge list ---------- */
.challenges {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2.5rem 0;
}
.challenge {
  padding: 1.5rem 1.6rem;
  background: var(--paper-warm);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}
.challenge__num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.challenge__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0.3rem 0 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.challenge__body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Tool cards (Chat / Cowork / Code) ---------- */
.tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2.5rem 0;
}
.tool {
  padding: 1.6rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  position: relative;
}
.tool__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: -0.005em;
}
.tool__when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dark);
  margin: 0.2rem 0 0.9rem;
  display: block;
}
.tool__desc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
@container main (min-width: 640px) {
  .tools { grid-template-columns: repeat(3, 1fr); }
}
/* Fallback when container queries aren't supported AND no sidebar (mobile) */
@supports not (container-type: inline-size) {
  @media (min-width: 760px) {
    .tools { grid-template-columns: repeat(3, 1fr); }
  }
  @media (min-width: 900px) {
    .stage { grid-template-columns: 1fr 1fr; }
    .stage__block--wide { grid-column: 1 / -1; }
  }
}

/* ---------- Decision table (Chat / Cowork / Code) ---------- */
.decision {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.92rem;
}
.decision caption {
  caption-side: bottom;
  margin-top: 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: left;
}
.decision th, .decision td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule-soft);
}
.decision thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--rule);
}
.decision tbody th {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
}
.decision td { color: var(--ink-soft); line-height: 1.5; }
.decision tbody tr:last-child th, .decision tbody tr:last-child td { border-bottom: 0; }
/* Stack the table into labelled cards on narrow screens */
@media (max-width: 620px) {
  .decision, .decision tbody, .decision tr, .decision th, .decision td { display: block; }
  .decision thead { display: none; }
  .decision tr {
    border: 1px solid var(--rule-soft);
    border-radius: 6px;
    margin-bottom: 0.8rem;
    padding: 0.7rem 1rem;
    background: var(--paper);
  }
  .decision tbody th, .decision tbody td { white-space: normal; border: 0; padding: 0.35rem 0; }
  .decision tbody th { font-size: 1.02rem; }   /* the task is the card's lead line */
  .decision td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.15rem;
  }
}

/* ---------- Founder story cards ---------- */
.stories {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
.story {
  padding: 1.4rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
}
.story__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.005em;
}
.story__tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.story__body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
}
@container main (min-width: 640px) {
  .stories { grid-template-columns: 1fr 1fr; }
}
@supports not (container-type: inline-size) {
  @media (min-width: 760px) { .stories { grid-template-columns: 1fr 1fr; } }
}

/* ---------- Resources ---------- */
.resources {
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0;
}
.resource {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule-soft);
  text-decoration: none;
  color: inherit;
  transition: padding-left 0.2s ease;
}
.resource:hover { padding-left: 0.4rem; }
.resource__num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.resource__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.005em;
}
.resource__desc {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
  font-family: var(--font-body);
}
.resource__arrow {
  font-family: var(--font-mono);
  color: var(--muted-light);
  transition: transform 0.2s ease, color 0.2s ease;
}
.resource:hover .resource__arrow { color: var(--accent); transform: translateX(4px); }

/* ============================================================
   Taiwan localization callout — .tw-note
   ============================================================ */
.tw-note {
  background: var(--paper-warm);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1.3rem 1.5rem;
  margin: 1.5rem 0;
}
.tw-note__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 0.5rem;
}
.tw-note__body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.tw-note__body > * + * { margin-top: 0.7em; }
.tw-note__body p { margin: 0; }
.tw-note__body strong { font-weight: 600; color: var(--ink); }
.tw-note__body ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tw-note__body ul li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.4rem;
}
.tw-note__body ul li::before {
  content: "";
  position: absolute; left: 0; top: 0.65em;
  width: 8px; height: 1px;
  background: var(--accent);
}

/* ============================================================
   Recipe grid — .recipes / .recipe
   ============================================================ */
.recipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0;
}
.recipe {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
}
.recipe__cmd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #8F4A30;
  background: rgba(204,120,92,0.16);
  padding: 0.1em 0.5em;
  border-radius: 4px;
}
.recipe__desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0.6rem 0 0;
}

/* ============================================================
   Numbered step strip — .flow
   ============================================================ */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.8rem 1.4rem;
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
  counter-reset: flowstep;
}
.flow__step {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: relative;
}
/* Arrow separator between steps (horizontal) */
.flow__step::after {
  content: "→";
  font-family: var(--font-mono);
  color: var(--muted-light);
  margin-left: 0.6rem;
}
.flow__step:last-child::after { content: none; }
.flow__num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
}
.flow__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.4;
}
.flow__text strong {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.flow__text span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Stack vertically on narrow screens; switch arrow to a downward glyph */
@media (max-width: 620px) {
  .flow {
    flex-direction: column;
    gap: 0.5rem;
  }
  .flow__step {
    flex-direction: row;
    align-items: center;
  }
  .flow__step::after {
    content: "↓";
    position: absolute;
    left: 1rem;
    bottom: -0.55rem;
    margin-left: 0;
    transform: translateX(-50%);
  }
  .flow__step:last-child::after { content: none; }
}

/* ============================================================
   Before/after time chip — .timesave
   ============================================================ */
.timesave {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.1rem 0;
}
.timesave__from {
  color: var(--muted);
  font-size: 0.95rem;
}
.timesave__arrow {
  font-family: var(--font-mono);
  color: var(--muted-light);
}
.timesave__to {
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 1.15rem;
}
.timesave__note {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   Install step card — .install-step
   ============================================================ */
.install-step {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  padding: 1.6rem;
  margin: 1.2rem 0;
}
.install-step__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
  margin-bottom: 1.1rem;
}
.install-step__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.install-step__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1 1 auto;
}
.install-step__time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.install-step__block + .install-step__block { margin-top: 1rem; }
.install-step__sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 0.4rem;
}
.install-step__block p {
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0;
}
.install-step__block ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: installlist;
}
.install-step__block ol li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  counter-increment: installlist;
}
.install-step__block ol li::before {
  content: counter(installlist, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.7;
}
/* The "stuck?" block gets a warm tinted inner surface */
/* --do / --see render as plain blocks by design; only --stuck is tinted */
.install-step__block--stuck {
  background: var(--paper-warm);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}

/* ---------- Visually hidden (screen-reader-only) utility ---------- */
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;}

/* ============================================================
   Copyable scenario prompt card — .prompt-card
   ============================================================ */
.prompt-card {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.prompt-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.prompt-card__persona {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.prompt-card__scene {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}
.prompt-card__box {
  position: relative;
}
.prompt-card__pre {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 2.6rem 1.2rem 1.1rem;   /* top room reserved for the copy button */
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt-card__pre code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: inherit;
}
.prompt-card__copy {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.prompt-card__copy:hover {
  border-color: var(--ink);
}
/* The label text (複製 ↔ 已複製 / Copy ↔ Copied) is swapped in JS so it stays
   bilingual; CSS only handles the visual "copied" state. */
.prompt-card__copy[data-copied="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.prompt-card__does {
  margin-top: 1.1rem;
}
.prompt-card__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 0.4rem;
}
.prompt-card__does ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: doeslist;
}
.prompt-card__does ol li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  counter-increment: doeslist;
}
.prompt-card__does ol li::before {
  content: counter(doeslist, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.7;
}
.prompt-card .timesave { margin-top: 1.1rem; }

/* ============================================================
   Warning / caution callout — .warn
   ============================================================ */
.warn {
  background: var(--paper-warm);
  border-left: 3px solid var(--accent-dark);
  border-radius: 6px;
  padding: 1.3rem 1.5rem;
  margin: 1.5rem 0;
}
.warn__title {
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.98rem;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.warn p {
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0;
}
.warn > * + * { margin-top: 0.6em; }
.warn strong { font-weight: 600; color: var(--ink); }

/* ---------- Closing section ---------- */
.closing {
  text-align: center;
  padding: 5rem 0 2rem;
}
.closing__rule {
  display: block;
  width: 80px; height: 1px;
  background: var(--accent);
  margin: 0 auto 2.5rem;
}
.closing__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-3);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.015em;
}
.closing__sub {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 auto;
  max-width: 50ch;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 3rem var(--page-pad) 2rem;
  font-size: 0.82rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
}
.site-footer__inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1rem 2.5rem;
  align-items: baseline; justify-content: space-between;
}
.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
.site-footer a:hover { color: var(--ink); text-decoration-color: var(--accent); }

/* ---------- Mobile / TOC toggle ---------- */
.toc__toggle { display: none; }

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 var(--page-pad) 4rem;
  }
  .toc {
    position: relative;
    top: 0;
    max-height: none;
    padding: 1.5rem 0 0.5rem;
  }
  .toc__toggle {
    display: flex;
    align-items: center; justify-content: space-between;
    width: 100%;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--rule);
    background: var(--paper);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .toc__toggle::after {
    content: "+";
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1;
    transition: transform 0.25s ease;
  }
  .toc[data-open="true"] .toc__toggle::after { transform: rotate(45deg); }
  .toc__panel {
    display: none;
    padding-top: 1rem;
  }
  .toc[data-open="true"] .toc__panel { display: block; }
  .toc__cta { display: none; }
  .main { padding-top: 1rem; }
  .section + .section { margin-top: 4.5rem; }
  .hero { padding: 2.5rem 0 2rem; }
}

/* Free up the header on narrow screens so the switch fits */
@media (max-width: 720px) {
  .site-header__inner { gap: 0.6rem; }
  .site-header__actions { gap: 0.4rem; }
  .brand__sep, .brand__sub { display: none; }   /* shorten brand */
  .brand { white-space: nowrap; min-width: 0; overflow: hidden; }  /* never break the title (esp. CJK) */
  .lang-switch a { padding: 0.3rem 0.6rem; }
  .lang-switch { font-size: 0.78rem; }
  .ghstar { padding: 0.4rem 0.7rem; }
  .ghstar__text { display: none; }               /* icon + star count only */
}

/* Tightest screens: drop the brand wordmark to the diamond so the switch wins the room */
@media (max-width: 560px) {
  .brand span:not([class]) { display: none; }
  .ghstar { padding: 0.4rem 0.55rem; }
}

@media (max-width: 560px) {
  html { font-size: 16px; }
  .hero__meta { gap: 1.2rem; }
  .brand { font-size: 0.95rem; }   /* keep the title on one line in the header */

  /* Less nested padding → text gets more width and stops feeling cramped */
  .stage { gap: 1.5rem; margin-top: 2.25rem; }
  .stage__block { padding: 1.4rem 1.3rem 1.6rem; }
  .challenges, .tools { gap: 0.85rem; margin: 2rem 0; }
  .challenge { padding: 1.3rem 1.3rem; }
  .tool { padding: 1.4rem 1.3rem; }
  .pullquote { padding: 1.5rem 0 1.5rem 1.1rem; margin: 2rem 0; }
  .closing { padding: 3.5rem 0 1.5rem; }

  /* New components: ease padding on the smallest screens */
  .tw-note, .warn { padding: 1.1rem 1.2rem; }
  .install-step { padding: 1.3rem 1.2rem; }
  .prompt-card { padding: 1.3rem 1.2rem; }
  .recipes { gap: 0.7rem; }
}

/* ---------- Print ---------- */
@media print {
  body::before, .progress, .site-header, .toc, .site-footer { display: none; }
  .layout { display: block; padding: 0; }
  .stage__block, .challenge, .tool,
  .tw-note, .recipe, .install-step, .prompt-card, .warn { break-inside: avoid; }
  .prompt-card__copy { display: none; }
  .prompt-card__pre { background: var(--paper); color: var(--ink); border: 1px solid var(--rule); }
}

/* ---------- Accessibility ---------- */
:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
  border-radius: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
}

/* ---------- CJK refinements (applied via :lang) ---------- */
:lang(zh-Hant) {
  font-feature-settings: "kern" 1, "palt" 1;
}
:lang(zh-Hant) .hero__title,
:lang(zh-Hant) .chapter__title {
  letter-spacing: -0.005em;
  line-height: 1.18;
}
:lang(zh-Hant) .hero__lede,
:lang(zh-Hant) .chapter__sub,
:lang(zh-Hant) .pullquote,
:lang(zh-Hant) .timesave__note {
  font-style: normal; /* CJK italic looks odd */
}
:lang(zh-Hant) .prose .dropcap::first-letter {
  float: none;
  font-size: 1em;
  padding: 0;
  color: inherit;
}
/* New components read well in Traditional Chinese: looser line-height, no forced italics */
:lang(zh-Hant) .tw-note__body,
:lang(zh-Hant) .recipe__desc,
:lang(zh-Hant) .install-step__block p,
:lang(zh-Hant) .install-step__block ol li,
:lang(zh-Hant) .prompt-card__does ol li,
:lang(zh-Hant) .warn p {
  line-height: 1.7;
}
:lang(zh-Hant) .prompt-card__persona { letter-spacing: 0; }
