/* ============================================================
   TEMPLATE design system — re-skin a site by editing ONLY the
   :root variables below. Everything else is shared and should
   not need per-site changes.
   ------------------------------------------------------------
   In template/styles.css the :root values are template tokens filled
   in by new-site.py from the site's site.config.json. In a
   generated site they appear as plain values (e.g. #101828).
   ============================================================ */

:root {
  /* ---- Theme: edit these per site ---- */
  --ink: #101828;
  --ink-deep: #0b1220;
  --ink-soft: #1d2939;
  --paper: #faf7f2;
  --paper-dim: #f2ede3;
  --card: #ffffff;
  --accent: #d97706;
  --accent-deep: #b45309;
  --muted: #475467;
  --muted-light: #98a2b3;
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  /* ---- Layout constants: usually leave alone ---- */
  --line: rgba(16, 24, 40, 0.14);
  --line-light: rgba(250, 247, 242, 0.16);
  --nav-h: 68px;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* Subtle film grain over everything — texture, not decoration */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

p { margin: 0 0 1em; }

a { color: inherit; }

.wrap {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}
.wrap-narrow { width: min(760px, 100% - 2.5rem); }

.section { padding: 4.5rem 0; scroll-margin-top: var(--nav-h); }
.section-paper { background: var(--paper); }
.section-ink { background: var(--ink); color: var(--paper); }

/* Alternating fine-line rhythm between paper sections */
.section-paper + .section-paper { border-top: 1px solid var(--line); }

.display { font-size: clamp(2.6rem, 7vw, 4.75rem); font-weight: 700; }
.display-sm { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 700; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.section-kicker {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.section-kicker-light { color: var(--muted-light); }
.section-num {
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.1em 0.6em;
  margin-right: 0.6em;
  font-size: 0.85em;
}

.section-sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 44rem;
  margin-bottom: 2.5rem;
}
.section-ink .section-sub { color: #d0d5dd; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-align: center;
  padding: 0.8em 1.5em;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--ink-deep);
}
.btn-primary:hover { background: #e88a0c; box-shadow: 0 6px 22px rgba(217, 119, 6, 0.35); }

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line-light);
}
.btn-ghost:hover { border-color: var(--paper); }

.btn-lg { font-size: 1.05rem; padding: 0.9em 1.8em; }
.btn-block { display: block; width: 100%; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--ink-deep);
  padding: 0.6em 1em;
  font-weight: 600;
  z-index: 10000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-light);
  color: var(--paper);
}
.nav-inner {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  margin-right: auto;
}
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 1.05rem;
}
.nav-links { display: none; gap: 1.6rem; }
.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  color: #d0d5dd;
}
.nav-links a:hover { color: var(--paper); }
.btn-nav { display: none; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 0.6rem;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--paper);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line-light);
}
.mobile-menu.open { display: flex; }
.mobile-menu a:not(.btn) {
  text-decoration: none;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line-light);
  color: #d0d5dd;
}
.mobile-menu .btn { margin-top: 0.75rem; }

/* ---------- Hero ---------- */
.hero {
  background: var(--ink-deep);
  color: var(--paper);
  padding: 5.5rem 0 5rem;
  position: relative;
  overflow: hidden;
}
/* Fine-line texture: hairline grid fading at the edges */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(250, 247, 242, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 247, 242, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, black 30%, transparent 75%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 46rem; }
.hero .lede {
  font-size: 1.2rem;
  line-height: 1.7;
  color: #d0d5dd;
  margin: 1.25rem 0 2rem;
  max-width: 40rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.hero-note {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted-light);
  letter-spacing: 0.02em;
}

