/* ============================================================
   COOK CONTRACTING — 3D Builder Page Styles
   Shares the same design system as index.html
   (Oswald / Inter / JetBrains Mono, #CC1B1B accent)
============================================================ */

:root {
  --ink:    #0a0a0a;
  --ink-2:  #181818;
  --ink-3:  #2a2a2a;
  --bone:   #f4f0e8;
  --paper:  #faf7f2;
  --line:   rgba(255,255,255,0.12);
  --line-d: rgba(0,0,0,0.1);
  --accent: #CC1B1B;
  --accent-2:#A81515;
  --muted:  #6b6560;
  --max:    1320px;
  --pad:    clamp(16px,3vw,48px);
  --sidebar-w: 340px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

.shell { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.d { font-family: 'Oswald', sans-serif; font-weight: 600; text-transform: uppercase; line-height: .95; }
.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.12em; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--accent); display: inline-block; }
.eyebrow.lit { color: rgba(255,255,255,0.6); }
.eyebrow.lit::before { background: var(--accent); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 24px;
  font-family: 'Oswald', sans-serif; font-weight: 600;
  font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 2px solid var(--ink); background: var(--ink); color: #fff;
  transition: all .18s ease; white-space: nowrap;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn.ghost:hover { background: #fff; color: var(--ink); border-color: #fff; }
.btn.sm { padding: 10px 16px; font-size: 12px; }
.btn .arr { font-size: 16px; transition: transform .18s; }
.btn:hover .arr { transform: translateX(4px); }

/* ============================================================
   TOP STRIP
============================================================ */
.topstrip { background: var(--ink); color: rgba(255,255,255,0.75); border-bottom: 1px solid #1e1e1e; }
.topstrip .inner {
  display: flex; align-items: center; justify-content: center;
  height: 36px; gap: 24px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
}

/* ============================================================
   HEADER
============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper); border-bottom: 1px solid #ddd8cc;
  transition: box-shadow .2s;
}
.site-header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.08); }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 70px; gap: 16px; }
.brand { display: flex; align-items: center; }
.brand img { height: 58px; width: auto; }
nav.main { display: flex; align-items: center; gap: 0; }
nav.main a {
  font-family: 'Oswald', sans-serif; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 14px;
  color: var(--ink); padding: 10px 14px; position: relative; transition: color .15s;
}
nav.main a:hover { color: var(--accent); }
nav.main a.active-builder { color: var(--accent); }
nav.main a.active-builder::after {
  content: ""; position: absolute; left: 14px; right: 14px;
  bottom: 6px; height: 2px; background: var(--accent);
}
.menu-btn {
  display: none; width: 44px; height: 44px;
  border: 2px solid var(--ink); align-items: center;
  justify-content: center; flex-direction: column; gap: 5px;
}
.menu-btn span { width: 20px; height: 2px; background: var(--ink); display: block; transition: all .25s; }
.mobile-nav {
  position: fixed; inset: 0; background: var(--ink);
  z-index: 200; display: none; flex-direction: column; padding: 24px var(--pad) 40px;
}
.mobile-nav.open { display: flex; }
.mob-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.mob-close { width: 44px; height: 44px; border: 1px solid var(--line); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.mob-links { display: flex; flex-direction: column; margin-top: 28px; gap: 0; }
.mob-links a { font-family: 'Oswald', sans-serif; font-size: 36px; font-weight: 600; text-transform: uppercase; color: #fff; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mob-links a:hover { color: var(--accent); }
.mob-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 24px; display: grid; gap: 8px; font-size: 14px; color: rgba(255,255,255,0.7); }
.mob-foot a { color: #fff; }

/* ============================================================
   BUILDER HERO STRIP
============================================================ */
.builder-hero {
  background: var(--ink); color: #fff;
  padding: 28px 0;
  border-bottom: 3px solid var(--accent);
}
.builder-hero-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.builder-hero h1 {
  font-family: 'Oswald', sans-serif; font-weight: 700;
  text-transform: uppercase; font-size: clamp(26px, 3vw, 40px);
  line-height: 1; letter-spacing: -0.01em; color: #fff;
}
.builder-hero h1 span { color: var(--accent); }
.builder-hero p {
  font-size: 13px; color: rgba(255,255,255,0.6);
  margin-top: 6px; max-width: 54ch;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.06em;
}
.builder-breadcrumb {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.4); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.builder-breadcrumb a { color: rgba(255,255,255,0.4); transition: color .15s; }
.builder-breadcrumb a:hover { color: var(--accent); }
.builder-breadcrumb span { color: var(--accent); }

/* ============================================================
   BUILDER LAYOUT
============================================================ */
.builder-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr 280px;
  min-height: calc(100vh - 200px);
  border-bottom: 1px solid var(--line-d);
}

/* LEFT SIDEBAR — config controls */
.builder-sidebar {
  background: var(--ink-2);
  border-right: 1px solid rgba(255,255,255,0.07);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 70px;
}

/* CENTER — 3D canvas */
.builder-canvas-wrap {
  position: relative;
  background: #87c3e8;
  display: flex;
  flex-direction: column;
}
.builder-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  flex: 1;
}

/* RIGHT PANEL — spec sheet + CTAs */
.builder-spec-panel {
  background: var(--paper);
  border-left: 1px solid var(--line-d);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 70px;
}

/* ============================================================
   VIEW BUTTONS BAR (above canvas)
============================================================ */
.view-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--ink); border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 16px;
}
.view-bar-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-right: 16px; white-space: nowrap;
}
.view-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.45); padding: 12px 14px;
  border-right: 1px solid rgba(255,255,255,0.07);
  transition: color .15s, background .15s; cursor: pointer;
  background: none; border-top: 0; border-left: 0; border-bottom: 0;
}
.view-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.view-btn.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
#btn-frame-sidebar.active { background: rgba(204,27,27,0.18); border-color: var(--accent); color: var(--accent); }
.view-bar-sep { width: 1px; height: 28px; background: rgba(255,255,255,0.1); margin: 0 4px; flex-shrink: 0; }

