/* ============================================================
   TABLE OF CONTENTS  (search the "=== NAME ===" banners to jump)
   ============================================================
   RESET · FONTS · VARIABLES · BASE · LAYOUT · COMPONENTS · SPECTRUM
   GRADIENT THEME · HERO · ARTICLES · WORK · POSTS · POST POPUP
   SIDE PROJECTS · SKILLS · RECOGNITIONS · WIDGET STATUS · CONTACT
   FAB · DARK MODE · MEDIA QUERIES · ARTICLE PAGE · RÉSUMÉ PAGE
   ============================================================ */

/* === RESET === */

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

html {
  scroll-behavior: smooth;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

/* Controls are for tapping, not selecting — stop long-press / drag from
   highlighting their labels or popping the iOS text/callout menu (e.g. holding
   the colour button for rainbow mode used to select its contents). Page copy
   stays selectable; this only covers interactive chrome. */
button,
.fab-item,
.icon-btn,
.btn-primary,
.btn-ghost,
.top-ctrl-btn,
.hero-call-label,
.lang-code {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* === FONTS === */

/* Gadey — display face for the hero greeting. Self-hosted: woff2 (small) with
   the original TTF as a fallback. font-display: swap shows Inter until it
   loads, so there's no invisible-text flash. */
@font-face {
  font-family: 'Gadey';
  src: url('/assets/Gadey.woff2') format('woff2'),
       url('/assets/Gadey-5yG4z.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

/* === VARIABLES === */

:root {
  /* Palette — light mode */
  --bg: #F2F2EE;
  --text: #111111;
  --muted: rgba(17, 17, 17, 0.4);
  --border: rgba(17, 17, 17, 0.1);
  --card-bg: #FFFFFF;
  /* Pills sit on white cards, so they carry a faint warm-gold grey to stand
     apart from the surrounding surface without shouting. */
  --pill-bg: #F6F3EC;
  --pill-border: rgba(120, 96, 54, 0.12);
  --shadow: rgba(0, 0, 0, 0.06);
  --theme-color: #4F46E5;

  /* Typography */
  --font: 'Inter', sans-serif;
  --size-xs: 0.75rem;
  --size-sm: 0.875rem;
  --size-base: 1rem;
  --size-lg: 1.125rem;
  --size-xl: 1.375rem;
  --size-2xl: 1.75rem;
  --size-3xl: 2.25rem;
  --size-4xl: 3rem;
  --size-5xl: 3.75rem;
  --leading-tight: 1.2;
  --leading-body: 1.7;
  --tracking-tight: -0.01em;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.05em;

  /* Spacing (number = px at 16px root font size) */
  --space-1:  0.25rem;  /*  4px */
  --space-2:  0.5rem;   /*  8px */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* Layout */
  --max-width: 760px;
  --section-gap: 3rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 220ms ease;

  /* Shadows */
  --shadow-sm: 0 1px 4px var(--shadow);
  --shadow-md: 0 4px 16px var(--shadow);
  --shadow-lg: 0 8px 32px var(--shadow);
  --shadow-card: 0 8px 64px rgba(0, 0, 0, 0.5);

  /* Misc */
  --color-page-bg: #F9F8F5;
  --color-always-white: #FFFFFF;
  --color-online: #22c55e;
  --size-role-icon: 36px;
  --size-hero-photo: 160px;
}

/* Dark mode overrides */
[data-theme="dark"] {
  --bg: #111111;
  --text: #F0F0F0;
  --muted: rgba(240, 240, 240, 0.4);
  --border: rgba(240, 240, 240, 0.08);
  --card-bg: #1C1C1C;
  --pill-bg: #272320;
  --pill-border: rgba(196, 164, 110, 0.18);
  --shadow: rgba(0, 0, 0, 0.3);
  --color-page-bg: #0D0D0D;
}

/* === BASE === */

html {
  background: var(--color-page-bg);
}

html, body {
  font-family: var(--font);
  font-size: var(--size-base);
  font-weight: 400;
  line-height: var(--leading-body);
  color: var(--text);
  background-color: var(--color-page-bg);
  -webkit-font-smoothing: antialiased;
}

/* Sideways-overflow guard on <html> ONLY: overflow-x on <body> would make it
   a scroll container and break position: sticky (the reading pages' header). */
html { overflow-x: hidden; }

/* Dynamic "bokeh" background — the drifting radial-gradient layers now live in
   the standalone bokeh.js library (mounted via [data-bokeh] on <html>), so they
   can be reused and configured at runtime. See bokeh.js. Rainbow ("gradient")
   mode is driven there too, via Bokeh.setPalette() from script.js — the UI
   accents for that mode are still styled below in the GRADIENT THEME section. */

h1, h2, h3, h4 {
  font-weight: 300;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

p {
  line-height: var(--leading-body);
}

/* === LAYOUT === */

main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 2.5rem auto;
  background: transparent;
  box-shadow: none;
  border-radius: 4px;
  overflow: hidden;
}

.page-wrapper {
  padding: 0 var(--space-8);
}

/* The landing/hero keeps the original, roomier side margin */
.hero .page-wrapper {
  padding: 0 var(--space-12);
}

section {
  padding: var(--space-12) 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

[data-theme="light"] section {
  background: var(--card-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Articles, posts, and recognitions are nearly transparent — the animated bg shows through */
section.engagements,
section.articles,
section.posts,
section.recognitions {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] section.engagements,
[data-theme="light"] section.articles,
[data-theme="light"] section.posts,
[data-theme="light"] section.recognitions {
  background: rgba(255, 255, 255, 0.12);
}

section:last-child {
  border-bottom: none;
}

.section-heading {
  font-size: var(--size-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--theme-color);
  margin-bottom: var(--space-6);
  text-align: center;
}

/* === COMPONENTS === */


/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-6);
}

/* Pills / tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--size-xs);
  color: var(--muted);
  white-space: nowrap;
  background: var(--pill-bg);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-size: var(--size-sm);
  font-weight: 500;
  transition: opacity var(--transition-base);
}

.btn-primary:hover {
  opacity: 0.8;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-size: var(--size-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  transition: border-color var(--transition-base), background var(--transition-base);
}

.btn-ghost:hover {
  border-color: var(--text);
  background: var(--bg);
}


/* Toast */
.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--text);
  color: var(--bg);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  z-index: 2000;
  opacity: 0;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  pointer-events: none;
  white-space: nowrap;
}

.toast.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Utility ctrl buttons — circular, slide left from FAB */
/* Utility-control grid: two rows of three, stacked directly above the FAB.
   Top row = cursor / scheme / sound; bottom row (nearest the close button) =
   colour / language / parallax. Right-anchored so its edge lines up with the
   FAB pill. */
.fab-ctrl-items {
  position: fixed;
  bottom: 84px;            /* clears the 44px FAB sitting at bottom:20px */
  right: 20px;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 10px;
  justify-content: end;
  z-index: 799;
  pointer-events: none;
}

.fab-ctrl-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-full);
  background: var(--theme-color);
  color: var(--color-always-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px) scale(0.82);
  transition: opacity 200ms ease, transform 200ms ease, background var(--transition-fast), filter var(--transition-fast);
  pointer-events: none;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.fab-ctrl-btn.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.fab-ctrl-btn:hover {
  filter: brightness(1.14);
}

/* Parallax / cursor / sound off: ghost appearance to signal inactive */
#parallax-toggle-btn[data-parallax="off"],
#cursor-toggle-btn[data-cursor="off"],
#sound-toggle-btn[data-sound="off"] {
  background: var(--card-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

/* Custom cursors are desktop-only — hide the toggle where they cannot apply.
   visibility (not display:none) keeps its grid cell so the rest of the control
   grid stays aligned on touch devices. */
@media (pointer: coarse) {
  #cursor-toggle-btn { visibility: hidden; pointer-events: none; }
}

/* Scheme icon visibility — show only the icon matching current state */
.scheme-icon { display: none; }
#scheme-toggle-btn[data-scheme="auto"]  .scheme-icon--auto  { display: block; }
#scheme-toggle-btn[data-scheme="light"] .scheme-icon--light { display: block; }
#scheme-toggle-btn[data-scheme="dark"]  .scheme-icon--dark  { display: block; }

/* Language toggle — shows the current locale's short code */
.lang-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* === SPECTRUM GRADIENT THEME === */

@keyframes spectrum-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* The gradient itself — wide enough to roll smoothly */
:root {
  --spectrum: linear-gradient(
    90deg,
    #f87171, #fb923c, #fbbf24, #a3e635,
    #34d399, #22d3ee, #60a5fa, #818cf8,
    #c084fc, #f472b6, #f87171
  );
}

/* Elements that use theme-color as a solid fill get the rolling gradient */
[data-gradient-theme] .hero-photo,
[data-gradient-theme] .post-card-photo,
[data-gradient-theme] .fab-btn,
[data-gradient-theme] .fab-ctrl-btn:not(#parallax-toggle-btn[data-parallax="off"]):not(#cursor-toggle-btn[data-cursor="off"]):not(#sound-toggle-btn[data-sound="off"]),
[data-gradient-theme] .articles-dot.active,
[data-gradient-theme] .btn-primary,
[data-gradient-theme] .status-dot {
  background: var(--spectrum);
  background-size: 200% auto;
  animation: spectrum-shift 3s linear infinite;
  color: var(--color-always-white);
}

/* Theme-color text elements — rolling gradient clipped to text */
[data-gradient-theme] .hero-name,
[data-gradient-theme] .typewriter-word,
[data-gradient-theme] .hero-call-label,
[data-gradient-theme] .section-heading,
[data-gradient-theme] .contact-heading {
  background: var(--spectrum);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: spectrum-shift 4s linear infinite;
  border-color: transparent;
}

/* Fade-in animation via IntersectionObserver */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === HERO === */

.hero {
  padding: var(--space-12) 0;
  text-align: center;
}

.hero-photo {
  width: var(--size-hero-photo);
  height: var(--size-hero-photo);
  border-radius: 50%;
  border: 5px solid var(--color-always-white);
  box-shadow: 0 0 0 1.5px var(--border), var(--shadow-md);
  /* The hero photo is a transparent PNG cutout — fill the circle with the
     randomised accent so it shows behind the silhouette. */
  background: var(--theme-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-8);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero-photo-initials {
  font-size: var(--size-3xl);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  user-select: none;
}


.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-online);
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-headline {
  margin-top: var(--space-24);
  margin-bottom: var(--space-5);
}

.hero-greeting {
  font-family: 'Gadey', var(--font);
  font-size: var(--size-4xl);
  font-weight: 700;
  color: var(--text);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
}

/* The name in the greeting picks up the page's randomised accent colour */
.hero-name {
  color: var(--theme-color);
}

.hero-ai-line {
  font-size: var(--size-lg);
  font-weight: 400;
  color: var(--muted);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.hero-headline .line-2 {
  font-size: var(--size-lg);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  line-height: var(--leading-body);
  margin-bottom: var(--space-3);
}

.typewriter-word {
  color: var(--theme-color);
  border-right: 2px solid var(--theme-color);
  padding-right: 2px;
}

.hero-socials {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.hero-socials-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--card-bg);
  transition: border-color var(--transition-base), background var(--transition-base);
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--text);
}

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.hero-call-label {
  font-size: var(--size-sm);
  color: var(--theme-color);
  transition: color var(--transition-base);
}

.hero-call-label:hover {
  opacity: 0.75;
}

/* === ARTICLES === */

.articles {
  overflow: visible;
}

/* full viewport bleed while keeping section padding */
.articles-scroll {
  /* Near-full-width with a slight peek on mobile; much wider (capped) on
     tablet/desktop. Side padding centers the snapped card for symmetric peek. */
  --art-card-w: calc(100vw - 2 * var(--space-8));
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: var(--space-6);
  padding: 0 calc(50vw - var(--art-card-w) / 2) var(--space-6);
  scroll-padding-inline: calc(50vw - var(--art-card-w) / 2);
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

@media (min-width: 768px) {
  .articles-scroll {
    --art-card-w: min(600px, calc(100vw - var(--space-24)));
  }
}

.articles-scroll::-webkit-scrollbar {
  display: none;
}

.article-card {
  scroll-snap-align: center;
  flex-shrink: 0;
  width: var(--art-card-w);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow var(--transition-base);
  padding: 0 0 var(--space-5);
}

.article-card .article-card-date,
.article-card .article-card-title,
.article-card .article-card-subtitle,
.article-card .article-card-tags,
.article-card .article-card-desc {
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.article-card:hover {
  box-shadow: var(--shadow-md);
}

.article-card-date {
  font-size: var(--size-xs);
  color: var(--muted);
  letter-spacing: var(--tracking-wide);
  padding-top: var(--space-5);
  margin-bottom: var(--space-3);
  display: block;
}

/* View-count badge — baked into datelines/card meta, refreshed live by the
   beacon (article/post pages) or the batch read (homepage). Inherits the muted
   dateline colour; the whitespace keeps the eye glyph off the number. */
.view-count {
  white-space: nowrap;
}

.article-card-title {
  font-size: var(--size-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  letter-spacing: var(--tracking-wide);
  line-height: var(--leading-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.article-card-tags::-webkit-scrollbar { display: none; }

/* build.js wraps each language's pills in a <span data-tr>, so the flex gap
   would otherwise fall between the (hidden) language groups, not the pills.
   Collapsing the visible wrapper makes the pills the real flex children. */
.article-card-tags [data-tr]:not([hidden]),
.article-popup-tags [data-tr]:not([hidden]) {
  display: contents;
}

.article-card-subtitle {
  font-size: var(--size-sm);
  color: var(--muted);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-desc {
  font-size: var(--size-sm);
  color: var(--muted);
  line-height: var(--leading-body);
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* iOS-style dots */
.articles-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-4);
}

.articles-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background var(--transition-base), width var(--transition-base), opacity var(--transition-base);
  min-width: unset;
  min-height: unset;
}

.articles-dot.active {
  width: 20px;
  border-radius: 4px;
  background: var(--text);
  opacity: 1;
}

/* Current Engagements — same carousel mechanics as Articles, shorter cards */
.engagements {
  overflow: visible;
}

.engagement-card {
  flex-shrink: 0;
  width: min(300px, calc(100vw - 4rem));
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base);
}

.engagement-card.is-clickable {
  cursor: pointer;
}

.engagement-card.is-clickable:hover {
  box-shadow: var(--shadow-md);
}

.engagement-card-icon {
  width: var(--size-role-icon);
  height: var(--size-role-icon);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.engagement-card-body {
  flex: 1;
  min-width: 0;
}

.engagement-card-title {
  font-size: var(--size-base);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  line-height: var(--leading-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engagement-card-org {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engagement-card-desc {
  font-size: var(--size-sm);
  color: var(--muted);
  line-height: var(--leading-body);
  margin-top: var(--space-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Engagement popup — rendered inside the shared post-popup overlay */
.engagement-popup-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.engagement-popup-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.engagement-popup-meta {
  flex: 1;
  min-width: 0;
}

.engagement-popup-title {
  font-size: var(--size-lg);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

.engagement-popup-org {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-1);
}

.engagement-popup-body {
  margin-bottom: var(--space-6);
}

.engagement-popup-body p {
  font-size: var(--size-sm);
  color: var(--muted);
  line-height: var(--leading-body);
  margin-bottom: var(--space-4);
}

.engagement-popup-body p:last-child {
  margin-bottom: 0;
}

.engagement-popup-cta {
  display: inline-flex;
}

/* === WORK === */

.work-role {
  display: flex;
  gap: var(--space-4);
  cursor: pointer;
  position: relative;
  padding: var(--space-6) 0 0;
  align-items: flex-start;
}

.work-role:first-child {
  margin-top: 0;
  padding-top: 0;
}

.work-role:last-child {
  padding-bottom: var(--space-6);
}

.work-role:not(:last-child) .work-role-body {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-6);
}

/* vertical line through icon centers */
.work-role:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px;
  top: var(--size-role-icon);
  bottom: calc(-1 * var(--space-6));
  width: 3px;
  background: var(--border);
  z-index: 0;
}

.work-role-icon {
  width: var(--size-role-icon);
  height: var(--size-role-icon);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.work-role-body {
  flex: 1;
  min-width: 0;
  position: relative;
}

.work-role-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  user-select: none;
  padding-top: 4px;
  padding-right: 28px;
}

.work-role-info {
  flex: 1;
  min-width: 0;
}

.work-role-title {
  font-size: var(--size-base);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
}

.work-role-company {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-1);
}

/* A role that has its own site (e.g. Openly) links out from the company line */
.work-role-company a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}

.work-role-company a:hover {
  text-decoration-color: var(--theme-color);
}

.work-role-meta {
  font-size: var(--size-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.work-role-desc {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-2);
  padding-right: 0;
}

.expand-btn {
  position: absolute;
  top: 8px;
  right: 0;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: color var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expand-btn:hover {
  color: var(--text);
}

.expand-btn.open {
  color: var(--theme-color);
}

.expand-btn.open .expand-icon {
  transform: rotate(45deg);
}

.expand-icon {
  transition: transform 300ms ease;
}

/* smooth accordion */
.work-role-expand {
  overflow: hidden;
}

/* Collapsed: bullets take no space (the photos show as a thumbnail strip);
   open: full height + fade in. The panel's own height is animated in JS (FLIP). */
.work-role-bullets {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: var(--space-4);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 360ms ease;
}

.work-role.is-open .work-role-bullets {
  max-height: none;
  opacity: 1;
}

/* Collapsed: small square thumbnails in a row. Open: 4:3 photos stacked
   (mobile) — the same <img> elements morph between the two via FLIP. */
.work-role-media {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.work-role.is-open .work-role-media {
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.work-role-photo {
  width: 56px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  transform-origin: top left;
}

.work-role.is-open .work-role-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
}

.work-role-bullets li {
  font-size: var(--size-sm);
  color: var(--muted);
  position: relative;
  padding-left: var(--space-4);
}

.work-role-bullets li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--theme-color);
  font-size: 0.6rem;
  line-height: calc(var(--size-sm) * var(--leading-body));
}

/* === POSTS === */

.posts {
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
}


.marquee-row {
  display: flex;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  overflow: hidden;
  cursor: grab;
}

.marquee-row:last-child {
  margin-bottom: 0;
}

.marquee-track {
  display: flex;
  gap: var(--space-5);
  animation: marquee-left 40s linear infinite;
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.marquee-row.reverse .marquee-track {
  animation-name: marquee-right;
}

.marquee-row:hover .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes marquee-right {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

.post-card {
  width: 300px;
  flex-shrink: 0;
  cursor: pointer;
  transition: box-shadow var(--transition-base);
}

.post-card:hover {
  box-shadow: var(--shadow-md);
}

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.post-card-author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post-card-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  /* Transparent DP cutout — accent shows behind the silhouette, like the hero. */
  background: var(--theme-color);
}

.post-card-name {
  font-size: var(--size-xs);
  font-weight: 600;
  color: var(--text);
}

.post-card-timestamp {
  font-size: var(--size-xs);
  color: var(--muted);
  white-space: nowrap;
}

.post-card-body {
  font-size: var(--size-sm);
  color: var(--text);
  line-height: var(--leading-body);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === FEED (important shares — homepage #feed + /share/<slug>) === */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 640px;
}

.feed-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}

.feed-video-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* A 16:9 thumbnail that links out to YouTube — no iframe, no player script. */
.feed-video {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-bg);
}

.feed-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Styled like .btn-primary so the glyph stays legible over any thumbnail in
   both themes (--text / --bg are always opposite). */
.feed-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding-left: 4px;
  border-radius: var(--radius-full);
  background: var(--text);
  color: var(--bg);
  font-size: var(--size-lg);
  transition: transform var(--transition-base);
}

.feed-video:hover .feed-video-play {
  transform: translate(-50%, -50%) scale(1.08);
}

.feed-video-caption {
  font-size: var(--size-xs);
  color: var(--muted);
  line-height: var(--leading-body);
}

.feed-video-btn {
  align-self: flex-start;
}

.feed-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feed-card-pill {
  align-self: flex-start;
  font-size: var(--size-xs);
  font-weight: 600;
  color: var(--theme-color);
  background: rgba(var(--theme-color-rgb), 0.1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-1);
}

.feed-card-title {
  font-size: var(--size-lg);
  font-weight: 600;
  color: var(--text);
  line-height: var(--leading-tight);
}

.feed-card-take {
  font-size: var(--size-sm);
  color: var(--text);
  line-height: var(--leading-body);
}

.feed-card-meta {
  font-size: var(--size-xs);
  color: var(--muted);
}

.feed-card-readmore {
  align-self: flex-start;
  font-size: var(--size-sm);
  font-weight: 500;
  color: var(--theme-color);
  text-decoration: none;
}

.feed-card-readmore:hover {
  text-decoration: underline;
}

/* Dedicated /share/<slug> page: reuses .post-page-* chrome, extra spacing. */
.share-page-header .feed-card-pill {
  margin-bottom: var(--space-4);
}

.share-page-content .feed-video-figure {
  margin: var(--space-6) 0;
}

/* Post popup overlay */
.post-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.post-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.post-popup {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(8px);
  transition: transform var(--transition-slow);
}

.post-overlay.open .post-popup {
  transform: translateY(0);
}

.post-popup-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--muted);
  font-size: var(--size-xl);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-base);
}

.post-popup-close:hover {
  color: var(--text);
}

/* Article popup — full article rendered inside the shared post overlay */
.article-popup-dateline {
  font-size: var(--size-xs);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-3);
}

.article-popup-title {
  font-size: var(--size-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  margin-bottom: var(--space-3);
}

.article-popup-subtitle {
  font-size: var(--size-lg);
  color: var(--muted);
  line-height: var(--leading-body);
  margin-bottom: var(--space-4);
}

.article-popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

/* Popup body chrome; typography comes from the shared `.reading` rules. */
.article-popup-body {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
}

/* === SIDE PROJECTS === */

.side-projects-list {
  display: flex;
  flex-direction: column;
}

.side-project-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) 0;
}

.side-project-item:first-child {
  padding-top: 0;
}

.side-project-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.side-project-icon {
  width: var(--size-role-icon);
  height: var(--size-role-icon);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.side-project-body {
  flex: 1;
  min-width: 0;
}

.side-project-role {
  font-size: var(--size-base);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
}

.side-project-org {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-1);
}

.side-project-date {
  font-size: var(--size-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

.side-project-desc {
  font-size: var(--size-sm);
  color: var(--muted);
  margin-top: var(--space-2);
  line-height: var(--leading-body);
}

/* === SKILLS === */

.skills-category {
  margin-bottom: var(--space-6);
}

.skills-category-label {
  font-size: var(--size-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-3);
}

.skills-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* === RECOGNITIONS === */

.recognitions {
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  min-height: 72px;
}

.recognitions-track {
  display: flex;
  gap: var(--space-4);
  width: max-content;
  animation: marquee-left 24s linear infinite;
  will-change: transform;
}

.recognitions-track:hover {
  animation-play-state: paused;
}

.recognition-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: inherit;
}

.recognition-pill-icon {
  font-size: var(--size-base);
}

.recognition-pill-name {
  font-size: var(--size-sm);
  font-weight: 500;
  color: var(--text);
}

.recognition-pill-meta {
  font-size: var(--size-xs);
  color: var(--muted);
}

/* === WIDGET STATUS === */

/* hero-status is now the live widget (top of page) */
.hero-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--size-xs);
  color: var(--muted);
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-12);
}

.widget-last-updated {
  font-size: var(--size-xs);
  color: var(--muted);
  letter-spacing: var(--tracking-wider);
  margin-top: var(--space-8);
  opacity: 0.6;
}

/* === CONTACT === */

.contact {
  background: var(--card-bg);
  text-align: center;
  padding: var(--space-24) 0;
}

.contact-heading {
  font-size: var(--size-4xl);
  font-weight: 700;
  color: var(--text);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
}

.contact-body {
  color: var(--muted);
  font-size: var(--size-lg);
  line-height: var(--leading-body);
  margin-bottom: var(--space-10);
}

.contact-scroll-up {
  font-size: var(--size-xs);
  color: var(--muted);
  letter-spacing: var(--tracking-wider);
  transition: color var(--transition-base);
  display: block;
}

.contact-scroll-up:hover {
  color: var(--text);
}

/* === FAB === */

/* Scroll lock when FAB is open */
body.fab-open { overflow: hidden; touch-action: none; }

/* Dark blur overlay behind FAB speed-dial */
.fab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 798;
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  transition: opacity var(--transition-slow);
}

