/* ==========================================================================
   Keith Megaridis - portfolio
   Design system: "Industry". The tokens in section 2 are the source of truth;
   never hard-code a value a token carries.
   Layout numbers (paddings, type sizes) come from the approved mockups.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts - self-hosted, latin subset, no third-party requests.
   Barlow / Barlow Condensed, SIL Open Font License 1.1.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/barlow-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/barlow-700.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/barlow-condensed-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/barlow-condensed-600.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  --color-bg: #f2f2f3;
  --color-surface: #e9e9ea;
  --color-text: #1d1f20;
  --color-accent: #5980a6;
  --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);

  /* Muted text. The system specifies a 55% mix, which lands at ~3.5:1 on this
     ground and fails WCAG AA at the sizes it is used at (10-13.5px). Raised to
     65% (~4.8:1). Visually near-identical, legible to everyone. */
  --color-muted: color-mix(in srgb, var(--color-text) 65%, transparent);

  --color-accent-100: #eef6ff;
  --color-accent-200: #d6ebff;
  --color-accent-300: #b5d9fd;
  --color-accent-400: #94bce3;
  --color-accent-500: #749dc4;
  --color-accent-600: #597ea3;
  --color-accent-700: #416180; /* the step for accent-coloured small text */
  --color-accent-800: #2c455d;
  --color-accent-900: #1d2d3d;

  --font-heading: "Barlow Condensed", ui-sans-serif, system-ui, sans-serif;
  --font-heading-weight: 600;
  --font-body: "Barlow", ui-sans-serif, system-ui, sans-serif;

  --space-1: 3.4px;
  --space-2: 6.8px;
  --space-3: 10.2px;
  --space-4: 13.6px;
  --space-6: 20.4px;
  --space-8: 27.2px;

  /* Sheet width, and the sticky header that anchors have to clear. */
  --sheet-width: 1300px;
  --header-height: 56px;
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }

p { margin: 0 0 var(--space-3); }
img { display: block; max-width: 100%; }
figure { margin: 0; }

a {
  color: var(--color-accent);
  text-underline-offset: 3px;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
::selection {
  background: color-mix(in srgb, var(--color-accent) 30%, transparent);
}

.text-muted { color: var(--color-muted); }

/* Visible only when focused - the first tab stop on every page. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-text);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* --------------------------------------------------------------------------
   4. Design-system components
   -------------------------------------------------------------------------- */

/* Blueprint frame - a square hairline box carrying four registration marks.
   The marks are drawn on one pseudo-element (eight gradient layers, two per
   corner) instead of four <i> elements, so the HTML stays easy to edit. */
.blueprint {
  position: relative;
  border: 1px solid var(--color-divider);
  border-radius: 0;
}
.blueprint::before {
  content: "";
  position: absolute;
  inset: -6px;
  pointer-events: none;
  --mark: color-mix(in srgb, var(--color-text) 55%, transparent);
  background-image:
    linear-gradient(var(--mark), var(--mark)), linear-gradient(var(--mark), var(--mark)),
    linear-gradient(var(--mark), var(--mark)), linear-gradient(var(--mark), var(--mark)),
    linear-gradient(var(--mark), var(--mark)), linear-gradient(var(--mark), var(--mark)),
    linear-gradient(var(--mark), var(--mark)), linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-size:
    1px 11px, 11px 1px,
    1px 11px, 11px 1px,
    1px 11px, 11px 1px,
    1px 11px, 11px 1px;
  background-position:
    left 5px top 0, left 0 top 5px,
    right 5px top 0, right 0 top 5px,
    left 5px bottom 0, left 0 bottom 5px,
    right 5px bottom 0, right 0 bottom 5px;
}

/* Photographs wash into the steel accent. */
.duotone {
  position: relative;
  overflow: hidden;
}
.duotone::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--color-accent);
  mix-blend-mode: color;
}
/* A blueprint draws its marks outside the box, so the frame wins over the
   duotone clip when both share a wrapper. */
.blueprint.duotone { overflow: visible; }

