:root {
  --primary: #7a2e1e;
  --secondary: #786650;
  --accent: #d8cbb3;
  --dark: #221a17;
  --text: #3b322d;
  --background: #e4dccd;
  --card: #f4eee1;
  --hover: #5c1f1f;
  --line: rgba(55, 42, 34, 0.18);
  --shadow: 0 24px 70px rgba(47, 36, 29, 0.16);
  --paper: #f1eadb;
  --paper-deep: #dfd3bf;
  --paper-edge: rgba(70, 52, 39, 0.22);
  --ink: #1a1108;
  --ink-soft: rgba(26, 17, 8, 0.74);
  --verdigris: #506b63;
  --palette-mid: #a8957b;
  --palette-soft: #d2c2a8;
  --palette-stone: #c9c2b3;
  --radius: 8px;
  --max: 900px;
}

/* F1: Dark mode */
html[data-theme="dark"] {
  --primary: #e0b36f;
  --secondary: #c8975d;
  --accent: #473526;
  --dark: #f6e7c7;
  --text: #dfcdb0;
  --background: #0f0c09;
  --card: #241912;
  --hover: #f0ca8a;
  --line: rgba(239, 213, 168, 0.18);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  --paper: #241912;
  --paper-deep: #1a120d;
  --paper-edge: rgba(230, 184, 114, 0.16);
  --ink: #f6e7c7;
  --ink-soft: rgba(223, 205, 176, 0.76);
  --verdigris: #8fb1a5;
  --palette-mid: #8c6b43;
  --palette-soft: #5f4930;
  --palette-stone: #3d3428;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 16px;
  font-variant-ligatures: common-ligatures discretionary-ligatures;
  font-variant-numeric: oldstyle-nums;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -4rem, rgba(255, 252, 239, 0.78), transparent 24rem),
    radial-gradient(circle at 88% 8rem, rgba(80, 107, 99, 0.11), transparent 26rem),
    radial-gradient(circle at 50% 48%, rgba(114, 91, 65, 0.08), transparent 34rem),
    linear-gradient(180deg, #d4c8b5, var(--background) 18rem, #d8cebd);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 18% 0, rgba(89, 65, 38, 0.38), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(62, 91, 82, 0.16), transparent 26rem),
    linear-gradient(180deg, #0e0a08, var(--background) 18rem, #0b0807);
}

body::after {
  content: "";
  position: fixed;
  inset: clamp(0.35rem, 1.5vw, 1rem);
  z-index: 0;
  pointer-events: none;
  border: 1px solid var(--paper-edge);
  border-radius: 10px 16px 12px 14px;
  box-shadow:
    inset 0 0 54px rgba(58, 43, 31, 0.1),
    inset 0 0 3px rgba(255, 255, 255, 0.42),
    0 28px 90px rgba(47, 36, 29, 0.16);
}

main,
.footer {
  position: relative;
  z-index: 1;
}

::selection {
  background: rgba(122, 46, 30, 0.18);
  color: #1a1108;
}

/* C7: Parchment scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--palette-mid) var(--paper-deep);
  scroll-behavior: smooth;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--paper-deep); }
::-webkit-scrollbar-thumb { background: var(--palette-mid); border-radius: 4px; }

/* Paper fibre texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.24;
  mix-blend-mode: multiply;
  background-image:
    linear-gradient(96deg, rgba(58, 43, 31, 0.045) 0 1px, transparent 1px 31px),
    linear-gradient(3deg, transparent 0 47%, rgba(70, 52, 39, 0.035) 48% 49%, transparent 51% 100%),
    radial-gradient(circle at 18% 22%, rgba(72, 48, 32, 0.08), transparent 9rem),
    radial-gradient(circle at 82% 68%, rgba(72, 48, 32, 0.06), transparent 12rem),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='0.65' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 46px 46px, 100% 22px, 100% 100%, 100% 100%, 256px 256px;
}

html[data-theme="dark"] body::before {
  opacity: 0.06;
  mix-blend-mode: screen;
}

body.is-translating main {
  opacity: 0.38;
  transform: translateY(4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

.project-body a:not(.btn),
main p a,
.pullquote a {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(122, 46, 30, 0.5);
}

button, input, textarea, select { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(126, 82, 55, 0.42);
  outline-offset: 4px;
}

html[data-theme="dark"] :focus-visible {
  outline-color: rgba(200, 173, 153, 0.6);
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--dark);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.skip-link:focus { top: 1rem; }

html[data-theme="dark"] .skip-link {
  background: var(--primary);
  color: #1A1412;
}

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

/* E14: Scroll progress bar */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  z-index: 11;
  width: 0%;
  transition: width 50ms linear;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(241, 234, 219, 0.78);
  backdrop-filter: blur(16px) saturate(0.9);
  border-bottom: 1px solid rgba(74, 45, 27, 0.14);
  transition: box-shadow 220ms ease, background 220ms ease;
}

