/* The Coffee Brew Lab 咖啡釀造實驗室 — shared stylesheet */
:root {
  color-scheme: light dark;
  --paper: #f5f1e8;
  --paper-2: #e9e1d2;
  --ink: #1f211e;
  --muted: #575a53;
  --line: #c8bdad;
  --espresso: #3f2418;
  --copper: #b84e2a;
  --teal: #1f625f;
  --mustard: #d0a53c;
  --white: #fffdf8;
  --shadow: 0 18px 55px rgba(63,36,24,.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161714;
    --paper-2: #23231f;
    --ink: #f5f0e7;
    --muted: #c6c0b6;
    --line: #45443d;
    --espresso: #e4c2aa;
    --copper: #ec7650;
    --teal: #58aaa5;
    --mustard: #e3bc55;
    --white: #1d1e1a;
    --shadow: 0 18px 55px rgba(0,0,0,.28);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-width: 320px;
  background: var(--paper); color: var(--ink);
  font-family: "IBM Plex Sans TC", "Noto Sans TC", sans-serif;
  line-height: 1.75; overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: min(1080px, calc(100% - 40px)); margin-inline: auto; }
h1, h2, h3 { font-family: "Noto Serif TC", serif; line-height: 1.3; margin-top: 0; }

/* ---------- top bar ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 50; }
.topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.35rem;
  background: linear-gradient(135deg, var(--espresso), var(--copper));
  color: #fff; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: "Noto Serif TC", serif; font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: .78rem; letter-spacing: .18em; }
.topbar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; }
.topbar nav a { text-decoration: none; font-weight: 600; font-size: .92rem; padding: 8px 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover, .topbar nav a:focus-visible, .topbar nav a[aria-current="page"] { color: var(--copper); border-color: var(--copper); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; padding: clamp(40px, 6vw, 84px) 0 clamp(36px, 5vw, 64px); }
.kicker { color: var(--copper); font-weight: 700; letter-spacing: .06em; margin: 0 0 14px; font-size: .95rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); letter-spacing: -.02em; margin-bottom: 18px; }
.hero p.lead { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.15rem); max-width: 32rem; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--espresso); color: var(--paper);
  text-decoration: none; font-weight: 700; padding: 13px 22px;
  border-radius: 2px 16px 2px 16px; border: 0; cursor: pointer;
}
.btn:hover { background: var(--copper); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--copper); color: var(--copper); background: transparent; }
.hero-art { position: relative; min-height: 300px; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 78% 22%, rgba(208,165,60,.55), transparent 42%),
    radial-gradient(circle at 22% 78%, rgba(184,78,42,.5), transparent 46%),
    linear-gradient(150deg, #6b3d22 0%, #3f2418 58%, #2a170e 100%);
}
.hero-art::after {
  content: "☕"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(4rem, 10vw, 7rem); opacity: .9; filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}
.hero-art figcaption {
  position: absolute; left: 16px; bottom: 14px; z-index: 2;
  background: rgba(20,12,7,.72); color: #ffe9c4; font-size: .85rem;
  padding: 8px 14px; border-radius: 999px;
}

/* ---------- sections & cards ---------- */
.section { padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 28px; max-width: 46rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin-bottom: 8px; }
.section-head p { color: var(--muted); margin: 0; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-art { height: 130px; flex: none; }
.card-body { padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body .tag { color: var(--teal); font-size: .8rem; font-weight: 700; }
.card-body h3 { font-size: 1.18rem; margin: 0; }
.card-body p { color: var(--muted); font-size: .92rem; margin: 0; flex: 1; }
.card-body .more { color: var(--copper); font-weight: 700; font-size: .9rem; }
.a1 { background: linear-gradient(135deg, #b84e2a, #d0a53c); }
.a2 { background: linear-gradient(135deg, #3f2418, #7a4a24); }
.a3 { background: linear-gradient(135deg, #1f625f, #58aaa5); }
.a4 { background: linear-gradient(135deg, #d0a53c, #f0d78a); }
.a5 { background: linear-gradient(135deg, #5a3220, #b84e2a); }
.a6 { background: linear-gradient(135deg, #2a4a3f, #1f625f); }
.t1 { background: linear-gradient(135deg, #3f2418, #b84e2a); }
.t2 { background: linear-gradient(135deg, #1f625f, #3f2418); }

/* ---------- article prose ---------- */
.breadcrumb { font-size: .85rem; color: var(--muted); padding: 22px 0 0; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--copper); }
.prose { max-width: 44rem; padding: 18px 0 30px; }
.prose h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); margin-bottom: 10px; }
.prose .meta { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }
.prose h2 { font-size: 1.55rem; margin: 44px 0 14px; padding-top: 6px; }
.prose h3 { font-size: 1.2rem; margin: 30px 0 10px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.4em; }
.prose li { margin-bottom: 8px; }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0 24px; font-size: .93rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper-2); font-weight: 700; }
.tip {
  background: var(--paper-2); border-left: 5px solid var(--mustard);
  padding: 16px 20px; margin: 22px 0; border-radius: 0 8px 8px 0;
}
.tip strong { color: var(--copper); }
.toc { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; margin: 24px 0; }
.toc strong { display: block; margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin-bottom: 4px; }
.toc a { text-decoration: none; }
.toc a:hover { color: var(--copper); }
.next-read { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 24px; }
.next-read h2 { font-size: 1.3rem; margin-bottom: 14px; }

/* ---------- tools ---------- */
.tool-shell {
  display: grid; grid-template-columns: .72fr 1.28fr; min-height: 480px;
  background: var(--espresso); color: var(--paper); box-shadow: var(--shadow); border-radius: 8px; overflow: hidden;
}
.tool-intro { padding: clamp(28px, 4vw, 52px); background: var(--copper); }
.tool-intro h2 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); margin-bottom: 14px; color: #fff; }
.tool-intro p { margin: 0; color: rgba(255,255,255,.88); }
.calculator { padding: clamp(28px, 4vw, 54px); display: grid; align-content: center; gap: 24px; }
.control label { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-weight: 600; margin-bottom: 9px; }
.control output { color: var(--mustard); font-weight: 700; }
select, input[type="number"], textarea {
  width: 100%; background: transparent; color: inherit; border: 1px solid currentColor;
  border-radius: 4px; padding: 12px 14px;
}
select option { background: var(--white); color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--mustard); }
.result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(255,255,255,.22); }
.result div { background: var(--espresso); padding: 18px; }
.result strong { display: block; font-family: "Noto Serif TC", serif; color: var(--mustard); font-size: clamp(1.35rem, 2.6vw, 2rem); }
.result span { font-size: .82rem; color: rgba(255,255,255,.72); }
.formula-note { color: rgba(255,255,255,.7); font-size: .83rem; margin: 0; }
.diagnose-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 44px; align-items: start; }
.diagnose-copy h2 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); }
.diagnose-copy p { color: var(--muted); }
.taste-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0; }
.taste-buttons button {
  border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 15px 8px;
  cursor: pointer; font-weight: 700; border-radius: 6px;
}
.taste-buttons button[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }
.diagnosis {
  background: var(--white); padding: clamp(24px, 4vw, 44px); border-top: 8px solid var(--mustard);
  box-shadow: var(--shadow); min-height: 280px; border-radius: 0 0 8px 8px;
}
.diagnosis h3 { font-size: 1.6rem; }
.adjustments { display: grid; gap: 12px; padding: 0; margin: 20px 0 0; list-style: none; counter-reset: fix; }
.adjustments li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; }
.adjustments li::before {
  counter-increment: fix; content: counter(fix); display: grid; place-items: center;
  width: 28px; height: 28px; background: var(--paper-2); color: var(--copper); font-weight: 700; border-radius: 50%;
}

/* ---------- forms ---------- */
.contact-form { display: grid; gap: 18px; max-width: 36rem; }
.contact-form label { font-weight: 600; display: grid; gap: 8px; }
.contact-form input, .contact-form textarea { border: 1.5px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); }
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--copper); outline: none; }
.contact-form textarea { min-height: 160px; resize: vertical; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 40px 0 calc(34px + env(safe-area-inset-bottom)); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-bottom: 18px; }
.footer-inner strong { font-family: "Noto Serif TC", serif; color: var(--ink); font-size: 1.05rem; }
.footer-inner p { margin: 6px 0 0; max-width: 26rem; }
.footer-inner nav { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.footer-inner nav a { text-decoration: none; font-weight: 600; }
.footer-inner nav a:hover { color: var(--copper); }
.copyright { font-size: .82rem; border-top: 1px solid var(--line); padding-top: 16px; }

:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 220px; order: -1; }
  .cards { grid-template-columns: 1fr 1fr; }
  .tool-shell, .diagnose-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .wrap { width: min(100% - 28px, 1080px); }
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 6px; padding-block: 12px; }
  .topbar nav { justify-content: flex-start; gap: 2px 16px; }
  .cards { grid-template-columns: 1fr; }
  .result { grid-template-columns: 1fr; }
  .taste-buttons { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