/* Buttons - square line drawings. The solid accent primary is the exception. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 0;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}
.btn-primary:hover {
  background: var(--color-accent-600);
  border-color: var(--color-accent-600);
}
.btn-primary:active {
  background: var(--color-accent-700);
  border-color: var(--color-accent-700);
}
.btn-secondary:hover {
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
}
.btn-secondary:active {
  background: color-mix(in srgb, var(--color-text) 14%, transparent);
}

/* Button sizes used by the mockups. */
.btn-sm { font-size: 12px; padding: 7px 14px; }
.btn-md { font-size: 12.5px; padding: 8px 14px; }
.btn-lg { padding: 10px 18px; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 0;
}
.tag-accent {
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}
/* Border keeps the base accent; the text steps to 700 so 11px copy clears AA. */
.tag-outline {
  border: 1px solid var(--color-accent);
  color: var(--color-accent-700);
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.table th {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}

/* Image placeholder - a hatched box standing in for artwork that does not
   exist yet. Replace the whole element with an <img> once the real asset
   arrives; the surrounding .blueprint frame stays. */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font: 400 10.5px/1.4 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 7px,
    color-mix(in srgb, var(--color-text) 7%, transparent) 7px,
    color-mix(in srgb, var(--color-text) 7%, transparent) 8px
  );
}
.placeholder small {
  display: block;
  font-size: inherit;
  opacity: 0.75;
}

/* A real image in a blueprint frame. Sized by the same height rules as
   .placeholder, so swapping one for the other never shifts the layout. */
.figure { overflow: hidden; }
.figure-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Dashboards read from the top: crop off the bottom, never the header. */
  object-position: center top;
}

/* --------------------------------------------------------------------------
   5. Sheet - the page is a fixed-width drawing sheet centred on the ground.
   -------------------------------------------------------------------------- */
.sheet {
  max-width: var(--sheet-width);
  margin: 0 auto;
  border-left: 1px solid var(--color-divider);
  border-right: 1px solid var(--color-divider);
}
/* No sheet edges once the sheet fills the viewport. */
@media (max-width: 1340px) {
  .sheet {
    border-left: 0;
    border-right: 0;
  }
}

/* Every landing-page band. */
.band {
  padding: 44px 32px;
  border-bottom: 1px solid var(--color-divider);
}

/* Numbered section head: "01  WORK EXPERIENCE". */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
}
.section-num {
  font: var(--font-heading-weight) 12px/1 var(--font-heading);
  letter-spacing: 0.2em;
  color: var(--color-accent-700);
}
.section-head h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.section-meta {
  margin-left: auto;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   6. Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-height);
  padding: 0 32px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
}
.site-brand {
  margin-right: auto; /* pushes the nav and the resume button to the right */
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
  letter-spacing: 0.02em;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-nav a {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 150ms ease, color 150ms ease;
}
.site-nav a:hover { color: var(--color-accent-700); }
/* Set by script.js as sections pass under the header. */
.site-nav a[aria-current="true"] {
  color: var(--color-accent-700);
  border-bottom-color: var(--color-accent);
}
.site-nav .btn { border-bottom: 0; }

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 44px;
  padding: 56px 32px 48px;
  border-bottom: 1px solid var(--color-divider);
}
.hero-kicker {
  font: var(--font-heading-weight) 11px/1 var(--font-heading);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent-700);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(44px, 7.5vw, 78px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.hero-lede {
  font-size: 19px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 0 0 26px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Title block - the resume facts, framed like a drawing's title block.
   Facts on the left, a vertical portrait on the right, like an ID card. */
.title-block {
  padding: 22px;
  align-self: start;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: stretch;
}
.spec-list {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: max-content;
  align-content: start;
  gap: 11px 16px;
  margin: 0;
  font-size: 13.5px;
}
.spec-list dt { color: var(--color-muted); }
.spec-list dd { margin: 0; }
/* The portrait: a fixed-width vertical column that matches the facts' height. */
.title-block-photo {
  width: 190px;
  align-self: stretch;
  overflow: hidden;
}
.title-block-photo .figure-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
/* A placeholder here still needs an explicit height (no image to size it). */
.title-block .placeholder {
  height: 300px;
  margin-top: 18px;
}

/* Facts stack above the portrait once the hero is a single column. */
@media (max-width: 900px) {
  .title-block {
    grid-template-columns: 1fr;
  }
  .title-block-photo {
    width: 100%;
    max-width: 320px;
    height: 340px;
  }
}

/* --------------------------------------------------------------------------
   8. 01 - Work experience
   -------------------------------------------------------------------------- */
.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}
.work-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 24px;
}
.work-card-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}
.work-card h3 {
  margin: 8px 0 4px;
  font-size: 24px;
}
.work-card-role {
  font-size: 13.5px;
  margin-bottom: 14px;
}
.work-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.6;
}
.work-card li + li { margin-top: 8px; }

