/* ==========================================================================
   Base: reset, typography, shared primitives (container, buttons, glass)
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text-on-light);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

/* One size and style for every section heading (h2) on the site */
main :is(.xray__intro, .services__head, .roof__copy, .thermal__inner,
         .why__head, .process__head, .reviews__head, .faq__head, .closing__copy) h2 {
  margin-top: 0.6rem;
  font-size: var(--display-section);
  line-height: 1.04;
  letter-spacing: -0.005em;
  text-transform: none;
}

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--sand-400); color: var(--abyss-900); }

.container {
  width: min(100% - 2 * var(--gutter), var(--container-max));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--sand-400);
  color: var(--abyss-900);
  font-weight: 700;
  border-radius: var(--radius-s);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Small mono label used above headings and inside panels */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 2rem; height: 2px;
  background: currentColor;
  opacity: 0.7;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--sand-400);
  --btn-fg: var(--abyss-900);
  --btn-sweep: var(--sand-100);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.4rem 0.95rem 1.6rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-s) var(--ease-out-expo), box-shadow var(--dur-s);
}
/* Colour sweep that rises from below on hover / focus / touch-press */
.btn::before,
.dock__call::before,
.dock__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-sweep);
  transform: translateY(101%);
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  transition: transform 0.5s var(--ease-out-expo), border-radius 0.5s var(--ease-out-expo);
}
.btn:hover::before, .btn:focus-visible::before, .btn:active::before,
.dock__call:hover::before, .dock__call:focus-visible::before, .dock__call:active::before,
.dock__cta:hover::before, .dock__cta:focus-visible::before, .dock__cta:active::before {
  transform: translateY(0);
  border-radius: 0;
}
.btn:active { transform: scale(0.97); }

.btn__arrow {
  display: grid;
  place-items: center;
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--btn-fg);
  color: var(--btn-bg);
  transition: transform 0.5s var(--ease-out-expo);
}
.btn__arrow svg { width: 0.9rem; height: 0.9rem; }
.btn:hover .btn__arrow, .btn:focus-visible .btn__arrow { transform: rotate(-45deg); }

.btn--sand { box-shadow: 0 0.75rem 2rem -0.75rem rgb(211 171 125 / 0.7); }

.btn--teal {
  --btn-bg: var(--teal-700);
  --btn-fg: var(--cyan-50);
  --btn-sweep: var(--abyss-800);
}
.btn--teal .btn__arrow { background: var(--sand-400); color: var(--abyss-900); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--cyan-50);
  --btn-sweep: rgb(236 248 254 / 0.16);
  border: 1px solid var(--glass-dark-border);
  backdrop-filter: blur(10px);
}
.btn--ghost .btn__arrow { background: var(--cyan-50); color: var(--abyss-900); }

.btn--ghost-light {
  --btn-bg: transparent;
  --btn-fg: var(--teal-700);
  --btn-sweep: var(--cyan-200);
  border: 1px solid rgb(9 84 115 / 0.35);
}
.btn--ghost-light .btn__arrow { background: var(--teal-700); color: var(--cyan-50); }

.btn--small { padding: 0.6rem 1.1rem; font-size: 0.8125rem; }

/* ---------- Glass surfaces ---------- */
.glass-dark {
  background: var(--glass-dark-bg);
  border: 1px solid var(--glass-dark-border);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgb(255 255 255 / 0.18);
  color: var(--text-on-dark);
}
.glass-light {
  background: var(--glass-light-bg);
  border: 1px solid var(--glass-light-border);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: var(--shadow-soft), inset 0 1px 0 #fff;
  color: var(--text-on-light);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-dark  { background: rgb(6 43 59 / 0.92); }
  .glass-light { background: rgb(255 255 255 / 0.96); }
}

/* Content stays visible unless JS + GSAP are confirmed to be running
   (class "motion-ok" is added by js/main.js) */
.motion-ok [data-reveal] { opacity: 0; transform: translateY(2rem); }

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

/* Big outlined numerals: keep Cormorant, but use lining figures (no dropping 3) */
main .tile__num,
main .xray-step__num,
main .process__n {
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}