/* ============================================================
   app.css — the universal stylesheet, loaded on every single page
   (marketing pages AND /app/): design tokens/reset, buttons, cards,
   form-field basics, badges, and site chrome (header/footer/hero/
   sections) — see the header/footer/hero note further down for why
   even the marketing-flavored chrome stays here rather than in a
   3rd file.

   This used to also contain the /app/-only pieces (modals, the
   template-gallery/saved-drafts dialog content, tabs, tax rows,
   payment-method rows) merged in from the old components.css.
   Lighthouse's "reduce unused CSS" audit measured that as ~29KB of
   this ~40KB file going completely unused on a plain marketing page
   — moved all of that into app-shell.css (already conditionally
   loaded only on /app/) instead. A few truly dead rules found along
   the way (never referenced by any markup or JS — grepped, not
   assumed) were deleted outright rather than relocated: the old
   .accordion-item/.accordion-trigger/.accordion-panel component,
   .modal-overlay (superseded by native <dialog>'s own ::backdrop
   when the modal system was built, but never removed), .toast, and
   .thumb-skeleton.
   ============================================================ */

/* Self-hosted (not a Google Fonts/CDN link — the site's CSP is font-src
   'self', and this avoids depending on a third-party request at all,
   consistent with the "no third-party scripts" privacy stance). Variable
   font, one file covers the full weight range headings use (700-800),
   under the SIL Open Font License — see assets/fonts/inter/LICENSE.txt.
   font-display: swap shows the system-font fallback immediately and
   swaps to Inter once it loads, instead of an invisible-text flash. */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter/Inter-VariableFont.woff2") format("woff2-variations"), url("/assets/fonts/inter/Inter-VariableFont.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-doc: "Inter", Helvetica, Arial, sans-serif;

  --color-bg: #ffffff;
  --color-bg-subtle: #f6f7fb;
  --color-surface: #ffffff;
  --color-border: #e2e4ea;
  --color-text: #14161f;
  --color-text-muted: #5c6070;
  --color-primary: #2952e3;
  --color-primary-hover: #1f3fc4;
  --color-primary-contrast: #ffffff;
  --color-accent: #0f172a;
  --color-success: #16794f;
  --color-danger: #c22b3c;
  --color-warning: #ad6a05;
  --color-focus-ring: #2952e3;

  /* Refined-SaaS accents: a violet secondary the brand blue can gradient
     into, used sparingly (hero backdrop, primary-button sheen, section
     dividers) — never a wholesale color swap of --color-primary itself,
     since plenty of existing CSS (badges, focus rings, links) treats it
     as a flat, mixable color. */
  --color-primary-2: #6d5ef1;
  --color-primary-soft: #eef1fd;
  --gradient-brand: linear-gradient(135deg, var(--color-primary), var(--color-primary-2));
  --gradient-mesh:
    radial-gradient(circle at 15% 20%, rgba(41, 82, 227, 0.16), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(109, 94, 241, 0.14), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(41, 82, 227, 0.08), transparent 55%);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --shadow-sm: 0 1px 2px rgba(20, 22, 31, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 22, 31, 0.08);
  --shadow-lg: 0 12px 32px rgba(20, 22, 31, 0.14);
  --shadow-glow: 0 8px 24px rgba(41, 82, 227, 0.28);

  --header-height: 64px;
  --max-content-width: 1120px;
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  /* A gentle overshoot-free ease-out — the "premium" motion feel used for
     hover lifts and scroll-reveal, distinct from the snappier linear-ish
     --transition-fast/base used for toggles and focus states. */
  --transition-smooth: 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --color-bg: #12141c;
  --color-bg-subtle: #191b26;
  --color-surface: #1b1e2a;
  --color-border: #2c2f3d;
  --color-text: #eef0f6;
  --color-text-muted: #a2a6b8;
  --color-primary: #6d87ff;
  --color-primary-hover: #8398ff;
  --color-primary-contrast: #0c0e14;
  --color-accent: #c8d1ff;
  --color-primary-2: #9d8bff;
  --color-primary-soft: #232a45;
  --gradient-mesh:
    radial-gradient(circle at 15% 20%, rgba(109, 135, 255, 0.22), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(157, 139, 255, 0.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(109, 135, 255, 0.1), transparent 55%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 8px 24px rgba(109, 135, 255, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #12141c;
    --color-bg-subtle: #191b26;
    --color-surface: #1b1e2a;
    --color-border: #2c2f3d;
    --color-text: #eef0f6;
    --color-text-muted: #a2a6b8;
    --color-primary: #6d87ff;
    --color-primary-hover: #8398ff;
    --color-primary-contrast: #0c0e14;
    --color-accent: #c8d1ff;
    --color-primary-2: #9d8bff;
    --color-primary-soft: #232a45;
    --gradient-mesh:
      radial-gradient(circle at 15% 20%, rgba(109, 135, 255, 0.22), transparent 45%),
      radial-gradient(circle at 85% 0%, rgba(157, 139, 255, 0.18), transparent 40%),
      radial-gradient(circle at 50% 100%, rgba(109, 135, 255, 0.1), transparent 55%);
    --shadow-glow: 0 8px 24px rgba(109, 135, 255, 0.35);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; display: block; }

a { color: var(--color-primary); text-decoration-thickness: 1px; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary-hover); }

::selection { background: var(--color-primary); color: #fff; }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); line-height: 1.15; margin: 0 0 var(--space-3); font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2.25rem); letter-spacing: -0.015em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); color: var(--color-text-muted); }

ul, ol { padding-left: 1.25em; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Visible focus for keyboard users everywhere, no outline suppression. */
:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 8px; }

/* Small set of spacing utilities — used sparingly for one-off gaps between
   otherwise-unrelated elements, not as a general utility-CSS system. */
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.container {
  width: 100%;
  max-width: var(--max-content-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  /* Buttons are just as often <a class="btn" href="..."> as <button> on
     the marketing pages (every hero/CTA link) — the base `a` rule never
     resets text-decoration, so without this every one of those inherited
     the browser's default underline. */
  text-decoration: none;
  /* A button squeezed for horizontal space should never silently wrap
     its label onto a second line — that makes it taller than
     min-height expects, which is exactly what broke the mobile header
     (the fixed-height .site-header had nowhere to put a 2-line "Create
     Invoice" button and visibly overflowed). Something upstream should
     give it enough room or hide it, not let text wrapping surprise the
     layout silently. */
  white-space: nowrap;
  transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base), transform var(--transition-smooth), box-shadow var(--transition-smooth);
  min-height: 44px;
  line-height: 1.1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
/* Solid on its own; the gradient + lift only kick in on hover, so the
   resting state still reads as a plain, fast, predictable button — the
   "premium" motion is a reward for interaction, not baseline noise. */
.btn-primary { background: var(--color-primary); color: var(--color-primary-contrast); }
.btn-primary:hover { background: var(--gradient-brand); color: var(--color-primary-contrast); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
/* A soft background fill on hover, not just a border/shadow change — a
   1px lift alone reads as "no hover state" at the small sizes used on
   /app/'s toolbars (btn-sm buttons packed close together), especially
   for icon-only buttons where there's no color/weight change to notice. */
.btn-secondary:hover { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--color-text); }
.btn-ghost:hover { background: var(--color-bg-subtle); }
.btn-danger { background: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger); color: #fff; }
/* Only used on /app/'s toolbars (not on marketing pages), so shrinking
   this is scoped to the editor's own density by construction, not a
   global small-button size. */
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 8px; min-width: 44px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { transform: none; box-shadow: none; }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}
.card-pad { padding: var(--space-5); }

/* Opt-in lift for cards that are themselves a link/button (template
   thumbnails, feature cards, guide/article cards) — plain informational
   cards (dialogs, form wrappers) don't get this since they're not
   interactive targets and a hover-lift on them would be misleading. */
a.card:hover, .card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

/* Form fields */
.field { margin-bottom: var(--space-4); }
.field label, .field .field-label {
  display: block;
  font-weight: 600;
  font-size: 0.8125rem;
  margin-bottom: 6px;
  color: var(--color-text);
}
.field .field-hint { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: var(--space-1); }
.field .field-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Groups a related cluster of fields within a tab panel — the border-top
   keeps long panels (e.g. Taxes & Totals, Design) visually chunked instead
   of reading as one undifferentiated list of inputs. */
.field-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: var(--space-6) 0 var(--space-3);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}
.field-group-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.field-group-subtitle { font-size: 0.8125rem; color: var(--color-text-muted); margin: -8px 0 var(--space-3); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-primary); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-danger); }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 480px) { .input-row { grid-template-columns: 1fr; } }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.badge-primary { background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-primary); border-color: transparent; }

