/* =========================================================================
   MO NAGDY — CV
   Clean greyscale, Inter sans
   ========================================================================= */

:root {
  --paper:       #f6f5f2;
  --paper-warm:  #fbfaf7;
  --ink:         #141414;
  --ink-soft:    #262626;
  --ink-mid:     #4a4a4a;
  --ink-dim:     #6e6e6e;
  --muted:       #9a9a9a;
  --subtle:      #b8b8b8;

  --rule:        rgba(20, 20, 20, 0.08);
  --rule-med:    rgba(20, 20, 20, 0.14);
  --rule-strong: rgba(20, 20, 20, 0.28);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Sticky-stack offsets (compact heights once scrolled) */
  --sticky-masthead: 3.6rem;
  --sticky-h2:       2.5rem;
}

/* Dark theme — applied via system preference (no override) or [data-theme="dark"] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #1a1a1a;
    --paper-warm:  #232323;
    --ink:         #f1ede4;
    --ink-soft:    #ddd8cd;
    --ink-mid:     #b3aea3;
    --ink-dim:     #8a857b;
    --muted:       #6b675e;
    --subtle:      #4a4742;

    --rule:        rgba(241, 237, 228, 0.08);
    --rule-med:    rgba(241, 237, 228, 0.16);
    --rule-strong: rgba(241, 237, 228, 0.30);
  }
}
:root[data-theme="dark"] {
  --paper:       #1a1a1a;
  --paper-warm:  #232323;
  --ink:         #f1ede4;
  --ink-soft:    #ddd8cd;
  --ink-mid:     #b3aea3;
  --ink-dim:     #8a857b;
  --muted:       #6b675e;
  --subtle:      #4a4742;

  --rule:        rgba(241, 237, 228, 0.08);
  --rule-med:    rgba(241, 237, 228, 0.16);
  --rule-strong: rgba(241, 237, 228, 0.30);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--rule-med);
  border-radius: 50%;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-mid);
}
.theme-toggle:focus-visible {
  outline: 1px solid var(--ink-mid);
  outline-offset: 3px;
}
.theme-toggle .theme-icon {
  width: 16px;
  height: 16px;
}
.theme-toggle .theme-icon-sun { display: block; }
.theme-toggle .theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .theme-icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .theme-icon-moon { display: none; }

/* Logos that need to be inverted to white in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img[src$="veyor.svg"],
  :root:not([data-theme="light"]) img[src$="juven.svg"],
  :root:not([data-theme="light"]) img[src$="oxford.svg"],
  :root:not([data-theme="light"]) img[src$="ihs.svg"],
  :root:not([data-theme="light"]) img[src$="unicaf.svg"] {
    filter: brightness(0) invert(1);
  }
}
:root[data-theme="dark"] img[src$="veyor.svg"],
:root[data-theme="dark"] img[src$="juven.svg"],
:root[data-theme="dark"] img[src$="oxford.svg"],
:root[data-theme="dark"] img[src$="ihs.svg"],
:root[data-theme="dark"] img[src$="unicaf.svg"] {
  filter: brightness(0) invert(1);
}

/* -------------------------------------------------------------------------
   Reset + base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--paper);
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-anchor: none;
  font-feature-settings: "cv11" 1, "ss01" 1, "kern" 1;
}

/* -------------------------------------------------------------------------
   Main column
   ------------------------------------------------------------------------- */
main {
  max-width: 780px;
  margin: 0 auto;
  padding: 5rem 2rem 6rem;
  position: relative;
}

/* -------------------------------------------------------------------------
   Masthead
   ------------------------------------------------------------------------- */
.masthead {
  --p: var(--scroll-progress, 0);
  display: flex;
  align-items: center;
  gap: calc(2.5rem - var(--p) * 1.5rem);
  padding: calc(2rem - var(--p) * 2rem) 0 calc(2.25rem - var(--p) * 2.25rem);
  margin-bottom: calc(3.5rem - var(--p) * 3.5rem);
  min-height: var(--sticky-masthead);
  border-bottom: 1px solid var(--rule-strong);
  animation: drift-in 700ms ease-out both;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  contain: layout style;
  overflow-anchor: none;
}

