/* Malibu Coastal Modernism Architectural Studio Design
   Palette: Museum White, Warm Honey Cedar, Malibu Slate, Deep Graphite, Pacific Ocean Cyan */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #efece5;
  --ink: #14171c;
  --ink-muted: #565d68;
  --border: #dcd7cc;
  --border-strong: #bdb6a7;
  --accent: #0c7c96;
  --accent-bright: #19b5d8;
  --accent-soft: rgba(12, 124, 150, 0.10);
  --cedar: #a46431;
  --pass: #157a4c;
  --pass-bg: rgba(21, 122, 76, 0.10);
  --warn: #b45309;
  --fail: #b91c1c;
  --fail-bg: rgba(185, 28, 28, 0.08);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  --shadow: 0 12px 32px rgba(15, 23, 32, 0.06);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

img, video {
  display: block;
  max-width: 100%;
}

/* --- Top Architectural Navigation --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: var(--surface);
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--mono);
}

.page-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-tab {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.page-tab:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.page-tab.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.page-tab .num {
  font-family: var(--mono);
  color: var(--accent);
  margin-right: 6px;
  font-size: 11px;
}

/* --- Layout Containers --- */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
}

section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: inline-block;
}

h1, h2, h3 {
  margin: 0 0 12px;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.45rem, 2.2vw, 2.0rem);
  font-weight: 700;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.lead {
  font-size: 1.04rem;
  color: var(--ink-muted);
  max-width: 68ch;
  margin: 0 0 24px;
}

/* --- Hero Split --- */
.hero {
  padding: 44px 0 48px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr;
  gap: 40px;
  align-items: center;
}

.hero-frame {
  position: relative;
  border: 1px solid var(--border);
  background: #0e1318;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.frame-caption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(14, 19, 24, 0.78);
  backdrop-filter: blur(8px);
  color: #f3f6f8;
  padding: 6px 11px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.spec-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 26px 0 28px;
}

.spec-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.spec-chip .val {
  display: block;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.spec-chip .lbl {
  display: block;
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--ink);
  transition: all 0.16s ease;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--ink);
  background: var(--surface-alt);
}

/* --- Interactive 3D WebGL Viewer --- */
.viewer-shell {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.viewer-canvas-wrap {
  position: relative;
  min-height: 500px;
  background: linear-gradient(180deg, #cfe3f1 0%, #eaf1f6 55%, #dfe7ec 100%);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#viewer3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.viewer-overlay-top {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.viewer-pill {
  background: rgba(20, 23, 28, 0.78);
  color: #f4f7fa;
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 4px;
  backdrop-filter: blur(6px);
}

.viewer-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(246, 244, 239, 0.85);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  transition: opacity 0.3s ease;
}

.viewer-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 4px 4px 8px;
}

.ctrl-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.ctrl-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ctrl-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.ctrl-val {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.preset-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.14s ease;
}

.preset-btn:hover, .preset-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* --- 5-Strata Architectural Explorer --- */
.layer-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-btn {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.layer-btn:hover {
  border-color: var(--accent);
}

.layer-btn.active {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(12, 124, 150, 0.12);
}

.layer-btn-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.layer-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

.layer-dim {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.layer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.layer-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.layer-plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
  background: #101419;
}

.layer-plate {
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.layer-plate:last-child {
  border-right: none;
}

.layer-plate img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.layer-detail-body {
  padding: 22px 24px;
}

.layer-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.meta-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}

.meta-box strong {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.meta-box span {
  font-size: 13px;
  font-weight: 600;
}

/* --- Methodology 4-Step Grid --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.step-card .step-idx {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}

.step-card p {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin: 0;
}

/* --- Study Plates Gallery --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.plate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.plate-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.plate-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #13181f;
}

.plate-meta {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.plate-meta strong {
  font-size: 12.5px;
}

.plate-meta span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
}

/* --- Page 2: Cinema Video Showcase --- */
.cinema-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.cinema-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  transition: all 0.16s ease;
}

.cinema-tab .tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.cinema-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.cinema-tab.active .tag {
  color: var(--accent-bright);
}

.cinema-stage {
  background: #0d1117;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cinema-stage video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.cinema-bar {
  background: var(--surface);
  padding: 18px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.chapter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chapter-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.14s ease;
}

.chapter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mini-videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.mini-vid-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.mini-vid-card .vid-specs {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  margin: 4px 0 8px;
}

.mini-vid-card p {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
}

/* --- Comparison Matrix --- */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 13.5px;
}

.compare-table th, .compare-table td {
  padding: 15px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.compare-table th {
  background: var(--surface-alt);
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-pass {
  background: var(--pass-bg);
  color: var(--pass);
}

.badge-fail {
  background: var(--fail-bg);
  color: var(--fail);
}

/* --- Preflight QA Proof --- */
.qa-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.qa-audit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.qa-audit-row:last-child {
  border-bottom: none;
}

.qa-metric {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
}

/* --- Code Blocks --- */
.code-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.code-box {
  background: #11161d;
  color: #e2e8f0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 20px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
  border: 1px solid #232c38;
}

.code-box .cm { color: #7e8fa3; }
.code-box .hl { color: #67e8f9; font-weight: 600; }
.code-box .ok { color: #6ee7b7; }

/* --- Footer --- */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --- Lightbox Modal --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 14, 18, 0.92);
  backdrop-filter: blur(10px);
  display: none;
  place-items: center;
  padding: 28px;
}

.lightbox.open {
  display: grid;
}

.lightbox-inner {
  max-width: 1280px;
  width: 100%;
  text-align: center;
}

.lightbox-inner img {
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.lightbox-caption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: #cbd5e1;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .hero-grid, .viewer-shell, .layer-layout, .qa-grid, .code-grid {
    grid-template-columns: 1fr;
  }
  .steps-grid, .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .spec-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .steps-grid, .gallery-grid, .mini-videos-grid, .layer-plates, .layer-meta-grid {
    grid-template-columns: 1fr;
  }
}