/* ============================================================
   Site chrome: header/footer/hero/sections. All of this — including
   the marketing-flavored hero/grid/feature-card/faq-item bits below
   — stays in the universal file rather than a 3rd marketing-only
   bundle: header.php/footer.php are shared partials rendered on
   /app/ too, and splitting the smaller remainder (hero/sections)
   into yet another request would trade a modest unused-bytes saving
   on the single /app/ page for a real extra round-trip on every one
   of the ~24 marketing pages — the wrong side of that trade, unlike
   the much larger app-only chunk (modals, template gallery, tabs,
   tax rows) that moved out to app-shell.css.
   ============================================================ */

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  /* Solid fallback first — if color-mix() is unsupported, the browser
     drops that whole declaration as invalid and keeps this one, rather
     than leaving the header background transparent. */
  background: var(--color-bg);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
/* Toggled by site.js on scroll — a plain flat header reads fine at the
   very top of the page (flush against the hero), but once content has
   scrolled underneath it, a hairline shadow keeps it feeling anchored
   instead of blending into whatever's now behind it. Pure CSS fallback
   (no JS) is just the static border-bottom above, so nothing breaks if
   the script fails to load. */
.site-header.is-scrolled { box-shadow: var(--shadow-sm); border-color: transparent; }

.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--color-text);
  text-decoration: none;
}
.brand:hover { color: var(--color-text); }
.brand .brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.main-nav { display: flex; align-items: center; gap: var(--space-5); }
.main-nav ul { list-style: none; display: flex; gap: var(--space-4); margin: 0; padding: 0; }
.main-nav a {
  position: relative;
  color: var(--color-text-muted);
  font-weight: 600;
  text-decoration: none;
  padding-bottom: 2px;
  transition: color var(--transition-fast);
}
.main-nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-smooth);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--color-text); }
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { transform: scaleX(1); }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  /* .main-nav ul used to just be display:none here with no way back —
     the hamburger button existed (aria-controls="mobile-nav") but
     nothing ever toggled it: no JS listener, and no element with that
     id even existed to control. Below ~860px the nav links were
     completely unreachable on every page. Fixed: a real dropdown panel,
     toggled by site.js, anchored to .site-header (already a positioned
     element via position:sticky, so it's a valid containing block for
     this without needing an extra wrapper). */
  .main-nav ul {
    display: none;
    position: absolute;
    top: 100%;
    left: var(--space-4);
    right: var(--space-4);
    flex-direction: column;
    gap: 0;
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 150;
  }
  .main-nav.is-open ul { display: flex; }
  .main-nav ul li { width: 100%; }
  .main-nav a {
    display: block;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
  }
  /* The sliding underline only makes sense as a horizontal-row hover
     cue; in a stacked dropdown list a background tint reads better and
     doesn't clip oddly against the panel's own rounded corners. */
  .main-nav a::after { display: none; }
  .main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--color-primary-soft); color: var(--color-primary); }
  .nav-toggle { display: inline-flex; }

  /* Below this breakpoint there's no longer room in the fixed-height
     header bar for brand + "Create Invoice" + hamburger together (on a
     narrow phone the button's label was wrapping onto a second line and
     visibly overflowing the header). The CTA moves into the dropdown
     instead of getting squeezed — swap which of the two elements is
     shown, don't try to shrink both into a space neither fits. */
  .header-cta-desktop { display: none; }
  .mobile-nav-cta {
    display: block;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
  }
  /* .main-nav a { color: var(--color-text-muted); } and
     .main-nav a:hover { background: ...; color: var(--color-primary); }
     just above are both MORE specific (class+element, and
     class+element+pseudo-class) than .btn-primary's own color/background
     rules — so without this, the nav-link styling silently won the
     cascade on this element and the button rendered with dark/muted
     text on its own dark-blue background, and lost its background
     entirely on hover. !important is deliberate here: this is one
     specific element intentionally combining two style systems
     (nav-link + button), and fighting that with plain specificity/
     source-order would be more fragile than just being explicit that
     the button styling must win. */
  .mobile-nav-cta .btn {
    display: flex;
    width: 100%;
    color: var(--color-primary-contrast) !important;
    background: var(--color-primary) !important;
  }
  .mobile-nav-cta .btn:hover {
    color: var(--color-primary-contrast) !important;
    background: var(--gradient-brand) !important;
  }
}
@media (min-width: 861px) {
  /* Only ever rendered inside the mobile dropdown; on desktop the nav
     renders as a horizontal row and this would show up as a stray
     filled button sitting among the plain text links. */
  .mobile-nav-cta { display: none; }
}

