/*
 * Levain docs: one stylesheet for every page.
 * Why: the docs should feel like the theme itself — warm paper, ink hairlines, Fraunces with italic tails,
 * a colored band with wavy edges and stamp details — while staying fast and readable.
 * How: color and type tokens on :root (light) with a dark set; components are BEM-ish blocks.
 */
:root {
  --paper: #f8eedc;
  --cream: #fcf5e8;
  --ink: #28241b;
  --muted: #5f5747;
  --line: #d6c7ab;
  --accent: #a62f22;
  --butter: #efbc63;
  --band: #d8e1c7;
  --band-ink: #28241b;
  --forest: #283a2c;
  --forest-ink: #f8eedc;
  --focus: #a62f22;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1d1a14;
    --cream: #26221a;
    --ink: #f3e8d4;
    --muted: #c2b59c;
    --line: #4a4335;
    --accent: #f08a74;
    --butter: #efbc63;
    --band: #2b3a2e;
    --band-ink: #eef0e2;
    --forest: #11180f;
    --forest-ink: #f3e8d4;
    --focus: #f0a08f;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.65 var(--font-body);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; z-index: 10; }
.skip:focus { top: 12px; }
.detail { font: 400 0.78rem/1.4 var(--font-mono); letter-spacing: 0.02em; color: var(--muted); font-variant-numeric: tabular-nums; }
.detail a { color: inherit; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 600 1.5rem/1 var(--font-display); text-decoration: none; letter-spacing: -0.02em; }
.wordmark__seal { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--cream); font: italic 600 1.05rem/1 var(--font-display); transform: rotate(-6deg); }
.top__nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); font-weight: 500; }
.top__nav a { text-decoration: none; padding-block: 6px; border-bottom: 1.5px solid transparent; }
.top__nav a[aria-current='page'] { border-color: currentColor; }
.pill { font: 400 0.75rem/1 var(--font-mono); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); }

/* Type */
.display { font: 500 clamp(2.6rem, 7.5vw, 6rem)/0.95 var(--font-display); letter-spacing: -0.035em; margin: 0 0 24px; font-variation-settings: 'opsz' 144; }
.display em, .h2 em, .foot__mark em { font-style: italic; color: var(--accent); }
.display--page { font-size: clamp(2.3rem, 5.5vw, 4.2rem); }
.h2 { font: 500 clamp(1.8rem, 3.6vw, 2.8rem)/1.05 var(--font-display); letter-spacing: -0.025em; margin: 0; }
.h3 { font: 600 1.35rem/1.2 var(--font-display); margin: 0 0 20px; }
.lead { font-size: clamp(1.08rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 40em; margin: 0 0 28px; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 600 0.98rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 var(--butter); transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.button:hover { color: var(--paper); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--butter); }
.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--butter); }
.button--ghost { background: transparent; color: var(--ink); box-shadow: none; }
.button--ghost:hover { color: var(--ink); background: var(--cream); box-shadow: none; }
.button[disabled] { opacity: 0.6; cursor: progress; }

