/* ==========================================================================
   alejandrofiestas.com
   Order: fonts, tokens, base, layout primitives, then components in page order.
   Colors and type come from the Claude Design source (Alejandro Fiestas.dc.html).
   ========================================================================== */

/* Fonts (self-hosted, OFL-licensed, latin subsets) ------------------------ */
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/HankenGrotesk-var.woff2") format("woff2");
}
/* Metric-matched fallbacks: Arial sized to Hanken Grotesk's measured widths
   (regular 100.4%, bold 94.2%) so text barely moves when the web font lands. */
@font-face {
  font-family: "Hanken Grotesk Fallback";
  font-weight: 400 500;
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 100.4%;
  ascent-override: 99.6%;
  descent-override: 30.2%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Hanken Grotesk Fallback";
  font-weight: 600 700;
  src: local("Arial Bold"), local("Helvetica Bold"), local("Liberation Sans Bold"), local("Arial");
  size-adjust: 94.2%;
  ascent-override: 106.2%;
  descent-override: 32.2%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/IBMPlexMono-500.woff2") format("woff2");
}

/* Tokens ------------------------------------------------------------------ */
:root {
  color-scheme: light;

  --ink: #111318;
  --ink-soft: #3a3f4a;
  --muted: #5b616e;
  --rule: #d7dae0;
  --rule-dashed: #b9bec8;
  --signal: #1d4ed8;
  --signal-deep: #1e3a8a;
  --paper: #ffffff;
  --paper-soft: #f6f7f9;
  --grid-line: rgba(29, 78, 216, 0.055);

  /* Brand accent for Convertidora del Pacífico: the trace's theta green
     (js/eeg.js), 5.5:1 on white. */
  --brand-cdp: #0f766e;

  --font-sans: "Hanken Grotesk", "Hanken Grotesk Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1040px;
  --gutter: clamp(20px, 4.5vw, 32px);
  --col-gap: clamp(32px, 5vw, 48px);
  --aside-basis: 220px;
  --main-basis: 420px;
  --row-gap: 28px;
  --measure: 68ch;

  /* Vertical rhythm scales with the viewport between phone and desktop. */
  --space-section: clamp(52px, 8vw, 72px);
  --space-entry: clamp(32px, 5vw, 44px);
  --space-strip: clamp(32px, 5vw, 44px);

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration-fast: 0.15s;
  --duration-swap: 0.3s;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p,
dl,
dd,
figure,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--signal-deep);
}

button {
  font: inherit;
  color: inherit;
}

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

canvas {
  display: block;
}

@keyframes swap-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* List <-> detail swap via the View Transitions API (js/nav.js). The page
   cross-fades while the chosen title slides from its row to the heading. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--duration-swap);
  animation-timing-function: var(--ease-out);
}

::view-transition-group(entry-title) {
  animation-duration: 0.4s;
  animation-timing-function: var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

/* Utilities --------------------------------------------------------------- */
.mono {
  font-family: var(--font-mono);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--signal);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
}

.skip-link:focus {
  top: 16px;
}

.accent-cdp {
  color: var(--brand-cdp);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Layout primitives ------------------------------------------------------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Two-column row: aside (title) left, body right. Wraps to one column when
   the row is narrower than aside + main + gap (688px); the container query
   below keys off that same width. */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--row-gap) var(--col-gap);
  container-type: inline-size;
}

.split__aside {
  flex: 1 1 var(--aside-basis);
  min-width: 0;
}

.split__main {
  flex: 2.6 1 var(--main-basis);
  min-width: 0;
}

/* The aside only sticks once the two columns actually sit side by side.
   When the row has wrapped, a sticky title would slide over the body copy. */
@container (min-width: 688px) {
  .split__aside--sticky {
    position: sticky;
    top: 32px;
    align-self: flex-start;
  }
}

body[data-layout="stacked"] .split {
  gap: 18px var(--col-gap);
}