.site-footer {
  position: relative;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  margin-top: var(--space-9);
  padding: var(--space-8) 0 var(--space-5);
}
/* Thin gradient hairline instead of a flat border — a small, cheap detail
   that reads as considered rather than a default browser rule left in place. */
.site-footer::before {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: var(--gradient-brand);
  opacity: 0.5;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-6);
}
@media (max-width: 780px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-grid h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.footer-grid a { color: var(--color-text); text-decoration: none; font-size: 0.9375rem; }
.footer-grid a:hover { color: var(--color-primary); }
.footer-bottom {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Back-to-top button — present on every page (footer.php), hidden until
   site.js adds .is-visible once the user has scrolled past a threshold.
   Kept in the DOM (not [hidden]) so the opacity/transform transition can
   actually animate instead of snapping via display:none. */
.back-to-top {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 40;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease, border-color 0.15s ease;
}
.back-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.back-to-top:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: opacity 0.2s ease; }
}

/* Hero / content sections used on marketing pages */
.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-9) 0 var(--space-7);
}
/* Soft gradient mesh behind the hero content, not a flat block color —
   painted first in DOM order (and thus behind) the .container that
   follows it, no z-index gymnastics needed. */
.hero::before {
  content: '';
  position: absolute;
  inset: -15% -10%;
  background: var(--gradient-mesh);
  pointer-events: none;
}
.hero > .container { position: relative; }
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}
.hero h1 { max-width: 820px; }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-6); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--space-7); align-items: center; }
.hero-media { display: flex; justify-content: center; }
.hero-media img { width: 100%; max-width: 380px; height: auto; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media img { max-width: 260px; margin-inline: auto; }
}

