/* ============================================================================
   The demo theme.
   A worked example of a front end, not a framework: every class here is used by a
   template in app/views/site/, and nothing in the CMS depends on any of it. Change
   it, or delete it and write your own — the admin carries on either way.

   The one value that comes from the CMS is --accent (Settings → Look).
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  --accent: #2f6f4f;
  --accent-fg: #ffffff;

  --bg: #fcfcfb;
  --bg-2: #f4f4f1;
  --fg: #14161a;
  --fg-2: #474d55;
  --muted: #5d646c;
  --line: #e6e5e0;
  --line-2: #d6d5ce;

  /* The code block keeps its own dark palette in both themes. */
  --code-bg: #15181c;
  --code-fg: #d7dde4;
  --code-dim: #7d8794;
  --code-line: #272c33;

  /* The accent is a setting, so it can be any colour. For small text we use a version of
     it pinned to a readable lightness instead — dark on paper, light on near-black. */
  --accent-text: color-mix(in oklch, var(--accent) 75%, black);

  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 72rem;
  --measure: 36rem;
  --step: clamp(3.5rem, 7vw, 6rem);   /* vertical rhythm between bands */

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@supports (color: oklch(from red 0.5 c h)) {
  :root { --accent-text: oklch(from var(--accent) 0.45 c h); }
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-text: color-mix(in oklch, var(--accent) 55%, white);
    --bg: #0f1114;
    --bg-2: #161a1e;
    --fg: #edeff2;
    --fg-2: #b2bac3;
    --muted: #868f99;
    --line: #232930;
    --line-2: #2f363e;
  }
  @supports (color: oklch(from red 0.5 c h)) {
    :root { --accent-text: oklch(from var(--accent) 0.78 c h); }
  }
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.1; letter-spacing: -0.03em; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.125rem; letter-spacing: -0.015em; }
p, ul, ol, figure, blockquote, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--accent-fg); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap.narrow { width: min(100% - 2.5rem, 46rem); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.push { margin-left: auto; }
.muted { color: var(--muted); }
.right { text-align: right; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius-sm); transition: top .15s; }
.skip:focus { top: 1rem; }

/* --------------------------------------------------------- header & footer */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-block: .9rem;
}
.brand { font-weight: 650; letter-spacing: -0.02em; font-size: 1.05rem; display: inline-flex; align-items: center; gap: .55rem; }
.brand::before {
  content: ""; width: .95rem; height: .95rem; border-radius: 4px; flex: none;
  background: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.site-nav { display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: .95rem; }
.site-nav a { color: var(--fg-2); }
.site-nav a:hover { color: var(--fg); }
.editbar { background: color-mix(in oklch, var(--accent) 14%, var(--bg)); border-bottom: 1px solid var(--line); font-size: .875rem; padding-block: .55rem; }
.editbar a { text-decoration: underline; }

.site-foot { margin-top: var(--step); border-top: 1px solid var(--line); padding-block: 3rem 3.5rem; font-size: .95rem; background: var(--bg-2); }
.foot-grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.foot-grid h2 { font-family: var(--mono); font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: .75rem; }
.foot-grid nav a { display: block; padding-block: .25rem; color: var(--fg-2); }
.foot-grid nav a:hover { color: var(--fg); }
.foot-base { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: .85rem; }

/* ------------------------------------------------------------------ pieces */
.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .14em; color: var(--accent-text);
  margin-bottom: 1rem;
}
.lede { margin-top: 1.25rem; font-size: 1.2rem; color: var(--fg-2); max-width: var(--measure); }
.lede p + p { margin-top: .75em; }
.lede strong { color: var(--fg); font-weight: 600; }
.note { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 3rem; padding: 0 1.35rem;
  border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-fg);
  font-weight: 600; font-size: .95rem; border: 1px solid transparent;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { background: color-mix(in oklch, var(--accent) 86%, black); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--bg-2); border-color: var(--fg-2); }