.site-header::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(to bottom, rgba(55, 42, 34, 0.07), transparent);
  pointer-events: none;
}

html[data-theme="dark"] .site-header {
  background: rgba(19, 14, 11, 0.84);
  border-bottom-color: rgba(239, 213, 168, 0.1);
}

.site-header.is-scrolled {
  background: rgba(241, 234, 219, 0.94);
  box-shadow: 0 14px 34px rgba(55, 34, 18, 0.12);
}

html[data-theme="dark"] .site-header.is-scrolled {
  background: rgba(26, 20, 18, 0.95);
}

.nav {
  width: min(var(--max), calc(100% - 4rem));
  min-height: 66px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(1rem, 1.6vw, 1.28rem);
  font-weight: 700;
  color: var(--dark);
  letter-spacing: 0.02em;
}

.brand span { color: var(--primary); margin-left: 0.18rem; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-menu a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.62rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink-soft);
  transition: background 180ms ease, color 180ms ease;
}

html[data-theme="dark"] .nav-menu a {
  color: rgba(232, 223, 214, 0.78);
}

.nav-menu a:hover,
.nav-menu a[aria-current="page"] {
  background: rgba(89, 53, 43, 0.1);
  color: var(--dark);
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.language-switcher button {
  min-height: 34px;
  min-width: 36px;
  border: 1px solid var(--line);
  background: rgba(244, 238, 225, 0.72);
  color: var(--dark);
  border-radius: 999px;
  padding: 0 0.55rem;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

html[data-theme="dark"] .language-switcher button {
  background: rgba(42, 33, 28, 0.72);
  border-color: rgba(232, 223, 214, 0.13);
}

.language-switcher button:hover {
  background: rgba(89, 53, 43, 0.1);
  border-color: rgba(126, 82, 55, 0.32);
  color: var(--dark);
}

html[data-theme="dark"] .language-switcher button:hover {
  background: rgba(200, 173, 153, 0.2);
  border-color: rgba(200, 173, 153, 0.35);
}

/* F1: Dark mode toggle */
.dark-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(244, 238, 225, 0.72);
  color: var(--dark);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
  padding: 0;
}

.dark-toggle:hover {
  background: rgba(89, 53, 43, 0.1);
  border-color: rgba(126, 82, 55, 0.32);
}

html[data-theme="dark"] .dark-toggle:hover {
  background: rgba(200, 173, 153, 0.2);
  border-color: rgba(200, 173, 153, 0.35);
}

.dark-toggle .icon-sun { display: none; }

html[data-theme="dark"] .dark-toggle .icon-moon { display: none; }
html[data-theme="dark"] .dark-toggle .icon-sun { display: block; }

html[data-theme="dark"] .dark-toggle {
  background: rgba(42, 33, 28, 0.72);
  border-color: rgba(232, 223, 214, 0.13);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
}

.section-pad {
  width: min(var(--max), calc(100% - 4rem));
  margin: 0 auto;
  padding: clamp(2.4rem, 4.8vw, 4.4rem) 0;
}

.hero {
  min-height: min(720px, calc(100svh - 66px));
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(280px, 0.82fr);
  align-items: center;
  gap: clamp(1.8rem, 5vw, 4.4rem);
  padding-top: 2rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--primary);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  font-size: 0.92rem;
  font-weight: 700;
}

