/* ============================================================
   REVISION D — Interactive Structural Scenes & Dossier Deck
   Unified with Version D Drafting Table Palette
   ============================================================ */
:root {
  --paper:       #F2EDE3;
  --paper-2:     #FAF8F3;
  --paper-3:     #E8E1D3;
  --sheet:       #FAF8F3;
  --surface:     #E8E1D3;
  --ink:         #16181D;
  --ink-2:       #5A6068;
  --ink-3:       #8A919A;
  --accent:      #C63D2F;
  --accent-2:    #E04E3A;
  --forest:      #16181D;
  --pale:        #F5D7D3;
  --blue:        #26426E;
  --compression: #C63D2F;
  --zero:        #8A919A;
  --line:        rgba(22,24,29,0.13);
  --line-2:      rgba(22,24,29,0.28);
  --grid:        rgba(38,66,110,0.055);
  --folder-a:    #E6DEC8;
  --folder-b:    #DCE2EA;
  --folder-c:    #EAE1D0;
  --folder-d:    #D8E0E8;
  --ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --dur:         0.55s;
  color-scheme:  light;
}

html[data-theme="dark"] {
  --paper:       #0C1320;
  --paper-2:     #121B2C;
  --paper-3:     #1A2436;
  --sheet:       #121B2C;
  --surface:     #1A2436;
  --ink:         #EDE6D6;
  --ink-2:       #96A0B2;
  --ink-3:       #5D6778;
  --accent:      #FF6B45;
  --accent-2:    #FF8C6B;
  --forest:      #EDE6D6;
  --pale:        #3A2422;
  --blue:        #6B9BD1;
  --compression: #FF6B45;
  --zero:        #647084;
  --line:        rgba(237,230,214,0.11);
  --line-2:      rgba(237,230,214,0.26);
  --grid:        rgba(107,155,209,0.05);
  --folder-a:    #1B263B;
  --folder-b:    #202D44;
  --folder-c:    #242B3D;
  --folder-d:    #1A283B;
  color-scheme:  dark;
}

body { overflow-x: clip; }
body.dialog-open { overflow: hidden; }
svg { display: block; max-width: 100%; }
button,a,input,select,summary { -webkit-tap-highlight-color: transparent; }
button,input,select { font: inherit; }
button,summary { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: default; opacity: .65; }
:is(a,button,input,select,summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 20px;
  transform: translateY(-160%);
  z-index: 1100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-sm);
}
.skip-link:focus { transform: none; }

.icon-btn { min-width: 42px; min-height: 42px; }
.nav-link { min-height: 42px; align-items: center; }

.hero { min-height: calc(100svh - var(--header-h)); padding-block: clamp(64px, 6.5vw, 104px); }
.section, .hero { scroll-margin-top: var(--header-h); }
.section-body { min-width: 0; }

/* ── PROFILE & EDUCATION ──────────────────────────────────── */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: clamp(32px, 5vw, 64px);
}
.prose p { color: var(--ink-2); }
.education {
  padding: 24px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  align-self: start;
}
.education h3 {
  font-size: 0.74rem;
  color: var(--accent);
  padding-bottom: 12px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line-2);
}
.education dl { margin: 0; display: grid; gap: 18px; }
.education dt { font-size: 0.92rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.education dd { font-size: 0.82rem; color: var(--ink-2); margin: 5px 0 0; line-height: 1.55; }

/* ── TIMELINE ─────────────────────────────────────────────── */
.timeline::before { transform: scaleY(1); }
.js-motion .timeline::before { transform: scaleY(0); }
.js-motion .timeline.is-visible::before { transform: scaleY(1); }

/* ── SKILLS & VIGNETTE LAYOUT ─────────────────────────────── */
.skills-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 1fr);
  gap: 40px;
  align-items: start;
}