.masthead-text { flex: 1 1 auto; min-width: 0; }

.masthead h1 {
  --h1-scale: calc(1 - var(--p) * 0.695);
  font-family: var(--font-sans);
  font-weight: 200;
  font-size: clamp(2.5rem, 11vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  color: var(--ink);
  height: calc(var(--h1-natural-height, 5.15rem) * var(--h1-scale));
  margin-bottom: calc(1.25rem - var(--p) * 1.25rem);
  transform: scale(var(--h1-scale));
  transform-origin: left top;
  will-change: transform;
}

/* Social links under the name */
.social-links {
  display: flex;
  gap: 0.85rem;
  margin-top: calc(0.85rem - var(--p) * 0.85rem);
  max-height: calc(2rem - var(--p) * 2rem);
  opacity: calc(1 - var(--p));
  overflow: hidden;
  will-change: opacity;
}
.social-links a {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  border-bottom: none;
  transition: color 200ms ease, transform 200ms ease;
}
.social-links a:hover {
  color: var(--ink);
  transform: translateY(-1px);
  border-bottom: none;
}
.social-links svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
}
body.masthead-collapsed .social-links { pointer-events: none; }

.contact {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
  font-feature-settings: "zero" 1, "tnum" 1;
}
.contact a {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-med);
  padding-bottom: 1px;
}
.contact a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.contact .sep { color: var(--subtle); margin: 0 0.35em; }

/* Portrait */
.portrait-frame {
  flex: 0 0 auto;
  animation: drift-in 700ms ease-out 100ms both;
}
.portrait {
  width: calc(120px - var(--scroll-progress, 0) * 120px);
  height: calc(120px - var(--scroll-progress, 0) * 120px);
  object-fit: cover;
  display: block;
  opacity: calc(1 - var(--scroll-progress, 0));
  border-radius: 12px;
}

/* -------------------------------------------------------------------------
   Sections
   ------------------------------------------------------------------------- */
main > section {
  margin: 3rem 0 2rem;
  animation: drift-in 600ms ease-out both;
}
main > section:nth-of-type(1) { animation-delay: 180ms; }
main > section:nth-of-type(2) { animation-delay: 240ms; }
main > section:nth-of-type(3) { animation-delay: 300ms; }
main > section:nth-of-type(4) { animation-delay: 360ms; }

h2 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: var(--sticky-masthead);
  z-index: 20;
  background: var(--paper);
  /* Height locked so the open-summary sticks flush below h2 */
  height: var(--sticky-h2);
  padding: 0;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule-med);
}

/* -------------------------------------------------------------------------
   Details / Summary
   ------------------------------------------------------------------------- */
details {
  border-bottom: 1px solid var(--rule);
  position: relative;
}
details:first-of-type { border-top: 1px solid var(--rule); }

summary {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.1rem 0.5rem 1.1rem 2rem;
  cursor: pointer;
  list-style: none;
  position: relative;
  transition: background-color 180ms ease;
  background: var(--paper);
}

/* Open role summary sticks under the section header */
section > details[open] > summary {
  position: sticky;
  top: calc(var(--sticky-masthead) + var(--sticky-h2));
  z-index: 10;
  border-bottom: 1px solid var(--rule);
}

@media (hover: hover) {
  summary:hover { background: var(--paper-warm); }
}
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }

summary::before {
  content: "+";
  position: absolute;
  left: 0.5rem;
  top: 1.15rem;
  width: 1rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1;
  transition: color 200ms ease;
}
details[open] > summary::before {
  content: "−";
  color: var(--ink-soft);
}
summary:hover::before { color: var(--ink); }
summary:focus-visible {
  outline: 1px solid var(--ink-mid);
  outline-offset: 4px;
}