/* --------------------------------------------------------------------------
   9. 02 - Business. The one inverted band: the tokens flip, and everything
   else is already expressed in them.
   -------------------------------------------------------------------------- */
.band-inverted {
  --color-text: #f2f2f3;
  --color-muted: #b5d9fd;
  --color-divider: rgba(242, 242, 243, 0.25);
  background: var(--color-accent-900);
  color: var(--color-text);
}
.band-inverted .section-num { color: var(--color-accent-300); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 24px;
}
.metric {
  padding: 22px 20px 20px;
  border-right: 1px solid var(--color-divider);
}
.metric:last-child { border-right: 0; }
.metric-figure {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(34px, 4.2vw, 44px);
  line-height: 1;
}
.metric-caption {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.business-copy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  font-size: 14.5px;
  line-height: 1.65;
}
.business-copy p { margin: 0; }

/* --------------------------------------------------------------------------
   10. 03 - Projects
   -------------------------------------------------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}
.project { position: relative; }
/* The whole card is the link target: the button's overlay covers the card.
   One link in the accessibility tree, rather than nesting a link inside a
   link. The button keeps the keyboard focus ring. */
.project .btn::after {
  content: "";
  position: absolute;
  inset: 0;
}
/* 320px is the ceiling before the wide dashboard shots start losing their
   left and right edges; the tall renders gain the most from it. */
.project .placeholder,
.project .figure { height: 320px; }
/* Renders and photos read better from the middle; dashboards from the top. */
.project .figure-img-center { object-position: center center; }
.project-body { margin-top: 22px; }
.project-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}
.project h3 {
  margin: 8px 0 10px;
  font-size: 26px;
}
.project p {
  font-size: 14.5px;
  line-height: 1.65;
  margin: 0 0 8px;
}
.project p:last-of-type { margin-bottom: 14px; }

/* One line on desktop; allowed to wrap on narrow screens (see section 14). */
.tag-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin: 0 0 14px;
  overflow: hidden;
}
.tag-row .tag { white-space: nowrap; }

/* Frames tint on hover - they never gain a fill. */
.project:hover .blueprint,
.project:focus-within .blueprint {
  border-color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   11. 04 - Skills
   -------------------------------------------------------------------------- */
.skills-table th {
  width: 190px;
  text-align: left;
  vertical-align: top;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Coursework - three grouped columns. Column headings follow the design
   system's accent-underlined pattern; auto-fit means the grid reflows from
   three columns to two to one without extra breakpoints. */
.coursework { margin-top: 34px; }
.coursework-title {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 18px;
}
.coursework-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 28px 32px;
}
.coursework-group h4 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-accent);
}
.coursework-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  line-height: 1.85;
}

/* --------------------------------------------------------------------------
   12. Site footer. Not in the mockups - the contact details are repeated from
   the title block so the page does not dead-end after the skills table.
   -------------------------------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 32px;
  border-top: 1px solid var(--color-text);
  font-size: 13px;
}
.site-footer-contact { margin: 0; }
.site-footer a { color: var(--color-accent-700); }

/* --------------------------------------------------------------------------
   13. Project detail pages - one shared template, 720px sheet.
   -------------------------------------------------------------------------- */