html[data-theme="dark"] .eyebrow {
  color: var(--primary);
}

h1, h2, h3 {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  color: var(--dark);
  line-height: 1.08;
  margin: 0;
  letter-spacing: 0;
}

h3 {
  font-family: "Playfair Display", Georgia, serif;
}

h1,
h2,
h3,
.brand,
.pullquote p,
.stat-value {
  text-shadow: 0 1px 1px rgba(255, 245, 220, 0.6), 0 -1px 1px rgba(30, 20, 10, 0.18);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] .brand,
html[data-theme="dark"] .pullquote p,
html[data-theme="dark"] .stat-value {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(0, 0, 0, 0.3);
}

h1 {
  font-size: clamp(2.15rem, 4.8vw, 3.8rem);
  font-kerning: normal;
  letter-spacing: -0.01em;
}
h2 { font-size: clamp(1.45rem, 2.8vw, 2.35rem); max-width: 720px; }
h3 { font-size: 1.04rem; }

.hero-title {
  margin: 1rem 0 0;
  font-size: clamp(0.98rem, 1.25vw, 1.08rem);
  color: var(--dark);
  font-weight: 800;
}

.hero-text,
.page-hero p {
  max-width: 640px;
  font-size: clamp(0.95rem, 1.1vw, 1rem);
}

.hero-text::first-letter {
  float: left;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 3.4em;
  font-weight: 600;
  line-height: 0.72;
  padding-right: 0.08em;
  margin-top: 0.1em;
  color: var(--primary);
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* E12: Ripple effect */
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0 1rem;
  font-weight: 800;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.btn.primary {
  color: #fff8e9;
  background: var(--primary);
  box-shadow: 0 14px 28px rgba(63, 36, 30, 0.22);
}

.btn.primary:hover { background: var(--hover); }

html[data-theme="dark"] .btn.primary {
  background: var(--primary);
  color: #1A1412;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .btn.primary:hover {
  background: var(--hover);
  color: #1A1412;
}

.btn.secondary {
  color: var(--dark);
  border-color: var(--line);
  background: rgba(244, 238, 225, 0.76);
}

html[data-theme="dark"] .btn.secondary {
  border-color: rgba(232, 223, 214, 0.2);
  background: rgba(42, 33, 28, 0.78);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: ripple-expand 600ms ease-out;
  pointer-events: none;
}

@keyframes ripple-expand { to { transform: scale(4); opacity: 0; } }

/* E3: Hero split entry */
.hero-copy {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.hero-visual {
  position: relative;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 700ms ease 150ms, transform 700ms ease 150ms;
}

.hero-copy.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.hero-visual.is-visible {
  opacity: 1;
  transform: translateX(0);
}


/* E4: Typing cursor */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: var(--primary);
  margin-left: 2px;
  animation: blink 0.7s step-end infinite;
  vertical-align: baseline;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.intro-band {
  border-top: none;
  border-bottom: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 250, 0.22), transparent);
  position: relative;
}

.intro-band::before,
.stats-band::before {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin-bottom: 0.5rem;
}

.intro-band::after,
.stats-band::after {
  content: "✦";
  display: block;
  text-align: center;
  color: var(--primary);
  opacity: 0.45;
  font-size: 0.8rem;
  margin-top: -0.5rem;
  letter-spacing: 0.3em;
}

.section-divider-ornament {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  color: var(--primary);
  opacity: 0.5;
}

.section-divider-ornament::before,
.section-divider-ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 600ms ease;
}

.section-divider-ornament.is-visible::before,
.section-divider-ornament.is-visible::after {
  transform: scaleX(1);
}

.section-heading { margin-bottom: clamp(1.4rem, 3vw, 2.25rem); }

