/* Befora — Base scaffolding (uses tokens from tokens.css) */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bef-canvas);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--bef-body);
  font-size: var(--fs-16);
  line-height: 1.55;
  color: var(--bef-ink);
  background: var(--bef-canvas);
  font-feature-settings: "ss01", "ss02", "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricprecision;
}

h1, h2, h3, h4 {
  font-family: var(--bef-display);
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--bef-ink);
  margin: 0 0 var(--s-4);
}

h1 { font-size: var(--fs-56); line-height: 1.05; letter-spacing: -0.012em; }
h2 { font-size: var(--fs-36); line-height: 1.1; }
h3 { font-size: var(--fs-24); line-height: 1.2; }
h4 { font-size: var(--fs-18); line-height: 1.3; }

h5, h6 {
  font-family: var(--bef-body);
  font-weight: 600;
  color: var(--bef-ink);
  margin: 0 0 var(--s-3);
}

p { margin: 0 0 var(--s-4); }

code, kbd, samp, pre {
  font-family: var(--bef-mono);
  font-size: 0.92em;
  background: var(--bef-canvas-sunk);
  padding: 0.1em 0.35em;
  border-radius: var(--r-1);
}

a {
  color: var(--bef-honey-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--dur-2) var(--ease-quiet);
}

a:hover {
  color: var(--bef-ember);
}

:focus-visible {
  outline: 2px solid var(--bef-ember);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bef-ink);
  color: var(--bef-canvas);
  padding: var(--s-2) var(--s-4);
  z-index: 100;
}

.skip-link:focus {
  left: var(--s-3);
  top: var(--s-3);
}

hr {
  border: 0;
  height: 1px;
  background: var(--bef-hairline);
  margin: var(--s-5) 0;
}

/* Page layout — sticky-footer scaffold from page.html.twig.

   .befora-page wraps the marketing header, <main>, and the marketing footer.
   Making it a full-viewport flex column with the main slot growing pins the
   footer to the viewport bottom on short pages. */
.befora-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.befora-page__main {
  flex: 1 0 auto;
}

/* ── Display type opt-ins for marketing heroes ─────────────────────
   Body-content h1 stays at 56px. Marketing pages add `.bef-display-xl`
   (landing-hero scale) or `.bef-display-lg` (calc-hero scale) to the
   heading element to upscale it without changing the global rule. */

.bef-display-xl {
  font-family: var(--bef-display, serif);
  font-size: var(--fs-88);
  line-height: 0.98;
  letter-spacing: -0.012em;
}

.bef-display-lg {
  font-family: var(--bef-display, serif);
  font-size: var(--fs-80);
  line-height: 0.98;
  letter-spacing: -0.012em;
}

/* Eyebrow — small mono-uppercase label that prefaces section headings. */
.bef-eyebrow {
  font-family: var(--bef-mono, monospace);
  font-size: var(--fs-13);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--bef-stone, #6F6557);
}

/* ── Art-eyebrow / Art-title / Art-lede — heavier marketing typography
       above the inline `.bef-eyebrow` / h1 / lede defaults. Use on
       hero blocks and full-page artwork. */
.bef-art-eyebrow {
  font-family: var(--bef-mono);
  font-size: var(--fs-14);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bef-stone);
}

.bef-art-title {
  font-family: var(--bef-display);
  font-size: var(--fs-56);
  line-height: 1.0;
  letter-spacing: -0.012em;
  color: var(--bef-ink);
}

.bef-art-lede {
  font-family: var(--bef-display);
  font-style: italic;
  font-size: var(--fs-22);
  line-height: 1.45;
  color: var(--bef-graphite);
  max-width: 56ch;
}

/* ── Calculator page chrome — temporary, until launch lands the full
       marketing-header / marketing-footer.
       See page--calculators.html.twig + befora_theme_suggestions_page_alter. */

.befora-page--calc {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bef-canvas);
  color: var(--bef-ink);
}

.befora-page--calc__viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 40px;
  border-bottom: 1px solid var(--bef-hairline);
  background: var(--bef-canvas-raised);
}

.befora-page--calc__brand {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--bef-display);
  font-size: var(--fs-22);
  color: var(--bef-ink);
  text-decoration: none;
}

.befora-page--calc__wordmark-dot {
  font-style: italic;
  color: var(--bef-ember);
}

.befora-page--calc__viewer-label {
  font-family: var(--bef-mono);
  font-size: var(--fs-13);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bef-stone);
}

.befora-page--calc__viewer-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.befora-page--calc__main {
  flex: 1;
  width: 100%;
}

.befora-page--calc__footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 56px;
  border-top: 1px solid var(--bef-hairline);
  background: var(--bef-canvas-raised);
  font-family: var(--bef-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bef-stone);
}

.befora-page--calc__footer a {
  color: var(--bef-stone);
  text-decoration: none;
  border-bottom: 1px dotted var(--bef-hairline-strong);
  padding-bottom: 1px;
  transition: color 200ms var(--ease-quiet), border-color 200ms var(--ease-quiet);
}

.befora-page--calc__footer a:hover {
  color: var(--bef-ink);
  border-bottom-color: var(--bef-ink);
}

@media (width <= 768px) {
  .befora-page--calc__viewer-bar { padding: 12px 20px; }
  .befora-page--calc__footer { padding: 14px 20px; flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ── Print — calc-page hero + formula are the primary takeaway.
       Strip viewer-bar / footer / breadcrumb / CTAs / TOC / related
       so the printable output is just the calculator + the math. */

@media print {
  body {
    background: white;
    color: black;
  }

  /* Strip page chrome */
  .befora-page--calc__viewer-bar,
  .befora-page--calc__footer,
  [data-component-id="befora:breadcrumb"],
  [data-component-id="befora:marketing-cta"],
  [data-component-id="befora:related-grid"],
  [data-component-id="befora:marketing-use-cases"],
  .befora-calc-hero-toc,
  .befora-calc-hero-features,
  .befora-coming-soon-grain,
  .befora-marketing-footer,
  .befora-marketing-header {
    display: none !important;
  }

  /* Hero: drop the 2-column grid; widget falls below copy */
  .befora-calc-hero-grid {
    display: block;
  }

  .befora-calc-hero-widget {
    position: static;
    break-before: avoid;
  }

  /* Method block: ensure it prints */
  [data-component-id="befora:method"] {
    break-inside: avoid;
  }

  /* FAQ: print all answers (the native <details> would hide closed ones) */
  [data-component-id="befora:faq-item"] details summary::after {
    content: "";
  }

  [data-component-id="befora:faq-item"] details:not([open]) > *:not(summary) {
    display: block !important;
  }
}

/* @TODO remove after calculators have a normal footer */
.befora-base {
  background: var(--bef-canvas);
  color: var(--bef-stone);
  border-top: 1px solid var(--bef-hairline);
  padding: var(--s-4) var(--s-5);
  text-align: center;
}

.befora-copyright {
  font-family: var(--bef-mono);
  font-size: var(--fs-12);
  color: var(--bef-stone);
  margin: 0 auto;
  max-width: 1280px;
}

/* --- Responsive --- */

@media (width <= 900px) {
  .befora-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-6);
  }

  .befora-brand-col {
    grid-column: 1 / -1;
  }
}

@media (width <= 560px) {
  .befora-inner {
    grid-template-columns: 1fr;
    padding: var(--s-6) var(--s-4);
  }
}

/* ── Auth pages — full-height flex chain through Canvas wrappers ─── */
.befora-page--auth,
.befora-page--auth > div,
.befora-page--auth > div > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.befora-page--auth {
  min-height: 100vh;
  min-height: 100dvh;
}
