/* ============================================================
   [Your Company Name] — plumbing, Mississauga
   Terminal-chrome layout · section-rotating palette · grain
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --c1: #0a0a0a;
  --c2: #e10600;
  --c3: #003c8a;
  --c4: #f4ff33;

  --ink: #0a0a0a;
  --paper: #f5f2ec;
  --paper-2: #ffffff;

  --bg: var(--paper);
  --fg: var(--ink);
  --muted: #5c5850;
  --line: rgba(10, 10, 10, 0.16);
  --line-strong: rgba(10, 10, 10, 0.34);
  --panel: #ffffff;
  --panel-2: #f0ece4;
  --accent: var(--c2);
  --accent-ink: #ffffff;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;

  --pad: clamp(1.15rem, 4vw, 3.25rem);
  --maxw: 74rem;
  --radius: 2px;
}

html[data-theme='dark'] {
  --bg: #0a0a0a;
  --fg: #f2efe9;
  --muted: #a8a29a;
  --line: rgba(242, 239, 233, 0.18);
  --line-strong: rgba(242, 239, 233, 0.4);
  --panel: #141414;
  --panel-2: #1c1c1c;
  --accent: var(--c4);
  --accent-ink: #0a0a0a;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  transition: background-color 0.25s ease, color 0.25s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- grain overlay ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}
html[data-theme='dark'] body::before { opacity: 0.075; }

/* ---------- focus ---------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ============================================================
   TERMINAL CHROME
   ============================================================ */
.chrome {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
}
.chrome-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: clamp(0.85rem, 1.6vw, 1.35rem) var(--pad);
  border-bottom: 1px solid var(--line);
}
.dots { display: inline-flex; gap: 0.5rem; flex: none; }
.dots i {
  width: clamp(0.85rem, 1.1vw, 1.05rem);
  height: clamp(0.85rem, 1.1vw, 1.05rem);
  border-radius: 50%;
  display: block;
}
.dots .d1 { background: var(--c2); }
.dots .d2 { background: var(--c4); }
.dots .d3 { background: var(--c3); }
html[data-theme='dark'] .dots .d3 { background: #4d8bff; }

.chrome-title {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.05vw, 0.95rem);
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
}
.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 0.95rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: clamp(0.72rem, 0.9vw, 0.82rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { background: var(--panel-2); border-color: var(--fg); }
.tt-value { color: var(--accent); font-weight: 700; }

.tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--pad);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 clamp(1rem, 1.6vw, 1.4rem);
  font-family: var(--mono);
  font-size: clamp(0.82rem, 1vw, 0.95rem);
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tab:hover { color: var(--fg); border-bottom-color: var(--line-strong); }
.tab-cta { color: var(--fg); font-weight: 700; }
.tab-cta::before { content: '→ '; color: var(--accent); }

/* ============================================================
   SECTIONS — palette rotation
   ============================================================ */
.sec {
  padding: clamp(3rem, 8vw, 6.5rem) var(--pad);
  border-bottom: 1px solid var(--line);
}
.wrap { max-width: var(--maxw); margin: 0 auto; }
.wrap-narrow { max-width: 46rem; }

.sec-1 { background: var(--bg); color: var(--fg); }
.sec-2 { background: var(--c2); color: #ffffff; }
.sec-3 { background: var(--c3); color: #ffffff; }
.sec-4 { background: var(--c4); color: #0a0a0a; }

/* inside coloured sections, re-map the neutral tokens so every
   child (borders, muted text, panels) stays legible */
.sec-2, .sec-3 {
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.82);
  --line: rgba(255, 255, 255, 0.28);
  --line-strong: rgba(255, 255, 255, 0.55);
  --panel: rgba(255, 255, 255, 0.1);
  --panel-2: rgba(255, 255, 255, 0.16);
  --accent: var(--c4);
}
.sec-4 {
  --fg: #0a0a0a;
  --muted: #3d3a12;
  --line: rgba(10, 10, 10, 0.28);
  --line-strong: rgba(10, 10, 10, 0.55);
  --panel: rgba(255, 255, 255, 0.5);
  --panel-2: rgba(255, 255, 255, 0.72);
  --accent: var(--c2);
}
.sec-2 :focus-visible, .sec-3 :focus-visible { outline-color: var(--c4); }
.sec-4 :focus-visible { outline-color: var(--c2); }

/* ---------- prompt line ---------- */
.prompt {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 1.1rem;
}
.sigil { color: var(--accent); font-weight: 700; margin-right: 0.35rem; }

/* ---------- type ---------- */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-variation-settings: 'wght' 400, 'opsz' 60;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 7.5vw, 5.2rem); }
h2 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.2; }

.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  line-height: 1.65;
  max-width: 62ch;
  margin: 0 0 2rem;
  color: var(--muted);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
