/* Dillon Harrington portfolio
   Colors live in the :root variables below. Dark mode swaps them automatically. */

:root {
  --page: #f1f0ed;      /* page background */
  --card: #ffffff;      /* project cards */
  --card-border: #dcd9d2;
  --ink: #1d1d1f;       /* graphite */
  --graphite: #5c5b57;
  --rule: #d6d3cc;
  --accent: #c2410c;    /* safety orange */
  --plate: #ffffff;     /* sits behind CAD images (white, so they blend into the cards) */
  --blend: normal;
  --hero-plate: var(--page);
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --gap: clamp(0.75rem, 1.6vw, 1.25rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #121212;
    --card: #1c1c1c;
    --card-border: #2e2e2c;
    --ink: #ededeb;
    --graphite: #a3a19c;
    --rule: #33332f;
    --accent: #f97316;
    --plate: #e6e5e2;   /* CAD images get a soft light plate instead of glaring white */
    --blend: multiply;
    --hero-plate: var(--plate);
    color-scheme: dark;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

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

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

/* Links inside text and the Contact box: orange text, underline only on hover */
.project p a,
.about p a,
.contact-block dd a,
.totop a {
  color: var(--accent);
  text-decoration: none;
}

.project p a:hover,
.about p a:hover,
.contact-block dd a:hover,
.totop a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

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

.wrap {
  max-width: calc(1240px + 2 * var(--pad));
  margin: 0 auto;
  padding-inline: var(--pad);
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(3rem, 8vw, 6.5rem); }

.name {
  margin: 0;
  font-size: clamp(3rem, 11vw, 9rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.9;
  letter-spacing: -0.015em;
}

.name span { display: block; }

.intro {
  margin: clamp(1.75rem, 3vw, 2.5rem) 0 0;
  max-width: 38ch;
  font-size: clamp(1.125rem, 0.6vw + 1rem, 1.375rem);
  line-height: 1.45;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.15rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

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

.hero-fig { margin: clamp(2.5rem, 5vw, 4rem) 0 0; }
.hero-fig .media { background: var(--hero-plate); }
.hero-fig .media img { mix-blend-mode: multiply; }

/* ---------- Project index ---------- */

.index { margin-top: clamp(4rem, 8vw, 6.5rem); }

.label {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
}

.index ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1.5px solid var(--ink);
}

.index a,
.index .static {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 1.05rem 0 1.1rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.index .yr,
.index .role { color: var(--graphite); }

.index .t {
  font-size: clamp(1.15rem, 0.8vw + 0.9rem, 1.5rem);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.2;
}

.index a:hover .t,
.index a:focus-visible .t {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

/* ---------- Projects ---------- */

.projects {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* lets cards shrink with the window */
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin-top: clamp(3rem, 6vw, 5rem);
}

.project {
  padding: clamp(1.25rem, 4vw, 3.5rem);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
  scroll-margin-top: 1.25rem;
}

.project-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(15rem, 4fr);
  grid-template-areas: "title box" "body box";
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.project-head > h2 { grid-area: title; }
.project-head > .tblock { grid-area: box; }
.project-head > .body { grid-area: body; }

h2 {
  margin: 0 0 1.4rem;
  font-size: clamp(2.1rem, 3vw + 1rem, 3.5rem);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.project p,
.about p { max-width: 62ch; margin: 0 0 1em; }

/* "I built in:" list in the driver station section */
.built-in { max-width: 62ch; margin: -0.4em 0 1em; padding-left: 1.25em; }
.built-in li { margin: 0.15em 0; padding-left: 0.2em; }
.built-in li::marker { color: var(--graphite); }

/* Title block, styled after the one in the corner of a drawing sheet */
.tblock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 12px;          /* echoes the project card corners */
}

.tblock > div { padding: 0.7rem 0.95rem 0.8rem; border-top: 1px solid var(--rule); }
.tblock > div:nth-child(-n + 2) { border-top: 0; }
.tblock > div:nth-child(2) { border-left: 1px solid var(--rule); }
.tblock > .wide { grid-column: 1 / -1; }

.tblock dt {
  margin-bottom: 0.15rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--graphite);
}

.tblock dd { margin: 0; font-weight: 600; line-height: 1.35; }

/* ---------- Galleries ----------
   Each row is a flex line. Every figure grows in proportion to its aspect
   ratio (--ar = width / height), so all media in a row end up the same height. */

.gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.row { display: flex; gap: var(--gap); align-items: flex-start; }
/* js/main.js sizes each image and lets a row break onto more lines when the images would get too small */
.row.js-lines { flex-wrap: wrap; row-gap: clamp(1.5rem, 3vw, 2.25rem); }

.fig { flex: var(--ar) 1 0%; min-width: 0; margin: 0; }

/* A lone tall clip: as big as possible, but never taller than most of the screen */
.fig.capped { flex: none; width: fit-content; max-width: 100%; margin-inline: auto; }
.fig.capped .media video { width: auto; max-width: 100%; max-height: min(42rem, 72vh); }
/* Same width as the capped lathe clip above it (1.3417 = the clip's width / height) */
.fig.match-clip { flex: none; width: min(100%, calc(min(42rem, 72vh) * 1.3417)); margin-inline: auto; }

.media {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  background: var(--plate);
}

.media img,
.media video { width: 100%; mix-blend-mode: var(--blend); }

.media.photo { background: transparent; }
.media.photo img,
.media.photo video { mix-blend-mode: normal; }

.zoom { display: block; cursor: zoom-in; }

/* Long galleries show their first line of images; the rest sits behind a button (added by js/main.js) */
.collapsed-out { display: none !important; }
.more-toggle[hidden] { display: none; }

.more-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-top: calc(-1 * clamp(0.75rem, 2vw, 1.5rem));
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.more-toggle::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-top: -0.25em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.more-toggle[aria-expanded="true"]::after { margin-top: 0.2em; transform: rotate(-135deg); }
.more-toggle:hover { border-color: var(--accent); color: var(--accent); }

figcaption {
  margin-top: 0.6rem;
  max-width: 52ch;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--graphite);
}

.clip { cursor: pointer; }

.clip-toggle {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  padding: 0.3rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.84);
  color: #ffffff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

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

.about { margin-top: clamp(6rem, 12vw, 10rem); }

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(15rem, 5fr);
  gap: 2rem clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.skills { margin: 0; border-top: 1.5px solid var(--ink); }

.skills > div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.skills dt { color: var(--graphite); font-size: 0.9375rem; }
.skills dd { margin: 0; font-size: 0.9375rem; line-height: 1.5; }

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

.foot {
  margin-top: clamp(6rem, 12vw, 10rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.contact-block {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 0.8fr 0.8fr;
  gap: 1px;                    /* the gaps show the rule color, drawing the cell lines */
  margin: 0;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--rule);
}

.contact-block > div { padding: 0.9rem 1.1rem 1rem; background: var(--page); }

.contact-block dt {
  margin-bottom: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--graphite);
}

.contact-block dd {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.totop { margin: 1.5rem 0 0; font-size: 0.9375rem; }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(14, 14, 14, 0.95);
  color: #ffffff;
}

.lightbox::backdrop { background: rgba(14, 14, 14, 0.6); }

.lb-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 3.75rem clamp(1rem, 6vw, 5rem) 1.25rem;
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #ffffff;
}

.lb-stage figcaption {
  margin-top: 0.85rem;
  color: #d6d5d1;
  text-align: center;
}

.lb-count:not(:empty) {
  margin-right: 0.75rem;
  color: #a3a19c;
  font-variant-numeric: tabular-nums;
}

.lb-btn {
  position: absolute;
  padding: 0.45rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(14, 14, 14, 0.6);
  color: #ffffff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.lb-btn:hover { border-color: #ffffff; }
.lb-close { top: 0.9rem; right: 0.9rem; }
.lb-prev { left: 0.9rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.9rem; top: 50%; transform: translateY(-50%); }

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

@media (max-width: 1080px) {
  .contact-block { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .project-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "box" "body"; grid-template-rows: auto; }
  .project-head > .tblock { margin-bottom: 1.5rem; }
  .tblock { max-width: 34rem; }
}

@media (max-width: 699px) {
  .index a,
  .index .static { grid-template-columns: 4.75rem minmax(0, 1fr); }
  .index .role,
  .index .res { grid-column: 2; }
  .index .role { margin-top: 0.15rem; }
  .row { flex-direction: column; gap: 2rem; }
  .contact-block { grid-template-columns: minmax(0, 1fr); }
  .fig { flex: none; width: 100%; }
  .media img,
  .media video { width: auto; max-width: 100%; max-height: 78vh; margin-inline: auto; }
  .lb-prev,
  .lb-next { top: auto; bottom: 0.9rem; transform: none; }
  .lb-stage { padding-bottom: 4.25rem; }
}

@media (max-width: 420px) {
  .skills > div { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --page: #ffffff;
    --card: #ffffff;
    --card-border: #d6d3cc;
    --ink: #1d1d1f;
    --graphite: #5c5b57;
    --rule: #d6d3cc;
    --plate: #ffffff;
    --blend: normal;
    --hero-plate: #ffffff;
  }
  body { font-size: 11pt; }
  .cta, .clip-toggle, .totop, .lightbox, .more-toggle { display: none !important; }
  .row.collapsed-out { display: flex !important; }
  .fig.collapsed-out { display: block !important; }
  .project { break-before: page; border: 0; padding: 0; }
  .fig, .tblock { break-inside: avoid; }
  a { text-decoration: none; }
}
