/* ============================================================
   MITCHELL LANGLEY, site.css
   One stylesheet for every page: home, resume, case studies,
   writing and photographs.

   SOURCE OF TRUTH
   Built on the Mitchell Langley Asesorías design system
   (claude.ai/design, project 22dc858d). Tokens in section 2 are
   copied from its tokens/*.css; do not invent new hues here.
     - One navy family carries the brand: #1D3F5C, hover #3D6485.
     - Green #1E8449 is reserved for the single most important
       action on a page (here: email). Never decorative.
     - Surfaces are white, alternating with #F4F6F8. Separation
       comes from background change and soft shadow; hairline
       #D8DCE0 rules only where a divider is needed.
     - Source Serif 4 for headings and the wordmark,
       Source Sans 3 for everything else.
     - One ease-out curve, four durations, one focal moment per
       page load. No bounce, no loops.

   FONTS
   Loaded by the Google Fonts link in every <head>:
   Source Serif 4 400/600/700, Source Sans 3 400/600/700.
   Keep weights in this file to that set.

   ROUTE CLASSES
   .route-work/.route-cases/.route-writing/.route-gallery remain
   in the markup but no longer change colour: the system has one
   brand colour, not a colour per section.
   ============================================================ */

/* ============================================================
   1. TOKENS (from the design system)
   ============================================================ */
:root {
  /* Brand palette */
  --navy-900: #1D3F5C;    /* primary / dark */
  --navy-600: #3D6485;    /* hover / accent tint, 6.0:1 on white */
  --green-700: #1E8449;   /* the one action per page */
  --green-800: #0F6330;
  --ink-900: #1A1A1A;     /* principal text */
  --ink-500: #69707D;     /* muted text, 4.9:1 white, 4.5:1 tint */
  --surface-tint: #F4F6F8;
  --white: #FFFFFF;
  --rule: #D8DCE0;
  --red-700: #C0392B;

  /* Semantic aliases */
  --color-primary: var(--navy-900);
  --color-primary-hover: var(--navy-600);
  --color-accent: var(--green-700);
  --color-accent-hover: var(--green-800);
  --text-body: var(--ink-900);
  --text-muted: var(--ink-500);
  --text-on-dark: var(--white);
  --text-on-dark-muted: rgba(255, 255, 255, .88);
  --surface-page: var(--white);
  --surface-card: var(--surface-tint);
  --surface-dark: var(--navy-900);
  --rule-dark: rgba(255, 255, 255, .22);
  --focus-ring: var(--navy-600);

  /* Kept as an alias so older markup and the print block still
     resolve; every page now draws its marks in navy. */
  --line: var(--navy-600);

  /* Type */
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Source Sans 3', Arial, sans-serif;

  --text-display: clamp(2rem, 1.4rem + 2.2vw, 3.1rem);
  --text-h1: 2rem;
  --text-h2: 1.7rem;
  --text-h3: 1.4rem;
  --text-subtitle: clamp(1.05rem, .95rem + .5vw, 1.3rem);
  --text-body-size: 1.05rem;
  --text-small: .9rem;
  --text-micro: .75rem;

  --leading-body: 1.6;
  --leading-tight: 1.2;
  --tracking-eyebrow: .07em;

  --measure: 68ch;
  --measure-read: 70ch;

  /* Space, the system's 4px scale */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --space-section: 80px;
  --content-max: 1100px;
  --gutter: 20px;

  /* Effects */
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-card: 0 4px 10px rgba(0, 0, 0, .05);
  --shadow-card-hover: 0 6px 16px rgba(29, 63, 92, .22);
  --shadow-nav: 0 2px 10px rgba(0, 0, 0, .05);
  --shadow-nav-scrolled: 0 4px 20px rgba(29, 63, 92, .13);
  --shadow-popover: 0 18px 44px rgba(29, 63, 92, .34);

  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;
  --dur-focal: 620ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  accent-color: var(--color-primary);
  caret-color: var(--color-primary);
  scrollbar-color: var(--color-primary-hover) var(--surface-card);
  color-scheme: light;
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
figure, blockquote, h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; }