/* Home */
.hero { position: relative; padding-block: clamp(56px, 10vw, 120px) clamp(40px, 7vw, 80px); }
.dictionary { font: 400 0.85rem/1.5 var(--font-mono); color: var(--muted); max-width: 34em; margin: 0 0 28px; }
.dictionary span { color: var(--accent); }
.hero .display { max-width: 11ch; }
.hero .display em { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--butter) 70%, transparent) 62% 92%, transparent 92%); color: inherit; padding-inline: 0.04em; }
.stamp {
  position: absolute; inset-inline-end: 0; top: clamp(48px, 9vw, 110px); display: grid; place-items: center;
  width: clamp(92px, 12vw, 132px); aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed var(--accent);
  color: var(--accent); font: italic 600 clamp(1.1rem, 2vw, 1.5rem)/1 var(--font-display); transform: rotate(-12deg);
}
.block { padding-block: clamp(40px, 7vw, 88px); }
.split-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.more { font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; }
.more::after { content: ' →'; }
.topics { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.topic a, .index a { display: grid; gap: 8px; height: 100%; padding: 22px; text-decoration: none; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background-color 0.25s var(--ease); }
.topic a:hover, .index a:hover { background: var(--cream); color: inherit; }
.topic__title { font: 600 1.2rem/1.2 var(--font-display); }
.topic a:hover .topic__title, .index a:hover .topic__title { color: var(--accent); }
.topic__summary { color: var(--muted); font-size: 0.93rem; }
@media (min-width: 900px) {
  .topics { grid-template-columns: repeat(12, 1fr); }
  .topic { grid-column: span 3; }
  .topic--big { grid-column: span 6; }
  .topic--big .topic__title { font-size: 1.7rem; }
}
.band { background: var(--band); color: var(--band-ink); margin-block: 24px; }
.band__inner { padding-block: clamp(32px, 6vw, 64px); }
.wave { width: 100%; height: 18px; fill: var(--paper); background: var(--band); }
.wave--flip { transform: scaleY(-1); }
.foot .wave { background: var(--paper); fill: var(--forest); }
.presets { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.preset { display: grid; gap: 6px; padding: 20px; background: color-mix(in srgb, var(--cream) 70%, transparent); border: 1.5px solid currentColor; border-radius: var(--radius); }
.preset:nth-child(even) { transform: rotate(0.6deg); }
.preset:nth-child(odd) { transform: rotate(-0.5deg); }
.preset__swatches { display: flex; margin-bottom: 8px; }
.preset__swatches i { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--ink); margin-inline-end: -8px; }
.preset__name { font: 600 1.45rem/1.1 var(--font-display); }
.band .detail { color: inherit; opacity: 0.8; }
.cta { max-width: 760px; }
.cta p { color: var(--muted); font-size: 1.1rem; margin: 16px 0 28px; }

/* Docs */
.docs { display: grid; gap: 32px; padding-block: 32px 72px; }
@media (min-width: 960px) { .docs { grid-template-columns: 250px minmax(0, 1fr); gap: 64px; padding-top: 56px; } }
.docs__nav { display: grid; gap: 16px; align-content: start; }
@media (min-width: 960px) { .docs__nav { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; } }
.toc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--cream); }
.toc summary { cursor: pointer; padding: 12px 16px; font: 400 0.8rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; list-style: none; display: flex; justify-content: space-between; }
.toc summary::after { content: '+'; }
.toc[open] summary::after { content: '–'; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0 8px 10px; }
.toc a { display: block; padding: 7px 10px; border-radius: 8px; text-decoration: none; font-size: 0.94rem; }
.toc a[aria-current='page'] { background: var(--ink); color: var(--paper); }
.help-card { display: grid; gap: 2px; padding: 14px 16px; border: 1.5px dashed var(--accent); border-radius: var(--radius); text-decoration: none; font: 600 1.05rem/1.3 var(--font-display); }
.prose { max-width: 760px; min-width: 0; }
.prose h3 { font: 600 1.4rem/1.2 var(--font-display); margin: 40px 0 12px; }
.prose p, .prose li { font-size: 1.04rem; }
.prose li { margin-block: 6px; }
.prose li::marker { color: var(--accent); font-family: var(--font-mono); font-size: 0.85em; }
.prose strong { font-weight: 600; }
.prose code { font: 0.86em var(--font-mono); background: var(--cream); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.table-wrap { overflow-x: auto; margin: 24px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.table-wrap table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.95rem; }
.table-wrap th { text-align: start; font: 400 0.76rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 12px 14px 10px 0; border-bottom: 1px solid var(--ink); }
.table-wrap td { vertical-align: top; padding: 14px 14px 14px 0; border-bottom: 1px solid var(--line); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { white-space: nowrap; }
.index { list-style: none; padding: 0; margin: 32px 0 0; border-top: 1px solid var(--line); }
.index a { border-inline: 0; padding-inline: 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font: 600 1.1rem/1.25 var(--font-display); }
.pager a[rel='next'] { text-align: end; }
.pager a:hover { background: var(--cream); }

/* Support */
.support { display: grid; gap: 40px; padding-block: clamp(40px, 7vw, 80px); }
@media (min-width: 960px) { .support { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; } .support__intro { position: sticky; top: 96px; } }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 40px 1fr; padding: 14px 0; border-bottom: 1px solid var(--line); }
.form { background: var(--cream); border: 1.5px solid var(--ink); border-radius: calc(var(--radius) + 6px); padding: clamp(20px, 4vw, 36px); box-shadow: 6px 6px 0 var(--band); display: grid; gap: 18px; }
.field-row { display: grid; gap: 18px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; font: 400 1rem/1.4 var(--font-body); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; transition: border-color 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 160px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.field [aria-invalid='true'] { border-color: var(--accent); }
.field ::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 6px; }
.notice { padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--accent); color: var(--ink); background: var(--paper); }
.notice--ok { border-color: var(--ink); }
.trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sent { padding-block: clamp(64px, 12vw, 140px); max-width: 760px; }
.sent .reference { font-family: var(--font-mono); color: var(--accent); }

/* Footer */
.foot { margin-top: 40px; }
.foot__band { background: var(--forest); color: var(--forest-ink); }
.foot__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-block: 40px 48px; }
.foot__mark { font: 500 1.8rem/1 var(--font-display); margin: 0 0 8px; }
.foot__mark em { color: var(--butter); }
.foot .detail { color: inherit; opacity: 0.75; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: start; }
.foot a:hover { color: var(--butter); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* WHY: on narrow screens the stamp would sit on the dictionary line; it is decoration only. */
@media (max-width: 719px) { .stamp { display: none; } }

/* Screenshots from the demo stores */
.preset__shot { width: calc(100% + 40px); max-width: none; margin: -20px -20px 14px; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0; border-bottom: 1.5px solid currentColor; }
.preset { overflow: hidden; }
.gallery-title { margin-top: 48px; }
.gallery { display: grid; gap: 28px 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin: 20px 0 8px; }
.gallery--presets { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.shot { margin: 0; display: grid; gap: 12px; }
.shot img { width: 100%; height: auto; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--cream); }
.shot figcaption { display: grid; gap: 4px; }
.gallery--presets figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.shot__frames { position: relative; padding-inline-end: 18%; padding-block-end: 8%; }
.shot__desktop { aspect-ratio: 4 / 3.4; object-fit: cover; object-position: top; }
.shot .shot__mobile { position: absolute; inset-inline-end: 0; bottom: 0; width: 30%; aspect-ratio: 375 / 667; border-radius: 16px; box-shadow: 4px 4px 0 var(--butter); }