/* ── ENGINEERING VIGNETTES (Interactive SVG Scenes) ───────── */
.engineering-vignette {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 16px 18px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.vignette-picture {
  width: 100%;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.vignette-picture svg {
  width: 100%;
  height: 300px;
  display: block;
  overflow: hidden;
}
.frame-vignette .vignette-picture svg { height: 280px; }
.truss-vignette .vignette-picture svg { height: 300px; }
.vignette-picture svg text {
  font: 500 11px var(--font-mono);
  fill: var(--ink);
  letter-spacing: 0.03em;
}
.vignette-copy { width: 100%; }
.drawing-title {
  font-size: 0.68rem;
  color: var(--accent);
  margin: 0 0 8px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.vignette-copy > p:not(.drawing-title) {
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 56ch;
  color: var(--ink-2);
  margin: 0;
}

.scene-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 18px;
  margin-top: 10px;
}
.scene-actions button, .text-control {
  border: 0;
  background: none;
  padding: 6px 0;
  min-height: 36px;
  font-size: 0.72rem;
  color: var(--ink);
  transition: transform 0.2s var(--ease), color 0.2s;
}
.scene-actions button:hover, .text-control:hover {
  color: var(--accent);
  transform: translateY(-1px);
}
.scene-phase { color: var(--blue); font-size: 0.7rem; margin-left: auto; }
.scene-model { width: 100%; color: var(--ink); font-size: 0.8rem; border-top: 1px solid var(--line); margin-top: 6px; }
.scene-model summary { font-size: 0.7rem; min-height: 36px; padding: 8px 0; width: fit-content; color: var(--ink-2); }
.scene-model summary:hover { color: var(--accent); }
.scene-model[open] { padding: 8px 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); }

.model-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 18px; }
.model-fields label { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 0.76rem; align-content: start; color: var(--ink-2); }
.model-fields output { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.model-fields input, .model-fields select { grid-column: 1 / -1; min-width: 0; width: 100%; min-height: 36px; margin: 0; accent-color: var(--accent); }
.model-fields select {
  padding: 6px 8px;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 0.78rem;
}
.model-readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.model-readings dt { font-size: 0.64rem; color: var(--ink-3); }
.model-readings dd { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink); font-weight: 600; }
.model-note { margin-top: 10px; font-size: 0.74rem; line-height: 1.55; color: var(--ink-2); }
.model-feedback:empty { display: none; }
.model-feedback { margin-top: 10px; color: var(--accent); font-size: 0.68rem; }