/* Figures line up and a zero never reads as a capital O */
.tnum, time, th, td, .role-dates, .metric-value, .essay-date, .shot-meta, .case-where {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-primary-hover); }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 3px;
}
.on-navy :focus-visible,
.plate :focus-visible,
.site-footer :focus-visible { outline-color: var(--white); }

::selection { background: rgba(29, 63, 92, .18); color: var(--text-body); }
.on-navy ::selection, .plate ::selection, .site-footer ::selection {
  background: rgba(255, 255, 255, .28); color: var(--white);
}

.skip-link {
  position: absolute; left: var(--s3); top: -4rem; z-index: 1100;
  padding: var(--s3) var(--s4);
  background: var(--color-primary); color: var(--white);
  border-radius: var(--radius-sm); font-weight: 600; font-size: var(--text-small);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--s3); color: var(--white); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
   3. HEADINGS AND TEXT
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--color-primary);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-body-size); }

p { max-width: var(--measure); text-wrap: pretty; }

.lead { font-size: var(--text-subtitle); line-height: 1.55; max-width: 58ch; }
.muted { color: var(--text-muted); }
.caption { font-size: var(--text-small); color: var(--text-muted); line-height: 1.5; }

/* Section title, the system's .section-title: serif, uppercase,
   wide tracking, hairline beneath. */
.sec {
  padding-bottom: .3em;
  margin-bottom: var(--s6);
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-h3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
}
.sec-wide { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.sec-wide .sec-aside {
  font-family: var(--font-sans); font-size: var(--text-small); font-weight: 600;
  text-transform: none; letter-spacing: 0; color: var(--text-muted);
}

/* Small block titles (resume sidebar) */
.section-kicker {
  margin-bottom: var(--s3);
  font-family: var(--font-serif);
  font-size: var(--text-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--color-primary);
}

/* Drawn chevron for "go there" links */
.go { text-decoration: none; }
.go:hover { text-decoration: underline; }
.go::after {
  content: ""; display: inline-block;
  width: .42em; height: .42em; margin-left: .45em;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: translateY(-.08em) rotate(45deg);
  transition: transform var(--dur-base) var(--ease-out);
}
.go:hover::after { transform: translate(.2em, -.08em) rotate(45deg); }

.mt-4 { margin-top: var(--s4); }
.mt-5 { margin-top: var(--s5); }
.mt-6 { margin-top: var(--s6); }
.mt-7 { margin-top: var(--s7); }
.prose-wide { max-width: none; }

/* ============================================================
   4. SHELL AND LAYOUT
   Sections alternate white and #F4F6F8; 80px vertical padding.
   ============================================================ */
.page { display: block; }

.rail { width: min(var(--content-max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.rail-text { width: min(760px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.band { padding-block: var(--space-section); }
.band-tight { padding-block: var(--s8); }
.band-wash { background: var(--surface-tint); }
.band-paper { background: var(--white); }

.on-navy { background: var(--surface-dark); color: var(--text-on-dark-muted); }
.on-navy h1, .on-navy h2, .on-navy h3, .on-navy h4 { color: var(--white); }
.on-navy a { color: var(--white); }
.on-navy .sec { border-bottom-color: var(--rule-dark); }

.stack > * + * { margin-top: var(--s4); }
.stack-tight > * + * { margin-top: var(--s2); }

/* ============================================================
   5. HEADER (the system's NavBar)
   White, sticky, soft shadow. Serif wordmark; semibold links
   whose underline grows from the centre.
   ============================================================ */
.doc-head {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--s4) var(--s6);
  padding: var(--s5) 50px;
  background: var(--white);
  box-shadow: var(--shadow-nav);
}

.doc-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
  text-decoration: none;
  margin-right: auto;
}
.doc-name:hover { color: var(--color-primary-hover); }

.doc-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) 25px; list-style: none; }
.doc-nav a {
  position: relative;
  display: inline-block;
  padding-block: var(--s1);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}
.doc-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--color-primary);
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--dur-base) var(--ease-out);
}
.doc-nav a:hover { color: var(--color-primary-hover); }
.doc-nav a:hover::after { background: var(--color-primary-hover); }
.doc-nav a:hover::after,
.doc-nav a.is-current::after,
.doc-nav a[aria-current="page"]::after { transform: scaleX(1); }