summary .role {
  flex: 1 1 auto;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

/* When a role has a logo, switch to flex so logo + text align cleanly */
summary .role:has(.role-logo) {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.role-logo {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}
.role-text {
  flex: 1 1 auto;
  min-width: 0;
}
summary .role em {
  font-weight: 400;
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.94em;
}
summary .role a {
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease;
}
summary .role a:hover { border-bottom-color: var(--ink); }

summary .when {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
summary .when time { color: var(--ink-dim); }

/* Body */
details > .body {
  padding: 0.25rem 0.5rem 1.75rem 2rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-soft);
  animation: unfold 380ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
details > .body p { margin: 0.65rem 0; }
details > .body ul { padding-left: 1.25rem; margin: 0.7rem 0; list-style: none; }
details > .body li { margin: 0.45rem 0; position: relative; }
details > .body li::before {
  content: "—";
  position: absolute;
  left: -1.3rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.85em;
  top: 0.15em;
}

details > .body strong {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
}

/* External role link — appears at the bottom of an expanded details body */
details > .body p.role-link {
  margin-top: 1.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
}
details > .body p.role-link a {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-med);
}
details > .body p.role-link a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
details > .body p.role-link a::after {
  content: " ↗";
  color: var(--ink-dim);
}

/* Press citation line */
details > .body p.press {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.9;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  text-transform: uppercase;
}
details > .body p.press a {
  text-transform: none;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.3em;
  letter-spacing: 0;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-med);
}
details > .body p.press a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* -------------------------------------------------------------------------
   Press gallery — branded article cards
   ------------------------------------------------------------------------- */
.press-gallery {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  margin-top: 1.75rem;
  padding: 2.4rem 0 0.5rem;
  border-top: 1px solid var(--rule);
  position: relative;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
  /* Subtle right-edge fade as a scroll affordance */
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 32px), transparent 100%);
}

.press-gallery::before {
  content: "Selected press";
  position: absolute;
  top: 1rem;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
}

/* Hide fade and label-position adjustment when content fits without scroll */
.press-gallery:not(:hover)::-webkit-scrollbar { height: 6px; }
.press-gallery::-webkit-scrollbar-track { background: transparent; }
.press-gallery::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 3px; }

.press-card {
  flex: 0 0 240px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--paper-warm);
  border: 1px solid var(--rule-med);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.press-card:hover {
  border-color: var(--ink-mid);
  border-bottom-color: var(--ink-mid);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px -8px rgba(0, 0, 0, 0.18);
}

.press-thumb {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}