.feature-grid,
.education-grid,
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card,
.education-card,
.project-card {
  background:
    linear-gradient(145deg, rgba(255, 253, 246, 0.72), rgba(222, 211, 191, 0.48)),
    var(--card);
  border: 1px solid rgba(55, 42, 34, 0.14);
  border-radius: 4px 12px 6px 10px;
  box-shadow:
    0 16px 40px rgba(47, 36, 29, 0.09),
    inset 0 0 22px rgba(61, 45, 33, 0.045);
  position: relative;
  overflow: hidden;
}

.feature-card::before,
.education-card::before,
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 11px,
    rgba(74, 52, 39, 0.04) 11px,
    rgba(74, 52, 39, 0.04) 12px
  );
  z-index: 0;
}

html[data-theme="dark"] .feature-card::before,
html[data-theme="dark"] .education-card::before,
html[data-theme="dark"] .project-card::before {
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 11px,
    rgba(200, 180, 140, 0.03) 11px,
    rgba(200, 180, 140, 0.03) 12px
  );
}

html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .education-card,
html[data-theme="dark"] .project-card {
  background: rgba(42, 33, 28, 0.84);
  border-color: rgba(232, 223, 214, 0.09);
}

/* E1: Stagger feature cards */
.feature-card,
.education-card {
  padding: 1.1rem;
  opacity: 0;
  transform: translateY(22px);
  isolation: isolate;
}

.feature-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 500ms ease, transform 500ms ease;
}

.feature-card:nth-child(2).is-visible { transition-delay: 100ms; }
.feature-card:nth-child(3).is-visible { transition-delay: 200ms; }
.feature-card:nth-child(4).is-visible { transition-delay: 300ms; }

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(89, 53, 43, 0.09);
  color: var(--primary);
  font-weight: 900;
  margin-bottom: 0.8rem;
}

.feature-icon--roman {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  font-weight: 600;
  width: auto;
  min-width: 36px;
  padding: 0 0.3rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  max-width: 100%;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 2rem;
  bottom: 2rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, transparent, var(--palette-mid) 15%, var(--palette-mid) 85%, transparent);
  pointer-events: none;
}

.timeline .timeline-column:first-child {
  padding-right: clamp(1rem, 2.5vw, 2rem);
}

.timeline .timeline-column:last-child {
  padding-left: clamp(1rem, 2.5vw, 2rem);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 0.8rem;
}

/* E9: Timeline progress - base line */
.timeline-list::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

/* E9: Timeline progress - animated overlay */
.timeline-list::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 0;
  width: 2px;
  height: var(--progress, 0%);
  background: linear-gradient(var(--primary), rgba(80, 109, 100, 0.38));
  transition: height 100ms linear;
  z-index: 1;
}

.timeline-item {
  position: relative;
  padding-left: 2.4rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.55rem;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(200, 173, 153, 0.32);
}

html[data-theme="dark"] .timeline-item::before {
  box-shadow: 0 0 0 6px rgba(200, 173, 153, 0.15);
}

.timeline-content {
  padding: 1rem;
  background:
    linear-gradient(145deg, rgba(255, 253, 246, 0.58), rgba(222, 211, 191, 0.36)),
    rgba(244, 238, 225, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px 10px 8px 6px;
}

html[data-theme="dark"] .timeline-content {
  background: rgba(42, 33, 28, 0.74);
}

.timeline-column {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  height: 100%;
}

.timeline-column > h3 {
  padding-left: 2.4rem;
  font-family: "Inter", "Source Sans Pro", Arial, sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-left: 2.4rem;
  margin-top: 0.3rem;
}

.timeline-cta {
  justify-self: start;
}

.timeline-year {
  color: var(--primary);
  font-weight: 700;
  font-style: italic;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.95rem;
}

.timeline-ordinal {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
  margin-right: 0.35em;
  opacity: 0.7;
}

.timeline-item--notarial .timeline-content {
  padding-left: 1.2rem;
  text-indent: 0;
}

.timeline-item--notarial h3 {
  margin-top: 0.25rem;
  font-size: 0.97rem;
}

.timeline-item--notarial p {
  text-indent: 1.5em;
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 2.5rem;
}

.skill-index-col {
  list-style: none;
  margin: 0;
  padding: 0;
}

.skill-index-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.3rem 0;
  border-bottom: 1px dotted rgba(55, 42, 34, 0.12);
  font-size: 0.92rem;
}