/* Link to the Spanish site, set off by a hairline */
.doc-nav .lang-link { padding-left: 25px; border-left: 1px solid var(--rule); }
.doc-nav .lang-link a { font-weight: 400; color: var(--text-muted); }
.doc-nav .lang-link a:hover { color: var(--color-primary); }

/* Contact line under the name (resume) */
.doc-contact { width: 100%; font-size: var(--text-small); color: var(--text-muted); line-height: 1.7; overflow-wrap: anywhere; }
.doc-contact a { color: inherit; text-decoration: none; }
.doc-contact a:hover { color: var(--color-primary); text-decoration: underline; }

/* ============================================================
   6. PAGE PLATE (the system's dark page banner)
   Markup:
   <section class="plate"><div class="rail">
     <p class="plate-line">Case studies</p>
     <h1>...</h1><p class="plate-note">...</p>
   </div></section>
   ============================================================ */
.plate {
  padding-block: 70px;
  background: var(--surface-dark);
  color: var(--text-on-dark-muted);
}
.plate-line {
  font-family: var(--font-serif);
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
}
.plate h1 {
  margin-top: var(--s3);
  font-size: var(--text-display);
  line-height: 1.12;
  color: var(--white);
  max-width: 60ch;
}
.plate-note { margin-top: var(--s4); font-size: var(--text-subtitle); line-height: 1.55; color: var(--text-on-dark-muted); max-width: 80ch; }

.plate-facts {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6);
  margin-top: var(--s6); padding-top: var(--s4);
  border-top: 1px solid var(--rule-dark);
  font-size: var(--text-small);
  color: var(--text-on-dark-muted);
}
.plate-facts b { color: var(--white); font-weight: 600; }

/* ============================================================
   7. HOME
   Navy hero (portrait + introduction), then the four sections as
   a line diagram on the tint band, then recent work as cards.
   ============================================================ */
.home { padding-block: 96px 104px; }
.home-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s7); align-items: center; }

/* The system's profile photo: 16px radius, heavy border, lifted */
.portrait {
  width: 220px; height: 220px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 5px solid var(--white);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}
.home h1 { font-size: var(--text-display); line-height: 1.1; }
.home .lead { margin-top: var(--s5); color: var(--text-on-dark-muted); }
.home .lead + p { color: var(--text-on-dark-muted); }

/* Line diagram. A navy trunk runs down the left; each section is
   a stop. Markup:
   <nav class="home-routes-nav"><ul class="home-routes">
     <li class="home-route"><a><span class="label"/><span class="what"/></a></li> */
.home-routes {
  --stop-x: 1.25rem;
  --stop-y: calc(var(--s5) + .8125rem);
  list-style: none;
  border-top: 1px solid var(--rule);
}
.home-route { position: relative; border-bottom: 1px solid var(--rule); }
.home-route::before {
  content: ""; position: absolute; z-index: 1;
  left: calc(var(--stop-x) - 1.5px); width: 3px;
  top: 0; bottom: -1px;   /* run over the row's 1px bottom rule so the trunk stays unbroken */
  background: var(--color-primary);
}
.home-route:first-child::before { top: var(--stop-y); }
.home-route:last-child::before  { bottom: auto; height: var(--stop-y); }