/* ------------------------------------------------------------------- bands */
.hero { padding-block: clamp(4rem, 10vw, 8rem) var(--step); }
.hero h1 { max-width: 18ch; }
.hero .lede { font-size: clamp(1.15rem, 2vw, 1.35rem); max-width: 42rem; }
.band { padding-block: var(--step); border-top: 1px solid var(--line); }
.band__head { max-width: var(--measure); margin-bottom: 3rem; }
.band--quote { background: var(--bg-2); text-align: center; }
.band--quote blockquote { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 550; letter-spacing: -0.02em; line-height: 1.3; text-wrap: balance; }
.band--quote cite { display: block; margin-top: 1.5rem; font-style: normal; font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.band--cta { background: color-mix(in oklch, var(--accent) 10%, var(--bg)); text-align: center; }
.band--cta .lede { margin-inline: auto; }
.band--cta .actions { justify-content: center; }

/* code example beside its explanation */
.split { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 62rem) { .split { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 4rem; } }
.split__text .prose { color: var(--fg-2); }
.code { background: var(--code-bg); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--code-line); }
.code__name { font-family: var(--mono); font-size: .75rem; color: var(--code-dim); padding: .7rem 1rem; border-bottom: 1px solid var(--code-line); }
.code pre { margin: 0; padding: 1.25rem 1rem; overflow-x: auto; }
.code code { color: var(--code-fg); font-size: .82rem; line-height: 1.75; white-space: pre; }
.code__caption { font-size: .8rem; color: var(--code-dim); padding: .75rem 1rem 1rem; border-top: 1px solid var(--code-line); }

/* feature grid */
.features { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 40rem) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .features { grid-template-columns: repeat(3, 1fr); } }
.features li { background: var(--bg); padding: 1.75rem 1.5rem; }
.features h3 { margin-bottom: .5rem; }
.features h3::before { content: ""; display: block; width: 1.5rem; height: 2px; background: var(--accent); margin-bottom: .9rem; }
.features p { color: var(--fg-2); font-size: .95rem; }

/* numbered steps */
.steps { display: grid; gap: 1.5rem; counter-reset: step; }
@media (min-width: 52rem) { .steps { grid-template-columns: repeat(2, 1fr); gap: 2.5rem 3rem; } }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start; }
.steps__n { font-family: var(--mono); font-size: .8rem; color: var(--accent-text); padding-top: .2rem; }
.steps h3 { margin-bottom: .35rem; }
.steps p { color: var(--fg-2); font-size: .95rem; }

/* faq */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.15rem 2rem 1.15rem 0; position: relative;
  font-weight: 550; font-size: 1.05rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .25rem; top: 1rem; font-family: var(--mono); color: var(--muted); font-size: 1.1rem; }
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--accent-text); }
.faq .prose { padding-bottom: 1.35rem; color: var(--fg-2); max-width: var(--measure); }

/* ------------------------------------------------------- articles & pages */
.page-head { padding-block: clamp(3rem, 6vw, 5rem) 2rem; max-width: var(--measure); }
.kicker { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 1rem; }
.kicker a:hover { color: var(--accent-text); }
.byline { margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.cover { margin-block: 2.5rem; }
.cover img { border-radius: var(--radius); width: 100%; }

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.3em; }
.prose h2 { font-size: 1.55rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3rem; list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--muted); }
.prose a { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .2em; }
.prose blockquote { padding-left: 1.2rem; border-left: 3px solid var(--accent); color: var(--fg-2); }
.prose code { background: var(--bg-2); padding: .12em .4em; border-radius: 5px; font-size: .88em; }
.prose pre { background: var(--code-bg); color: var(--code-fg); padding: 1.1rem 1.2rem; border-radius: var(--radius); overflow-x: auto; font-size: .82rem; line-height: 1.7; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose img { border-radius: var(--radius); }
.prose-page { padding-bottom: var(--step); }
.tags { margin-top: 3rem; display: flex; flex-wrap: wrap; gap: .45rem; }
.tags span { font-family: var(--mono); font-size: .72rem; color: var(--muted); border: 1px solid var(--line-2); border-radius: 99px; padding: .2rem .7rem; }

.card-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); display: flex; flex-direction: column; transition: border-color .2s ease, transform .2s ease; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card__shot img { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.card__body { padding: 1.4rem 1.5rem 1.6rem; display: grid; gap: .6rem; }
.card h2 { font-size: 1.3rem; }
.card h2 a:hover { color: var(--accent-text); }
.card p { color: var(--fg-2); font-size: .95rem; }
.card .byline { margin-top: .2rem; font-size: .8rem; }
.empty { padding: 4rem 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: 3.5rem; font-size: .9rem; }
.pager { display: grid; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--line); }
@media (min-width: 40rem) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: grid; gap: .3rem; }
.pager a:hover b { color: var(--accent-text); }
.pager span { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.pager b { font-weight: 600; letter-spacing: -0.015em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