.hero-h1 {
  font-variation-settings: 'wght' 200, 'opsz' 100;
  animation: weigh linear both;
  animation-timeline: scroll(root);
  animation-range: 0 30vh;
}
@keyframes weigh {
  from { font-variation-settings: 'wght' 200, 'opsz' 100; }
  to   { font-variation-settings: 'wght' 900, 'opsz' 100; }
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 2.5rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid var(--fg);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn-solid { background: var(--fg); color: var(--bg); }
.btn-solid:hover { transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.facts dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.facts dd { margin: 0; font-size: 0.98rem; }
.facts a { text-decoration-color: var(--line-strong); text-underline-offset: 3px; }

.hero-fig { margin: 0; }
.hero-fig img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  filter: saturate(0.92) contrast(1.03);
}

@media (min-width: 62rem) {
  #hero { grid-template-columns: 1.05fr 0.95fr; }
}

/* ============================================================
   EXPANDABLE INDEX (signature)
   ============================================================ */
.index {
  border-top: 1px solid var(--line-strong);
  margin-top: 0.5rem;
}
.entry {
  border-bottom: 1px solid var(--line);
}
.entry summary {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'num title' 'num meta';
  gap: 0.15rem 1rem;
  align-items: baseline;
  padding: 1.15rem 2.2rem 1.15rem 0;
  cursor: pointer;
  list-style: none;
  position: relative;
  min-height: 44px;
  transition: padding-left 0.25s ease;
}
.entry summary::-webkit-details-marker { display: none; }
.entry summary::after {
  content: '+';
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--accent);
  transition: transform 0.25s ease;
}
.entry[open] summary::after { content: '−'; }
.entry summary:hover { padding-left: 0.55rem; }
.entry-num {
  grid-area: num;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 0.35rem;
}
.entry-title {
  grid-area: title;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  font-variation-settings: 'wght' 500, 'opsz' 40;
  line-height: 1.2;
}
.entry-meta {
  grid-area: meta;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.entry-body {
  padding: 0 0 1.6rem 2.1rem;
  max-width: 68ch;
  animation: reveal 0.3s ease both;
}
.entry-body p { margin: 0 0 1rem; }
.entry-body p:last-child { margin-bottom: 0; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.ticks {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.ticks li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.97rem;
  line-height: 1.55;
}
.ticks li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.85rem;
}

/* ============================================================
   WORK CARDS
   ============================================================ */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}
@media (min-width: 48rem) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 0 0 1.4rem;
  display: flex;
  flex-direction: column;
}
.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 1.1rem;
}
.card h3, .card p { padding: 0 1.2rem; }
.card h3 { margin-bottom: 0.35rem; }
.card-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.card p:last-child { margin: 0; font-size: 0.97rem; }

/* ============================================================
   GALLERY
   ============================================================ */
.gallery {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 34rem) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }

.shot { margin: 0; }
.shot-btn {
  display: block;
  width: 100%;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: zoom-in;
  text-align: left;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.shot-btn:hover { transform: translateY(-3px); border-color: var(--fg); }
.shot-btn img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--line-strong);
  filter: saturate(0.92) contrast(1.03);
  transition: filter 0.25s ease;
}
.shot-btn:hover img { filter: none; }
.shot-cap {
  display: block;
  padding: 0.7rem 0.85rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(10, 10, 10, 0.92);
  color: #f2efe9;
}
.lightbox[hidden] { display: none; }
.lb-figure {
  margin: 0;
  max-width: min(100%, 68rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.lb-figure img {
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border: 1px solid rgba(242, 239, 233, 0.35);
  background: #000;
}
.lb-figure figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #d8d3ca;
}
.lb-close {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  min-height: 48px;
  padding: 0 1.1rem;
  background: transparent;
  border: 1px solid rgba(242, 239, 233, 0.55);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f2efe9;
  cursor: pointer;
}
.lb-close:hover { background: #f2efe9; color: #0a0a0a; }
.lightbox :focus-visible { outline: 3px solid var(--c4); outline-offset: 3px; }

/* ============================================================
   QUOTE FORM
   ============================================================ */
.quote-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-top: 1.5rem;
}
@media (min-width: 40rem) {
  .quote-form { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: #0a0a0a;
  background: #ffffff;
  border: 1px solid rgba(10, 10, 10, 0.35);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  min-height: 48px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input::placeholder, .field textarea::placeholder { color: #6b675f; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid #0a0a0a;
  outline-offset: 2px;
  border-color: #0a0a0a;
}
.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.form-foot .btn-solid {
  background: #ffffff;
  color: #0a0a0a;
  border-color: #ffffff;
}
.form-foot .btn-solid:hover { background: #0a0a0a; color: #ffffff; border-color: #0a0a0a; }
.form-status {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #ffffff;
}
.form-status[data-state='error'] { color: #ffe9e7; text-decoration: underline; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-foot {
  background: var(--c1);
  color: #f2efe9;
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad) 5rem;
  --muted: #b3ada4;
  --accent: var(--c4);
}
.foot-inner { max-width: var(--maxw); margin: 0 auto; }
.foot-line { margin: 0 0 0.35rem; font-size: 0.95rem; }
.muted { color: var(--muted); }
.site-foot .attribution {
  margin-top: 2rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: #b3ada4;
}
.site-foot .attribution a {
  color: #b3ada4;
  text-decoration-color: rgba(179, 173, 164, 0.5);
  text-underline-offset: 3px;
}
.site-foot .attribution a:hover { color: #f2efe9; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-h1 {
    animation: none !important;
    font-variation-settings: 'wght' 600, 'opsz' 100;
  }
  .entry-body { animation: none !important; }
  .entry summary, .btn, .tab { transition: none !important; }
  .btn-solid:hover { transform: none; }
  .entry summary:hover { padding-left: 0; }
  .shot-btn, .shot-btn img { transition: none !important; }
  .shot-btn:hover { transform: none; }
}