.home-route a {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) 1.5rem;
  gap: var(--s2) var(--s5); align-items: baseline;
  padding: var(--s5) var(--s4) var(--s5) calc(var(--stop-x) * 2 + var(--s5));
  color: var(--text-body); text-decoration: none;
  transition: background var(--dur-base) var(--ease-out);
}
.home-route a::before {
  content: ""; position: absolute; z-index: 2;
  left: var(--stop-x); top: var(--stop-y);
  width: 1.125rem; height: 1.125rem; border-radius: 50%;
  background: var(--white); border: 3.5px solid var(--color-primary);
  transform: translate(-50%, -50%);
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.home-route a::after {
  content: ""; justify-self: end; align-self: center;
  width: .55rem; height: .55rem;
  border-top: 2px solid var(--color-primary); border-right: 2px solid var(--color-primary);
  transform: rotate(45deg); opacity: .35;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.home-route a:hover, .home-route a:focus-visible { background: var(--white); }
.home-route a:hover::before, .home-route a:focus-visible::before {
  background: var(--color-primary-hover); border-color: var(--color-primary-hover);
}
.home-route a:hover::after, .home-route a:focus-visible::after { opacity: 1; transform: translateX(.25rem) rotate(45deg); }
.home-route .label {
  font-family: var(--font-serif); font-size: 1.2rem; font-weight: 700;
  line-height: 1.35; color: var(--color-primary);
  transition: color var(--dur-fast) var(--ease-out);
}
.home-route a:hover .label { color: var(--color-primary-hover); }
.home-route .what { color: var(--text-muted); }

/* Optional intro video, kept for the existing player script */
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.plate.has-video { position: relative; min-height: min(72vh, 620px); display: flex; align-items: center; overflow: hidden; }
.plate.has-video .rail { position: relative; z-index: 2; }
.plate.has-video::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: rgba(29, 63, 92, .82);   /* fixed scrim, tuned for AA: do not lighten */
}

/* ============================================================
   8. RESUME
   ============================================================ */
.cv-layout { display: grid; grid-template-columns: minmax(230px, 30%) minmax(0, 1fr); gap: var(--s8); padding-block: var(--space-section); }
.cv-sidebar { align-self: start; position: sticky; top: 6.5rem; }
.cv-main { min-width: 0; }

.sidebar-section { padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--rule); }
.sidebar-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.summary { font-size: var(--text-small); line-height: 1.6; }

.role { padding: var(--s5) 0; border-top: 1px solid var(--rule); }
.sec + .role { border-top: 0; padding-top: 0; }   /* the title's hairline already divides */
.role:last-child { border-bottom: 1px solid var(--rule); }
.role-hd { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); }
.role-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--color-primary); }
.role-dates { flex: 0 0 auto; font-size: var(--text-small); color: var(--text-muted); white-space: nowrap; }
.role-org { margin-top: 2px; font-size: var(--text-small); color: var(--color-primary-hover); font-weight: 600; }
.role ul { margin-top: var(--s3); padding-left: 1.1rem; }
.role li { margin-bottom: var(--s2); font-size: var(--text-small); line-height: 1.55; }
.role li:last-child { margin-bottom: 0; }
.role li::marker { color: var(--color-primary-hover); }

.skill-group + .skill-group { margin-top: var(--s4); }
.skill-group-title { font-size: var(--text-small); font-weight: 700; color: var(--color-primary); margin-bottom: 2px; }
.skills { display: flex; flex-wrap: wrap; gap: 2px var(--s3); list-style: none; font-size: var(--text-small); }
.skill { display: inline-block; }
.skill:not(:last-child)::after { content: ","; color: var(--text-muted); }

.edu + .edu { margin-top: var(--s4); }
.edu-deg { font-size: var(--text-small); font-weight: 600; line-height: 1.4; }
.edu-desc { margin-top: 2px; font-size: var(--text-small); color: var(--text-muted); }

.info { font-size: var(--text-small); }
.info + .info { margin-top: var(--s2); }
.info b { color: var(--color-primary); font-weight: 600; }

/* KPI tiles: tint surface, no border */
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.metric { padding: var(--s4); background: var(--surface-card); border-radius: var(--radius-md); }
.metric-value { display: block; font-family: var(--font-serif); font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--color-primary); }
.metric-label { display: block; margin-top: var(--s2); font-size: var(--text-micro); line-height: 1.35; color: var(--text-muted); }

/* ============================================================
   9. CASE STUDIES
   Each case is the system's ContentCard: tint surface, 8px
   radius, soft shadow, no border; lifts on hover.
   ============================================================ */
.case-list { list-style: none; display: grid; gap: var(--s4); }
.case-item > a {
  display: grid; grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) minmax(0, 15rem);
  grid-template-rows: auto 1fr;   /* spare height goes below the description, not between title and it */
  gap: var(--s2) var(--s6); align-items: start;
  padding: 25px 30px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-body); text-decoration: none;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.band-wash .case-item > a { background: var(--white); }
