/* ==========================================================
   Engineering portfolio — shared styles
   Colors are defined once here. Change a token, the whole
   site follows (light and dark mode).
   ========================================================== */

:root {
  --paper: #f3f5f7;      /* page background, like drafting film */
  --surface: #ffffff;    /* panels, title blocks */
  --ink: #17202b;        /* body text */
  --muted: #5a6672;      /* secondary text */
  --line: #c9d1da;       /* borders, rules */
  --dykem: #1d3f8f;      /* layout-fluid blue: hero, links, buttons */
  --dykem-ink: #e8eef9;  /* text on blue */
  --scribe: rgba(232, 238, 249, 0.38); /* scribed lines on blue */
  --link: #1d3f8f;
  --fill-bg: #ffe36e;    /* highlighter for text you still need to write */
  --fill-ink: #3a3000;

  --wrap: 68rem;
  --measure: 38rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 3px;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11171e;
    --surface: #18212b;
    --ink: #e4e9ee;
    --muted: #9ca8b4;
    --line: #2d3946;
    --dykem: #22469a;
    --dykem-ink: #eef3fc;
    --scribe: rgba(238, 243, 252, 0.3);
    --link: #93b3f2;
    --fill-bg: #5c4b00;
    --fill-ink: #fff0b0;
  }
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  line-height: 1.12;
  margin: 0 0 0.5em;
  font-stretch: 118%;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

/* Text you still need to replace. Search the files for class="fill". */
.fill {
  background: var(--fill-bg);
  color: var(--fill-ink);
  padding: 0 0.2em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.wordmark {
  font-weight: 700;
  font-stretch: 125%;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

/* ---------- Hero (home) ---------- */

.hero {
  background: var(--dykem);
  color: var(--dykem-ink);
  position: relative;
  overflow: hidden;
}

/* A single dash-dot centerline scribed across the blue */
.hero::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2.4rem;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--scribe) 0 28px,
    transparent 28px 34px,
    var(--scribe) 34px 38px,
    transparent 38px 44px
  );
}

.hero .wrap {
  padding-top: clamp(4rem, 10vw, 7rem);
  padding-bottom: clamp(3rem, 8vw, 5.5rem);
  position: relative;
}

.name-block {
  display: inline-block;
  max-width: 100%;
}

.hero h1 {
  font-size: clamp(2.6rem, 9vw, 5.6rem);
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1;
}

/* Dimension line that measures the name */
.dim {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1rem;
  height: 1.5rem;
  border-left: 1px solid var(--scribe);
  border-right: 1px solid var(--scribe);
  color: var(--dykem-ink);
}

.dim-seg {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.75;
  position: relative;
}

.dim-seg::before {
  content: "";
  position: absolute;
  top: -4px;
  width: 11px;
  height: 9px;
  background: currentColor;
}

.dim-seg.l::before { left: 0; clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.dim-seg.r::before { right: 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }

.dim-label {
  font-size: 0.95rem;
  white-space: nowrap;
  font-stretch: 105%;
}

.hero .lede {
  max-width: var(--measure);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.5;
  margin: 2rem 0 2rem;
}

.hero .fill { background: rgba(255, 227, 110, 0.9); color: #2a2300; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
}

.btn {
  display: inline-block;
  background: var(--dykem-ink);
  color: var(--dykem);
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: #fff; }

.hero a:not(.btn) { color: var(--dykem-ink); }
.hero :focus-visible { outline-color: var(--dykem-ink); }

/* ---------- Sections ---------- */

.section {
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.section + .section { border-top: 1px solid var(--line); }

.section-intro {
  max-width: var(--measure);
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* ---------- Project list (home) ---------- */

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.project:first-child {
  border-top: 0;
  padding-top: 0;
}

/* The lead project gets more room */
.project.lead {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}
.project.lead h3 { font-size: 1.65rem; }

.project-media {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 4 / 3;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; }

.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { text-decoration: underline; }

.project-role {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.project-tools {
  font-size: 0.92rem;
  color: var(--muted);
  border-left: 2px solid var(--dykem);
  padding-left: 0.75rem;
  margin: 1rem 0 1.1rem;
}

/* ---------- About / skills ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.about-grid p { max-width: var(--measure); }

.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.skills h3 {
  font-size: 1rem;
  font-stretch: 110%;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.skills ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.97rem;
}
.skills li { padding: 0.2rem 0; }

/* ---------- Contact ---------- */

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  font-size: 1.1rem;
}

.contact-list span {
  display: inline-block;
  min-width: 6.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================
   Project pages
   ========================================================== */

.project-header {
  padding: clamp(2.5rem, 6vw, 4rem) 0 2rem;
}

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.project-header h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  font-stretch: 122%;
  font-weight: 800;
  max-width: 22ch;
}

.project-header .summary {
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  max-width: var(--measure);
  color: var(--muted);
}

/* Drawing-style title block: the facts a recruiter scans first */
.title-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  border: 1px solid var(--ink);
  background: var(--surface);
  margin: 2rem 0 0;
}

.title-block div {
  padding: 0.7rem 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 -1px -1px 0;
}

.title-block dt {
  font-size: 0.8rem;
  color: var(--muted);
}

.title-block dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
}

.hero-figure {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

figure { margin: 0; }

.hero-figure img { width: 100%; max-height: 42rem; object-fit: contain; }

figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.6rem 0.2rem 0;
}

.hero-figure figcaption { padding: 0.6rem 0.9rem 0.75rem; }

.writeup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
  gap: clamp(2rem, 5vw, 4rem);
  padding: 2.5rem 0 4rem;
}

.writeup article { max-width: var(--measure); }

.writeup article h2 {
  font-size: 1.45rem;
  margin-top: 2.4rem;
}
.writeup article h2:first-child { margin-top: 0; }

.writeup article ul { padding-left: 1.2rem; }
.writeup article li { margin-bottom: 0.4rem; }

.writeup aside {
  font-size: 0.95rem;
  position: sticky;
  top: 1.5rem;
  align-self: start;
}

.writeup aside h2 {
  font-size: 1rem;
  font-stretch: 110%;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}

.writeup aside ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
}
.writeup aside li { padding: 0.2rem 0; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin: 1.25rem 0 0;
}