.skill-name {
  white-space: nowrap;
  color: var(--dark);
  font-weight: 500;
}

.skill-dots {
  flex: 1;
  border-bottom: 1px dotted rgba(55, 42, 34, 0.25);
  margin: 0 0.3rem;
  min-width: 1rem;
  align-self: flex-end;
  margin-bottom: 4px;
}

.skill-level {
  white-space: nowrap;
  color: var(--verdigris);
  font-size: 0.72rem;
  letter-spacing: -0.05em;
}

html[data-theme="dark"] .skill-index-row {
  border-bottom-color: rgba(232, 223, 214, 0.1);
}

html[data-theme="dark"] .skill-dots {
  border-bottom-color: rgba(232, 223, 214, 0.2);
}

@media (max-width: 620px) {
  .skills { grid-template-columns: 1fr; }
}

/* Keep old .skill class for any fallback */

/* E10: Skill glow hover */
.skill {
  padding: 0.55rem 0.82rem;
  border: 1px solid rgba(164, 125, 100, 0.3);
  border-radius: 999px;
  background: rgba(244, 238, 225, 0.74);
  color: var(--dark);
  font-weight: 800;
  animation: floaty 5s ease-in-out infinite;
  transition: box-shadow 300ms ease, transform 300ms ease;
}

html[data-theme="dark"] .skill {
  border-color: rgba(200, 173, 153, 0.3);
  background: rgba(42, 33, 28, 0.78);
}

.skill:nth-child(2n) { animation-delay: 0.7s; }
.skill:nth-child(3n) { animation-delay: 1.1s; }

.skill:hover {
  box-shadow: 0 0 16px rgba(89, 53, 43, 0.18);
  transform: translateY(-5px);
}

html[data-theme="dark"] .skill:hover {
  box-shadow: 0 0 18px rgba(200, 173, 153, 0.3);
}

.page-hero {
  padding-top: clamp(3rem, 5.5vw, 4.6rem);
  padding-bottom: clamp(1.3rem, 3vw, 2.2rem);
}

.page-hero h1 { font-size: clamp(1.95rem, 4.2vw, 3.35rem); max-width: 760px; }

.filter-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-btn {
  border: 1px solid var(--line);
  background: rgba(244, 238, 225, 0.76);
  color: var(--dark);
  min-height: 36px;
  padding: 0 0.82rem;
  border-radius: 999px;
  font-weight: 750;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

html[data-theme="dark"] .filter-btn {
  background: rgba(42, 33, 28, 0.78);
  border-color: rgba(232, 223, 214, 0.13);
  color: var(--text);
}

.filter-btn:hover {
  background: var(--ink);
  color: #fff8e9;
  transform: translateY(-1px);
}

.filter-btn.is-active {
  background: var(--verdigris);
  color: #fff;
  border-color: var(--verdigris);
  transform: translateY(-1px);
}

html[data-theme="dark"] .filter-btn:hover {
  background: var(--dark);
  color: var(--background);
}

html[data-theme="dark"] .filter-btn.is-active {
  background: var(--verdigris);
  color: #fff;
  border-color: var(--verdigris);
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Project card animations + ink-blot hover (F3) */
.project-card {
  transform-origin: center;
  transform-style: preserve-3d;
  perspective: 800px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 350ms ease, transform 350ms ease, box-shadow 200ms ease;
}

.project-card::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  padding-top: 200%;
  background: rgba(122, 46, 30, 0.055);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 480ms ease;
  pointer-events: none;
  z-index: 0;
}

.project-card:hover::after {
  transform: translate(-50%, -50%) scale(1);
}

.project-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.project-card.is-hidden {
  opacity: 0;
  transform: scale(0.92) translateY(10px);
  pointer-events: none;
  position: absolute;
}

.project-body { padding: 1rem; position: relative; z-index: 1; }

.card-source {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 30px;
  margin-bottom: 0.7rem;
  padding: 0.28rem 0.62rem 0.28rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(216, 203, 179, 0.54);
  color: var(--dark);
  font-size: 0.76rem;
  font-weight: 800;
}

html[data-theme="dark"] .card-source {
  background: rgba(42, 33, 28, 0.74);
  border-color: rgba(232, 223, 214, 0.12);
}

.source-logo {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--card);
  object-fit: contain;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--primary);
  font-weight: 900;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* F4: Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-badge--active {
  background: rgba(76, 143, 76, 0.15);
  color: #3D7A3D;
}