/* ============================================================
   LOADING OVERLAY
============================================================ */
.builder-loading {
  position: absolute; inset: 0; background: #87c3e8;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  z-index: 10;
}
.builder-loading .load-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.builder-loading p {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SIDEBAR INTERNALS
============================================================ */
.sb-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: var(--ink);
}
.sb-type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.sb-type-btn {
  padding: 12px 10px; border: 1.5px solid rgba(255,255,255,0.14);
  background: transparent; color: rgba(255,255,255,0.6);
  font-family: 'Oswald', sans-serif; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer; transition: all .15s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.sb-type-btn:hover { border-color: rgba(255,255,255,0.4); color: #fff; }
.sb-type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sb-type-icon { font-size: 22px; line-height: 1; }

.sb-section { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sb-section-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: rgba(255,255,255,0.28); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.sb-section-label::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,0.06); }

/* Slider row */
.cfg-row { margin-bottom: 14px; }
.cfg-row:last-child { margin-bottom: 0; }
.cfg-lbl {
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.38); margin-bottom: 8px;
}
.cfg-lbl .cfg-val {
  font-family: 'Oswald', sans-serif; font-size: 18px;
  font-weight: 600; color: var(--accent); letter-spacing: 0;
  text-transform: none;
}
.cfg-slider {
  -webkit-appearance: none; width: 100%; height: 2px;
  background: rgba(255,255,255,0.14); outline: none; cursor: pointer; display: block;
}
.cfg-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); cursor: pointer;
}
.cfg-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); cursor: pointer;
}