.gallery img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.callout {
  border-left: 3px solid var(--dykem);
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  margin: 1.5rem 0;
  font-size: 0.97rem;
}
.callout p:last-child { margin-bottom: 0; }

/* Responsive 3D model / video embed */
.embed {
  position: relative;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin: 1.25rem 0 0;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.next-project {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.next-project a { font-weight: 600; }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .project,
  .project.lead,
  .about-grid,
  .writeup {
    grid-template-columns: minmax(0, 1fr);
  }

  .skills { grid-template-columns: minmax(0, 1fr); gap: 1rem; }

  .writeup aside { position: static; order: -1; }

  .dim-label { white-space: normal; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }

@media print {
  .site-header, .site-nav, .next-project, .skip { display: none; }
  .hero { background: none; color: var(--ink); }
  .fill { background: none; }
}

/* ---------- Data tables (predicted vs. measured, etc.) ---------- */

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.97rem;
  margin: 0.5rem 0 1.25rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
table.data thead th {
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}

/* ---------- Project filter (home) ---------- */

.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0;
  border: 0;
}

.filter legend {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  padding: 0;
  width: 100%;
}

.filter button {
  font: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.filter button:hover { border-color: var(--ink); }

.filter button[aria-pressed="true"] {
  background: var(--dykem);
  border-color: var(--dykem);
  color: var(--dykem-ink);
}

.project[hidden] { display: none; }

.project-tags {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.4rem 0 0.75rem;
}

/* CAD renders sit on white even in dark mode */
.project-media img,
.hero-figure img,
.figure img,
.gallery img,
.build img { background: #fff; }

/* ---------- Figures inside a write-up ---------- */

.figure {
  margin: 1.25rem 0 1.5rem;
}

.figure img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
}

.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.5rem;
}

.figure-row img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
}

/* Wide figures can break out of the text column on large screens */
@media (min-width: 1000px) {
  .figure.wide { margin-right: calc(-15rem - clamp(2rem, 5vw, 4rem)); }
}

/* ---------- Builds page ---------- */

.builds {
  list-style: none;
  margin: 0;
  padding: 0 0 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2rem 1.75rem;
}

.build img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
}

.build h2 {
  font-size: 1.12rem;
  font-stretch: 110%;
  margin-bottom: 0.3rem;
}

.build p {
  font-size: 0.96rem;
  margin-bottom: 0.4rem;
}

.build .made {
  font-size: 0.86rem;
  color: var(--muted);
}

.builds-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: center;
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 1.5rem;
  margin-top: 2.5rem;
}
.builds-callout h3 { margin-bottom: 0.3rem; }
.builds-callout p { margin: 0; color: var(--muted); }
.builds-callout .btn { background: var(--dykem); color: var(--dykem-ink); }
.builds-callout .btn:hover { background: var(--ink); }

@media (max-width: 760px) {
  .builds-callout { grid-template-columns: minmax(0, 1fr); }
}

.figure-row.stack { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }

/* Video and photo tweaks */
.figure video {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
}
.figure video.portrait { max-width: 20rem; }
.build img.photo { object-fit: cover; }

/* Wide tables scroll sideways on phones instead of stretching the page */
@media (max-width: 760px) {
  table.data { display: block; overflow-x: auto; font-size: 0.9rem; }
}

/* Featured build: spans the full grid with a photo strip */
.build.feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.5rem;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.feature-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.feature-photos img { margin: 0; aspect-ratio: 4 / 3; object-fit: cover; }
.feature-photos img:first-child { grid-column: 1 / -1; }
.feature-text h2 { font-size: 1.4rem; }
.feature-text p { font-size: 1rem; }
.embed-links { font-size: 0.95rem; margin-top: 0.75rem; }
@media (max-width: 760px) {
  .build.feature { grid-template-columns: minmax(0, 1fr); }
}