.sheet-detail { --sheet-width: 900px; }

.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--color-divider);
}
.detail-bar a {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text);
}
.detail-bar a:hover { color: var(--color-accent-700); }
.detail-count {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-body { padding: 38px 28px 30px; }
.detail-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent-700);
  margin-bottom: 14px;
}
.detail-body h1 {
  font-size: clamp(32px, 5.2vw, 46px);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}
/* ME371 runs one size larger - its title is shorter. */
.detail-body h1.detail-title-lg {
  font-size: clamp(32px, 6vw, 52px);
  line-height: 0.98;
}
.detail-lede {
  font-size: 17px;
  line-height: 1.55;
  max-width: 48ch;
  margin: 0 0 26px;
}

.detail-figure { margin-bottom: 32px; }
.detail-figure .placeholder { height: 250px; }
/* Detail pages have no grid to keep in step, so a real screenshot runs at
   its natural aspect ratio - the whole image, nothing cropped. */
.detail-figure .figure { height: auto; }
.detail-figure .figure-img { height: auto; }
.detail-figure-hero .placeholder { height: 280px; }
.detail-figure figcaption {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 12px;
}
.detail-figure-inline {
  margin-top: 16px;
  margin-bottom: 0;
}
.detail-figure-inline .placeholder { height: 180px; }
.detail-figure-inline figcaption { margin-top: 6px; }

/* Spec strip - four values under the hero figure. */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 32px;
}
.spec-cell {
  padding: 14px 12px 12px;
  border-right: 1px solid var(--color-divider);
}
.spec-cell:last-child { border-right: 0; }
.spec-cell dt {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.spec-cell dd {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 1.2;
}
.spec-strip-lg .spec-cell dd { font-size: 22px; }
/* Three-value strip: used where a fourth figure would be filler. */
.spec-strip-3 { grid-template-columns: repeat(3, 1fr); }

/* Labelled prose rows. */
.detail-section {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 22px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 26px;
}
.detail-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
  margin-bottom: 0;
}
.detail-section h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.detail-section p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  /* The sheet is wide enough that unconstrained prose would run to ~95
     characters a line. Figures and tables still take the full width. */
  max-width: 80ch;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.7;
  max-width: 80ch;
}
.detail-list li + li { margin-top: 4px; }

/* Click-to-enlarge. Both the button and the dialog are built by script.js,
   so none of this renders unless JS ran. */
.figure-zoom {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
/* Tint the frame on hover, the same cue the project cards use. */
.detail-figure .figure:has(.figure-zoom:hover) { border-color: var(--color-accent); }

.zoom-dialog {
  padding: 14px;
  border: 1px solid var(--color-text);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text);
  max-width: 96vw;
  max-height: 94vh;
  /* Tall screenshots scroll here rather than being shrunk to fit the
     viewport - the point of opening one is to read it at full size. */
  overflow: auto;
}
.zoom-dialog::backdrop {
  background: color-mix(in srgb, #1d2d3d 80%, transparent);
}
.zoom-dialog form { display: flex; justify-content: flex-end; }
.zoom-close {
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 0;
  padding: 6px 12px;
  margin-bottom: 10px;
}
.zoom-close:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.zoom-figure { margin: 0; }
/* width:auto keeps the image at its natural size until the viewport is the
   limit, so it is never upscaled past the source into blur. */
.zoom-image {
  width: auto;
  height: auto;
  max-width: calc(96vw - 30px);
  /* No height cap: a tall screenshot shows at full width and the dialog
     scrolls, rather than being shrunk back down to almost its inline size. */
  max-height: none;
}
.zoom-caption {
  margin-top: 10px;
  font-size: 11px;
  color: var(--color-muted);
}

/* Scotch-yoke mechanism diagram (ME 370). A line drawing in the same language
   as the blueprint frames, animated to show rotation becoming linear motion.
   The global prefers-reduced-motion rule freezes it into a static diagram. */
.mechanism {
  padding: 14px;
  background: transparent;
}
.mechanism-svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--color-text);
}
.mech-line * ,
.mech-line {
  fill: none;
  stroke: var(--color-text);
  stroke-width: 1.5;
}
.mech-dot { fill: var(--color-text); }
.mech-rail {
  stroke: var(--color-divider);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}