.case-item > a:hover, .case-item > a:focus-visible { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.case-where { grid-row: 1 / span 2; font-size: var(--text-small); color: var(--text-muted); padding-top: .3em; }
.case-item h3 { font-size: var(--text-h3); color: var(--color-primary); transition: color var(--dur-fast) var(--ease-out); }
.case-item > a:hover h3 { color: var(--color-primary-hover); }
.case-what { grid-column: 2; color: var(--text-muted); margin-top: var(--s1); }
.case-result {
  grid-column: 3; grid-row: 1 / span 2;
  padding-top: var(--s3);
  border-top: 2px solid var(--color-primary);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-body);
}

/* Detail page: facts table, then prose */
.facts { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr); gap: var(--s3) var(--s5); font-size: var(--text-small); }
.facts dt { font-weight: 600; color: var(--text-muted); }

.figure-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s4); margin-block: var(--s6); }
.figure-row > div { padding: var(--s5) var(--s4); background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.figure-row b { display: block; font-family: var(--font-serif); font-size: 1.75rem; font-weight: 700; color: var(--color-primary); line-height: 1; }
.figure-row span { display: block; margin-top: var(--s2); font-size: var(--text-small); color: var(--text-muted); }

/* Chip, the system's Badge */
.tag {
  display: inline-block; padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(29, 63, 92, .08);
  font-size: var(--text-micro); font-weight: 600; color: var(--color-primary);
}

.note {
  padding: var(--s4) var(--s5);
  background: var(--surface-card);
  border-radius: var(--radius-md);
  font-size: var(--text-small); color: var(--text-muted);
}

.project-card {
  display: flex; flex-direction: column;
  padding: 25px 30px;
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--s5); }

/* ============================================================
   10. WRITING
   ============================================================ */
.essay-list { list-style: none; border-top: 1px solid var(--rule); }
.essay-list li { border-bottom: 1px solid var(--rule); }
.essay-list a {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: var(--s1) var(--s5); align-items: baseline;
  padding: var(--s4) var(--s3);
  color: var(--text-body); text-decoration: none;
  transition: background var(--dur-base) var(--ease-out);
}
.essay-list a:hover, .essay-list a:focus-visible { background: var(--surface-card); }
.essay-date { font-size: var(--text-small); color: var(--text-muted); }
.essay-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.2rem; color: var(--color-primary); }
.essay-list a:hover .essay-title { color: var(--color-primary-hover); }
.essay-note { grid-column: 2; font-size: var(--text-small); color: var(--text-muted); }

/* Standalone essay document -------------------------------------------------
   Long-form essays use the same design tokens as the rest of the site, but
   are presented as a physical sheet of paper on screen. Apply
   class="essay-document" to <body> and wrap the article in .essay-paper. */
body.essay-document {
  background: #cfcfcf;
  color: var(--text-body);
  font-family: var(--font-serif);
  font-size: clamp(.875rem, .705rem + .4vw, 1rem);
  line-height: 1.6;
}

.essay-paper {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  position: relative;
  background: var(--surface-page);
  box-shadow: none;
}

.essay-paper-head {
  margin-bottom: 1.25rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--color-primary);
  text-align: left;
}

.essay-paper-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, .818rem + 1.2vw, 1.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .01em;
  color: var(--color-primary);
}

.essay-byline {
  margin-top: .35rem;
  font-family: var(--font-serif);
  font-size: clamp(.75rem, .642rem + .5vw, .875rem);
  line-height: 1.35;
  letter-spacing: .015em;
  color: var(--text-muted);
}

.essay-paper p {
  max-width: none;
  margin: 0 0 1rem;
  font-size: inherit;
  line-height: 1.6;
  text-wrap: pretty;
}

.essay-paper h2 {
  margin: 1.25rem 0 .5rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-serif);
  font-size: clamp(.95rem, .744rem + .6vw, 1.15rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-primary);
}

.essay-paper h3 {
  margin: 1.25rem 0 .5rem;
  font-size: 1rem;
  color: var(--color-primary);
}

.essay-paper strong { font-weight: 600; }
.essay-paper a { color: var(--color-primary); text-decoration: none; }
.essay-paper a:hover { color: var(--color-primary-hover); text-decoration: underline; }

.essay-image-block { margin: 1.25rem 0; }
.essay-image-block--first { margin-top: 0; margin-bottom: 1.25rem; }
.essay-image-block--middle { margin-top: 1.25rem; margin-bottom: 1.25rem; }
.essay-image-block--last { margin-top: 2rem; margin-bottom: 0; }