/* ---------- Math section ---------- */
.math-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 34rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.07);
}
.math-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 1.25rem;
}
.math-rows { display: grid; gap: 0.9rem; }
.math-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed var(--line);
  font-size: 1.02rem;
}
.math-row strong { font-family: var(--font-display); font-size: 1.25rem; }
.math-row .per { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.math-total { border-bottom: 0; padding-bottom: 0; }
.math-total strong { color: var(--accent-deep); font-size: 1.6rem; }
.math-footnote {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}
.math-after { max-width: 44rem; }
.math-after h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.math-after p { color: var(--muted); font-size: 1.08rem; margin: 0; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
}
.card-num {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.card p { color: var(--muted); margin: 0; }
.card p em { color: var(--ink); font-style: normal; font-weight: 600; }
.cards-note {
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Steps (dark) ---------- */
.steps {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  counter-reset: step;
}
.step {
  background: var(--ink-soft);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.step-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  line-height: 1;
}
.step h3 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.step p { color: #d0d5dd; margin: 0; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 0.9rem; margin-top: 2.5rem; }
.faq {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 1.5rem;
}
.faq summary {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  padding: 1.2rem 2rem 1.2rem 0;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 1.05rem;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent-deep);
  line-height: 1;
}
.faq[open] summary::after { content: "\2013"; }
.faq p {
  color: var(--muted);
  margin: 0;
  padding: 0 0 1.4rem;
  max-width: 40rem;
}

/* ---------- Book / form ---------- */
.book-grid { display: grid; gap: 2.5rem; }
.book-copy p { color: #d0d5dd; font-size: 1.08rem; }
.book-points { list-style: none; margin: 1.75rem 0; padding: 0; display: grid; gap: 0.7rem; }
.book-points li {
  padding-left: 1.75rem;
  position: relative;
  color: var(--paper);
  font-size: 1rem;
}
.book-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.7em;
  height: 0.45em;
  border-left: 2.5px solid var(--accent);
  border-bottom: 2.5px solid var(--accent);
  transform: rotate(-45deg) translateY(-1px);
}
.book-alt { font-size: 0.95rem; color: var(--muted-light); }
.book-alt a { color: var(--accent); font-weight: 600; }

.form-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.field { margin-bottom: 1.1rem; }
.field-row { display: grid; gap: 1.1rem; }
.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field label span[aria-hidden] { color: var(--accent-deep); }
.field label .opt { color: var(--muted); font-weight: 400; }
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7em 0.85em;
}
.field textarea { resize: vertical; min-height: 4.5em; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field input.field-error,
.field select.field-error { border-color: #b42318; outline-color: #b42318; }
/* Honeypot: invisible to humans, irresistible to bots */
.hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
.form-status {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  min-height: 1.4em;
}
.form-status.success { color: #067647; font-weight: 600; }
.form-status.error { color: #b42318; font-weight: 600; }
.form-status.sending { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink-deep);
  color: #d0d5dd;
  padding: 3.5rem 0 0;
  border-top: 1px solid var(--line-light);
}
.footer-inner {
  display: grid;
  gap: 2rem;
  padding-bottom: 2.5rem;
}
.footer-brand p { font-size: 0.92rem; color: var(--muted-light); margin-top: 1rem; max-width: 22rem; }
.footer-head {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  margin-bottom: 0.75rem;
}
.footer-col p { font-size: 0.95rem; margin: 0; line-height: 1.9; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { color: var(--accent); }
.footer-base {
  border-top: 1px solid var(--line-light);
  padding: 1.25rem 0 5.5rem;
  font-size: 0.85rem;
  color: var(--muted-light);
}
.footer-base p { margin: 0; }

/* ---------- Sticky mobile CTA ---------- */
.mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line-light);
  transform: translateY(110%);
  transition: transform 0.3s ease;
}
.mobile-cta.show { transform: translateY(0); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Breakpoints ---------- */
@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .footer-base { padding-bottom: 1.25rem; }
  .mobile-cta { display: none; }
}

@media (min-width: 900px) {
  .section { padding: 6rem 0; }
  .hero { padding: 7rem 0 6.5rem; }
  .nav-links { display: flex; }
  .btn-nav { display: inline-block; }
  .nav-toggle { display: none; }
  .book-grid { grid-template-columns: 1fr 1.1fr; align-items: start; }
  .form-card { padding: 2.25rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}

/* ============================================================
   HOME-SERVICES ADD-ON BLOCKS
   Copy-paste these sections from template/sections.md; the styles
   below are already here so the blocks work out of the box.
   ============================================================ */

/* ---------- Before / after gallery ---------- */
.gallery-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.ba-pair {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
}
.ba-images { display: grid; grid-template-columns: 1fr 1fr; }
.ba-images figure { margin: 0; position: relative; }
.ba-images img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.ba-images figcaption {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(11, 18, 32, 0.85);
  color: var(--paper);
  padding: 0.3em 0.7em;
  border-radius: 999px;
}
.ba-caption {
  padding: 1rem 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- Reviews ---------- */
.reviews-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.review-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
}
.review-stars {
  color: var(--accent);
  letter-spacing: 0.15em;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.review-card blockquote { margin: 0 0 1rem; font-size: 1.02rem; }
.review-card cite {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.review-cta { margin-top: 2rem; text-align: center; }
.review-cta p { color: var(--muted); }

/* ---------- Service area ---------- */
.area-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.area-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}
.area-card h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.area-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  color: var(--muted);
  font-size: 0.98rem;
}
.area-list li { padding-left: 1.1rem; position: relative; }
.area-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--accent);
}
.area-note { margin-top: 1.5rem; color: var(--muted); }

@media (min-width: 700px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .reviews-grid { grid-template-columns: repeat(3, 1fr); }
  .area-grid { grid-template-columns: repeat(2, 1fr); }
}
