/* ───── Hero: one sentence with the work set inline ───── */
.hero { padding-top: clamp(56px, 10vw, 136px); padding-bottom: clamp(64px, 9vw, 112px); }
.hero h1 { font-size: clamp(32px, 4.3vw, 58px); line-height: 1.14; font-weight: 600; letter-spacing: -0.032em; max-width: 19em; text-wrap: pretty; }
/* Project phrases: a faint blue rule that fills in on hover */
.chip { color: var(--ink); text-decoration: none; }
.chip span {
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft)), linear-gradient(color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent) 45%, transparent));
  background-size: 100% 0%, 100% 0.06em; background-position: 0 88%, 0 92%; background-repeat: no-repeat;
  transition: background-size var(--t-slow) var(--ease-out), color var(--t-fast) var(--ease);
}
.chip:hover { color: var(--accent); }
.chip:hover span { background-size: 100% 38%, 100% 0.06em; }
.hero-foot { margin-top: clamp(32px, 4vw, 48px); max-width: 620px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* Floating preview that follows the cursor over hero links */
.peek {
  position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none;
  width: 260px; aspect-ratio: 4 / 3; border-radius: var(--r-m); overflow: hidden;
  box-shadow: var(--shadow-lg); background: var(--bg-2);
  opacity: 0; scale: 0.92;
  transition: opacity var(--t) var(--ease), scale var(--t) var(--ease-out);
}
.peek.on { opacity: 1; scale: 1; }
.peek img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none) { .peek { display: none; } }

/* ───── Work index ───── */
.work { padding-bottom: clamp(72px, 10vw, 128px); }
.work h2, .about h2, .jobs h2 { margin-bottom: clamp(28px, 4vw, 48px); }
.item a {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(220px, 360px); gap: 20px 40px; align-items: center;
  padding: 28px 0; color: var(--ink); text-decoration: none;
}
.item + .item a { border-top: 1px solid var(--line); }
.item .when { font: 400 13px/1.4 var(--mono); color: var(--text-2); align-self: start; padding-top: 8px; }
.item h3 { transition: color var(--t-fast) var(--ease); }
.item p { color: var(--text-2); margin-top: 8px; max-width: 52ch; }
.item .who { font-size: 14px; color: var(--text-3); margin-top: 12px; }
.item .ph { aspect-ratio: 4 / 3; border-radius: var(--r-m); }
.item .ph img { transition: opacity var(--t-slow) var(--ease), transform 900ms var(--ease-out); }
@media (hover: hover) {
  .item a:hover h3 { color: var(--accent); }
  .item a:hover .ph img { transform: scale(1.04); }
}
@media (max-width: 820px) {
  .item a { grid-template-columns: 1fr; gap: 10px; }
  .item .ph { order: -1; aspect-ratio: 16 / 10; }
  .item .when { padding-top: 6px; }
}

/* ───── About ───── */
.about { padding-bottom: clamp(72px, 10vw, 128px); }
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 6vw, 88px); }
.prose p + p { margin-top: 18px; color: var(--text-2); }
.tools { margin: 0; }
.tools div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 0; }
.tools div + div { border-top: 1px solid var(--line); }
.tools div:first-child { padding-top: 0; }
.tools dt { color: var(--text-2); font-size: 15px; }
.tools dd { margin: 0; font-size: 16px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

/* ───── Jobs ───── */
.jobs { padding-bottom: clamp(72px, 10vw, 128px); }
.jobs-list > li { display: grid; grid-template-columns: 130px minmax(0, 1fr) 200px; gap: 8px 40px; padding: 28px 0; }
.jobs-list > li + li { border-top: 1px solid var(--line); }
.jobs-list > li:first-child { padding-top: 0; }
.jobs-list .when { font: 400 13px/1.4 var(--mono); color: var(--text-2); padding-top: 6px; }
.jobs-list .role { color: var(--text-2); margin-top: 4px; }
.jobs-list .place { color: var(--text-3); font-size: 15px; text-align: right; padding-top: 4px; }
.jobs-list ul { margin-top: 14px; display: grid; gap: 6px; color: var(--text-2); }
.jobs-list ul li { padding-left: 18px; position: relative; }
.jobs-list ul li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1.5px; background: var(--accent); }
@media (max-width: 820px) { .jobs-list > li { grid-template-columns: 1fr; } .jobs-list .place { text-align: left; } }

