/* ---------------------------------------------------------------
   Design tokens — restrained, editorial minimalism
   --------------------------------------------------------------- */
:root {
  --color-bg: #faf7f0;
  --color-panel: #f1eadf;
  --color-ink: #2a2422;
  --color-muted: #756a62;
  --color-accent: #581c2b;
  --color-divider: rgba(42, 36, 34, 0.12);

  /* The hero sits on a photographic background rather than the flat
     page background, so its text uses its own light-on-dark pair
     instead of --color-ink / --color-accent. */
  --color-hero-ink: #faf7f0;
  --color-hero-muted: rgba(250, 247, 240, 0.75);

  --font-sans: "Inter", -apple-system, system-ui, sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;

  --content-width: 760px;
  --wide-width: 1280px;

  /* Fixed navigation bar height (never changes on scroll). Things that stick
     below the header (hero, long-scroll headings) are offset from this. */
  --header-height: 4rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3.5rem;
  --space-5: 7rem;

  --radius: 20px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto !important;
  }

  .hero-stage {
    height: auto !important;
  }

  .hero-pin {
    position: static !important;
    height: auto !important;
    padding: var(--space-5) 0;
  }

  .hero-gap {
    height: var(--gap-default, 40px) !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* ---------------------------------------------------------------
   Scroll-reveal system
   Progressive enhancement: [data-reveal] elements start hidden only
   once JS has confirmed it's running (via the .js class set inline
   in <head>, before paint). No-JS visitors always see full content.
   --------------------------------------------------------------- */
:root:not(.js) [data-reveal] {
  opacity: 1 !important;
  translate: none !important;
  scale: 1 !important;
}

.js [data-reveal] {
  --reveal-y: 28px;
  --reveal-scale: 0.95;
  opacity: 0;
  translate: 0 calc(var(--reveal-y, 0px) + var(--parallax-y, 0px));
  scale: var(--reveal-scale, 1);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), translate 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    scale 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.js [data-reveal].is-visible {
  --reveal-y: 0px;
  --reveal-scale: 1;
  opacity: 1;
}

/* Tilt (transform: rotate) and parallax/reveal (translate + scale) are
   kept on separate CSS properties on purpose, so an element like the
   hero portrait can rise+scale in on reveal, drift for parallax, AND
   tilt on hover, all at once, instead of one silently overwriting
   another. */
[data-parallax] {
  translate: 0 calc(var(--reveal-y, 0px) + var(--parallax-y, 0px));
}

[data-tilt] {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  will-change: transform;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  color: var(--color-ink);
  background: var(--color-bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--color-ink);
}

h3 {
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--color-ink);
}

h1 {
  font-size: 3.25rem;
  margin: 0 0 var(--space-2);
}

h2 {
  font-size: 1.7rem;
  margin: 0 0 var(--space-2);
}

h3 {
  font-size: 1.05rem;
  margin: var(--space-3) 0 var(--space-1);
}

p {
  margin: 0 0 var(--space-2);
  color: var(--color-ink);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity 0.25s ease;
}

a:hover,
a:focus-visible {
  opacity: 0.7;
}

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

/* ---------------------------------------------------------------
   Header / nav
   --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--wide-width);
  margin: 0 auto;
  height: var(--header-height);
  padding: 0 var(--space-2);
}

/* Full-width bar that only materialises once you scroll, so at the top
   of the page the nav floats seamlessly on the page with no visible edge. */
.site-header.is-scrolled {
  background: rgba(250, 247, 240, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: 0 1px 0 var(--color-divider);
}

.site-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.015em;
  color: var(--color-ink);
}

/* Small uppercase descriptor under the name. */
.site-tagline {
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.site-header nav ul {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  position: relative;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: color 0.25s ease;
}

.site-header nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transition: right 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header nav a:hover::after,
.site-header nav a:focus-visible::after {
  right: 0;
}

.site-header nav a[aria-current="page"]::after {
  right: 0;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--color-ink);
  opacity: 1;
}

