/* Right Portion Kitchen: a food blog. Built from DESIGN-cohere.md tokens. */
:root {
  --primary: #17171c;
  --black: #000000;
  --ink: #212121;
  --canvas: #ffffff;
  --soft-stone: #eeece7;
  --reading-bg: #f8f6f1;
  --hairline: #d9d9dd;
  --border-light: #e5e7eb;
  --muted: #6e6e7a;      /* darkened from #93939f for 4.5:1 contrast on white */
  --slate: #5f5f73;      /* darkened from #75758a for contrast */
  --body-muted: #555555;
  --action-blue: #1863dc;
  --focus-blue: #4c6ee6;
  --coral: #ff7759;
  --coral-text: #b8412a; /* coral for text on light surfaces (contrast) */
  --coral-soft: #ffad9b;
  --display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
  --body: Inter, Arial, ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r-xs: 4px; --r-sm: 8px; --r-md: 16px; --r-lg: 22px; --r-pill: 32px;
  --container: 1200px;
  --lh: 1.65;
}

/* ---------- Reader settings (set on <html> by reader.js) ---------- */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-size="1"] { font-size: 112.5%; }
html[data-size="2"] { font-size: 125%; }
html[data-font="easy"] { --body: "Atkinson Hyperlegible", Verdana, Arial, sans-serif; --display: "Atkinson Hyperlegible", Verdana, Arial, sans-serif; }
html[data-spacing="wide"] { --lh: 1.95; }
html[data-spacing="wide"] .prose { letter-spacing: 0.02em; word-spacing: 0.08em; }
html[data-links="underline"] a { text-decoration: underline !important; text-underline-offset: 3px; }
html[data-contrast="high"] {
  --ink: #000; --muted: #2b2b2b; --slate: #2b2b2b; --body-muted: #1a1a1a;
  --hairline: #6b6b6b; --border-light: #6b6b6b; --coral-text: #8a2a17; --action-blue: #0b3fa8;
}
html[data-contrast="high"] .chip { border-color: #000; }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--body); font-size: 1rem; line-height: 1.5; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus-blue); outline-offset: 3px; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.nav { border-bottom: 1px solid var(--border-light); background: var(--canvas); position: sticky; top: 0; z-index: 30; }
.nav .container { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 68px; gap: 16px; }
.logo { font-family: var(--display); font-size: 1.25rem; letter-spacing: -0.4px; text-decoration: none; color: var(--black); white-space: nowrap; }
.logo span { color: var(--coral-text); }
.menu { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.menu a { text-decoration: none; }
.menu a:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav-tools { justify-self: end; display: flex; gap: 8px; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: transparent; border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 7px 14px; font-size: .875rem; line-height: 1.4; color: var(--ink);
}
.tool-btn:hover { border-color: var(--ink); }
.tool-btn[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.tool-btn svg { width: 16px; height: 16px; flex: none; }
.count { font-family: var(--mono); font-size: .75rem; background: var(--soft-stone); color: var(--ink); border-radius: 999px; padding: 0 7px; }

/* ---------- Buttons, chips, labels ---------- */
.btn { display: inline-block; text-decoration: none; cursor: pointer; font-size: .875rem; font-weight: 500; line-height: 1.71; border-radius: var(--r-pill); padding: 12px 24px; border: 1px solid transparent; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--black); }
.btn-text { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.mono-label { font-family: var(--mono); font-size: .875rem; letter-spacing: 0.28px; text-transform: uppercase; color: var(--slate); }
.chip { display: inline-block; font-size: .875rem; line-height: 1.4; color: var(--coral-text); border: 1px solid var(--coral-soft); background: #fff5f2; border-radius: var(--r-sm); padding: 4px 12px; text-decoration: none; white-space: nowrap; cursor: pointer; }
.chip-lg { font-size: 1.125rem; padding: 6px 14px; }
.chip[aria-pressed="true"] { background: var(--coral); color: var(--ink); border-color: var(--coral); }

/* ---------- Home ---------- */
.hero { padding: 80px 0 40px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(48px, 9vw, 96px); line-height: 1; letter-spacing: -0.02em; margin: 16px 0 20px; max-width: 12ch; color: var(--black); }
.hero .lead { font-size: 1.125rem; line-height: 1.45; color: var(--body-muted); max-width: 560px; margin: 0; }
.featured { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; align-items: center; margin-top: 56px; text-decoration: none; }
.featured img { border-radius: var(--r-lg); width: 100%; }
.featured .label { margin-bottom: 12px; display: block; }
.featured h2 { font-weight: 400; font-size: clamp(1.75rem, 3.2vw, 2.25rem); line-height: 1.2; letter-spacing: -0.01em; margin: 12px 0; }
.featured:hover h2 { text-decoration: underline; text-underline-offset: 5px; }
.featured p { color: var(--body-muted); margin: 0 0 16px; font-size: 1.0625rem; }
.post-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .875rem; }

.section { padding: 56px 0; }
.section-head h2 { font-weight: 400; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.2; letter-spacing: -0.01em; margin: 8px 0 24px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.post-row { display: grid; grid-template-columns: 1fr auto auto; gap: 24px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--hairline); }
.post-row a.title { font-size: 1.375rem; line-height: 1.3; text-decoration: none; }
.post-row a.title:hover { text-decoration: underline; text-underline-offset: 5px; }
.post-row p { margin: 6px 0 0; color: var(--body-muted); }
.post-row .when { color: var(--muted); font-size: .875rem; text-align: right; white-space: nowrap; }
.post-row .chip { justify-self: start; }
.about-text { max-width: 640px; font-size: 1.125rem; line-height: 1.6; color: var(--body-muted); margin: 0; }

/* ---------- Article ---------- */
.progress { position: fixed; top: 0; left: 0; height: 4px; width: 100%; z-index: 60; background: transparent; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--coral); transition: width .1s linear; }
.article-hero { padding: 56px 0 32px; }
.article-hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.25rem, 6vw, 4.5rem); line-height: 1.02; letter-spacing: -0.02em; margin: 20px 0; max-width: 18ch; color: var(--black); }
.article-hero .dek { font-size: 1.125rem; line-height: 1.45; color: var(--body-muted); max-width: 640px; margin: 0 0 24px; }
.article-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.article-figure { margin: 0; }
.article-figure img { border-radius: var(--r-lg); width: 100%; }
figcaption { font-size: .875rem; color: var(--muted); margin-top: 10px; }