.press-mark {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* Bloomberg — black with serif italic wordmark */
.press-card[data-source="bloomberg"] .press-thumb {
  background: #000;
}
.press-card[data-source="bloomberg"] .press-mark {
  color: #fff;
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* TechCrunch — TC green */
.press-card[data-source="techcrunch"] .press-thumb {
  background: #0a9928;
}
.press-card[data-source="techcrunch"] .press-mark {
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* FT — salmon paper with black wordmark */
.press-card[data-source="ft"] .press-thumb {
  background: #fff1e5;
}
.press-card[data-source="ft"] .press-mark {
  color: #000;
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
}

.press-meta {
  padding: 0.85rem 0.95rem 0.95rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.press-title {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.38;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 0;
}

.press-source {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 720px) {
  .press-card { flex: 0 0 200px; }
  .press-thumb { height: 60px; }
  .press-mark { font-size: 0.95rem; }
  .press-title { font-size: 0.78rem; }
}

/* -------------------------------------------------------------------------
   Earlier experience — flat siblings, hidden until toggle
   ------------------------------------------------------------------------- */
.earlier-role { display: none; }
section.earlier-shown .earlier-role { display: block; }

.earlier-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 1.5rem auto 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule-med);
  border-radius: 50%;
  color: var(--ink-dim);
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}
.earlier-toggle:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
  background: var(--paper-warm);
}
.earlier-toggle:focus-visible {
  outline: 1px solid var(--ink-mid);
  outline-offset: 3px;
}
.earlier-toggle .chevron {
  width: 12px;
  height: 8px;
  display: block;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.earlier-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* -------------------------------------------------------------------------
   Portfolio table
   ------------------------------------------------------------------------- */
.portfolio {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}
.portfolio thead th {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: left;
  padding: 0.6rem 0.75rem 0.6rem 0;
  color: var(--ink-dim);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-med);
}
.portfolio thead th:first-child { width: 40px; padding: 0; }
.portfolio thead th:last-child { text-align: right; padding-right: 0; }

.portfolio tbody td {
  padding: 0.8rem 0.75rem 0.8rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  color: var(--ink-soft);
}
.portfolio tbody td:last-child { padding-right: 0; }
.portfolio tbody tr:last-child td { border-bottom: 1px solid var(--rule-strong); }

.portfolio tbody a { color: var(--ink); border-bottom: 1px solid var(--rule-med); }
.portfolio tbody a:hover { border-bottom-color: var(--ink); }

.portfolio tbody td.col-num,
.portfolio tbody td:last-child {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.portfolio tbody td.held {
  color: var(--subtle);
  font-style: normal;
  letter-spacing: 0.04em;
}

/* Inline footnote popovers */
.note {
  position: relative;
  display: inline;
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 0 0.18em;
  cursor: help;
  font: inherit;
  color: inherit;
}
.note-mark {
  font-family: var(--font-mono);
  font-size: 0.62em;
  vertical-align: 0.55em;
  color: var(--ink-dim);
  font-feature-settings: "tnum" 1;
  border-bottom: 1px dotted var(--rule-strong);
  padding: 0 0.05em;
  transition: color 180ms ease, border-color 180ms ease;
}
.col-num .note { margin-right: -0.7em; }

.note:hover .note-mark,
.note:focus-visible .note-mark { color: var(--ink); border-bottom-color: var(--ink); }
.note:focus-visible { outline: none; }
.note:focus-visible .note-mark {
  outline: 1px solid var(--ink-mid);
  outline-offset: 2px;
}

.note-pop {
  position: absolute;
  bottom: calc(100% + 0.55rem);
  left: 50%;
  transform: translate(-50%, 4px);
  z-index: 40;
  min-width: 9rem;
  max-width: 15rem;
  padding: 0.5rem 0.7rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  border-radius: 2px;
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.note-pop::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.note:hover .note-pop,
.note:focus-visible .note-pop,
.note:focus-within .note-pop {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 720px) {
  .note-pop { font-size: 0.7rem; min-width: 7rem; }
}

@media print {
  .note-pop {
    position: static;
    opacity: 1;
    pointer-events: auto;
    background: none;
    color: var(--ink-dim);
    box-shadow: none;
    transform: none;
    padding: 0 0 0 0.3em;
    font-size: 0.7em;
  }
  .note-pop::after { display: none; }
}

.logo-cell { width: 40px; padding-right: 0.6rem !important; }
.logo-cell img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  background: transparent;
}
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.74rem;
}

.exit {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 2px 5px 1px;
  margin-left: 0.5rem;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--rule-strong);
  vertical-align: 2px;
}

/* -------------------------------------------------------------------------
   Skills
   ------------------------------------------------------------------------- */
.skills {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.85rem 1.75rem;
  margin: 0.5rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule-med);
  border-bottom: 1px solid var(--rule-med);
}
.skills dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  padding-top: 0.25rem;
}
.skills dd {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
footer.page-footer {
  margin-top: 5rem;
  padding-top: 1.75rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
}

/* -------------------------------------------------------------------------
   Links (global)
   ------------------------------------------------------------------------- */
a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-med);
  transition: border-color 180ms ease;
}
a:hover { border-bottom-color: var(--ink); }
a:focus-visible {
  outline: 1px solid var(--ink-mid);
  outline-offset: 2px;
}

em { font-style: italic; }

code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--ink-dim);
  letter-spacing: -0.01em;
  word-break: break-all;
}

/* -------------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------------- */
@keyframes drift-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes unfold {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html.static *, html.static *::before, html.static *::after {
  animation: none !important;
  transition: none !important;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 720px) {
  main { padding: 2.75rem 1.25rem 3rem; }

  .masthead {
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
  }
  .portrait-frame { display: none; }

  summary {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding: 0.9rem 0.25rem 0.9rem 1.75rem;
  }
  summary::before { top: 1rem; }
  summary .when {
    width: 100%;
    padding-left: 0;
    padding-top: 0;
    font-size: 0.66rem;
  }

  .portfolio { font-size: 0.82rem; }
  .portfolio-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-strong) transparent;
    margin-right: -1.25rem;
    padding-right: 1.25rem;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  .portfolio-scroll .portfolio { min-width: 520px; }
  .portfolio-scroll .portfolio thead th,
  .portfolio-scroll .portfolio tbody td { white-space: nowrap; }

  .skills {
    grid-template-columns: 1fr;
    gap: 0.25rem 0;
    padding: 1.25rem 0;
  }
  .skills dt { margin-top: 0.6rem; }
  .skills dt:first-of-type { margin-top: 0; }
}