.mech-pin {
  fill: var(--color-accent);
  stroke: var(--color-accent-800);
  stroke-width: 1.5;
}
/* Packs waiting in the hopper: same object as the dispensed one, quieter. */
.mech-stack {
  fill: color-mix(in srgb, var(--color-text) 10%, transparent);
  stroke: var(--color-text);
  stroke-width: 1.5;
}
.mech-pack {
  fill: color-mix(in srgb, var(--color-accent) 22%, transparent);
  stroke: var(--color-accent-700);
  stroke-width: 1.5;
}
.mech-arrow {
  fill: none;
  stroke: var(--color-accent-700);
  stroke-width: 1.5;
  color: var(--color-accent-700);
}
.mech-label {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 11px;
  letter-spacing: 0.1em;
  fill: var(--color-muted);
}

/* The pin orbits the disc centre at radius 56; the yoke slot must sit at
   x = 140 + 56*cos(theta) to stay on the pin. Easing cannot approximate a
   cosine, so the curve is sampled every 5% and played linearly - the pin
   then never leaves the slot. */
.mech-crank {
  transform-origin: 150px 122px;
  animation: mech-spin 4.5s linear infinite;
}
.mech-yoke { animation: mech-slide 4.5s linear infinite; }
.mech-pack { animation: mech-eject 4.5s linear infinite; }
.mech-feed { animation: mech-drop 4.5s linear infinite; }

@keyframes mech-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes mech-slide {
  0%   { transform: translateX(0); }
  5%   { transform: translateX(-2.2px); }
  10%  { transform: translateX(-8.6px); }
  15%  { transform: translateX(-18.5px); }
  20%  { transform: translateX(-31.1px); }
  25%  { transform: translateX(-45.0px); }
  30%  { transform: translateX(-58.9px); }
  35%  { transform: translateX(-71.5px); }
  40%  { transform: translateX(-81.4px); }
  45%  { transform: translateX(-87.8px); }
  50%  { transform: translateX(-90.0px); }
  55%  { transform: translateX(-87.8px); }
  60%  { transform: translateX(-81.4px); }
  65%  { transform: translateX(-71.5px); }
  70%  { transform: translateX(-58.9px); }
  75%  { transform: translateX(-45.0px); }
  80%  { transform: translateX(-31.1px); }
  85%  { transform: translateX(-18.5px); }
  90%  { transform: translateX(-8.6px); }
  95%  { transform: translateX(-2.2px); }
  100% { transform: translateX(0); }
}
/* The pack is dispensed, cleared away, drops into the hopper mouth, then rides
   out on exactly the pusher's curve - same 90px travel, same cosine - so the
   pusher face stays against it the whole stroke. */