/* ───── Contact ───── */
.contact { padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(64px, 9vw, 112px); }
.contact h2 { font-size: clamp(34px, 5vw, 66px); max-width: 15em; }
.copy { color: var(--accent); text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.14em; font: inherit; letter-spacing: inherit; transition: color var(--t-fast) var(--ease); }
.copy:hover { color: var(--accent-hover); }
.contact-sub { margin-top: 24px; max-width: 600px; }

/* ───── Case study ───── */
.case { padding-bottom: 40px; }
.case-head { padding-top: clamp(28px, 5vw, 56px); }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-2); text-decoration: none; }
.back:hover { color: var(--accent); }
.back svg { width: 8px; height: 13px; }
.case-head h1 { margin-top: clamp(24px, 4vw, 40px); max-width: 14em; }
.case-head .t-lead { margin-top: 18px; max-width: 34em; color: var(--text-2); }
.case-hero { margin-top: clamp(32px, 5vw, 56px); }
.case-hero .ph { aspect-ratio: 16 / 9; border-radius: var(--r-xl); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.facts div { padding: 20px 20px 22px 0; }
.facts dt { font-size: 14px; color: var(--text-2); }
.facts dd { margin: 4px 0 0; font-size: 16px; font-weight: 500; }

.case-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 72px 64px; padding-top: clamp(48px, 7vw, 88px); }
.case-body > h2 { font: 500 15px/1.4 var(--font); color: var(--text-2); padding-top: 6px; }
.case-body > .block { min-width: 0; }
.case-body > .block p { max-width: 64ch; }
.case-body > .block p + p { margin-top: 14px; }
.case-body > .block .t-lead { color: var(--ink); }
.sub { margin-top: 40px; }
.sub:first-child { margin-top: 0; }
.sub h3 { margin-bottom: 10px; }
.sub p { color: var(--text-2); }
.sub figure { margin: 24px 0 0; }
.sub figure .ph { aspect-ratio: 16 / 10; border-radius: var(--r-l); }
.sub figcaption { margin-top: 10px; font-size: 14px; color: var(--text-3); }

.decisions li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px 32px; padding: 16px 0; }
.decisions li:first-child { padding-top: 0; }
.decisions li + li { border-top: 1px solid var(--line); }
.decisions strong { font-weight: 600; }
.decisions span { color: var(--text-2); }
@media (max-width: 640px) { .decisions li { grid-template-columns: 1fr; } }

.fill {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--r-s);
  background: var(--accent-soft); color: var(--accent-hover); font-size: 14px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.fill::before { content: "Fill in: "; font-weight: 600; }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 46%); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .ph { aspect-ratio: 4 / 3; border-radius: var(--r-m); scroll-snap-align: start; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-l); overflow: hidden; background: #000; }