/* Chip rows */
.cfg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-chip {
  padding: 7px 12px; border: 1.5px solid rgba(255,255,255,0.14);
  background: transparent; color: rgba(255,255,255,0.6);
  font-family: 'Oswald', sans-serif; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer; transition: all .14s; user-select: none;
}
.cfg-chip:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
.cfg-chip.sel { background: var(--ink-3); border-color: var(--accent); color: #fff; }
.cfg-chip.sel-multi { background: rgba(204,27,27,0.18); border-color: var(--accent); color: #fff; }

/* Counter */
.cfg-counter { display: flex; align-items: center; border: 1.5px solid rgba(255,255,255,0.14); width: fit-content; }
.cfg-counter-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; color: rgba(255,255,255,0.6);
  transition: background .14s; background: none; border: none;
}
.cfg-counter-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cfg-count {
  width: 44px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-family: 'Oswald', sans-serif; font-size: 18px; font-weight: 600; color: #fff;
  border-left: 1.5px solid rgba(255,255,255,0.14);
  border-right: 1.5px solid rgba(255,255,255,0.14);
}

/* Color swatches */
.cfg-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.swatch-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.swatch {
  width: 30px; height: 30px; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.sel { box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px var(--accent); }
.swatch-lbl {
  font-family: 'JetBrains Mono', monospace; font-size: 7px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); text-align: center;
  max-width: 36px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============================================================
   SPEC PANEL INTERNALS
============================================================ */
.sp-header {
  background: var(--ink); color: #fff;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sp-co {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-bottom: 4px;
}
.sp-title {
  font-family: 'Oswald', sans-serif; font-size: 18px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #fff;
}
.sp-ref {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin-top: 5px;
}
.sp-body { padding: 16px 20px; }
.sp-sec-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
}
.sp-sec-label::after { content: ""; flex: 1; height: 1px; background: var(--line-d); }
.sp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid var(--line-d); gap: 8px;
}
.sp-row:last-child { border-bottom: none; }
.sp-key {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); flex-shrink: 0;
}
.sp-val {
  font-family: 'Oswald', sans-serif; font-size: 14px;
  text-transform: uppercase; color: var(--ink);
  letter-spacing: 0.02em; text-align: right;
}
.sp-val.hi { color: var(--accent); }
.sp-color-preview { display: inline-flex; align-items: center; gap: 5px; }
.sp-color-dot { width: 10px; height: 10px; display: inline-block; border: 1px solid rgba(0,0,0,0.15); flex-shrink: 0; }

.sp-divider { border: none; border-top: 1px solid var(--line-d); margin: 12px 0; }

/* Price estimate display */
.sp-est-range {
  font-family: 'Oswald', sans-serif; font-size: 24px; font-weight: 700;
  color: var(--accent); letter-spacing: 0.02em; margin: 6px 0 4px;
}
.sp-est-note {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.1em; color: var(--muted); line-height: 1.6;
}

/* Spec panel tabs */
.sp-tabs {
  display: flex; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 12px;
}
.sp-tab {
  flex: 1; padding: 9px 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer; transition: color .15s, border-color .15s;
}
.sp-tab:hover { color: rgba(255,255,255,0.7); }
.sp-tab.active { color: #fff; border-bottom-color: var(--accent); }

/* Material list */
.sp-mat-note {
  font-family: 'JetBrains Mono', monospace; font-size: 8px;
  color: var(--muted); margin-left: 4px; text-transform: none; letter-spacing: 0;
}

/* CTA buttons in spec panel */
.sp-ctas { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.sp-ctas .btn { justify-content: center; width: 100%; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 12px 24px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; border-left: 3px solid var(--accent);
  transition: transform .3s ease; z-index: 999; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============================================================
   FOOTER
============================================================ */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.7); padding: 48px 0 24px; border-top: 5px solid var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1);
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.4);
  flex-wrap: wrap; gap: 12px;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1100px) {
  :root { --sidebar-w: 280px; }
  .builder-layout { grid-template-columns: var(--sidebar-w) 1fr; }
  .builder-spec-panel { display: none; }
}
@media (max-width: 768px) {
  .builder-layout {
    display: flex; flex-direction: column;
  }
  .builder-canvas-wrap { order: 1; min-height: 55vw; max-height: 55vw; }
  .builder-sidebar {
    order: 2; max-height: none; position: static;
    border-right: none; border-top: 3px solid var(--accent);
  }
  .builder-spec-panel {
    display: block !important; order: 3;
    max-height: none; position: static; border-left: none;
    border-top: 1px solid var(--line-d);
  }
  nav.main { display: none; }
  .menu-btn { display: inline-flex; }
  .header-cta .btn { display: none; }
  .view-bar { overflow-x: auto; gap: 0; }
  .view-btn { padding: 10px 10px; font-size: 9px; }
}
@media (max-width: 480px) {
  .builder-canvas-wrap { min-height: 60vw; max-height: 60vw; }
}

/* print / PDF */
@media print {
  .builder-canvas-wrap, .builder-sidebar, .builder-hero, .site-header,
  .topstrip, .site-footer, .view-bar, .sp-ctas, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .builder-layout { display: block; }
  .builder-spec-panel {
    display: block !important; max-height: none !important; position: static !important;
    border: none; width: 100%; overflow: visible;
  }
  .sp-header { background: #1a1a1a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sp-est-range { color: #CC1B1B !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sp-body { display: block !important; padding: 20px; }
  #sp-mat-body { display: none !important; }
  .sp-tabs { display: none !important; }
  .sp-row { page-break-inside: avoid; }
}