/* -------------------------------------------------------------------------
   Print
   ------------------------------------------------------------------------- */
@media print {
  :root {
    --paper: #ffffff;
    --ink: #000;
    --ink-soft: #111;
    --ink-mid: #333;
    --ink-dim: #555;
    --muted: #777;
    --subtle: #999;
    --rule: rgba(0, 0, 0, 0.12);
    --rule-med: rgba(0, 0, 0, 0.22);
    --rule-strong: rgba(0, 0, 0, 0.45);
  }
  body { background: #fff; color: #111; }
  main { max-width: none; padding: 1.5rem; }
  .masthead, h2, summary,
  section > details[open] > summary {
    position: static !important;
    background: transparent !important;
  }
  .earlier-role { display: block !important; }
  .earlier-toggle { display: none !important; }
  .masthead, main > section, .portrait-frame { opacity: 1; animation: none; }
  .portrait { filter: grayscale(100%) contrast(1.05); }
  details > *:not(summary) { display: block !important; }
  details { border: none; margin: 0.6rem 0; page-break-inside: avoid; }
  summary { cursor: default; padding-left: 0; }
  summary::before { display: none; }
  summary:hover { padding-left: 0; }
  details > .body { padding-left: 0; animation: none; }
  a { color: #111; border-bottom: none; }
  h2, details, tr { break-inside: avoid; }
  .deal-map { break-inside: avoid; }
  .deal-map .country { fill: #f1efe8 !important; stroke: #cfcbc1 !important; }
  .deal-map .country.is-active { fill: #2a2a2a !important; }
  .deal-map-hover { display: none; }
}

/* -------------------------------------------------------------------------
   Deal map (Bolt — global markets atlas)
   ------------------------------------------------------------------------- */
.deal-map {
  margin: 1.4rem 0 0.25rem;
  padding: 0.6rem 0 0.4rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  animation: drift-in 600ms ease-out 80ms both;
}
.deal-map-canvas {
  width: 100%;
  aspect-ratio: 2 / 1;
  position: relative;
  overflow: hidden;
}
.deal-map-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
}
.deal-map .deal-map-sphere {
  fill: var(--paper-warm);
  stroke: var(--rule);
  stroke-width: 0.6px;
  vector-effect: non-scaling-stroke;
}
.deal-map .country {
  fill: var(--map-country, #ece8df);
  stroke: var(--map-country-stroke, rgba(20, 20, 20, 0.10));
  stroke-width: 0.5px;
  vector-effect: non-scaling-stroke;
  transition: fill 220ms ease;
}
.deal-map .country.is-active {
  fill: var(--map-active, #1f6b4f);
}
.deal-map .country.is-active:hover {
  fill: var(--map-active-hover, #2c8a66);
  cursor: default;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --map-country: #2e2e2e;
    --map-country-stroke: rgba(241, 237, 228, 0.10);
    --map-active: #2c8a66;
    --map-active-hover: #38a87b;
  }
}
:root[data-theme="dark"] {
  --map-country: #2e2e2e;
  --map-country-stroke: rgba(241, 237, 228, 0.10);
  --map-active: #2c8a66;
  --map-active-hover: #38a87b;
}
.deal-map-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.deal-map-caption strong { color: var(--ink); font-weight: 500; }
.deal-map-key { display: inline-flex; align-items: center; gap: 0.55rem; }
.deal-map-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #1f6b4f;
  box-shadow: 0 0 0 3px rgba(31, 107, 79, 0.12);
  display: inline-block;
}
.deal-map-hover {
  font-feature-settings: "tnum" 1;
  min-height: 1em;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0.78;
  text-align: right;
}
@media (max-width: 540px) {
  .deal-map-caption { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .deal-map-hover { text-align: left; }
}