.essay-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  mask-composite: intersect;
}

.essay-paper .caption {
  max-width: none;
  margin-top: .35rem;
  margin-bottom: 0;
  font-family: var(--font-serif);
  font-size: .75rem;
  font-style: italic;
  line-height: 1.2;
  text-align: left;
  color: var(--text-muted);
}

@media screen and (min-width: 768px) {
  body.essay-document { padding: 2rem 0; }
  .essay-paper {
    max-width: 11in;
    padding: .8in 1in;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
  }
}

.prose {
  max-width: var(--measure-read);
  margin-inline: auto;
  font-family: var(--font-serif);
  font-size: 1.1875rem;
  line-height: 1.7;
}
.prose > * + * { margin-top: var(--s5); }
.prose p { max-width: none; }
.prose h2 { margin-top: var(--s8); font-size: var(--text-h3); }
.prose h3 { margin-top: var(--s7); font-size: 1.2rem; }
.prose h2 + p, .prose h3 + p { margin-top: var(--s4); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: var(--s2); }
.prose li::marker { color: var(--color-primary-hover); }
.prose img { width: 100%; border-radius: var(--radius-md); }
.prose hr { height: 0; margin-block: var(--s7); border: 0; border-top: 1px solid var(--rule); }

.prose blockquote {
  padding: var(--s4) var(--s5);
  background: var(--surface-card);
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--color-primary);
}
.prose blockquote cite { display: block; margin-top: var(--s3); font-family: var(--font-sans); font-size: var(--text-small); font-style: normal; color: var(--text-muted); }
.prose figure figcaption { margin-top: var(--s3); font-family: var(--font-sans); font-size: var(--text-small); color: var(--text-muted); }

.footnotes { margin-top: var(--s8); padding-top: var(--s5); border-top: 1px solid var(--rule); font-family: var(--font-sans); font-size: var(--text-small); color: var(--text-muted); }
.footnotes li + li { margin-top: var(--s3); }

[lang="es"] .prose p, .prose[lang="es"] p { text-align: justify; hyphens: auto; }
[lang="en"] .prose p, .prose[lang="en"] p { text-align: left; hyphens: manual; }

/* ============================================================
   11. PHOTOGRAPHS
   ============================================================ */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--s5); list-style: none; }
.shot-wide { grid-column: span 2; }
.shot-tall .shot-frame { aspect-ratio: 3 / 4; }

.shot figure { margin: 0; }
.shot-frame {
  display: block; position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius-md); background: var(--surface-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.shot-frame img { width: 100%; height: 100%; object-fit: cover; }
.shot a:hover .shot-frame, .shot button:hover .shot-frame { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.shot figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); margin-top: var(--s3); font-size: var(--text-small); }
.shot-place { color: var(--color-primary); font-weight: 600; }
.shot-meta { color: var(--text-muted); }
.shot a, .shot button {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; color: inherit; text-decoration: none;
}

