/* ==========================================================================
   MDB Co — Scroll Story. Base layer: fonts, tokens, type, header, footer,
   long-form pages, post lists, menus. Authored fresh for this theme.
   Home-page chapters live in css/mdb.css.
   ========================================================================== */

@font-face { font-family: "Instrument Serif"; src: url("../assets/fonts/instrument-serif-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../assets/fonts/instrument-serif-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("../assets/fonts/hanken-grotesk-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../assets/fonts/geist-mono-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --espresso: #1B1612;
  --espresso-2: #241D18;
  --espresso-3: #2E2620;
  --bone: #EEE7DB;
  --bone-dim: #B3A795;
  --linen: #F2ECE2;
  --linen-2: #E7DFD1;
  --ink: #1B1612;
  --ink-muted: #5E544A;
  --brass: #B8955E;
  --brass-light: #C9A872;
  --brass-deep: #7F6236;
  --line-dark: rgba(238, 231, 219, 0.16);
  --line-light: rgba(27, 22, 18, 0.14);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --hdr: 68px;
  --gutter: clamp(20px, 4.5vw, 64px);
  --maxw: 1320px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  /* Pinned kUInetic sections clear the host's preview bar; the header overlays them by design. */
  --kui-pin-offset: var(--tovu-theme-preview-height, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video, svg { max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; text-wrap: balance; }
em { font-style: italic; }
button { font: inherit; }
address { font-style: normal; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--brass); color: var(--espresso); padding: 10px 16px; border-radius: 999px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: calc(var(--tovu-theme-preview-height, 0px) + 12px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font: 600 0.8125rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-brass { background: var(--brass); color: var(--espresso); }
.btn-brass:hover { background: var(--brass-light); }
.btn-line { border-color: currentColor; color: inherit; background: transparent; }
.btn-line:hover { background: rgba(238, 231, 219, 0.1); }
.btn-ink { background: var(--ink); color: var(--bone); }
.btn-ink:hover { background: var(--espresso-3); }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover { transition: none; transform: none; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: var(--tovu-theme-preview-height, 0px); z-index: 60;
  background: rgba(27, 22, 18, 0.93);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  color: var(--bone);
  border-bottom: 1px solid var(--line-dark);
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: var(--hdr); padding-inline: var(--gutter); max-width: 1600px; margin-inline: auto;
}
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1; flex: none; }
.brand-word { font-family: var(--serif); font-size: 1.5rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-word em { color: var(--brass-light); }
.brand-sub { margin-top: 5px; font-size: 0.625rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--bone-dim); white-space: nowrap; }

.main-nav { display: flex; align-items: center; }
.main-nav > ul, .main-nav .menu-list { list-style: none; margin: 0; padding: 0; }
.main-nav > ul { display: flex; align-items: center; gap: 4px; }
.main-nav > a, .main-nav > ul > li > a, .main-nav > ul > li > .menu-item-label {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px;
  font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  color: var(--bone); opacity: 0.86; border-radius: 999px; white-space: nowrap;
}
.main-nav a:hover, .main-nav a:focus-visible { opacity: 1; color: var(--brass-light); }
.main-nav .is-current > a, .main-nav a[aria-current="page"] { opacity: 1; color: var(--brass-light); }
.main-nav li { position: relative; }
.main-nav li.has-children > a::after {
  content: ""; width: 6px; height: 6px; margin-left: 2px; margin-top: -3px;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: rotate(45deg);
}
.main-nav .menu-list.depth-1 {
  position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px; padding: 10px;
  background: var(--espresso-2); border: 1px solid var(--line-dark); border-radius: 16px;
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.6);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.main-nav .menu-list.depth-1::before { content: ""; position: absolute; inset: -10px 0 auto; height: 10px; }
.main-nav li.has-children:hover > .menu-list.depth-1,
.main-nav li.has-children:focus-within > .menu-list.depth-1 {
  opacity: 1; visibility: visible; transform: none; transition-delay: 0s;
}
.main-nav .menu-list.depth-1 a {
  display: block; padding: 10px 14px; border-radius: 10px; text-decoration: none;
  font-size: 0.9375rem; color: var(--bone); white-space: nowrap;
}
.main-nav .menu-list.depth-1 a:hover, .main-nav .menu-list.depth-1 a:focus-visible { background: var(--espresso-3); color: var(--brass-light); }

.nav-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.nav-cta { min-height: 40px; padding: 0 18px; font-size: 0.75rem; }
.nav-toggle {
  display: none; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  background: transparent; color: var(--bone); border: 1px solid var(--line-dark); border-radius: 999px; cursor: pointer;
  font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.nav-toggle:hover { border-color: var(--brass); }
@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; }
}
.site-header.nav-compact .main-nav { display: none; }
.site-header.nav-compact .nav-toggle { display: inline-flex; }
@media (max-width: 560px) {
  .nav-cta { display: none; }
  .brand-word { font-size: 1.3rem; }
}

/* ---------- compact menu (dialog) ---------- */
.mnav {
  margin: 0 0 0 auto; padding: 0; border: 0; width: min(420px, 100vw); max-width: 100vw;
  height: 100dvh; max-height: 100dvh; background: var(--espresso); color: var(--bone);
}
.mnav::backdrop { background: rgba(10, 8, 6, 0.6); }
.mnav[open] { animation: ss-drawer .35s var(--ease-out); }
@keyframes ss-drawer { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mnav[open] { animation: none; } }
html.mnav-open { overflow: hidden; }
.mnav-panel { display: flex; flex-direction: column; height: 100%; padding: calc(20px + var(--tovu-theme-preview-height, 0px)) 24px 28px; }
.mnav-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line-dark); }
.mnav-title { font-family: var(--serif); font-size: 1.4rem; }
.mnav-title em { color: var(--brass-light); }
.mnav-close {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: transparent; color: var(--bone); border: 1px solid var(--line-dark); cursor: pointer;
}
.mnav-body { flex: 1; overflow-y: auto; padding: 12px 0; }
.mnav-list { list-style: none; margin: 0; padding: 0; }
.mnav-list .mnav-list { padding: 0 0 8px 16px; }
.mnav-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mnav-link {
  display: block; flex: 1; padding: 12px 0; text-decoration: none;
  font-family: var(--serif); font-size: 1.75rem; line-height: 1.15; color: var(--bone);
}
.mnav-list .mnav-list .mnav-link { font-family: var(--sans); font-size: 1rem; padding: 9px 0; color: var(--bone-dim); }
.mnav-link[aria-current="page"], .mnav-link:hover { color: var(--brass-light); }
.mnav-disclose {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px;
  background: transparent; color: var(--bone); border: 1px solid var(--line-dark); border-radius: 999px; cursor: pointer;
}
.mnav-disclose svg { width: 18px; height: 18px; transition: transform .2s ease; }
.mnav-disclose[aria-expanded="true"] svg { transform: rotate(180deg); }
.mnav-disclose-label { flex: 1; justify-content: space-between; border: 0; padding: 12px 0; font-family: var(--serif); font-size: 1.75rem; }
.mnav-foot { padding-top: 16px; border-top: 1px solid var(--line-dark); }
.mnav-foot .btn { width: 100%; }