.fab-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* FAB button — theme-color pill */
.fab-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  height: 44px;
  min-width: 80px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
  background: var(--theme-color);
  color: var(--color-always-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.10);
  transition: background var(--transition-base), transform 150ms ease;
  white-space: nowrap;
}

.fab-btn-text {
  font-size: var(--size-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
}

.fab-btn:hover {
  filter: brightness(1.12);
}

/* Speed-dial nav stack — sits above the two-row control grid (which occupies
   ~98px above the FAB), so Awards lands nearest the controls and Top is highest. */
.fab-items {
  position: fixed;
  bottom: 196px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
  z-index: 799;
  pointer-events: none;
}

/* Each item is a compact pill: label + icon side by side */
.fab-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px 8px 16px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  transition: opacity 200ms ease, transform 200ms ease, background var(--transition-fast);
  pointer-events: none;
}

.fab-item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.fab-item:hover {
  background: var(--card-bg-hover, var(--border));
}

.fab-item-label {
  font-size: var(--size-sm);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: var(--tracking-wide);
}

.fab-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* === DARK MODE === */

[data-theme="dark"] .post-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* === MEDIA QUERIES === */

@media (max-width: 480px) {
  .hero-greeting {
    font-size: var(--size-2xl);
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .hero-greeting {
    font-size: var(--size-3xl);
  }
}

@media (min-width: 768px) {
  .recognitions-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-headline .line-2 {
    max-width: 36ch;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-socials {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .hero-socials-row {
    flex-shrink: 0;
  }

  /* Tablet/desktop: when open, the three role photos sit side by side as a
     3-up grid instead of stacking; the page column's max-width caps their size */
  .work-role.is-open .work-role-media {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Wider page column on large desktops so it doesn't read as a mobile layout */
@media (min-width: 1200px) {
  main {
    max-width: 1040px;
  }
}

@media (max-width: 767px) {
  main {
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
  }

  .recognitions-track {
    animation-name: marquee-left;
    animation-duration: 14s;
  }
}

@media print {
  .fab-btn,
  .fab-panel,
  .posts,
  .hero-socials,
  .hero-cta .btn-ghost {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  section {
    padding: 1.5rem 0;
    break-inside: avoid;
  }

  .page-wrapper {
    max-width: 100%;
    padding: 0;
  }
}


/* ==========================================================================
   SITE HEADER + SITE BAR — the reading pages' (/article, /post, /share)
   chrome: the main-site twin of the Facet pages' shell. A brand strip on
   top (gem chip + Gadey wordmark, nothing else — scrolls with the page,
   a divider beneath) and the floating
   pill navigation bar at the bottom — round menu button (left panel),
   segment links, round settings button (right panel). Markup from
   renderSiteHeader() in build.js; the slide-panel engine, gem and theme
   wiring ride the shared brand-assets block. z order: panels scrim 43,
   panels 44, bar 45 — the bar stays visible above an open panel as its
   close toggle (same law as the Facet tab bar).
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.site-header .brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.site-header .wordmark-slot {
  font-size: var(--size-lg);
  white-space: nowrap;
  color: var(--text);
}

/* --- the pill bar --- */

.site-bar {
  position: fixed;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.site-bar-btn,
.site-bar-set {
  background: color-mix(in srgb, var(--card-bg) 75%, transparent);
  -webkit-backdrop-filter: blur(8px) saturate(1.3);
  backdrop-filter: blur(8px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.site-bar-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition-base);
}

.site-bar-btn[aria-expanded="true"] { color: var(--theme-color); }

.site-bar-set {
  display: flex;
  align-items: center;
  padding: var(--space-1);
}

.site-bar-seg {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: var(--size-sm);
  font-weight: 500;
  transition: color var(--transition-base);
}

.site-bar-seg:hover { color: var(--text); }

.site-bar-seg[aria-current="true"] {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

/* --- the edge panels (left: navigation, right: settings) --- */

.site-panel-scrim { z-index: 43; }

/* the article column clears the floating pill bar */
body:has(.site-bar) main {
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

/* the pill's desktop-only slots (same convention as the library bar) */
.site-bar-brand,
.site-bar-action { display: none; }

/* wide screens: the bar pins to the TOP edge — brand in the pill's left,
   tabs centred, the download CTA on its right — and the in-flow header
   retires; the content clears the fixed bar */
@media (min-width: 640px) {
  .site-header { display: none; }
  .site-bar {
    top: 20px;
    bottom: auto;
    left: 20px;
    right: 20px;
    transform: none;
    justify-content: center;
  }
  .site-bar-set {
    flex: 1 1 auto;
    max-width: 48rem;
    justify-content: center;
  }
  .site-bar-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-right: auto;
    padding: 0 var(--space-3) 0 var(--space-1);
    white-space: nowrap;
  }
  .site-bar-action {
    display: inline-flex;
    margin-left: auto;
    border-radius: var(--radius-full);
  }
  body:has(.site-bar) main { padding-top: calc(20px + 84px); }
}

.site-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 44;
  width: min(80vw, 20rem);
  padding: var(--space-8) var(--space-4) var(--space-6);
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.site-panel-right {
  left: auto;
  right: 0;
  border-right: 0;
  border-left: 1px solid var(--border);
}

.site-panel[hidden] { display: none; }

.site-panel-label {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--size-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.site-panel-label:first-child { margin-top: 0; }

.site-panel-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-base);
}

.site-panel-row:hover { background: var(--card-bg); }

.site-panel-row svg { flex: none; color: var(--muted); }

.site-panel-row .row-value {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--size-sm);
}

.site-panel .btn-primary {
  display: flex;
  justify-content: center;
  margin-top: var(--space-4);
}

.site-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
}

.site-swatches button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
}

.site-swatches button[aria-pressed="true"] {
  outline: 2px solid var(--theme-color);
  outline-offset: 2px;
}

.site-swatches [data-accent=""] { background: var(--text); }


/* ==========================================================================
   READING PAGE — the one shared shell for /article, /post and /share.
   Deliberately plain: a narrow column of type on a calm surface, no byline,
   no author card, no tag rail. The Markdown body is rendered into `.reading`
   (shared with the homepage popups) so both places read identically.
   ========================================================================== */

.reading-page {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-16);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

[data-theme="light"] .reading-page {
  background: rgba(255, 255, 255, 0.90);
}

/* Top bar: home link + share */
.reading-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-10);
}

.reading-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--size-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.reading-back:hover { color: var(--text); }

.reading-share {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--size-sm);
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.reading-share:hover { color: var(--text); border-color: var(--text); }

/* Header: pill (share only) → title → subtitle → meta line */
.reading-head { margin-bottom: var(--space-8); }

.reading-pill { margin-bottom: var(--space-4); }

.reading-title {
  font-size: var(--size-3xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  margin-bottom: var(--space-3);
}

.reading-subtitle {
  font-size: var(--size-lg);
  color: var(--muted);
  line-height: var(--leading-body);
  font-weight: 400;
  margin-bottom: var(--space-4);
}

.reading-meta {
  font-size: var(--size-sm);
  color: var(--muted);
  font-weight: 500;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Footer back link */
.reading-foot {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  text-align: center;
}

.reading-foot a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--size-sm);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  background: var(--card-bg);
  transition: border-color var(--transition-fast);
}

.reading-foot a:hover { border-color: var(--text); }

/* --------------------------------------------------------------------------
   .reading — shared Markdown typography (dedicated pages + homepage popups).
   -------------------------------------------------------------------------- */
.reading {
  font-size: var(--size-base);
  line-height: 1.75;
  color: var(--text);
}

.reading > :first-child { margin-top: 0; }
.reading > :last-child { margin-bottom: 0; }

.reading p {
  margin: 0 0 var(--space-5);
}

.reading h2 {
  font-size: var(--size-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text);
  margin: var(--space-10) 0 var(--space-4);
}

.reading h3 {
  font-size: var(--size-lg);
  font-weight: 600;
  color: var(--text);
  margin: var(--space-8) 0 var(--space-3);
}

.reading ul,
.reading ol {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-6);
}

.reading ul { list-style: disc; }
.reading ol { list-style: decimal; }

.reading li {
  margin-bottom: var(--space-2);
}

/* Only style plain Markdown links; buttons/video links keep their own classes. */
.reading a:not([class]) {
  color: var(--theme-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reading strong { font-weight: 700; }

.reading code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: rgba(var(--theme-color-rgb), 0.1);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

.reading hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-10) 0;
}

.reading img { max-width: 100%; height: auto; display: block; }

/* Block quote: thin theme-coloured rule, quiet emphasis */
.reading-quote {
  margin: var(--space-8) 0;
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  border-left: 2px solid var(--theme-color);
  font-size: var(--size-lg);
  font-weight: 300;
  line-height: 1.4;
  color: var(--text);
}

/* Fenced code block */
.reading-code {
  margin: 0 0 var(--space-5);
  padding: var(--space-4);
  background: rgba(var(--theme-color-rgb), 0.08);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.reading-code code {
  background: none;
  padding: 0;
  font-size: var(--size-sm);
  line-height: 1.6;
}

/* Image figure */
.reading-figure {
  margin: var(--space-8) 0;
}

.reading-figure img { border-radius: var(--radius-lg); }

.reading-figure figcaption {
  margin-top: var(--space-2);
  font-size: var(--size-xs);
  color: var(--muted);
  line-height: var(--leading-body);
  text-align: center;
}

/* Video link-out inside a reading body */
.reading .feed-video-figure { margin: var(--space-8) 0; }

@media (max-width: 480px) {
  .reading-page { padding: var(--space-6) var(--space-4) var(--space-12); }
  .reading-title { font-size: var(--size-2xl); }
}

/* ==========================================================================
   GEM COLLECTION — a compact row of every gem.js gem at the page bottom.
   gem.js only renders/lights the stones; the row layout, the click-to-open
   behaviour and the gallery overlay below all live in script.js + this CSS.
   ========================================================================== */
.gem-collection {
  padding: var(--space-12) var(--space-8) var(--space-16);
  display: flex;
  justify-content: center;
}
.gem-collection-row {
  display: grid;
  grid-template-columns: repeat(6, auto); /* phones: 6 across → two rows of six */
  align-items: center;
  justify-items: center;
  justify-content: center;
  gap: clamp(var(--space-2), 3vw, var(--space-4));
}
@media (min-width: 768px) {
  .gem-collection-row { grid-template-columns: repeat(12, auto); } /* desktop: one row of twelve */
}
.gem-collection-gem {
  width: clamp(28px, 6vw, 40px);
  height: clamp(28px, 6vw, 40px);
  overflow: visible;                  /* let scintillation stars spill past the edge */
  cursor: zoom-in;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.18));
  transition: filter 0.15s ease;      /* no transform here — parallaxCtrl drives the transform */
}
.gem-collection-gem:hover { filter: drop-shadow(0 6px 11px rgba(0, 0, 0, 0.3)); }