.site-header nav a[aria-current="page"] {
  color: var(--color-ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.lang-switch {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--color-divider);
  padding-left: var(--space-3);
}

.lang-switch a {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.lang-switch a:hover,
.lang-switch a:focus-visible {
  color: var(--color-ink);
  opacity: 1;
}

.lang-switch a[aria-current="page"] {
  color: var(--color-accent);
}

/* ---------------------------------------------------------------
   Main / footer
   --------------------------------------------------------------- */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-2);
  min-height: 60vh;
}

main.wide {
  max-width: var(--wide-width);
}

.site-footer {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-2) var(--space-3);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.footer-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-ink);
}

.footer-col h2 {
  margin: 0 0 var(--space-1);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin: 0 0 0.35rem;
}

.footer-col a {
  color: var(--color-ink);
}

.footer-col a:hover,
.footer-col a:focus-visible {
  color: var(--color-accent);
  opacity: 1;
}

.footer-meta {
  margin: var(--space-4) 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

/* ---------------------------------------------------------------
   Hero — full-height landing intro. The stage reserves extra scroll
   distance; the pin holds the intro on screen while that distance is
   consumed, then releases normally into the home-grid below (see
   data-hero-stage / data-hero-gap in site.js for the scroll-linked
   gap-closing that replaces the dead scroll space between the two).
   --------------------------------------------------------------- */
.hero-stage {
  position: relative;
  height: 220vh;
  /* Cancel main's top padding so the hero starts flush under the header. */
  margin-top: calc(-1 * var(--space-5));
}

.hero-pin {
  position: sticky;
  /* Pins exactly at the header's bottom edge, so there is never a gap. */
  top: var(--header-height);
  height: calc(100vh - var(--header-height) - 1rem);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* Biases the centered content upward a bit, so the name sits closer
     to true vertical center rather than the whole (taller) block. */
  padding-bottom: 14vh;
}

/* The mountain artwork, pinned full-bleed behind the hero content only.
   Anchored so it fills the stage and crops from the top on tall/narrow
   screens rather than losing the peaks or the fog line at the base. */
.hero-photo {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: hidden;
  border-bottom: 1px solid var(--color-accent);
  z-index: 0;
  pointer-events: none;
}

.hero-photo svg {
  width: 100%;
  height: 100%;
  display: block;
  /* Scroll-linked: the artwork drifts upward and eases in as the hero is
     scrolled through (--hero-progress is 0 -> 1, set in site.js). The
     constant scale keeps the edges covered while it travels. */
  transform: translateY(calc(var(--hero-progress, 0) * -9%)) scale(calc(1.12 + var(--hero-progress, 0) * 0.04));
  transform-origin: 50% 100%;
  transition: transform 0.15s linear;
  will-change: transform;
}

.hero-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(20, 14, 12, 0.5) 0%, rgba(20, 14, 12, 0.18) 42%, transparent 62%);
}

/* Fades and shrinks slightly as the hero-stage above is scrolled through
   (--hero-fade / --hero-shrink are set per scroll frame in site.js);
   kept on the plain wrapper rather than .hero-info so it doesn't fight
   with that element's own [data-reveal] opacity/scale transition. */
.hero {
  position: relative;
  z-index: 1;
  opacity: var(--hero-fade, 1);
  scale: var(--hero-shrink, 1);
  translate: 0 calc(var(--hero-progress, 0) * -48px);
  transition: opacity 0.2s linear, scale 0.2s linear, translate 0.2s linear;
}

.hero-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-4);
  max-width: 560px;
  width: 100%;
}

.hero-text {
  min-width: 0;
}