/* ---------- footer ---------- */
.site-footer { background: var(--espresso); color: var(--bone); padding: clamp(48px, 5vw, 72px) 0 32px; }
.footer-lead { display: grid; gap: 16px; padding-bottom: clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--line-dark); }
.footer-mark { margin: 0; font-family: var(--serif); font-size: clamp(2.5rem, 7vw, 6.5rem); line-height: 0.95; letter-spacing: -0.02em; }
.footer-mark em { color: var(--brass-light); }
.footer-note { max-width: 46ch; margin: 0; color: var(--bone-dim); }
.footer-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; padding: 40px 0; }
.footer-col h2 { margin-bottom: 14px; font: 600 0.75rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass-light); }
.footer-col a { display: block; width: fit-content; padding: 5px 0; text-decoration: none; color: var(--bone); opacity: 0.86; }
.footer-col a:hover { opacity: 1; color: var(--brass-light); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col address { color: var(--bone-dim); }
.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 24px; border-top: 1px solid var(--line-dark); font-size: 0.8125rem; color: var(--bone-dim);
}
.footer-legal, .footer-legal ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; }
.footer-legal a { color: var(--bone-dim); text-decoration: none; }
.footer-legal a:hover { color: var(--brass-light); }
.site-footer-min { padding: 28px 0; }
.site-footer-min .footer-bottom { border-top: 0; padding-top: 0; }
@media (max-width: 640px) { .footer-top { grid-template-columns: 1fr 1fr; } .footer-top .footer-col:last-child { grid-column: 1 / -1; } }