/* ── Full-screen gem gallery (the click-to-expand carousel) ───────────────── */
.gem-gallery { position: fixed; inset: 0; z-index: 2000; font-family: var(--font); }
.gem-gallery[hidden] { display: none; }
.gem-gallery-backdrop {
  position: absolute; inset: 0; cursor: zoom-out; opacity: 0;
  background: radial-gradient(120% 120% at 50% 38%, rgba(20, 16, 10, 0.84), rgba(6, 5, 4, 0.96));
  transition: opacity 0.4s ease;
}
.gem-gallery.open .gem-gallery-backdrop { opacity: 1; }
.gem-gallery-shadow {
  position: absolute; left: 50%; top: 50%; width: min(70vmin, 470px); height: min(70vmin, 470px);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 72%);
  filter: blur(7px); opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
  transform: translate(-50%, -22%) scaleY(0.42);
}
.gem-gallery.open .gem-gallery-shadow { opacity: 1; }
.gem-gallery-track {
  position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none;
  opacity: 0; transform: scale(0.94); touch-action: pan-x; cursor: grab;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.22, 0.7, 0.3, 1);
}
.gem-gallery-track::-webkit-scrollbar { display: none; }
.gem-gallery.open .gem-gallery-track { opacity: 1; transform: scale(1); }
.gem-gallery-track.dragging { scroll-snap-type: none; cursor: grabbing; }
.gem-gallery-slide {
  flex: 0 0 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--space-4); scroll-snap-align: center;
}
.gem-gallery-stage {
  position: relative; width: min(76vmin, 500px); height: min(76vmin, 500px); overflow: visible;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.4));
}
.gem-gallery-stage > div { width: 100%; height: 100%; overflow: visible; }
.gem-gallery-cap {
  color: #e9e0cf; font-size: var(--size-sm); letter-spacing: 0.06em;
  text-transform: uppercase; font-weight: 700; opacity: 0.8;
}
.gem-gallery-close, .gem-gallery-nav {
  position: absolute; z-index: 3; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06); color: #fff; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.gem-gallery-close { top: max(14px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; font-size: 24px; }