.status-badge--completed {
  background: rgba(140, 140, 140, 0.15);
  color: #6B6B6B;
}

html[data-theme="dark"] .status-badge--active {
  background: rgba(76, 175, 76, 0.2);
  color: #7BC67B;
}

html[data-theme="dark"] .status-badge--completed {
  background: rgba(180, 180, 180, 0.15);
  color: #A0A0A0;
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 1rem;
}

.tech-list span {
  background: rgba(80, 107, 99, 0.13);
  color: var(--verdigris);
  border: 1px solid rgba(80, 107, 99, 0.22);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 600;
  position: relative;
}

html[data-theme="dark"] .tech-list span {
  color: var(--verdigris);
  border-color: rgba(143, 177, 165, 0.25);
}

.tech-list span[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px 6px 5px 3px;
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  z-index: 10;
}

.tech-list span[data-tooltip]:hover::after {
  opacity: 1;
}

.project-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }

/* G6: Bibliographic publication list */
.bib-list {
  max-width: 720px;
}

.bib-entry {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.bib-entry:last-child { border-bottom: none; }

.bib-ref {
  margin: 0 0 0.5rem;
  line-height: 1.55;
  max-width: 65ch;
}

.bib-title {
  font-style: italic;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
}

a.bib-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(122, 46, 30, 0.4);
}

a.bib-title:hover {
  color: var(--primary);
}

