/* ============================================================
   W.S. BUILDING & REMODELING — Design System
   Thesis: Architectural drafting meets New England craftsmanship.
   Material, measured, warm. Not tech-brutalism; not template.
   ============================================================ */

:root {
  /* Palette — from WS logo terracotta + blueprint language */
  --clay: #b8502d;           /* primary accent, from logo */
  --clay-deep: #8f3a1e;
  --clay-soft: #d88e6e;
  --ink: #18140f;            /* warm near-black text */
  --bone: #f5efe4;           /* warm off-white page */
  --paper: #faf6ee;          /* lightest surface */
  --stone: #cec4b3;          /* mid warm neutral */
  --stone-soft: #e4dccc;
  --blueprint: #1e3a5f;      /* secondary indigo */
  --blueprint-soft: #3f5f85;
  --graphite: #3a342c;
  --mortar: #74695a;         /* body text grayish warm */
  --rule: rgba(24, 20, 15, 0.12);

  /* Type */
  --serif: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Scale (architect's ruler, not bootstrap) */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 72px;
  --s-9: 104px; --s-10: 152px;

  /* Type scale */
  --display: clamp(3.2rem, 7.5vw, 7.5rem);
  --h1: clamp(2.2rem, 4.5vw, 4.2rem);
  --h2: clamp(1.6rem, 2.8vw, 2.6rem);
  --h3: 1.375rem;
  --body: 1.03rem;
  --small: 0.88rem;
  --tag: 0.72rem;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-draft: cubic-bezier(0.65, 0.02, 0.18, 1);
}

[data-theme="dark"] {
  --bone: #14110d;
  --paper: #1c1813;
  --ink: #f2ebdd;
  --stone: #3a342c;
  --stone-soft: #2a251e;
  --mortar: #a69a86;
  --rule: rgba(242, 235, 221, 0.13);
  --clay: #d27049;
  --clay-soft: #e8a488;
  --blueprint: #7fa2ce;
  --blueprint-soft: #a9c1dc;
  --graphite: #e2d9c5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: var(--body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bone);
  font-feature-settings: "ss01", "cv11";
  transition: background 240ms var(--ease-out), color 240ms var(--ease-out);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 { font-family: var(--serif); font-weight: 450; letter-spacing: -0.015em; line-height: 1.05; }
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); line-height: 1.2; }

.display {
  font-family: var(--serif);
  font-size: var(--display);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-variation-settings: "SOFT" 20, "WONK" 0, "opsz" 144;
}
.display em { font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; color: var(--clay); }

.tag {
  font-family: var(--mono);
  font-size: var(--tag);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mortar);
}
.tag-num { color: var(--clay); }

a { color: inherit; text-decoration: none; }
p { max-width: 62ch; color: var(--graphite); }
img { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT — strict architect's grid
   ============================================================ */
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 var(--s-6); }
@media (max-width: 720px) { .wrap { padding: 0 var(--s-5); } }

section { padding: var(--s-9) 0; position: relative; }
section.tight { padding: var(--s-8) 0; }

.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s-5); }
@media (max-width: 900px) { .grid-12 { grid-template-columns: repeat(6, 1fr); } }

.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
@media (max-width: 900px) { .col-5, .col-6, .col-7, .col-8 { grid-column: span 6; } }

/* ============================================================
   SIGNATURE: dimension-line section headers
   Replaces generic "squiggly underlines" with construction drafting ticks.
   ============================================================ */
.section-head { margin-bottom: var(--s-7); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.section-head h2 { max-width: 16ch; }

.dim-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mortar);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.dim-label::before {
  content: ""; width: 28px; height: 1px; background: var(--clay);
  position: relative;
}
.dim-label::after {
  content: ""; width: 4px; height: 4px; background: var(--clay); border-radius: 50%;
}