.gem-gallery-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 26px; }
.gem-gallery-nav.prev { left: 10px; }
.gem-gallery-nav.next { right: 10px; }
.gem-gallery-parallax {
  position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 3;
  display: inline-flex; align-items: center; gap: 9px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07); color: #e9e0cf; border-radius: var(--radius-full);
  padding: 10px 16px; font-size: var(--size-sm); font-weight: 700; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: border-color 0.2s, color 0.2s;
}
.gem-gallery-parallax .gem-gallery-led { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transition: background 0.2s, box-shadow 0.2s; }
.gem-gallery-parallax.on { border-color: rgba(110, 230, 160, 0.55); color: #dff3e6; }
.gem-gallery-parallax.on .gem-gallery-led { background: #5fe6a0; box-shadow: 0 0 9px rgba(95, 230, 160, 0.9); }
.gem-gallery-parallax:not(.on) { animation: gem-gallery-pulse 1.6s ease-in-out infinite; }
@keyframes gem-gallery-pulse { 0%, 100% { opacity: 0.72; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .gem-gallery-backdrop, .gem-gallery-track { transition: none; }
  .gem-gallery-parallax { animation: none; }
}


/* === RÉSUMÉ PAGE (dedicated /resume page) ===
   A flat, printable, black-and-white document — a plain white A4 sheet on a soft
   grey desk. It reuses the site's component styles but re-defines the colour
   tokens (same pattern as the dark-mode block) under html[data-resume="simple"],
   which is hardcoded on the page, so the whole sheet is monochrome. */

.resume-body {
  background-color: var(--color-page-bg);
}

.resume-page {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: var(--space-12) auto;
  padding: var(--space-16) var(--space-16) var(--space-12);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Simple (default) mode — plain white paper on a grey desk, no accent. */
html[data-resume="simple"] {
  --bg: #FFFFFF;
  --text: #111111;
  --muted: rgba(17, 17, 17, 0.5);
  --border: rgba(17, 17, 17, 0.1);
  --card-bg: #FFFFFF;
  --pill-bg: #F4F3EF;
  --pill-border: rgba(17, 17, 17, 0.1);
  --shadow: rgba(0, 0, 0, 0.08);
  --theme-color: #111111;
  --theme-color-rgb: 17, 17, 17;
  --color-page-bg: #E7E6E1;
}

/* --- header --- */
.resume-header {
  margin-bottom: var(--space-2);
}

.resume-name {
  font-size: var(--size-4xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
}

.resume-title {
  margin-top: var(--space-2);
  font-size: var(--size-lg);
  font-weight: 500;
  color: var(--theme-color);
}

.resume-headline {
  max-width: 64ch;
  margin-top: var(--space-5);
  font-size: var(--size-base);
  color: var(--muted);
  line-height: var(--leading-body);
}

.resume-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.resume-contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.resume-contact-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--size-sm);
  color: var(--text);
  transition: color var(--transition-fast);
}

.resume-contact-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

.resume-contact-item:hover {
  color: var(--theme-color);
}

.resume-contact-item:hover svg {
  color: var(--theme-color);
}

/* Understated outline button — inverts on hover; quieter than btn-primary. */
.resume-download {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--size-sm);
  color: var(--text);
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.resume-download svg {
  color: var(--muted);
}

.resume-download:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.resume-download:hover svg {
  color: var(--bg);
}

/* --- sections & entries --- */
.resume-section {
  margin-top: var(--space-10);
}

.resume-section-heading {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--size-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--theme-color);
}

.resume-entry {
  margin-bottom: var(--space-8);
  break-inside: avoid;
}

.resume-entry:last-child {
  margin-bottom: 0;
}

.resume-entry--compact {
  margin-bottom: var(--space-6);
}

.resume-entry-head {
  margin-bottom: var(--space-2);
}

.resume-entry-title {
  font-size: var(--size-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.resume-entry-org {
  font-size: var(--size-sm);
  font-weight: 500;
  color: var(--text);
}

.resume-entry-meta {
  margin-top: 2px;
  font-size: var(--size-xs);
  color: var(--muted);
}

.resume-entry-desc {
  margin-top: var(--space-2);
  font-size: var(--size-sm);
  color: var(--muted);
}

.resume-entry-bullets {
  margin-top: var(--space-3);
}

.resume-entry-bullets li {
  position: relative;
  margin-bottom: var(--space-2);
  padding-left: var(--space-4);
  font-size: var(--size-sm);
  color: var(--text);
  line-height: 1.55;
}

.resume-entry-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--theme-color);
}

/* --- skills --- */
.resume-skills-group {
  margin-bottom: var(--space-5);
}

.resume-skills-group:last-child {
  margin-bottom: 0;
}

.resume-skills-label {
  margin-bottom: var(--space-2);
  font-size: var(--size-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--muted);
}

.resume-skills-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --- awards --- */
.resume-awards-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.resume-award {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

.resume-award-name {
  font-size: var(--size-sm);
  font-weight: 500;
  color: var(--text);
}

.resume-award-meta {
  font-size: var(--size-xs);
  color: var(--muted);
}

/* --- footer --- */
.resume-footer {
  margin-top: var(--space-12);
}

.resume-back-link {
  font-size: var(--size-sm);
  color: var(--muted);
  transition: color var(--transition-fast);
}

.resume-back-link:hover {
  color: var(--text);
}

/* --- responsive --- */
@media (max-width: 640px) {
  .resume-page {
    margin: 0;
    padding: var(--space-12) var(--space-5) var(--space-8);
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  html[data-resume="simple"] .resume-body {
    background-color: var(--card-bg);
  }

  .resume-name {
    font-size: var(--size-3xl);
  }
}

/* --- print: drop the chrome, flatten the sheet to the page --- */
@media print {
  .resume-footer {
    display: none;
  }

  .resume-page {
    margin: 0;
    max-width: 100%;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--color-always-white);
  }
}