.lightbox { width: min(1100px, 92vw); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--surface-dark); color: var(--text-on-dark-muted); box-shadow: var(--shadow-popover); }
.lightbox::backdrop { background: rgba(29, 63, 92, .82); }
.lightbox img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; background: #13293C; }
.lightbox figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); font-size: var(--text-small); }
.lightbox-close {
  position: absolute; top: var(--s3); right: var(--s3);
  width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: var(--radius-pill);
  background: rgba(29, 63, 92, .6); color: var(--white); cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lightbox-close:hover { background: var(--color-primary); }

/* ============================================================
   12. BUTTONS, TABLES, FORMS (the system's Button and TextField)
   Hover swaps colour only: no scale, no shadow growth.
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 8px 18px;
  border: 2px solid var(--color-primary); border-radius: var(--radius-sm);
  background: var(--color-primary); color: var(--white);
  font-family: var(--font-sans); font-size: 1rem; font-weight: 600; line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--white); }

/* Secondary on light ground: navy outline, fills on hover */
.btn-line { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-line:hover { background: var(--color-primary); border-color: var(--color-primary); color: var(--white); }

/* The one action: green, swaps to white fill with green text */
.btn-accent { background: var(--color-accent); border-color: var(--color-accent); color: var(--white); }
.btn-accent:hover { background: var(--white); border-color: var(--color-accent); color: var(--color-accent); }

/* Hero sizes */
.btn-pill { padding: 13px 32px; font-size: 1.1rem; border-radius: var(--radius-pill); }

/* On navy (hero, plates, dark bands): primary becomes the system's
   white "outline" button */
:is(.on-navy, .plate) .btn { background: var(--white); border-color: var(--white); color: var(--color-primary); }
:is(.on-navy, .plate) .btn:hover { background: var(--color-primary); border-color: var(--white); color: var(--white); }
:is(.on-navy, .plate) .btn-line { background: transparent; border-color: var(--white); color: var(--white); }
:is(.on-navy, .plate) .btn-line:hover { background: var(--white); color: var(--color-primary); }
:is(.on-navy, .plate) .btn-accent { background: var(--color-accent); border-color: var(--color-accent); color: var(--white); }
:is(.on-navy, .plate) .btn-accent:hover { background: var(--white); border-color: var(--white); color: var(--color-accent); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s4); }

table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
th { text-align: left; font-weight: 600; color: var(--text-muted); }
th, td { padding: var(--s3) var(--s4) var(--s3) 0; border-bottom: 1px solid var(--rule); }
thead th { border-bottom: 2px solid var(--color-primary); }
td.num, th.num { text-align: right; padding-right: 0; }

label { display: block; font-size: var(--text-small); font-weight: 600; color: var(--color-primary); margin-bottom: var(--s1); }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color var(--dur-fast) var(--ease-out);
}
input:focus, textarea:focus, select:focus { border-color: var(--color-primary-hover); }

/* ============================================================
   13. FOOTER
   ============================================================ */
.site-footer { padding-block: var(--s7) var(--s5); background: var(--surface-dark); color: var(--text-on-dark-muted); }
.site-footer .doc-name { color: var(--white); font-size: 1.3rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s5); }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); list-style: none; }
.site-footer a { color: var(--text-on-dark-muted); text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s6); padding-top: var(--s4);
  border-top: 1px solid var(--rule-dark);
  font-size: var(--text-small);
}

/* ============================================================
   14. MOTION
   One focal moment per page load: the opening content rises
   into place once. Everything else moves only on interaction.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .home .home-grid,
  .plate .rail { animation: rise var(--dur-focal) var(--ease-out) both; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

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

/* ============================================================
   15. RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .band { padding-block: var(--s8); }
  .doc-head { position: static; padding: var(--s4) var(--gutter); gap: var(--s2) var(--s4); }
  .doc-name { width: 100%; margin-right: 0; }
  .doc-nav { gap: 0 var(--s5); }
  .doc-nav a { padding-block: var(--s3); }
  /* The nav wraps here, so the hairline would strand on its own row */
  .doc-nav .lang-link { padding-left: 0; border-left: 0; }

  .home { padding-block: var(--s8) 72px; }
  .home-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .portrait { width: 150px; height: 150px; border-width: 4px; }
  .home-route a { grid-template-columns: minmax(0, 1fr) 1rem; padding-right: var(--s2); }
  .home-route .what { grid-column: 1; }
  .home-route a::after { grid-column: 2; grid-row: 1 / span 2; }

  .cv-layout { grid-template-columns: 1fr; gap: var(--s6); padding-block: var(--s8); }
  .cv-sidebar { position: static; }

  .case-item > a { grid-template-columns: 1fr; gap: var(--s2); padding: var(--s5); }
  .case-what, .case-result { grid-column: 1; }
  .case-where { grid-row: auto; padding-top: 0; }
  .case-result { grid-row: auto; margin-top: var(--s3); }

  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: var(--s3); }

  .essay-list a { grid-template-columns: 1fr; }
  .essay-note { grid-column: 1; }

  .gallery { gap: var(--s4); }
  .shot-wide { grid-column: auto; }
}

@media (max-width: 560px) {
  :root { --space-section: 56px; --s8: 48px; }
  .doc-nav { width: 100%; }
  .btn-row .btn { flex: 1 1 auto; }
  .gallery { grid-template-columns: 1fr; }
  .prose { font-size: 1.0625rem; }
  [lang="es"] .prose p, .prose[lang="es"] p { text-align: left; }
}