/* ---------- page heroes and long-form content (pages, posts, legal) ---------- */
.page-hero { background: var(--espresso); color: var(--bone); padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 72px); }
.page-hero .eyebrow { margin-bottom: 18px; font: 600 0.75rem/1 var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--brass-light); }
.page-hero h1 { font-family: var(--serif); font-size: clamp(2.6rem, 7vw, 6rem); line-height: 1; letter-spacing: -0.02em; }
.page-hero h1 em { color: var(--brass-light); }
.page-hero .lede { max-width: 52ch; margin: 20px 0 0; color: var(--bone-dim); font-size: 1.125rem; }
.page-hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.post-detail { max-width: 860px; margin-inline: auto; padding-block: clamp(48px, 7vw, 96px) clamp(40px, 5vw, 64px); }
.post-detail > div > h1:first-child, .post-detail h1 {
  font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 4.75rem); line-height: 1.02; letter-spacing: -0.02em; margin-bottom: 0.5em;
}
.post-detail h2 { font-family: var(--serif); font-size: clamp(1.75rem, 3.6vw, 2.6rem); line-height: 1.1; margin: 1.6em 0 0.5em; }
.post-detail h3 { font-family: var(--sans); font-weight: 600; font-size: 1.15rem; margin: 1.5em 0 0.4em; }
.post-detail p, .post-detail li { max-width: 68ch; color: #2F2822; }
.post-detail a { color: var(--brass-deep); }
.post-detail a:hover { color: var(--ink); }
.post-detail ul, .post-detail ol { padding-left: 1.2em; }
.post-detail li { margin-bottom: 0.4em; }
.post-detail img { border-radius: 14px; }
.post-detail blockquote { margin: 2em 0; padding-left: 24px; border-left: 2px solid var(--brass); font-family: var(--serif); font-size: 1.6rem; line-height: 1.3; }
.post-detail hr { border: 0; border-top: 1px solid var(--line-light); margin: 2.5em 0; }
.post-detail table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.post-detail th, .post-detail td { padding: 10px 12px; border-bottom: 1px solid var(--line-light); text-align: left; }
.post-detail code { font-family: var(--mono); font-size: 0.9em; background: var(--linen-2); padding: 2px 6px; border-radius: 6px; }
.post-detail pre { overflow-x: auto; padding: 20px; background: var(--espresso); color: var(--bone); border-radius: 14px; }
.post-detail pre code { background: none; padding: 0; }
.listing-intro { max-width: var(--maxw); padding-bottom: clamp(24px, 3vw, 40px); }
.post-meta, .post-author { font-size: 0.875rem; color: var(--ink-muted); }
.post-featured { margin: 0; }
.post-featured img { display: block; width: 100%; max-height: 72vh; object-fit: cover; }
.post-comments { max-width: 860px; margin-inline: auto; padding-bottom: 72px; }

.code-block-wrap { position: relative; }
.code-copy-btn {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--espresso-3); color: var(--bone); border: 1px solid var(--line-dark); border-radius: 8px; cursor: pointer;
}
.code-copy-btn svg { width: 16px; height: 16px; }
.code-copy-btn .icon-check, .code-copy-btn.copied .icon-copy { display: none; }
.code-copy-btn.copied .icon-check { display: block; }

/* ---------- post lists ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; max-width: var(--maxw); margin-inline: auto; padding: 0 var(--gutter) clamp(40px, 5vw, 64px); }
.blog-grid > p { grid-column: 1 / -1; color: var(--ink-muted); }
.post-card { display: flex; flex-direction: column; min-width: 0; padding: 0 0 20px; border-bottom: 1px solid var(--line-light); }
.post-card a { text-decoration: none; }
.post-card-media { aspect-ratio: 4 / 3; margin-bottom: 18px; overflow: hidden; border-radius: 14px; background: var(--linen-2); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.post-card:hover .post-card-media img { transform: scale(1.03); }
.post-card .tag { align-self: flex-start; margin-bottom: 10px; font-size: 0.6875rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--brass-deep); }
.post-card h2, .post-card h3 { font-family: var(--serif); font-size: 1.65rem; line-height: 1.1; margin-bottom: 10px; }
.post-card p { font-size: 0.95rem; color: var(--ink-muted); }
.post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.post-card.featured .post-card-media { margin: 0; }
.jini-pagination { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 24px; }
.jini-pagination a { font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.jini-pagination-status { color: var(--ink-muted); font-size: 0.875rem; }
@media (max-width: 900px) { .blog-grid { grid-template-columns: 1fr 1fr; } .post-card.featured { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .blog-grid { grid-template-columns: 1fr; } }

/* ---------- forms (comments, contact embeds) ---------- */
input, textarea, select {
  font: inherit; color: var(--ink); background: #FBF8F3; border: 1px solid var(--line-light); border-radius: 10px; padding: 12px 14px; max-width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
button[type="submit"] { background: var(--ink); color: var(--bone); border: 0; border-radius: 999px; min-height: 46px; padding: 0 22px; cursor: pointer; }

/* ---------- 404 ---------- */
.ss-404 { min-height: calc(100svh - var(--hdr) - var(--tovu-theme-preview-height, 0px)); display: grid; align-content: center; }
.ss-404 .big { font-family: var(--serif); font-size: clamp(6rem, 24vw, 18rem); line-height: 0.85; color: var(--brass-light); margin-bottom: 12px; }

/* ---------- lightbox (scripts/vendor/lightbox.js) ---------- */
.lightbox-overlay, .jini-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(10, 8, 6, 0.92); }
.lightbox-overlay img, .jini-lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; }