.bib-source {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.bib-entry.is-hidden {
  display: none;
}

.project-actions .btn { min-height: 36px; padding: 0 0.82rem; font-size: 0.88rem; }

.pullquote {
  position: relative;
  margin: 0;
  padding: 0 0 0 clamp(2rem, 4vw, 3.5rem);
  max-width: 720px;
}

.pullquote-mark {
  position: absolute;
  left: 0;
  top: -0.25em;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(3.5rem, 7vw, 5.5rem);
  line-height: 1;
  color: var(--primary);
  opacity: 0.4;
}

.pullquote p {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  line-height: 1.5;
  color: var(--dark);
  font-weight: 600;
  font-style: italic;
  margin: 0;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: clamp(1.2rem, 2.5vw, 1.6rem);
  border: 1px solid rgba(74, 45, 27, 0.16);
  border-radius: 4px 12px 6px 10px;
  background:
    linear-gradient(145deg, rgba(255, 253, 246, 0.72), rgba(222, 211, 191, 0.48)),
    var(--card);
  box-shadow: 0 16px 40px rgba(47, 36, 29, 0.09);
  transition: transform 250ms ease, box-shadow 250ms ease;
}

.contact-card--orcid .contact-card-icon {
  background: #8B1A1A;
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  box-shadow: 0 4px 14px rgba(139, 26, 26, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .contact-card {
  background: rgba(42, 33, 28, 0.84);
  border-color: rgba(232, 223, 214, 0.09);
}

.contact-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(80, 109, 100, 0.14);
  color: var(--primary);
  flex-shrink: 0;
}

.contact-card-label {
  font-weight: 900;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
}

.contact-card-value {
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}

.contact-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.4rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  transition: gap 180ms ease;
}

.contact-card:hover .contact-card-cta {
  gap: 0.6rem;
}

.contact-card-cta svg {
  width: 14px;
  height: 14px;
}


/* F14: Enriched footer */
.footer {
  width: min(var(--max), calc(100% - 4rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: rgba(74, 58, 53, 0.72);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col .brand { margin-bottom: 0.5rem; }

.footer-heading {
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.footer-nav a,
.footer-contact a {
  display: block;
  padding: 0.2rem 0;
  color: rgba(74, 58, 53, 0.72);
  font-size: 0.92rem;
  transition: color 180ms ease;
}

.footer-nav a:hover,
.footer-contact a:hover {
  color: var(--dark);
}

html[data-theme="dark"] .footer {
  color: rgba(212, 200, 188, 0.72);
}

html[data-theme="dark"] .footer-nav a,
html[data-theme="dark"] .footer-contact a {
  color: rgba(212, 200, 188, 0.72);
}

html[data-theme="dark"] .footer-nav a:hover,
html[data-theme="dark"] .footer-contact a:hover {
  color: var(--dark);
}

.footer-monogram {
  color: var(--primary);
  opacity: 0.5;
  margin-top: 0.5rem;
}

.footer-colophon {
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-variant-caps: all-small-caps;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  color: rgba(74, 58, 53, 0.45);
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

html[data-theme="dark"] .footer-colophon {
  color: rgba(212, 200, 188, 0.4);
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: rgba(74, 58, 53, 0.52);
  font-size: 0.88rem;
}

html[data-theme="dark"] .footer-bottom {
  color: rgba(212, 200, 188, 0.45);
}

/* F11: Stats band */
.stats-band {
  position: relative;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  text-align: center;
}

.stat-item { padding: 1.2rem 0.5rem; }

.stat-value {
  font-family: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.stat-suffix { font-size: 0.7em; }

.stat-label {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* F10: Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(52, 38, 31, 0.12);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease, background 180ms ease;
  z-index: 30;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary);
  color: #fff;
}

html[data-theme="dark"] .back-to-top {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .back-to-top:hover {
  background: var(--primary);
  color: #1A1412;
}

/* F5: Page transition — slide from right */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--paper);
  transform: translateX(100%);
  pointer-events: none;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page-transition.is-active {
  transform: translateX(0);
  pointer-events: auto;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(0.5px);
  transition: opacity 680ms ease, transform 680ms ease, filter 680ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { filter: none !important; }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* H3: Lang switch ink flash */
@keyframes ink-flash {
  0% { color: var(--primary); }
  30% { color: var(--ink); opacity: 1; }
  100% { color: var(--primary); }
}

.language-switcher button.lang-flash {
  animation: ink-flash 400ms ease forwards;
}

/* H5: Folio position indicator */
.folio-indicator {
  position: fixed;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  writing-mode: vertical-rl;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 0.72rem;
  color: var(--palette-mid);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
  letter-spacing: 0.06em;
}

.folio-indicator.is-visible {
  opacity: 0.6;
}

@media (max-width: 900px) {
  .folio-indicator { display: none; }
}

/* H6: Engraving frame on profile photo */
.hero-visual img {
  width: min(100%, 410px);
  margin-left: auto;
  border: none;
  border-radius: 18px 28px 20px 24px;
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(74, 45, 27, 0.18),
    0 0 0 6px rgba(240, 230, 210, 0.9),
    0 0 0 7px rgba(74, 45, 27, 0.12),
    0 0 0 13px rgba(240, 230, 210, 0.6),
    0 0 0 14px rgba(74, 45, 27, 0.08);
  transform: translateY(var(--parallax, 0));
  transition: transform 140ms linear;
}

html[data-theme="dark"] .hero-visual img {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(200, 173, 153, 0.2),
    0 0 0 6px rgba(36, 25, 18, 0.9),
    0 0 0 7px rgba(200, 173, 153, 0.15),
    0 0 0 13px rgba(36, 25, 18, 0.7),
    0 0 0 14px rgba(200, 173, 153, 0.08);
}

/* H7: Errata notice */
.content-notice {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: min(680px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.75rem 1rem 0.75rem 1.2rem;
  border-left: 3px solid var(--primary);
  border-radius: 0 4px 4px 0;
  background: rgba(244, 238, 225, 0.97);
  box-shadow: 0 18px 45px rgba(52, 38, 31, 0.18);
  color: var(--primary);
  font-size: 0.88rem;
  font-style: italic;
  font-family: "EB Garamond", Georgia, serif;
}

.content-notice::before {
  content: "* Errata: ";
  font-weight: 700;
  font-style: normal;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
}

html[data-theme="dark"] .content-notice {
  background: rgba(36, 25, 18, 0.97);
  border-left-color: var(--primary);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

/* G2: 65ch paragraph measure */
.project-body p,
.timeline-content p,
.hero-text,
.pullquote p {
  max-width: 65ch;
}

/* A7: Text indent on project/timeline paragraphs */
.project-body p + p,
.timeline-content p + p {
  text-indent: 1.5em;
  margin-top: 0;
}

/* Print media query (H2) */
@media print {
  .site-header,
  .footer,
  .back-to-top,
  .scroll-progress-bar,
  .folio-indicator,
  .page-transition,
  .dark-toggle,
  .language-switcher,
  .nav-toggle,
  .hero-actions,
  .filter-bar,
  .project-actions,
  .content-notice {
    display: none !important;
  }

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

  body::before,
  body::after {
    display: none !important;
  }

  h1, h2, h3 { color: #000 !important; text-shadow: none !important; }
  .feature-card, .project-card, .education-card, .timeline-content {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    break-inside: avoid;
  }

  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
}

/* E7: Custom nib cursor (desktop only) */
@media (pointer: fine) and (min-width: 901px) {
  body {
    cursor: url("../assets/images/cursor-nib.svg") 2 22, auto;
  }
  a, button, [role="button"] {
    cursor: url("../assets/images/cursor-nib.svg") 2 22, pointer;
  }
}

.custom-cursor, .custom-cursor-follower { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }

  .nav-menu {
    position: absolute;
    inset: 66px 1rem auto 1rem;
    display: grid;
    gap: 0.35rem;
    padding: 0.8rem;
    background: rgba(244, 238, 225, 0.96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
  }

  html[data-theme="dark"] .nav-menu {
    background: rgba(42, 33, 28, 0.94);
  }

  .nav-menu.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-menu a,
  .language-switcher { width: 100%; }

  .language-switcher button { flex: 1; }

  .dark-toggle { width: 100%; border-radius: var(--radius); }

  .hero,
  .timeline {
    grid-template-columns: 1fr;
  }

  .timeline::before { display: none; }
  .timeline .timeline-column:first-child { padding-right: 0; }
  .timeline .timeline-column:last-child { padding-left: 0; padding-top: 1.5rem; }

  .hero { padding-top: 3rem; }

  .hero-visual img { margin: 0; width: min(100%, 420px); }

  .feature-grid,
  .education-grid,
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .section-pad,
  .nav,
  .footer {
    width: min(var(--max), calc(100% - 1.5rem));
  }

  .hero-actions,
  .project-actions,
  .timeline-actions {
    display: grid;
    margin-left: 0;
  }

  .btn { width: 100%; }

  .feature-grid,
  .education-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .page-hero h1,
  h1 {
    font-size: clamp(1.9rem, 9vw, 2.65rem);
  }

  h2 { font-size: clamp(1.35rem, 7vw, 1.95rem); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  /* Disable custom cursor on small screens */
  .custom-cursor, .custom-cursor-follower { display: none; }
  body, a, button, input, textarea, select, [role="button"] { cursor: auto; }
}


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

  .hero-copy, .hero-visual, .feature-card, .project-card, .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .custom-cursor, .custom-cursor-follower { display: none !important; }
  body, a, button, input, textarea, select, [role="button"] { cursor: auto !important; }
}