.resume { display: none; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--soft-stone); border-radius: var(--r-sm); padding: 12px 16px; margin: 0 0 24px; font-size: .9375rem; }
.resume.show { display: flex; }
.resume button { cursor: pointer; background: var(--primary); color: #fff; border: 0; border-radius: var(--r-pill); padding: 6px 14px; font-size: .875rem; }
.resume .dismiss { background: transparent; color: var(--ink); text-decoration: underline; }

.article-layout { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; justify-content: center; padding: 48px 24px 0; max-width: var(--container); margin: 0 auto; }
.toc-side { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: .875rem; }
.toc-side .mono-label { display: block; margin-bottom: 10px; font-size: .75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--hairline); }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; text-decoration: none; color: var(--body-muted); line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--coral); }
.time-left { display: block; margin-top: 14px; color: var(--muted); font-size: .8125rem; }
.toc-inline { display: none; border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 28px; }
.toc-inline summary { cursor: pointer; font-weight: 500; }
.toc-inline .toc ol { margin-top: 10px; }

.prose { font-size: 1.125rem; line-height: var(--lh); min-width: 0; }
.prose h2 { font-weight: 400; font-size: 2rem; line-height: 1.2; letter-spacing: -0.01em; margin: 56px 0 16px; }
.prose p, .prose ul, .prose ol { margin: 0 0 20px; }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--action-blue); text-underline-offset: 3px; }
.prose figure { margin: 40px 0; }
.prose figure img { border-radius: var(--r-lg); }
.prose a.btn-primary { color: #fff; text-decoration: none; }
.summary { background: var(--soft-stone); border-radius: var(--r-lg); padding: 24px 28px; margin: 0 0 32px; }
.summary h2 { font-family: var(--mono); font-size: .8125rem; font-weight: 400; letter-spacing: .28px; text-transform: uppercase; color: var(--slate); margin: 0 0 10px; }
.summary ul { margin: 0; padding-left: 20px; }
.summary li { margin-bottom: 6px; }

.table-wrap { overflow-x: auto; margin: 0 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.4; }
th, td { text-align: left; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-family: var(--mono); font-weight: 400; font-size: .8125rem; letter-spacing: .28px; text-transform: uppercase; color: var(--slate); }
.pin-block { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: center; background: var(--soft-stone); border-radius: var(--r-lg); padding: 28px; margin: 56px 0 24px; }
.pin-block img { border-radius: var(--r-sm); }
.pin-block h2 { margin-top: 8px; }
.sources { font-size: .9375rem; color: var(--body-muted); }

.related { padding: 64px 0 0; }
.related[hidden] { display: none; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.related-card { text-decoration: none; }
.related-card img { border-radius: var(--r-sm); aspect-ratio: 3 / 2; object-fit: cover; width: 100%; margin-bottom: 12px; }
.related-card h3 { font-weight: 400; font-size: 1.25rem; line-height: 1.3; margin: 8px 0 0; }
.related-card:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
.cat-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

/* ---------- Reading mode ---------- */
.exit-reading { display: none; }
html.reading body { background: var(--reading-bg); }
html.reading .nav { border: 0; background: transparent; position: static; }
html.reading .nav .container, html.reading .footer, html.reading .toc-side, html.reading .toc-inline,
html.reading .pin-block, html.reading .article-figure, html.reading .article-tools,
html.reading .related, html.reading .resume, html.reading .time-pill { display: none !important; }
html.reading .article-layout { grid-template-columns: minmax(0, 680px); }
html.reading .article-hero .container { max-width: 728px; }
@media (min-width: 1101px) { .time-pill { display: none; } }
html.reading .prose { font-size: 1.25rem; }
html.reading .exit-reading { display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 70; background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Panels (accessibility, saved) ---------- */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; }
.panel { position: fixed; top: 0; right: 0; height: 100%; width: min(380px, 100%); background: var(--canvas); z-index: 90; border-left: 1px solid var(--hairline); padding: 24px; overflow: auto; }
.panel[hidden], .panel-backdrop[hidden] { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-head h2 { font-weight: 400; font-size: 1.5rem; margin: 0; }
.close-btn { cursor: pointer; background: transparent; border: 1px solid var(--hairline); border-radius: 999px; width: 36px; height: 36px; font-size: 1.125rem; line-height: 1; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.setting > span { font-size: .9375rem; }
.setting small { display: block; color: var(--muted); font-size: .8125rem; }
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--r-pill); overflow: hidden; }
.seg button { cursor: pointer; background: transparent; border: 0; padding: 6px 12px; min-width: 40px; }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.switch { cursor: pointer; width: 46px; height: 26px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--soft-stone); position: relative; flex: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--slate); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"]::after { left: 23px; background: #fff; }
.reset-btn { margin-top: 20px; cursor: pointer; background: transparent; border: 0; text-decoration: underline; color: var(--ink); padding: 0; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { display: flex; justify-content: space-between; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.saved-list a { text-decoration: none; line-height: 1.35; }
.saved-list a:hover { text-decoration: underline; }
.saved-list button { cursor: pointer; background: transparent; border: 0; color: var(--muted); text-decoration: underline; font-size: .8125rem; flex: none; }
.empty { color: var(--muted); }

.time-pill { position: fixed; left: 16px; bottom: 16px; z-index: 40; background: var(--primary); color: #fff; font-size: .8125rem; border-radius: var(--r-pill); padding: 6px 12px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.time-pill.show { opacity: 1; transform: none; }

/* ---------- Footer ---------- */
.footer { background: var(--primary); color: #fff; margin-top: 80px; padding: 40px 0; }
.footer .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer .logo { color: #fff; }
.footer .logo span { color: var(--coral-soft); }
.footer p, .footer a { color: #c9c9d1; font-size: .875rem; margin: 0; }
.footer a:hover { color: #fff; }
.footer-links { display: flex; gap: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 720px); gap: 0; }
  .toc-side { display: none; }
  .toc-inline { display: block; }
}
@media (max-width: 768px) {
  .nav .container { grid-template-columns: 1fr auto; }
  .nav .container > nav { display: none; }
  .tool-btn .label { display: none; }
  .hero { padding: 48px 0 24px; }
  .featured { grid-template-columns: 1fr; gap: 20px; margin-top: 36px; }
  .post-row { grid-template-columns: 1fr; gap: 10px; }
  .post-row .when { text-align: left; }
  .related-grid { grid-template-columns: 1fr; }
  .pin-block { grid-template-columns: 1fr; padding: 22px; }
  .pin-block img { max-width: 220px; }
  .prose { font-size: 1.0625rem; }
  .article-layout { padding: 32px 24px 0; }
  .grid-table thead { display: none; }
  .grid-table, .grid-table tbody, .grid-table tr, .grid-table td { display: block; width: 100%; }
  .grid-table tr { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 12px; }
  .grid-table td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
  .grid-table td::before { content: attr(data-label); font-family: var(--mono); font-size: .75rem; letter-spacing: .28px; text-transform: uppercase; color: var(--slate); padding-top: 2px; }
  .grid-table td:first-child { font-weight: 500; }
}
@media (max-width: 425px) {
  .container { padding: 0 16px; }
  .article-layout { padding: 28px 16px 0; }
  .logo { font-size: 1.0625rem; }
}

/* ---------- Categories dropdown (header) ---------- */
.menu { align-items: center; }
.cat-item { position: relative; }
.cat-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cat-menu summary::-webkit-details-marker { display: none; }
.cat-menu summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.cat-menu[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.cat-menu summary:hover { text-decoration: underline; text-underline-offset: 4px; }
.cat-menu-list { position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%); z-index: 40; width: max-content; min-width: 420px; list-style: none; margin: 0; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(0, 0, 0, .10); }
.cat-menu-list a { display: block; padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink); white-space: nowrap; }
.cat-menu-list a:hover, .cat-menu-list a:focus-visible { background: var(--soft-stone); text-decoration: none; }
.footer-links { flex-wrap: wrap; gap: 10px 20px; order: 3; flex-basis: 100%; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14); }
@media (max-width: 768px) {
  .nav .container { grid-template-columns: 1fr auto auto; }
  .nav .container > nav { display: block; }
  .nav .menu > li:not(.cat-item) { display: none; }
  .cat-item { position: static; }
  .cat-menu-list { position: absolute; left: 0; right: 0; top: 100%; transform: none; width: auto; min-width: 0; grid-template-columns: 1fr; border-radius: 0; border-width: 1px 0; box-shadow: 0 12px 24px rgba(0, 0, 0, .10); }
}
@media (max-width: 560px) { /* compact header for phones */
  .nav .container { gap: 8px; }
  .nav-tools { gap: 4px; }
  .nav-tools .tool-btn { padding: 7px 8px; }
  .menu { font-size: .8125rem; }
}

/* ---------- Legal pages ---------- */
.legal-hero h1 { font-size: clamp(40px, 6vw, 64px); max-width: none; }
.legal-body { padding-bottom: 24px; }
.legal-body > * { max-width: 760px; }
.legal-body > section h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.legal-toc { background: var(--soft-stone); border-radius: var(--r-lg); padding: 20px 24px; margin: 8px 0 8px; }
.legal-toc .mono-label { margin: 0 0 8px; font-size: .75rem; }
.legal-toc ul { columns: 2; column-gap: 32px; margin: 0; padding-left: 18px; font-size: 1rem; }
.legal-body code { font-family: var(--mono); font-size: .9em; background: var(--soft-stone); padding: 1px 6px; border-radius: var(--r-xs); }
@media (max-width: 768px) { .legal-toc ul { columns: 1; } }

/* ---------- Logo mark (plate with one portion; files from tools/make_brand.py) ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo::before { content: ""; flex: none; width: 30px; height: 30px; background: url("/logo-mark.svg") center / contain no-repeat; }
@media (max-width: 560px) {
  .logo { gap: 6px; font-size: .875rem; }
  .logo::before { width: 22px; height: 22px; }
}
@media (max-width: 400px) { /* phones up to 400px: mark only in the header; the name stays in the link for screen readers and in the footer */
  .nav .logo { font-size: 0; gap: 0; }
  .nav .logo::before { width: 30px; height: 30px; }
}
