/*
  Shared tokens, base and page frame for the three static pages (home, offers, services).
  Same 4px spacing scale and width tiers as the app (src/frontend/styles/ledger.css):
  phone <=639 · tablet 640-1023 · laptop 1024-1279 · desktop >=1280 (<=379 very small phone).
  Page-specific components live in each page's <style>; the home journal lives in folio.css.
*/
:root {
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;

  /* One frame for masthead, content and footer: identical left/right edges on every page. */
  --gutter: clamp(20px, 4vw, 40px);
  --wrap-max: 1240px;
  --section-y: clamp(var(--sp-7), 8vw, 96px); /* section top/bottom padding */
  --block-gap: clamp(var(--sp-7), 5vw, 64px); /* between blocks inside a section */
  --indent: clamp(var(--sp-5), 5vw, 64px); /* text indent inside a ruled column */
  --measure: 64ch; /* prose line length */

  --bg: #f5f4f0;
  --bg-alt: #eeebe5;
  --card: #fcfbfa;
  --border: #ded9d0;
  --text: #1a1c1e;
  --text-dim: #575c65;
  --accent: #8f6140;
  --accent-hover: #754d32;
  --on-accent: #fff;
  --selection: #e8d5c6;

  --font-display: "Young Serif", Georgia, serif;
  --font-body: "Schibsted Grotesk", system-ui, sans-serif;
  --font-mono: "Azeret Mono", monospace;

  color-scheme: light;
}

/* theme.js sets data-theme before paint; without JS the OS preference applies. */
:root[data-theme="dark"] {
  --bg: #1a1714;
  --bg-alt: #2b2620;
  --card: #221e19;
  --border: #473e33;
  --text: #ece5d9;
  --text-dim: #c8bcab;
  --accent: #c98f63;
  --accent-hover: #dba67e;
  --on-accent: #1a1714;
  --selection: #5a4330;

  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1a1714;
    --bg-alt: #2b2620;
    --card: #221e19;
    --border: #473e33;
    --text: #ece5d9;
    --text-dim: #c8bcab;
    --accent: #c98f63;
    --accent-hover: #dba67e;
    --on-accent: #1a1714;
    --selection: #5a4330;

    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--sp-7);
}
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font-body);
}
::selection {
  background: var(--selection);
  color: var(--text);
}
a {
  color: inherit;
  text-underline-offset: 0.2em;
}
h1,
h2,
h3 {
  overflow-wrap: break-word;
  text-wrap: balance;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

/* Masthead, content and footer share one frame so their edges line up. */
.folio-masthead,
main,
.folio-footer {
  width: min(100% - 2 * var(--gutter), var(--wrap-max));
  margin-inline: auto;
}

/* Filled call-to-action: offers cards and the services contact button. */
.btn-primary,
a.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color 0.16s ease;
}
@media (hover: hover) {
  .btn-primary:hover,
  a.cta:hover {
    background: var(--accent-hover);
  }
}

/* Sub-pages (offers, services): one column of blocks on the shared frame. */
.sub {
  padding-block: var(--section-y);
}
.sub > * + * {
  margin-top: var(--block-gap);
}
.sub h1 {
  font: 400 clamp(36px, 5vw, 64px) / 1.2 var(--font-display);
  letter-spacing: -0.04em;
}
.sub h1 + * {
  margin-top: var(--sp-6);
}
.sub h2 {
  font: 400 clamp(28px, 3.2vw, 36px) / 1.2 var(--font-display);
  letter-spacing: -0.03em;
}
.sub h3 {
  font: 400 24px / 1.3 var(--font-display);
}
.sub section > * + * {
  margin-top: var(--sp-6);
}
.sub section h2 + * {
  margin-top: var(--sp-3);
}
.lede {
  max-width: var(--measure);
  color: var(--text-dim);
}
.note {
  max-width: var(--measure);
  color: var(--text-dim);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}