/* Dimension rule: tick marks like a ruler, not a regular HR */
.dim-rule {
  height: 22px;
  width: 100%;
  border: 0;
  background:
    linear-gradient(to right, var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(to right, transparent 0 calc((100% - 1px) / 40), var(--rule) calc((100% - 1px) / 40) calc(((100% - 1px) / 40) + 1px)) 0 50% / 100% 8px no-repeat,
    repeating-linear-gradient(to right, transparent 0 calc((100% - 1px) / 8), var(--rule) calc((100% - 1px) / 8) calc(((100% - 1px) / 8) + 1px)) 0 50% / 100% 14px no-repeat;
  margin: var(--s-6) 0;
}

/* ============================================================
   BUTTONS — angular, with dimension corner ticks, no pills
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bone);
  position: relative;
  cursor: pointer;
  transition: transform 240ms var(--ease-out), background 240ms var(--ease-out), color 240ms var(--ease-out);
}
.btn::before, .btn::after {
  content: ""; position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--clay); pointer-events: none;
}
.btn::before { top: -4px; left: -4px; border-right: 0; border-bottom: 0; }
.btn::after  { bottom: -4px; right: -4px; border-left: 0; border-top: 0; }
.btn:hover { background: var(--clay); border-color: var(--clay); transform: translate(-2px, -2px); }
.btn:hover::before { transform: translate(-2px, -2px); }
.btn:hover::after { transform: translate(2px, 2px); }

.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--clay); color: var(--bone); border-color: var(--clay); }

.btn .arrow {
  display: inline-block; width: 14px; height: 1px; background: currentColor; position: relative;
  transition: width 220ms var(--ease-out);
}
.btn .arrow::after {
  content: ""; position: absolute; right: -1px; top: -3px; width: 7px; height: 7px;
  border-right: 1px solid currentColor; border-top: 1px solid currentColor; transform: rotate(45deg);
}
.btn:hover .arrow { width: 22px; }

/* ============================================================
   NAV — blueprint coordinate header, not a floating glass bar
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--bone) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-6);
  max-width: 1440px; margin: 0 auto;
}
.brand {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--mono);
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink);
}
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-txt small { display: block; color: var(--mortar); font-size: 0.62rem; letter-spacing: 0.25em; margin-top: 2px; }

.nav-links { display: flex; gap: var(--s-5); justify-content: center; flex-wrap: wrap; }
.nav-link {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--graphite); padding: var(--s-2) 0; position: relative;
  transition: color 180ms;
}
.nav-link[aria-current="page"], .nav-link:hover { color: var(--ink); }
/* Bracket-tick nav highlight — architectural, not a pin */
.nav-link::before, .nav-link::after {
  content: ""; position: absolute; width: 6px; height: 6px; opacity: 0;
  border-color: var(--clay); transition: opacity 200ms, transform 200ms var(--ease-out);
}
.nav-link::before { top: -3px; left: -7px; border-top: 1px solid; border-left: 1px solid; transform: translate(4px, 4px); }
.nav-link::after  { bottom: -3px; right: -7px; border-bottom: 1px solid; border-right: 1px solid; transform: translate(-4px, -4px); }
.nav-link:hover::before, .nav-link:hover::after,
.nav-link[aria-current="page"]::before, .nav-link[aria-current="page"]::after { opacity: 1; transform: translate(0, 0); }

.nav-right { display: flex; align-items: center; gap: var(--s-4); }
.nav-phone { font-family: var(--mono); font-size: 0.78rem; color: var(--ink); letter-spacing: 0.04em; }
.nav-phone::before { content: "☎ "; color: var(--clay); }

.theme-toggle {
  width: 44px; height: 26px; border: 1px solid var(--ink); background: transparent;
  position: relative; cursor: pointer;
}
.theme-toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: var(--ink); transition: transform 240ms var(--ease-out);
}
[data-theme="dark"] .theme-toggle::after { transform: translateX(18px); background: var(--clay); }

.nav-burger { display: none; background: transparent; border: 0; padding: 8px; cursor: pointer; }
.nav-burger span { display: block; width: 22px; height: 1px; background: var(--ink); margin: 5px 0; }

@media (max-width: 900px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bone); flex-direction: column; padding: var(--s-5); border-bottom: 1px solid var(--rule); }
  .nav.open .nav-links { display: flex; }
  .nav-burger { display: block; }
  .nav-phone { display: none; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--ink); color: var(--bone); padding: var(--s-9) 0 var(--s-6); margin-top: var(--s-9);
  position: relative;
}
.footer .wrap { position: relative; }
.footer h2 { font-size: clamp(2rem, 4.5vw, 4rem); max-width: 20ch; margin-bottom: var(--s-6); color: var(--bone); }
.footer h2 em { color: var(--clay-soft); font-style: italic; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-6); padding: var(--s-7) 0; border-top: 1px solid rgba(245, 239, 228, 0.15); }
.footer-grid h4 { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--clay-soft); margin-bottom: var(--s-4); font-weight: 400; }
.footer-grid a, .footer-grid p { color: var(--bone); opacity: 0.85; font-size: 0.9rem; display: block; margin-bottom: var(--s-2); }
.footer-grid a:hover { opacity: 1; color: var(--clay-soft); }
.footer-bar { display: flex; justify-content: space-between; padding-top: var(--s-5); border-top: 1px solid rgba(245, 239, 228, 0.12); font-family: var(--mono); font-size: 0.7rem; color: rgba(245, 239, 228, 0.55); letter-spacing: 0.1em; text-transform: uppercase; flex-wrap: wrap; gap: var(--s-3); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ============================================================
   REUSABLE PIECES
   ============================================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: var(--s-5);
  position: relative;
}
/* architect's corner tick on every card (subtle) */
.card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px;
  border-top: 1px solid var(--clay); border-left: 1px solid var(--clay);
}

.kpi { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px solid var(--rule); }
.kpi strong { font-family: var(--serif); font-size: 2.2rem; font-weight: 350; letter-spacing: -0.02em; color: var(--clay); }
.kpi span { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mortar); }

.eyebrow { display: inline-flex; align-items: center; gap: var(--s-3); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--clay); margin-bottom: var(--s-4); }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--clay); }

/* Reveal on scroll (JS-driven .in-view) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.reveal.in-view { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: 80ms; }
.reveal:nth-child(3) { transition-delay: 160ms; }
.reveal:nth-child(4) { transition-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