/* ── SVG DRAWING ELEMENTS ─────────────────────────────────── */
.scene-beam { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; }
.scene-member { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.15s ease; }
.scene-member:hover { stroke-width: 3.6; }
.scene-ghost { fill: none; stroke: var(--ink-3); stroke-width: 1.1; stroke-dasharray: 4 4; opacity: 0.45; }
.scene-support { fill: var(--ink); stroke: none; }
.scene-dimension { fill: none; stroke: var(--ink-3); stroke-width: 1; }
.scene-diagram { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.scene-diagram-area { fill: var(--accent); opacity: 0.1; stroke: none; }
.scene-baseline { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.75; }
.scene-deck { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
.scene-walkway { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 6 3; }
.scene-node { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.6; }
.scene-prop { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.scene-prop-accent { fill: var(--accent); stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.scene-prop-wheel { fill: var(--ink); stroke: none; }
.scene-rope { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.scene-callout-box { fill: var(--paper-2); stroke: var(--accent); stroke-width: 1.3; rx: 2px; }
.scene-callout-text { font: 600 9.5px var(--font-mono); fill: var(--accent); letter-spacing: 0.04em; }

.stick-limb { stroke: var(--ink); stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stick-head { stroke: var(--ink); stroke-width: 1.8; fill: var(--paper-2); }
.solid-head .stick-head { fill: var(--ink); }
.stick-hat { fill: var(--accent); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.solid-head .stick-hat { fill: var(--blue); }
.stick-eye { fill: var(--ink); }
.solid-head .stick-eye { fill: var(--paper-2); }
.static-beam, .static-frame { stroke: var(--ink); stroke-width: 2; fill: none; }

.force-key { display: flex; flex-wrap: wrap; gap: 14px; color: var(--ink-2); font-size: 0.66rem; margin: 6px 0 4px; }
.force-key span { display: inline-flex; align-items: center; gap: 6px; }
.force-key i { width: 16px; height: 3px; display: inline-block; }
.tension-dot { background: var(--blue); }
.compression-dot { background: var(--compression); }
.zero-dot { background: var(--zero); }

/* ── PROJECT FOLDER DECK (Fixed Height & Non-Overlapping) ─── */
.deck-wrap {
  padding-top: 36px;
  position: relative;
}
.project-deck {
  height: 455px;
  position: relative;
  perspective: 1400px;
  max-width: 100%;
  margin-bottom: 16px;
}
.project-file {
  position: absolute;
  top: 32px;
  left: 50%;
  display: block;
  width: 264px;
  height: 344px;
  background: var(--folder);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  translate: calc(-50% + var(--x)) var(--y);
  rotate: var(--r);
  transform: translateY(0) scale(1);
  transform-origin: center bottom;
  transition: translate 0.65s var(--ease), rotate 0.65s var(--ease), transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.35s ease;
}
.project-file::before {
  content: '';
  position: absolute;
  left: -1px;
  top: -27px;
  width: 76%;
  height: 28px;
  background: var(--folder);
  border-top: 1px solid var(--line-2);
  border-left: 1px solid var(--line-2);
  clip-path: polygon(0 0, 90% 0, 100% 100%, 0 100%);
}
.file-tab {
  position: absolute;
  top: -21px;
  left: 11px;
  font-size: 0.61rem;
  color: var(--ink);
  white-space: nowrap;
}
.file-paper {
  margin: 8px;
  padding: 14px 14px 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  height: 326px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.file-paper h3 {
  font: 600 0.98rem/1.22 var(--font-display);
  letter-spacing: -0.02em;
  margin: 6px 0 6px;
}
.file-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.58rem;
  color: var(--ink-2);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.file-meta span:first-child { color: var(--accent); font-weight: 600; }
.file-meta span:last-child { white-space: nowrap; }
.file-drawing { height: 118px; margin: 4px 0 6px; flex-shrink: 0; }
.file-drawing svg { width: 100%; height: 100%; }
.file-drawing :is(path,line,polyline), .dialog-visual :is(path,line,polyline) {
  stroke: var(--blue);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.file-drawing .solid, .dialog-visual .solid {
  fill: color-mix(in srgb, var(--blue) 14%, var(--paper-2));
}
.file-paper > p {
  font-size: 0.72rem;
  color: var(--ink-2);
  line-height: 1.42;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.open-project {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.66rem;
  color: var(--accent);
  font-weight: 600;
}

/* Wider resting fan so tabs & titles never collide, and clean full spread on hover */
.file-industrial { --folder: var(--folder-a); --x: -105px; --y: 12px; --r: -7deg;   z-index: 1; }
.file-bridges    { --folder: var(--folder-b); --x: -35px;  --y: 4px;  --r: -2.5deg; z-index: 2; }
.file-buildings  { --folder: var(--folder-c); --x: 35px;   --y: 4px;  --r: 2.5deg;  z-index: 3; }
.file-research   { --folder: var(--folder-d); --x: 105px;  --y: 12px; --r: 7deg;    z-index: 4; }

.project-deck:is(:hover, :focus-within, .is-spread) .file-industrial { --x: -340px; --y: 0px; --r: -8deg; }
.project-deck:is(:hover, :focus-within, .is-spread) .file-bridges    { --x: -114px; --y: 0px; --r: -2.5deg; }
.project-deck:is(:hover, :focus-within, .is-spread) .file-buildings  { --x: 114px;  --y: 0px; --r: 2.5deg; }
.project-deck:is(:hover, :focus-within, .is-spread) .file-research   { --x: 340px;  --y: 0px; --r: 8deg; }

.project-file:hover, .project-file:focus-visible {
  transform: translateY(-20px) scale(1.04);
  z-index: 20;
  border-color: var(--accent);
  box-shadow: 0 22px 44px rgba(0,0,0,0.18);
}

.deck-tools {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 18px 0 38px;
  padding-top: 8px;
}
.deck-hint { color: var(--ink-3); font-size: 0.65rem; }

/* ── COMPLEX GANTRY POSTSCRIPT SECTION ────────────────────── */
.project-postscript {
  display: grid;
  grid-template-columns: 0.88fr minmax(360px, 1.35fr);
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
  max-width: 1160px;
  margin: 28px auto 0;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}
.project-postscript > div > p:not(.drawing-title) {
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.72;
  margin-bottom: 1rem;
}
.project-postscript strong { color: var(--ink); }

/* ── CONTACT TRANSMITTAL BOX ──────────────────────────────── */
.contact-note {
  padding: 24px;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}
.contact-note > p:first-child {
  font: 600 1.15rem/1.4 var(--font-display);
  margin-bottom: 18px;
  color: var(--ink);
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-languages { font-size: 0.68rem; margin: 18px 0 0; color: var(--ink-2); }

/* ── DIALOG MODAL ─────────────────────────────────────────── */
.case-fallbacks { padding-bottom: 60px; }
.case-fallbacks article { max-width: 720px; margin: 60px auto; scroll-margin-top: 100px; }
.case-fallbacks article p { margin-block: 16px; }
.has-dialogs .case-fallbacks { display: none; }

#project-dialog {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 0;
  max-width: min(780px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  width: 780px;
  background: var(--paper-2);
  color: var(--ink);
  overflow: auto;
  box-shadow: 0 40px 80px rgba(0,0,0,0.38);
}
#project-dialog::backdrop {
  background: rgba(12, 19, 32, 0.62);
  backdrop-filter: blur(5px);
}
.dialog-sheet { padding: clamp(22px, 4vw, 42px); transform-origin: top left; }
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.dialog-top p { color: var(--accent); margin: 0; }
.close-button { background: none; border: 0; min-height: 38px; padding: 6px 8px; color: var(--ink-2); }
.close-button:hover { color: var(--accent); }
.dialog-visual {
  height: 180px;
  width: 100%;
  margin-bottom: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
}
.dialog-visual svg { width: 100%; height: 100%; }
.dialog-content h2 { font: 600 clamp(1.45rem, 2.8vw, 1.95rem)/1.2 var(--font-display); margin: 8px 0 16px; }
.dialog-content h3 { font: 600 1.05rem var(--font-display); margin-top: 22px; color: var(--ink); }
.dialog-content p { font-size: 0.96rem; line-height: 1.72; margin-top: 12px; color: var(--ink-2); }
.dialog-content strong { color: var(--ink); }
.dialog-content article > p:first-of-type { font-size: 0.68rem; color: var(--accent); }
.dialog-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* ── SCROLL REVEAL ────────────────────────────────────────── */
[data-reveal] { opacity: 1; transform: none; }
.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js-motion [data-reveal].is-visible { opacity: 1; transform: none; }

/* ── RESPONSIVE BREAKPOINTS ───────────────────────────────── */
@media (max-width: 1100px) and (min-width: 721px) {
  .project-file { width: 230px; }
  .project-deck:is(:hover, :focus-within, .is-spread) .file-industrial { --x: -235px; --r: -8deg; }
  .project-deck:is(:hover, :focus-within, .is-spread) .file-bridges    { --x: -78px; }
  .project-deck:is(:hover, :focus-within, .is-spread) .file-buildings  { --x: 78px; }
  .project-deck:is(:hover, :focus-within, .is-spread) .file-research   { --x: 235px; --r: 8deg; }
}

@media (max-width: 960px) {
  .hero-grid, .profile-layout, .skills-layout, .project-postscript, .contact-grid {
    grid-template-columns: 1fr;
  }
  .hero-facts { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .nav { visibility: hidden; }
  .nav.is-open { visibility: visible; }
  .hero { min-height: 0; padding-block: 44px 60px; }
  .hero-facts { grid-template-columns: 1fr; gap: 10px; }
  .regmark--bl, .regmark--br, .scroll-cue { display: none; }
  .project-deck {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 44px 16px;
    height: auto;
    perspective: none;
  }
  .project-file, .project-deck:is(:hover, :focus-within, .is-spread) .project-file {
    position: relative;
    top: auto; left: auto;
    width: 100%;
    height: auto;
    min-width: 0;
    translate: none;
    rotate: none;
  }
  .file-paper { height: auto; min-height: 290px; }
  .project-file:hover, .project-file:focus-visible { transform: translateY(-5px); }
  #spread-files { display: none; }
  .model-fields { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .project-deck { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-motion [data-reveal] { opacity: 1; transform: none; }
  .js-motion .timeline::before { transform: scaleY(1); }
  .project-file { transition: none; }
}