/* =========================================================================
   Cooking Fundamentals — shared design system
   Clean & technical: light, generous whitespace, one warm kitchen accent.
   Sibling to the roasting guide; re-themed from coffee amber to paprika red.
   ========================================================================= */

:root {
  /* Palette */
  --bg:           #ffffff;
  --bg-soft:      #faf7f5;
  --bg-sidebar:   #f8f3f0;
  --bg-inset:     #f4ede9;
  --text:         #1c1917;
  --text-soft:    #44403c;
  --text-muted:   #78716c;
  --border:       #ece3dd;
  --border-strong:#dccfc6;

  /* Kitchen accent */
  --accent:        #c1452b;  /* paprika / tomato */
  --accent-strong: #9a3520;
  --accent-soft:   #fdf1ec;
  --accent-ring:   rgba(193, 69, 43, .28);

  /* Data viz */
  --heat:   #c1452b;  /* pan / surface temperature  */
  --core:   #2563eb;  /* internal / core temperature */
  --env:    #a8a29e;  /* ambient / reference         */
  --fresh:  #4d7c2f;  /* acid / herb / green         */
  --gold:   #d6a635;  /* fat / sweet / caramel       */
  --good:   #15803d;
  --warn:   #b45309;
  --bad:    #b91c1c;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Metrics */
  --sidebar-w: 280px;
  --content-max: 760px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(28,25,23,.04), 0 6px 24px rgba(28,25,23,.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-ring); }

/* ---------- Layout ------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 26px 18px 40px;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 56px 40px 96px;
}

.prose { width: 100%; max-width: var(--content-max); }

/* ---------- Sidebar nav -------------------------------------------------- */
.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--text);
  margin: 4px 8px 22px;
}
.brand .mark { flex: 0 0 auto; }
.brand b { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand span { display: block; font-size: 12px; color: var(--text-muted); font-weight: 500; }

.nav-part {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 10px 7px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex; align-items: baseline; gap: 9px;
  padding: 6px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-soft);
  font-size: 14.5px; line-height: 1.35;
  transition: background .12s, color .12s;
}
.nav-list a .n {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  min-width: 16px;
}
.nav-list a:hover { background: rgba(193,69,43,.07); color: var(--text); }
.nav-list a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav-list a.active .n { color: var(--accent); }

/* ---------- Prose typography -------------------------------------------- */
.prose h1 {
  font-size: 34px; line-height: 1.15; letter-spacing: -.022em; font-weight: 800;
  margin: 0 0 8px;
}
.prose .eyebrow {
  display: inline-block;
  font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.prose .lead { font-size: 20px; line-height: 1.55; color: var(--text-soft); margin: 0 0 30px; }
.prose h2 {
  font-size: 24px; line-height: 1.25; letter-spacing: -.015em; font-weight: 750;
  margin: 48px 0 10px; padding-top: 8px;
}
.prose h3 { font-size: 18.5px; font-weight: 700; margin: 32px 0 6px; letter-spacing: -.01em; }
.prose p { margin: 0 0 18px; }
.prose a { color: var(--accent-strong); text-underline-offset: 2px; text-decoration-color: var(--accent-ring); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { font-weight: 680; color: var(--text); }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--accent); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.prose code {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--bg-inset); padding: 1.5px 5px; border-radius: 5px;
  border: 1px solid var(--border);
}

/* term / definition emphasis */
.term { font-weight: 680; color: var(--accent-strong); }

/* ---------- Callouts ----------------------------------------------------- */
.callout {
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 15px 18px; margin: 24px 0;
  font-size: 15.5px; line-height: 1.6;
}
.callout .ico { font-size: 18px; line-height: 1.5; }
.callout p:last-child { margin-bottom: 0; }
.callout .h { font-weight: 700; display: block; margin-bottom: 2px; }
.callout.key  { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.tip  { border-left-color: var(--good);   background: #f3faf5; }
.callout.warn { border-left-color: var(--bad);    background: #fdf4f3; }
.callout.cool { border-left-color: var(--core);   background: #f1f5fd; }

/* ---------- Figures ------------------------------------------------------ */
figure { margin: 28px 0; }
figure svg, figure img { display: block; width: 100%; height: auto; }
.figframe {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft); padding: 18px; overflow: hidden;
}
figcaption { font-size: 14px; color: var(--text-muted); margin-top: 10px; text-align: center; }
.photo-slot {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #fbf9f6, #fbf9f6 12px, #f6f2ec 12px, #f6f2ec 24px);
  color: var(--text-muted); font-size: 14px; text-align: center;
  padding: 26px 18px; margin: 24px 0;
}
.photo-slot b { color: var(--text-soft); }

/* ---------- Tables ------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 24px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border-strong); }
tbody tr:hover { background: var(--bg-soft); }
td .num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ---------- Widgets ------------------------------------------------------ */
.widget {
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 30px 0;
}
.widget-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.widget-head .badge {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent-strong); background: var(--accent-soft);
  border: 1px solid var(--accent-ring); border-radius: 999px; padding: 3px 9px;
}
.widget-head h3 { margin: 0; font-size: 17px; }
.widget-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 16px; }

.controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; }
.control { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1 1 150px; }
.control label { font-size: 13px; font-weight: 600; color: var(--text-soft); display: flex; justify-content: space-between; gap: 8px; }
.control label .v { font-family: var(--font-mono); color: var(--accent-strong); font-weight: 700; }
.control .hint { font-size: 12px; color: var(--text-muted); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  background: var(--border-strong); border-radius: 999px; outline: none; margin: 8px 0 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer;
}
input[type="range"]:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