.video button { position: absolute; inset: 0; width: 100%; display: grid; place-items: center; color: #fff; }
.video button img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity var(--t) var(--ease); }
.video button:hover img { opacity: 1; }
.video .play { position: relative; display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 20px; border-radius: var(--r-s); background: #fff; color: var(--ink); font-weight: 500; }
.video .play svg { width: 13px; height: 13px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.case-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.next { display: block; margin-top: clamp(64px, 9vw, 112px); padding: 32px 0 8px; color: var(--ink); text-decoration: none; }
.next .label { display: block; }
.next .t-1 { display: block; margin-top: 8px; transition: color var(--t-fast) var(--ease); }
.next:hover .t-1 { color: var(--accent); }

@media (max-width: 820px) {
  .case-body { grid-template-columns: 1fr; gap: 12px; }
  .case-body > h2 { padding-top: 24px; }
  .case-hero .ph { aspect-ratio: 4 / 3; border-radius: var(--r-l); }
}

/* Image morph between the index and a case study */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 260ms; }
::view-transition-group(proj) { animation-duration: 480ms; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Season results table */
.results-wrap { margin-top: 20px; overflow-x: auto; }
.results { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.results th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 13px; padding: 0 16px 10px 0; border-bottom: 1px solid var(--line-2); }
.results td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.results td:first-child, .results .num { font-family: var(--mono); font-size: 13px; white-space: nowrap; padding-top: 14px; }
.results td.won { color: var(--accent); font-weight: 500; }
.source { margin-top: 12px; font-size: 14px; color: var(--text-3); }

/* ───── Small things ───── */
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 10px 14px; border-radius: var(--r-s); background: var(--ink); color: #fff; text-decoration: none; transition: top var(--t-fast) var(--ease); }
.skip:focus { top: 12px; color: #fff; }
.case-head h1, .work h2, .about h2, .jobs h2, .item h3, .sub h3, .next .t-1 { text-wrap: balance; }
.case-body p, .item p, .prose p { text-wrap: pretty; }
/* Below-the-fold sections skip layout until they're near the screen */
.about, .jobs, .contact { content-visibility: auto; contain-intrinsic-size: auto 700px; }
.chip:focus-visible { outline-offset: 4px; }
.item a:focus-visible { outline-offset: 6px; border-radius: var(--r-s); }

@media print {
  .bar, .footer, .peek, .skip, .actions, .case-links, .video, .next { display: none !important; }
  body { font-size: 11pt; }
  .hero { padding: 0 0 24pt; }
  .item a, .jobs-list > li { break-inside: avoid; }
  .about, .jobs, .contact { content-visibility: visible; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .chip span, .item a, .btn { color: #000 !important; background: none !important; }
}

/* Whole photos at their own aspect ratio (set inline), no cropping. Tall ones are capped
   in height and centered so a portrait phone photo doesn't fill three screens. */
.ph.natural, .sub figure .ph.natural, .case-hero .ph.natural { aspect-ratio: auto; max-width: min(100%, var(--w, 100%)); }
.ph.natural.tall { max-height: 720px; margin-inline: auto; }
.ph.natural img { height: 100%; object-fit: contain; }
.case-hero .ph.natural, .sub figure .ph.natural { border-radius: var(--r-l); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.pair .ph.natural.tall { max-height: none; }
.strip { grid-auto-columns: max-content; }
.strip .ph.natural { height: 340px; width: auto; max-width: none; }
.strip .ph.natural img { width: auto; height: 100%; }
.specs { margin: 0; }
.specs div:first-child { padding-top: 0; }
.specs div { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 4px 32px; padding: 12px 0; }
.specs div + div { border-top: 1px solid var(--line); }
.specs dt { color: var(--text-2); font-size: 15px; }
.specs dd { margin: 0; }
.reqs { margin-top: 4px; display: grid; gap: 8px; }
.reqs li { position: relative; padding-left: 20px; color: var(--text-2); max-width: 64ch; }
.reqs li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1.5px; background: var(--accent); }
.block > p + .reqs { margin-top: 16px; }
@media (max-width: 640px) { .specs div { grid-template-columns: 1fr; } .strip .ph.natural { height: 260px; } }
.strip .ph:not(.natural) { width: 453px; height: 340px; aspect-ratio: auto; }
@media (max-width: 640px) { .strip .ph:not(.natural) { width: 347px; height: 260px; } }

/* Photo of Diego set inline in the hero sentence, the size of a word.
   The crop is a zoomed window that keeps Diego and the robot both in frame. */
.me {
  display: inline-block; position: relative; overflow: hidden; vertical-align: -0.2em;
  height: 1.08em; aspect-ratio: 1.6; margin: -0.1em 0.06em 0; border-radius: 0.24em;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line);
  rotate: -3deg; transition: rotate var(--t) var(--spring), scale var(--t) var(--spring);
}
.me img { position: absolute; width: 129%; max-width: none; height: auto; left: -0.6%; top: -31%; }
@media (hover: hover) { .me:hover { rotate: 0deg; scale: 1.06; } }

/* "Writeup pending" in place of a summary */
.pending { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.pending::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Work-in-progress notice shown when the site first opens */
dialog.wip { width: min(440px, 100vw - 32px); }
.wip-body { padding: 32px 32px 28px; }
.wip-body .label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.wip-body h2 { margin-top: 10px; font: 600 26px/1.15 var(--font-display); letter-spacing: -0.02em; }
.wip-body p { margin-top: 12px; color: var(--text-2); }
.wip-body form { margin-top: 24px; }
@media (max-width: 640px) { .wip-body { padding: 28px 24px calc(24px + env(safe-area-inset-bottom)); } .wip-body .btn { width: 100%; } }