/* ============================================================
   16. PRINT
   The resume and the essays are documents.
   ============================================================ */
@page { size: 8.5in 11in; margin: 12mm 16mm; }
@page essay { size: 8.5in 11in; margin: 0; }

@media print {
  :root {
    --navy-900: #111; --navy-600: #333; --ink-900: #1a1a1a; --ink-500: #555;
    --rule: #cfd6db; --surface-tint: transparent;
    --shadow-card: none; --shadow-card-hover: none;
  }
  html, body { background: #fff; color: #111; }
  body { font-size: 10pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  body.essay-document { padding: 0; background: #fff; font-family: var(--font-serif); }
  .essay-paper {
    page: essay;
    max-width: none;
    margin: 0;
    padding: .8in 1in;
    box-shadow: none;
  }
  .essay-paper-head { margin-bottom: .16in; padding-bottom: .08in; border-bottom: 2px solid #111; }
  .essay-paper-title { color: #111; font-size: 15pt; }
  .essay-byline { color: #555; font-size: 8.5pt; }
  .essay-paper p { font-size: 10.5pt; line-height: 1.42; margin-bottom: .1in; }
  .essay-paper h2 { margin: .18in 0 .07in; padding-bottom: .03in; border-bottom-color: #999; color: #111; font-size: 10.5pt; }
  .essay-paper h3 { color: #111; }
  .essay-paper a { color: #111; text-decoration: none; }
  .essay-image-block, .essay-image-block--first, .essay-image-block--middle { margin: .14in 0; }
  .essay-image-block--last { margin: .2in 0 0; }

  .doc-nav, .skip-link, .btn, .btn-row,
  .gallery, .lightbox, .home-routes-nav, .hero-video, .portrait { display: none !important; }

  .doc-head { position: static; display: block; padding: 0 0 .08in; margin-bottom: .16in; box-shadow: none; border-bottom: 2px solid #111; text-align: center; }
  .doc-name { color: #111; font-size: 13pt; }
  .doc-contact { color: #333; font-size: 9pt; }

  .plate, .home { padding: 0 0 .1in; margin-bottom: .16in; background: none; color: #111; border-bottom: 1px solid #111; }
  .plate h1, .home h1 { color: #111; font-size: 15pt; max-width: none; }
  .plate-line { color: #111; font-size: 8.5pt; }
  .plate-note, .home .lead, .home .lead + p { color: #333; font-size: 9.5pt; }

  .rail, .rail-text { width: auto; }
  .band { padding-block: 0; }
  .on-navy { background: none; color: #1a1a1a; }
  .on-navy h1, .on-navy h2, .on-navy h3, .on-navy h4, .on-navy a { color: #111; }
  .cv-layout { display: block; padding: 0; }
  .cv-sidebar { position: static; }
  .sidebar-section { padding: 0; margin: 0 0 .1in; border: 0; }
  .metrics-grid { display: none; }

  .sec { font-size: 10.5pt; margin: .16in 0 .07in; padding-bottom: .03in; border-bottom: 1px solid #111; }
  .role { padding: 0 0 .1in; border: 0; page-break-inside: avoid; }
  .role:last-child { border: 0; }
  .role-title, .role-dates, .role-org, .role li, .info, .edu-deg { font-size: 9.3pt; }
  .role-org { color: #333; }
  .role li { margin-bottom: .02in; line-height: 1.35; }
  .skill { font-size: 9.3pt; }
  .edu-desc, .caption { font-size: 9pt; }

  .case-item > a { display: block; padding: 0 0 .1in; box-shadow: none; background: none; page-break-inside: avoid; }
  .case-result { border-top: 1px solid #111; }

  .prose { max-width: none; font-size: 10.5pt; line-height: 1.42; }
  .prose > * + * { margin-top: .1in; }
  .prose h2, .prose h3 { margin-top: .18in; }
  .prose a { color: #111; text-decoration: none; }

  .site-footer { padding: .1in 0 0; background: none; color: #555; border-top: 1px solid #cfd6db; }
  .site-footer .doc-name { color: #111; }
  .footer-base { border: 0; margin-top: .05in; }

  .break-before { break-before: page; }
  h2, h3 { break-after: avoid; }
}