.section { padding: var(--space-8) 0; }
.section-alt { background: var(--color-bg-subtle); }
.section-header { max-width: 720px; margin-bottom: var(--space-6); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Template-thumbnail spotlight grids (homepage's 6-up preview, the
   /templates/ gallery's per-category rows, and each type-landing page's
   4-up "recommended templates" section) — these used to be `.grid-3`
   with an inline `style="grid-template-columns:repeat(4,1fr)"` (or 6)
   directly on the element, which — being an inline style — overrides
   *any* external stylesheet rule regardless of media query, permanently
   forcing 4 or 6 columns even on a phone screen. Real responsive classes
   instead, so the breakpoints below actually take effect. */
.thumb-grid-4, .thumb-grid-6 { display: grid; gap: var(--space-5); }
.thumb-grid-4 { grid-template-columns: repeat(4, 1fr); }
.thumb-grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 860px) { .thumb-grid-4, .thumb-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .thumb-grid-4, .thumb-grid-6 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .thumb-grid-4, .thumb-grid-6 { grid-template-columns: 1fr; } }

.feature-card {
  position: relative;
  padding: var(--space-5);
  overflow: hidden;
}
/* A thin gradient accent tab across the top of every feature card — a
   small recurring motif that ties the cards back to the brand gradient
   without repeating a full-color block 6+ times on one page. */
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
}
.feature-card .icon { width: 40px; height: 40px; margin-bottom: var(--space-3); color: var(--color-primary); }

/* FAQ accordion — bordered, rounded rows instead of a flat divided list.
   list-style:none + hiding the native marker so a custom rotating "+"
   can replace it; <details>/<summary> semantics (and keyboard/screen
   reader behavior) are untouched, this is presentation only. */
details.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  margin-bottom: var(--space-3);
  background: var(--color-surface);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}
details.faq-item:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
details.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  padding: var(--space-4) 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after {
  content: '+';
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--color-primary);
  transition: transform var(--transition-smooth);
}
details.faq-item[open] summary::after { transform: rotate(45deg); }
details.faq-item p { margin: 0 0 var(--space-4); }

.breadcrumbs { font-size: 0.8125rem; color: var(--color-text-muted); margin-bottom: var(--space-4); }
.breadcrumbs a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--color-primary); text-decoration: underline; }

/* Guide article pages (public/guides/*, narrow 760px reading column,
   many stacked <h2> sections) — the site-wide heading scale above is
   sized for marketing pages with a handful of large section headers,
   and reads oversized against a column of running prose. Scaled down
   specifically here rather than changing the global h1/h2/h3 rule. */
.guide-page h1 { font-size: clamp(1.875rem, 1.6rem + 1.2vw, 2.625rem); }
.guide-page h2 { font-size: clamp(1.3125rem, 1.15rem + 0.7vw, 1.6875rem); letter-spacing: -0.01em; }
.guide-page h3 { font-size: 1.125rem; }

/* Scroll-reveal (site.js) — progressive enhancement only. Elements only
   get the pending/hidden state once JS has actually added the class, so
   content is never stuck invisible if the script fails to load or a
   crawler doesn't execute JS at all. */
.reveal-pending { opacity: 0; transform: translateY(18px); transition: opacity var(--transition-smooth), transform var(--transition-smooth); }
.reveal-visible { opacity: 1; transform: none; }