body[data-layout="stacked"] .split__aside {
  flex-basis: 100%;
  position: static;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

.button--primary {
  background: var(--signal);
  color: #fff;
}

.button--primary:hover {
  background: var(--signal-deep);
  color: #fff;
}

.button--secondary {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.button--secondary:hover {
  background: var(--ink);
  color: #fff;
}

/* Site nav ---------------------------------------------------------------- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  padding: 22px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

.site-nav__brand {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 22px;
}

.site-nav__links a {
  display: inline-block;
  padding: 6px 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav__links a:hover {
  color: var(--ink);
}

/* Hero -------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(40px, 7vw, 64px) 0 clamp(48px, 8vw, 80px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.hero__trace {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  animation: fade-in 1s ease-out 0.15s both;
}

.hero__trace canvas {
  width: 100%;
  height: 100%;
}

.hero__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--col-gap);
}

.hero__text {
  position: relative;
  flex: 1 1 400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 720px;
  padding: 32px 72px 32px 0;
  margin: -32px 0;
}

/* White plate that lets the trace fade in behind the copy (backdrop mode). */
.hero__plate {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #fff 0%, #fff 78%, rgba(255, 255, 255, 0) 100%);
}

.hero__text > :not(.hero__plate) {
  position: relative;
  animation: rise 0.5s var(--ease-out) both;
}

/* A short staggered entrance on first paint; nothing animates on scroll. */
.hero__text > .hero__intro {
  animation-delay: 0.07s;
}

.hero__text > .hero__facts {
  animation-delay: 0.14s;
}

.hero__text > .actions {
  animation-delay: 0.2s;
}

.hero__heading {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero__heading h1 {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero__subtitle {
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.3;
  font-weight: 500;
}

.hero__intro {
  max-width: 58ch;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

.hero__facts > div {
  display: flex;
  gap: 10px;
}

.hero__facts dt {
  color: var(--muted);
  flex-shrink: 0;
}

.hero__panel {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero__panel-frame {
  height: 300px;
  padding: 14px 12px 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.hero__panel-frame canvas {
  width: 100%;
  height: 100%;
}

.hero__panel figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* Variants: data-hero="backdrop" (default) draws the trace behind the whole
   header; data-hero="panel" puts it in a framed figure beside the copy. */
body[data-hero="backdrop"] .hero__panel {
  display: none;
}

body[data-hero="panel"] .hero__trace,
body[data-hero="panel"] .hero__plate {
  display: none;
}

body[data-hero="panel"] .hero__text {
  padding-right: 0;
}

/* On phones the copy spans the full width, so a trace behind it would be
   covered by the plate. Show it as a band above the heading instead. */
@media (max-width: 640px) {
  .hero {
    padding: 36px 0 clamp(48px, 8vw, 56px);
  }
  body[data-hero="backdrop"] .hero__trace {
    position: relative;
    inset: auto;
    height: 128px;
    margin-bottom: 28px;
  }
  body[data-hero="backdrop"] .hero__plate {
    display: none;
  }
  .hero__text {
    gap: 22px;
    padding: 0;
    margin: 0;
  }
}

/* Sections ---------------------------------------------------------------- */
.section {
  padding: var(--space-section) 0 24px;
}

.section__head {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--ink);
}

.section__head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px var(--col-gap);
  container-type: inline-size;
}

.section__head h2 {
  flex: 1 1 var(--aside-basis);
  min-width: 0;
}

.section__head p {
  flex: 2.6 1 var(--main-basis);
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}

@container (min-width: 688px) {
  .section__head p {
    padding-right: min(120px, 12%);
  }
}

body[data-layout="stacked"] .section__head h2 {
  flex-basis: 100%;
}

h2 {
  font-size: clamp(24px, 3.2vw, 28px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Index lists (static markup; js/nav.js wires the rows in index mode) ------ */
/* The lists only make sense with JavaScript in index mode. */
html:not(.js) .index,
body:not([data-nav="index"]) .index {
  display: none;
}

.index.is-entering,
.entry.is-entering {
  animation: swap-in 0.28s var(--ease-out) both;
}

.index__item {
  border-bottom: 1px solid var(--rule);
}

.index__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px var(--col-gap);
  width: 100%;
  min-height: 44px;
  padding: clamp(18px, 3vw, 22px) 0;
  background: none;
  border: 0;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: color var(--duration-fast);
}

.index__row:hover {
  color: var(--signal);
}

.index__title {
  flex: 1 1 var(--aside-basis);
  min-width: 0;
  font-size: clamp(18px, 2.4vw, 20px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.index__body {
  flex: 2.6 1 var(--main-basis);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.index__summary {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.index__meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

body[data-layout="stacked"] .index__title {
  flex-basis: 100%;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 20px;
  padding: 0 14px 0 0;
  background: none;
  border: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--signal);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back:hover {
  color: var(--signal-deep);
}

/* Entries (one case study or project) ------------------------------------- */
.entry {
  padding: var(--space-entry) 0;
  border-bottom: 1px solid var(--rule);
}

/* In index mode (with JS) only the open entry is shown; without JS, or in
   scroll mode, every entry renders inline. */
html.js body[data-nav="index"] .entry {
  display: none;
}

html.js body[data-nav="index"] .entry.is-open {
  display: flex;
}

.entry__aside {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry__title {
  font-size: clamp(20px, 2.6vw, 22px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.entry__status {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.entry__stack {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.entry__body {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.entry__prose {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: var(--measure);
  font-size: 17px;
  line-height: 1.55;
}

.entry__prose p {
  text-wrap: pretty;
}

.entry__label {
  color: var(--muted);
}

/* Process diagram: a row of steps on a signal-colored rail. */
.flow {
  padding-top: 22px;
  border-top: 1px dashed var(--rule-dashed);
}

.flow > figcaption {
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.flow__steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 22px 0;
}

.flow__step {
  position: relative;
  padding: 16px 14px 0 0;
  border-top: 1.5px solid var(--signal);
  transition: transform 0.25s var(--ease-out);
}

.flow__step::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--signal);
  border-radius: 50%;
  background: var(--paper);
}

.flow__step:hover {
  transform: translateY(-2px);
}

/* The rail ends on a solid dot after the last step: an end state, not a step. */
.flow__step:last-child::after {
  content: "";
  position: absolute;
  top: -5px;
  right: 0;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--signal);
  border-radius: 50%;
  background: var(--signal);
}

.flow__step-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.flow__step-desc {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.flow__note {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

/* Screenshots and GIFs. Until a real file is dropped in, a labelled
   placeholder keeps the layout honest. */
.media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.media__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media__frame {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.media__frame img,
.media__frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A frame that wraps real media links to the full-size file and opens the
   lightbox (js/lightbox.js). */
.media__zoom {
  display: block;
  cursor: zoom-in;
  color: inherit;
  text-decoration: none;
}

/* Phone recordings get a screen-shaped frame in a narrower grid, three to a
   row, instead of floating inside a 16:10 box. The ratio matches a status-bar-
   cropped iPhone capture (1180×2380). */
.media--phones {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
}

.phone {
  display: block;
  aspect-ratio: 590 / 1190;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 22px;
  background: var(--paper);
}

.phone img,
.phone video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 480px) {
  .media--phones {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .phone {
    border-radius: 16px;
  }
}

/* A lone desktop frame spans the column instead of leaving an empty cell. */
.media--single {
  grid-template-columns: minmax(0, 1fr);
}

.media__slot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 12px;
  background: var(--paper-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

.media__item figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* Labelled catalogue used by the legacy-systems entry. */
.catalogue {
  padding-top: 22px;
  border-top: 1px dashed var(--rule-dashed);
}

.catalogue__label {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.catalogue__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px 32px;
  font-size: 15px;
  line-height: 1.5;
}

.catalogue b {
  font-weight: 600;
}

.catalogue span {
  color: var(--ink-soft);
}

/* Project extras -------------------------------------------------------- */
.entry__what {
  max-width: var(--measure);
  font-size: 17px;
  line-height: 1.55;
  text-wrap: pretty;
}

.scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 24px;
}

.scale > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scale dt {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.scale dd {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.decisions {
  padding-top: 22px;
  border-top: 1px dashed var(--rule-dashed);
}

.decisions__label {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.decisions ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: var(--measure);
}

.decisions li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.5;
}

.decisions li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 8px;
  height: 2px; /* whole pixels, so every dash renders the same on 1x screens */
  background: var(--signal);
}

/* About, education, skills -------------------------------------------------- */
.about {
  padding: var(--space-section) 0 var(--space-strip);
  border-bottom: 1px solid var(--rule);
}

.about .split {
  gap: 20px var(--col-gap);
}

.about__copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 66ch;
  font-size: 17px;
  line-height: 1.6;
}

.about__copy p {
  text-wrap: pretty;
}

.strip {
  padding: var(--space-strip) 0;
  border-bottom: 1px solid var(--rule);
}

.education {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.education__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.education__school {
  font-size: 17px;
  font-weight: 600;
}

.education__school span {
  font-weight: 400;
  color: var(--muted);
}

.education__degree {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.education__courses {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.skills {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 24px;
  font-size: 15px;
  line-height: 1.5;
}

.skills dt {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .skills {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .skills dd + dt {
    margin-top: 10px;
  }
}

/* Contact & footer ---------------------------------------------------------- */
.contact {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: var(--space-section) 0 clamp(56px, 8vw, 80px);
}

.contact h2 {
  max-width: 20ch;
  font-size: clamp(28px, 4vw, 40px);
  text-wrap: pretty;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 36px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

/* Lightbox ------------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--gutter);
  border: 0;
  background: transparent;
  color: var(--ink);
}

.lightbox[open] {
  display: grid;
  place-items: center;
  animation: lightbox-in 0.26s var(--ease-out) both;
}

.lightbox::backdrop {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox[open]::backdrop {
  animation: fade-in 0.26s ease-out both;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

body:has(.lightbox[open]) {
  overflow: hidden;
}

.lightbox__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: fit-content;
  max-width: min(100%, 1400px);
}

.lightbox__stage {
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.lightbox__stage img,
.lightbox__stage video {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(78vh, 900px);
}

/* Caption and controls take the media's width instead of setting it:
   width 0 keeps them out of the panel's intrinsic size, min-width fills it. */
.lightbox__caption,
.lightbox__bar {
  width: 0;
  min-width: 100%;
}

.lightbox__caption {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.lightbox__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.lightbox__controls {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.lightbox__button {
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.lightbox__button:hover {
  color: var(--signal-deep);
}

/* 404 ---------------------------------------------------------------------- */
.notfound {
  border-top: 1px solid var(--rule);
}

.notfound__code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

/* Print ------------------------------------------------------------------- */
@media print {
  body {
    background: #fff;
  }
  .hero__trace,
  .hero__panel,
  .site-nav,
  .skip-link,
  .index,
  .back,
  .actions {
    display: none !important;
  }
  .entry {
    display: flex !important;
    break-inside: avoid;
  }
  .split__aside--sticky {
    position: static;
  }
}