.hero-portrait {
  width: min(220px, 48vw);
  height: min(220px, 48vw);
  border-radius: var(--radius);
  background: var(--color-panel);
  box-shadow: 0 18px 40px rgba(20, 14, 12, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-portrait:hover img {
  transform: scale(1.04);
}

.hero-portrait .placeholder-label {
  color: var(--color-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 0 var(--space-2);
}

.hero h1 {
  color: var(--color-hero-ink);
}

.hero .role {
  color: var(--color-hero-muted);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
}

.hero p:not(.role) {
  color: var(--color-hero-ink);
  font-size: 1.1rem;
}

.hero .link-row a {
  --link-hover: #e8c9a6;
  position: relative;
  /* Two-tone text: cream on the right half, sand on the left half. Sliding the
     background left-to-right sweeps the new colour across the letters. */
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(to right, var(--link-hover) 50%, var(--color-hero-ink) 50%) 100% 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  transition: background-position 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Underline sweeps left to right in the same colour. */
.hero .link-row a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--link-hover);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero .link-row a:hover,
.hero .link-row a:focus-visible {
  opacity: 1;
  background-position: 0 0;
}

.hero .link-row a:hover::after,
.hero .link-row a:focus-visible::after {
  transform: scaleX(1);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.link-row a {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Sits between the hero and the home-grid. Starts wide (hero "holds"
   the screen) and narrows toward its default size as the hero-stage
   above is scrolled through; grows back the same way in reverse. */
.hero-gap {
  --gap-default: 40px;
  height: var(--gap-current, var(--gap-default));
}

/* ---------------------------------------------------------------
   Home page grid — 2x3, flat fill tiles
   --------------------------------------------------------------- */
/* Keep every tile flush with the grid tracks; the generic section spacing below
   is intended for ordinary vertical sections, not grid children. */
.home-grid>section {
  margin-top: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  grid-template-rows: 340px 260px;
  grid-template-areas:
    "math projects hobbies"
    "math photo    photo";
  align-items: stretch;
  gap: var(--space-2);
}

.panel {
  background: var(--color-panel);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

.panel:hover {
  border-color: rgba(88, 28, 43, 0.3);
  box-shadow: 0 24px 60px rgba(42, 36, 34, 0.12);
}

.panel h2 {
  color: var(--color-accent);
  font-size: 1rem;
  line-height: 1.3;
}

.panel-math {
  grid-area: math;
}

.panel-projects {
  grid-area: projects;
}

.panel-hobbies {
  grid-area: hobbies;
}

.panel-photo {
  grid-area: photo;
  padding: 0;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.panel p:last-child {
  margin-bottom: 0;
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.panel-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------------------------------------------------------------
   Long-scroll sections — heading stays pinned in view while its
   list/grid scrolls past beside it (pure CSS sticky, no JS needed).
   Applied to experience/education/certificates/gallery sections.
   --------------------------------------------------------------- */
.long-scroll {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: var(--space-4);
  align-items: start;
}

.long-scroll>h2,
.long-scroll>.section-heading {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  align-self: start;
  margin: 0;
}

@media (max-width: 860px) {
  .long-scroll {
    display: block;
  }

  .long-scroll>h2,
  .long-scroll>.section-heading {
    position: static;
    margin-bottom: var(--space-3);
  }
}


.section-heading {
  margin-bottom: var(--space-4);
}

.section-intro {
  max-width: 650px;
  margin: 0;
  color: var(--color-muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.section-heading::after {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  margin-top: var(--space-3);
  background: var(--color-accent);
}

/* ---------------------------------------------------------------
   Listing pages (articles, notes)
   --------------------------------------------------------------- */
.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry-list li {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-divider);
}

.entry-list li:first-child {
  border-top: none;
}

.entry-list h2,
.entry-list h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.entry-list .meta {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

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

section+section {
  margin-top: var(--space-4);
}

.meta {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------
   Article / note body
   --------------------------------------------------------------- */
article .meta {
  margin-bottom: var(--space-1);
}

article h1 {
  margin-top: var(--space-1);
  font-size: 2.1rem;
}

pre {
  background: var(--color-panel);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

code {
  font-size: 0.9em;
}

.fallback-notice {
  font-size: 0.85rem;
  color: var(--color-muted);
  background: var(--color-panel);
  border-radius: 10px;
  padding: 0.6rem var(--space-2);
  margin: 0 0 var(--space-3);
}

/* ---------------------------------------------------------------
   Gallery
   --------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.gallery-grid figure {
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-grid figure:hover img {
  transform: scale(1.05);
}

.gallery-grid figcaption {
  margin-top: var(--space-1);
  font-size: 0.85rem;
}

.gallery-grid figcaption .meta {
  display: block;
  margin-top: 0.15rem;
}

/* ---------------------------------------------------------------
   Experience — LinkedIn-style, sorted automatically by date
   --------------------------------------------------------------- */
.experience-section {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.experience-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.experience-list::before {
  content: '';
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 27px;
  width: 1px;
  background: var(--color-divider);
}

.experience-entry {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.experience-entry:first-child {
  padding-top: 0;
}

:root:not(.js) .experience-entry:hover {
  transform: translateX(3px);
}

.experience-logo {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg);
}

.experience-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-divider);
}

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

.experience-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.experience-top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.experience-company {
  color: var(--color-muted);
  font-weight: 500;
  margin: 0.15rem 0 0;
}

.experience-dates {
  color: var(--color-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  margin: 0;
  margin-left: auto;
  text-align: right;
}

.experience-highlights {
  margin: var(--space-1) 0 0;
  padding-left: 1.1rem;
  color: var(--color-ink);
}

.experience-highlights li {
  margin-bottom: 0.25rem;
}

.experience-highlights li:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 860px) {
  .home-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
    grid-template-areas:
      "math"
      "projects"
      "hobbies"
      "photo";
  }

  .panel-photo {
    min-height: 260px;
  }
}

/* Narrow screens: a compact two-row bar of constant height — title and
   language switch on top, the nav links on a single (scrollable) row below. */
@media (max-width: 760px) {
  :root {
    --header-height: 5.5rem;
  }

  .site-header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title lang"
      "nav   nav";
    align-items: center;
    row-gap: 0.5rem;
  }

  .header-right {
    display: contents;
  }

  .site-title {
    grid-area: title;
  }

  /* The phone header is already two rows; keep just the name there. */
  .site-tagline {
    display: none;
  }

  .lang-switch {
    grid-area: lang;
    border-left: none;
    padding-left: 0;
  }

  .site-header nav {
    grid-area: nav;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .site-header nav::-webkit-scrollbar {
    display: none;
  }

  .site-header nav ul {
    gap: var(--space-2);
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 2.1rem;
  }

  main {
    padding: var(--space-4) var(--space-2);
  }

  .hero-stage {
    margin-top: calc(-1 * var(--space-4));
  }

  .hero-pin {
    justify-content: center;
  }

  .hero-info {
    align-items: center;
    text-align: center;
  }

  .link-row {
    justify-content: center;
  }

  .hero-portrait {
    width: min(220px, 55vw);
    height: min(220px, 55vw);
  }

  .experience-entry {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* ---------------------------------------------------------------
   Education / other credentials — LinkedIn-style profile history
   --------------------------------------------------------------- */
.profile-section {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.education-list,
.certificate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.education-list::before,
.certificate-list::before {
  content: '';
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 27px;
  width: 1px;
  background: var(--color-divider);
}

.education-entry,
.certificate-entry {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.education-entry:first-child,
.certificate-entry:first-child {
  padding-top: 0;
}

:root:not(.js) .education-entry:hover,
:root:not(.js) .certificate-entry:hover {
  transform: translateX(3px);
}

.profile-logo {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg);
}

.profile-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-divider);
}

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

.profile-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.profile-top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.profile-organization {
  color: var(--color-muted);
  font-weight: 500;
  margin: 0.15rem 0 0;
}

.profile-dates {
  color: var(--color-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  margin: 0;
  margin-left: auto;
  text-align: right;
}

.profile-description {
  margin-top: var(--space-1);
  margin-bottom: 0;
}

.credential-link {
  display: inline-block;
  margin-top: var(--space-1);
  font-size: 0.9rem;
  font-weight: 500;
}

@media (max-width: 640px) {

  .education-entry,
  .certificate-entry {
    flex-direction: column;
    gap: var(--space-2);
  }

  .education-list::before,
  .certificate-list::before,
  .experience-list::before {
    display: none;
  }
}

/* ---------------------------------------------------------------
   Academic archives — notes and reports grouped by year and subject
   --------------------------------------------------------------- */
.archive-years {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.archive-year {
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-3);
}

.archive-year-heading,
.subject-heading,
.archive-entry-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.archive-year-heading h2,
.subject-heading h3 {
  margin: 0;
}

.archive-year-heading h2 {
  font-size: 1.5rem;
}

.archive-count {
  color: var(--color-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.subject-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.subject-group {
  background: var(--color-panel);
  border: 1px solid var(--color-divider);
  border-radius: 14px;
  padding: 0 var(--space-3);
}

.subject-heading {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}

.subject-heading h3 {
  font-size: 0.95rem;
  color: var(--color-accent);
}

.subject-group .entry-list li {
  padding: var(--space-2) 0;
}

.subject-group .entry-list li:first-child {
  border-top: none;
}

.subject-group .entry-list h3 {
  font-size: 1rem;
}

.archive-entry-row {
  align-items: center;
}

.archive-entry-row>div {
  min-width: 0;
}

.archive-file-link {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
  border-bottom: 1px solid rgba(88, 28, 43, 0.25);
}

.empty-archive {
  border: 1px dashed var(--color-divider);
  border-radius: 14px;
  padding: var(--space-3);
}

.empty-archive p:last-child {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .archive-entry-row {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-2);
  }

  .archive-file-link {
    margin-bottom: var(--space-2);
  }
}

/* ---------------------------------------------------------------
   Degree / year selector for the notes and reports archives
   --------------------------------------------------------------- */
.archive-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.archive-tabs[hidden],
.archive-panel[hidden] {
  display: none;
}

.archive-tab {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.archive-tab:hover,
.archive-tab:focus-visible {
  color: var(--color-ink);
  border-color: var(--color-muted);
}

.archive-tab[aria-pressed="true"] {
  color: var(--color-bg);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.archive-tabs-years {
  margin-bottom: var(--space-4);
}

/* Skills section (About page) */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.skill-group h3 {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
}

.skill-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  background: var(--color-panel);
  color: var(--color-ink);
  font-size: 0.95rem;
}

.skill-level {
  color: var(--color-muted);
  font-size: 0.8rem;
}

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

/* Publications / citations */
.citation {
  margin: var(--space-2) 0;
  font-size: 0.95rem;
}

.citation-text {
  margin: 0 0 var(--space-1);
  line-height: 1.65;
}

.citation-self {
  font-weight: 600;
}

.citation-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-1);
  font-size: 0.85rem;
}

.citation-bibtex summary {
  cursor: pointer;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.citation-bibtex pre {
  margin: var(--space-1) 0;
  padding: var(--space-2);
  overflow-x: auto;
  background: var(--color-panel);
  border: 1px solid var(--color-divider);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.citation-copy {
  padding: 4px 12px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--color-accent);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 999px;
  cursor: pointer;
}

/* ---------------------------------------------------------------
   Latest section (home page)
   --------------------------------------------------------------- */
.latest-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2);
}

.latest-card {
  background: var(--color-panel);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

.latest-card:hover {
  border-color: rgba(88, 28, 43, 0.3);
  box-shadow: 0 24px 60px rgba(42, 36, 34, 0.12);
}

.latest-kind {
  margin: 0 0 var(--space-1);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.latest-card h3 {
  margin: 0 0 var(--space-1);
  font-size: 1.1rem;
  line-height: 1.3;
}

.latest-summary {
  margin: var(--space-1) 0 0;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------
   404 page
   --------------------------------------------------------------- */
.not-found {
  padding: var(--space-4) 0;
}

.not-found-code {
  margin: 0;
  color: var(--color-accent);
  font-family: 'Fraunces', serif;
  font-size: clamp(4rem, 14vw, 8rem);
  line-height: 1;
}