select, .btn {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
select:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }
.btn { font-weight: 600; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--bg-soft); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button {
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  background: var(--bg); border: none; border-right: 1px solid var(--border); padding: 8px 13px; cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent); color: #fff; }

.canvas-wrap { position: relative; margin: 16px 0 4px; }
.widget canvas { display: block; width: 100%; touch-action: none; border-radius: 8px; }

.readouts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.readout {
  flex: 1 1 120px; min-width: 110px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px;
}
.readout .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.readout .val { font-family: var(--font-mono); font-size: 21px; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: 2px; }
.readout .val small { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.feedback { margin-top: 14px; display: grid; gap: 8px; }
.msg { display: grid; grid-template-columns: auto 1fr; gap: 9px; font-size: 14.5px; padding: 9px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-soft); }
.msg.good { border-color: #bbe7c8; background: #f3faf5; }
.msg.warn { border-color: #f3d9b0; background: #fff8ed; }
.msg.bad  { border-color: #f1c4c0; background: #fdf4f3; }
.msg .ico { font-size: 15px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-soft); margin-top: 10px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- Prev / next footer ------------------------------------------ */
.pager { display: flex; gap: 14px; margin-top: 64px; border-top: 1px solid var(--border); padding-top: 26px; }
.pager a {
  flex: 1 1 0; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
  transition: border-color .12s, background .12s;
}
.pager a:hover { border-color: var(--accent); background: var(--bg-soft); }
.pager .dir { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.pager .ttl { font-weight: 650; color: var(--accent-strong); margin-top: 2px; }
.pager .next { text-align: right; }
.pager .spacer { border: none; background: none; pointer-events: none; }

/* ---------- Landing page ------------------------------------------------- */
.hero { max-width: 860px; }
.hero h1 { font-size: 44px; line-height: 1.08; letter-spacing: -.025em; font-weight: 850; margin: 0 0 14px; }
.hero .lead { font-size: 21px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 12px 0 0; }
.card {
  text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 20px;
  background: var(--bg); transition: border-color .12s, box-shadow .12s, transform .12s;
  display: flex; flex-direction: column; gap: 6px;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.card .n { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); font-weight: 700; }
.card .t { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; }
.card .d { font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.card .wbadge { margin-top: auto; font-size: 11.5px; font-weight: 700; color: var(--accent-strong); }

.part-label { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 34px 0 4px; }

/* ---------- Mobile ------------------------------------------------------- */
.menu-btn {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 50;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 9px;
  width: 42px; height: 42px; font-size: 19px; cursor: pointer; box-shadow: var(--shadow);
}
.scrim { display: none; }

@media (max-width: 980px) {
  body { font-size: 16px; }
  .menu-btn { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(28,25,23,.36); z-index: 30; }
  .content { padding: 64px 22px 80px; }
  .prose h1, .hero h1 { font-size: 30px; }
  .hero h1 { font-size: 34px; }
  .control { flex-basis: 130px; }
}

@media (max-width: 560px) {
  .pager { flex-direction: column; }
  .controls { gap: 12px 14px; }
  .bar { grid-template-columns: 80px 1fr 36px; }
}

/* ---------- Added components: swatches, taste bars, zone panel, glossary -- */
.swatch-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.swatch {
  width: 86px; height: 86px; border-radius: 50%; flex: 0 0 auto;
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong), var(--shadow);
  transition: background .18s ease;
}
.swatch.sm { width: 56px; height: 56px; }

.bars { display: grid; gap: 11px; margin: 14px 0 2px; }
.bar { display: grid; grid-template-columns: 92px 1fr 42px; align-items: center; gap: 12px; }
.bar .lab { font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.bar .track { height: 9px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; transition: width .2s ease, background .2s ease; }
.bar .pct { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); text-align: right; }

.tnote { font-size: 14.5px; color: var(--text-soft); margin-top: 14px; line-height: 1.55; }
.tnote b { color: var(--accent-strong); }
.phase-pill {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  padding: 3px 11px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-strong); border: 1px solid var(--accent-ring);
}
.phase-pill.run { background: #f1f5fd; color: #2563eb; border-color: rgba(37,99,235,.3); }

.zone-info { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.zone-info .meta { min-width: 200px; flex: 1 1 200px; }
.zone-info .meta .name { font-weight: 700; font-size: 16px; color: var(--text); }
.zone-info .meta .desc { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

/* glossary definition list */
.gloss { margin: 26px 0; }
.gloss dt { font-weight: 700; color: var(--accent-strong); margin-top: 18px; font-size: 16px; }
.gloss dd { margin: 3px 0 0; color: var(--text-soft); }
.gloss dd + dt { border-top: 1px solid var(--border); padding-top: 16px; }