@keyframes mech-eject {
  0%   { transform: translateX(0); opacity: 1; }
  22%  { transform: translateX(0); opacity: 1; }
  32%  { transform: translateX(0); opacity: 0; }
  46%  { transform: translateX(-90px); opacity: 0; }
  52%  { transform: translateX(-90px); opacity: 1; }
  55%  { transform: translateX(-87.8px); opacity: 1; }
  60%  { transform: translateX(-81.4px); opacity: 1; }
  65%  { transform: translateX(-71.5px); opacity: 1; }
  70%  { transform: translateX(-58.9px); opacity: 1; }
  75%  { transform: translateX(-45.0px); opacity: 1; }
  80%  { transform: translateX(-31.1px); opacity: 1; }
  85%  { transform: translateX(-18.5px); opacity: 1; }
  90%  { transform: translateX(-8.6px); opacity: 1; }
  95%  { transform: translateX(-2.2px); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}
/* The feed arrow shows only at the moment the next pack drops. */
@keyframes mech-drop {
  0%, 40%   { opacity: 0; }
  46%, 56%  { opacity: 1; }
  62%, 100% { opacity: 0; }
}
.mech-feed { opacity: 0; }

/* Rubric table on a project detail page. */
.score-table { font-size: 13.5px; }
.score-table th[scope="col"] {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.score-table th[scope="row"] {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  letter-spacing: 0.02em;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.score-table .score-col {
  text-align: right;
  white-space: nowrap;
}
/* The total is the row that matters: rule it off like a drawing's summary.
   th[scope="row"] is repeated here so this beats the row rule above on
   specificity - otherwise the bottom hairline survives and the top one does not. */
.score-table tfoot th[scope="row"],
.score-table tfoot td {
  border-top: 1px solid var(--color-text);
  border-bottom: 0;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
}

/* Four columns will not fit a phone: let the table scroll inside its own box
   rather than pushing the page sideways.
   min-width:0 is load-bearing. Grid children default to min-width:auto, so
   without it the wrapper refuses to shrink below the table and widens the
   whole page instead of scrolling. */
.detail-section > * { min-width: 0; }
.table-scroll {
  overflow-x: auto;
  min-width: 0;
}
.table-scroll .table { min-width: 420px; }

.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 28px;
  border-top: 1px solid var(--color-text);
}
.detail-footer > .btn { order: 1; }
.detail-footer > div {
  order: 2;
  margin-left: auto;
  text-align: right;
}
.detail-footer-label {
  margin: 0 0 2px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.detail-footer-next {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--color-text);
  text-decoration: none;
  transition: color 150ms ease;
}
.detail-footer-next:hover { color: var(--color-accent-700); }

/* --------------------------------------------------------------------------
   14. Responsive. The mockups are fixed-width desktop canvases; everything
   below this point is implementation judgement, per the handoff notes.
   -------------------------------------------------------------------------- */

/* Tablet - collapse the two-column grids. */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 44px 24px 40px;
  }
  .band { padding: 36px 24px; }
  .work-grid,
  .project-grid,
  .business-copy {
    grid-template-columns: 1fr;
  }
  .business-copy { gap: 16px; }

  /* Metric cells stack, with rules between them instead of beside them. */
  .metrics { grid-template-columns: 1fr; }
  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--color-divider);
    padding: 18px 0 16px;
  }
  .metric:last-child { border-bottom: 0; }

  /* Detail pages: the label sits above its prose. */
  .detail-section {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-cell:nth-child(2) { border-right: 0; }
  .spec-cell:nth-child(-n + 2) { border-bottom: 1px solid var(--color-divider); }
}

/* Phone - the header wraps to two rows and tag rows are allowed to wrap. */
@media (max-width: 680px) {
  :root { --header-height: auto; }
  html { scroll-padding-top: 104px; }

  .site-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 20px 0;
  }
  /* The nav takes its own row and scrolls sideways rather than eating the
     viewport. No JS, no hamburger, every link still reachable. */
  .site-nav {
    order: 3;
    width: 100%;
    gap: 18px;
    margin-top: 8px;
    padding-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; }

  .band { padding: 32px 20px; }
  .hero { padding: 36px 20px 32px; }
  .hero-lede { font-size: 17px; }

  .tag-row {
    flex-wrap: wrap;
    overflow: visible;
  }

  .detail-bar,
  .detail-footer { padding: 14px 20px; }
  .detail-body { padding: 30px 20px 26px; }
  .detail-footer { flex-wrap: wrap; }
  .detail-footer-next { font-size: 19px; }

  /* The skills table becomes stacked label/value blocks. */
  .skills-table,
  .skills-table tbody,
  .skills-table tr,
  .skills-table th,
  .skills-table td {
    display: block;
    width: auto;
  }
  .skills-table th { padding: 0 0 4px; border-bottom: 0; }
  .skills-table td { padding: 0 0 14px; }

  .site-footer { padding: 22px 20px; }
}
