/* ==========================================================================
   Mathias Potter portfolio
   Design system modelled on shadcn/ui: neutral HSL palette, hairline borders,
   restrained radius, generous whitespace, Inter. Restraint over decoration.

   Everything visual is controlled by the tokens below.
   ========================================================================== */

/* ------------------------------- TOKENS --------------------------------- */

:root,
[data-theme="light"] {
  --background:        0 0% 100%;
  --foreground:        240 10% 4%;
  --muted:             240 5% 96%;
  --muted-foreground:  240 4% 46%;
  --card:              0 0% 100%;
  --border:            240 6% 90%;
  --primary:           240 6% 10%;
  --primary-foreground:0 0% 98%;
  --accent:            214 90% 36%;   /* navy, carried from the CV */
  --ring:              240 5% 65%;
  --shadow: 0 1px 2px 0 hsl(240 6% 10% / .04), 0 1px 3px 0 hsl(240 6% 10% / .06);
  --shadow-lg: 0 10px 30px -10px hsl(240 6% 10% / .12);
}

[data-theme="dark"] {
  --background:        240 10% 4%;
  --foreground:        0 0% 96%;
  --muted:             240 6% 10%;
  --muted-foreground:  240 5% 60%;
  --card:              240 8% 6%;
  --border:            240 5% 15%;
  --primary:           0 0% 96%;
  --primary-foreground:240 10% 6%;
  --accent:            214 90% 62%;
  --ring:              240 5% 40%;
  --shadow: 0 1px 2px 0 hsl(0 0% 0% / .3);
  --shadow-lg: 0 10px 30px -10px hsl(0 0% 0% / .5);
}

:root {
  --radius: 12px;
  --radius-sm: 8px;
  --container: min(1140px, 90vw);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ------------------------------- RESET ---------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

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

.container { width: var(--container); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  padding: .75rem 1rem; border-radius: var(--radius-sm); z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

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

/* ------------------------------- TYPE ----------------------------------- */

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }

h1 { font-size: clamp(3.2rem, 9vw, 6.5rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h3 { font-size: 1.075rem; letter-spacing: -0.015em; line-height: 1.35; }

p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-color: hsl(var(--border)); text-underline-offset: 3px; }
a:hover { text-decoration-color: hsl(var(--accent)); }

.muted { color: hsl(var(--muted-foreground)); }

.eyebrow {
  display: inline-block;
  font-size: .75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .16em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.1rem;
}

.big { font-size: 1.2rem; color: hsl(var(--foreground)); }

blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.4rem;
  border-left: 2px solid hsl(var(--accent));
  background: hsl(var(--muted));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: hsl(var(--muted-foreground));
  font-size: .95rem;
}

/* -------------------------------- NAV ----------------------------------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: hsl(var(--background) / .78);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom-color: hsl(var(--border));
}
.nav-inner {
  width: var(--container); margin-inline: auto;
  height: 62px; display: flex; align-items: center; gap: 1.5rem;
}
.nav-brand {
  font-weight: 700; letter-spacing: -0.04em; font-size: 1.05rem;
  text-decoration: none;
}
.nav-links { margin-left: auto; display: flex; gap: 1.75rem; }
.nav-links a {
  font-size: .875rem; font-weight: 500;
  color: hsl(var(--muted-foreground)); text-decoration: none;
  transition: color .15s;
}
.nav-links a:hover { color: hsl(var(--foreground)); }

.theme-toggle,
.nav-toggle {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover,
.nav-toggle:hover { background: hsl(var(--muted)); }
.theme-toggle svg,
.nav-toggle svg { grid-area: 1 / 1; }
[data-theme="light"] .moon,
[data-theme="dark"]  .sun { display: none; }

/* The burger only exists below the breakpoint; above it the links are inline. */
.nav-toggle { display: none; }
.nav-toggle .close { display: none; }
.nav[data-open="true"] .nav-toggle .burger { display: none; }
.nav[data-open="true"] .nav-toggle .close  { display: block; }

@media (max-width: 720px) {
  .nav-toggle { display: grid; margin-left: auto; }

  /* Links become a panel hanging off the bar. Always in the DOM and
     focusable-order-correct; visibility is what changes, so the reveal can
     animate and screen readers still see it collapsed. */
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    margin-left: 0;
    flex-direction: column; gap: 0;
    padding: .5rem 0 .75rem;
    /* Opaque, not translucent: the hero sits directly behind this panel and
       ghosts through anything less. */
    background: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
    visibility: hidden; opacity: 0;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
  }
  .nav-links a {
    padding: .7rem calc((100vw - var(--container)) / 2);
    font-size: .95rem;
  }
  .nav[data-open="true"] .nav-links {
    visibility: visible; opacity: 1; transform: none;
  }
  /* The bar needs its own surface once a panel is attached to it, or the
     panel floats over the hero with a transparent strip above it. */
  .nav[data-open="true"] {
    background: hsl(var(--background));
    backdrop-filter: none;
  }
}

/* -------------------------------- HERO ---------------------------------- */

.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem 0 3rem;
  position: relative;
  overflow: hidden;
}

/* Faint engineering grid behind the hero, faded out towards the edges with a
   radial mask so it never competes with the text. Two layers of lines at
   different scales gives it depth without looking like graph paper. */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(hsl(var(--foreground) / .045) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--foreground) / .045) 1px, transparent 1px),
    linear-gradient(hsl(var(--foreground) / .025) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--foreground) / .025) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}

/* Soft accent glow behind the name, barely visible, adds depth */
.hero::after {
  content: "";
  position: absolute;
  width: 45vw; height: 45vw; max-width: 600px; max-height: 600px;
  left: -8vw; top: 8%;
  background: radial-gradient(circle, hsl(var(--accent) / .10), transparent 68%);
  pointer-events: none;
  filter: blur(10px);
}

.hero-grid, .hero + * , .hero .container { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

/* --- staggered entrance -------------------------------------------------
   Every delay is offset by --intro-delay, which the curtain sets while it is
   on screen. One shared timeline, so the hero lands as the curtain lifts. */
.hero-text > * { animation: riseIn .95s cubic-bezier(.16,1,.3,1) both; }
.hero-text > *:nth-child(1) { animation-delay: calc(var(--intro-delay) + .06s); }
.hero-text > *:nth-child(2) { animation-delay: calc(var(--intro-delay) + .17s); }
.hero-text > *:nth-child(3) { animation-delay: calc(var(--intro-delay) + .28s); }
.hero-text > *:nth-child(4) { animation-delay: calc(var(--intro-delay) + .39s); }
.hero-text > *:nth-child(5) { animation-delay: calc(var(--intro-delay) + .50s); }
.hero-text > *:nth-child(6) { animation-delay: calc(var(--intro-delay) + .61s); }
.hero-portrait { animation: dropIn 1.05s cubic-bezier(.16,1,.3,1) calc(var(--intro-delay) + .32s) both; }
.hero-stats    { animation: riseIn 1.05s cubic-bezier(.16,1,.3,1) calc(var(--intro-delay) + .74s) both; }
.nav           { animation: navIn .8s cubic-bezier(.16,1,.3,1) calc(var(--intro-delay) + .02s) both; }
.scroll-cue    { animation: float 2.4s ease-in-out calc(var(--intro-delay) + 1.05s) infinite both; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
/* The portrait settles downward into its frame rather than rising with the text. */
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes navIn {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: none; }
}

/* --- credibility strip -------------------------------------------------- */

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: clamp(2.5rem, 6vh, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.hs-num {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 500; letter-spacing: -0.03em; line-height: 1;
  color: hsl(var(--foreground));
}
.hs-num .pct { font-size: .62em; color: hsl(var(--muted-foreground)); }
.hs-label {
  display: block; margin-top: .5rem;
  font-size: .78rem; line-height: 1.4;
  color: hsl(var(--muted-foreground));
}

@media (max-width: 760px) {
  .hero-stats { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* Hero status badge. The one place a pill shape is used, because it reads as
   a live status indicator rather than a category label. */
.badge {
  gap: .5rem;
  border-radius: 999px !important;
  padding: .38rem .85rem !important;
  background: hsl(var(--card));
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
  margin-bottom: 2rem;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: hsl(142 70% 45%);
  box-shadow: 0 0 0 3px hsl(142 70% 45% / .18);
}

.hero-role {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 500;
  color: hsl(var(--accent));
  margin: 1.4rem 0 1.2rem;
  letter-spacing: -0.01em;
}

.hero-lede {
  font-size: 1.075rem;
  color: hsl(var(--muted-foreground));
  max-width: 52ch;
}

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

.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  margin-top: 2.25rem;
  font-size: .875rem;
  color: hsl(var(--muted-foreground));
}
.hero-meta a { text-decoration: none; }
.hero-meta a:hover { color: hsl(var(--foreground)); }

.hero-portrait { position: relative; }
.portrait-frame {
  position: relative;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  background: hsl(var(--muted));
  box-shadow: var(--shadow-lg);
  aspect-ratio: 3 / 4;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .18em;
  color: hsl(var(--muted-foreground));
}
@keyframes float { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 6px); } }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; max-width: 240px; }
  .scroll-cue { display: none; }
}

/* ------------------------------ BUTTONS --------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .68rem 1.15rem;
  font-size: .9rem; font-weight: 500;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: hsl(var(--muted)); transform: translateY(-1px); }

.btn-primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover { opacity: .9; background: hsl(var(--primary)); }

/* ------------------------------ SECTIONS -------------------------------- */

.section { padding: clamp(5rem, 12vh, 8rem) 0; border-top: 1px solid hsl(var(--border)); }
.section-alt { background: hsl(var(--muted) / .45); }

/* The measure is set per-element, not on the block: `ch` here resolves against
   the block's 1rem font-size, so a single cap strangles the 3.25rem h2 long
   before it constrains the body copy it was meant for. */
.section-head { margin-bottom: 3.5rem; }
.section-head h2 { max-width: 24ch; text-wrap: balance; }
.section-sub {
  color: hsl(var(--muted-foreground)); margin-top: 1rem; font-size: .95rem;
  max-width: 52ch;
}

/* ---------------------------- SELECTED WORK ----------------------------- */

.work-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.work-text p { color: hsl(var(--muted-foreground)); }
.work-text .big { color: hsl(var(--foreground)); }

.work-stats { display: grid; gap: 1rem; position: sticky; top: 90px; }

.stat {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.stat-num {
  display: block;
  font-family: var(--mono);
  font-size: 2.4rem; font-weight: 500;
  letter-spacing: -0.04em; line-height: 1;
  color: hsl(var(--accent));
}
.stat-num .pct { font-size: 1.4rem; }
.stat-unit {
  display: block; margin-top: .35rem;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .12em;
  color: hsl(var(--foreground));
}
.stat-label {
  display: block; margin-top: .6rem;
  font-size: .84rem; line-height: 1.5;
  color: hsl(var(--muted-foreground));
}

.figure { margin: 3.5rem 0 0; }
.figure img {
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
/* Two variants side by side. A shared aspect box with object-fit: contain keeps
   the row level even though the source images differ in proportion. */
.figure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: center;
}
.figure-grid img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: .75rem;
}
@media (max-width: 720px) {
  .figure-grid { grid-template-columns: 1fr; }
}

figcaption {
  margin-top: .9rem; font-size: .85rem;
  color: hsl(var(--muted-foreground));
}

@media (max-width: 900px) {
  .work-grid { grid-template-columns: 1fr; }
  .work-stats { position: static; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ============================ BADGE SYSTEM ==============================
   One treatment for every small label on the site: tags, pills, the hero
   badge. Previously these each had their own font, border and background,
   which is what made them read as inconsistent. Now: same size, same radius,
   same padding, same weight. Two variants only: neutral and accent.
   ======================================================================== */

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; }

.tags span,
.pill,
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font);          /* sans, not mono; mono looked scrappy at 12px */
  font-size: .765rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  padding: .28rem .62rem;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Neutral: filled, no visible border. Softer than the old outlined chips. */
.tags span {
  background: hsl(var(--muted));
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

/* Accent variant, used sparingly for status and highlighted modules */
.pill,
.tag-accent {
  background: hsl(var(--accent) / .10) !important;
  border-color: hsl(var(--accent) / .22) !important;
  color: hsl(var(--accent)) !important;
  text-transform: none;
  letter-spacing: 0;
}

/* Long module names need to wrap rather than overflow the column */
.edu-modules .tags span { white-space: normal; }

/* -------------------------------- CARDS --------------------------------- */

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

.card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover {
  border-color: hsl(var(--ring));
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.card p { color: hsl(var(--muted-foreground)); font-size: .93rem; }

.card-top { display: flex; align-items: start; gap: 1rem; justify-content: space-between; }

.card-meta {
  font-size: .8rem !important;
  text-transform: uppercase; letter-spacing: .08em;
  margin: .6rem 0 1rem !important;
}

/* Only the positional bit lives here now; appearance comes from the badge
   system further up, so pills match tags exactly. */
.pill { flex-shrink: 0; }

/* ------------------------------ TIMELINE -------------------------------- */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid hsl(var(--border));
}
.timeline li:first-child { border-top: 0; padding-top: 0; }

.tl-when {
  font-family: var(--mono);
  font-size: .82rem;
  color: hsl(var(--muted-foreground));
  padding-top: .2rem;
}
.tl-org {
  color: hsl(var(--accent)) !important;
  font-size: .92rem; font-weight: 500;
  margin: .2rem 0 .8rem !important;
}
.tl-body p { color: hsl(var(--muted-foreground)); font-size: .93rem; }

@media (max-width: 720px) {
  .timeline li { grid-template-columns: 1fr; gap: .6rem; }
}

/* ------------------------------- CONTACT -------------------------------- */

.contact { text-align: center; max-width: 44rem; margin-inline: auto; }
.contact h2 { max-width: 20ch; margin-inline: auto; text-wrap: balance; }
.contact .section-sub { max-width: 46ch; margin-inline: auto; }
.contact .hero-actions { justify-content: center; }

/* -------------------------------- FOOTER -------------------------------- */

footer { border-top: 1px solid hsl(var(--border)); padding: 2rem 0; }
.footer-inner {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-size: .85rem; color: hsl(var(--muted-foreground));
}

/* --------------------------- RESEARCH PAPERS ---------------------------- */

.paper {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: clamp(1.5rem, 4vw, 2.75rem);
  box-shadow: var(--shadow);
}
.paper + .paper { margin-top: 2rem; }

.paper-head { margin-bottom: 2rem; }
.paper-title {
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  margin: .9rem 0 .5rem;
  max-width: 34ch;
}
.paper-meta {
  font-family: var(--mono);
  font-size: .82rem;
  color: hsl(var(--muted-foreground));
  margin: 0 !important;
}

.paper-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.paper-body p { color: hsl(var(--muted-foreground)); }
.paper-body .big { color: hsl(var(--foreground)); }

.paper-stats { display: grid; gap: 1rem; }

@media (max-width: 900px) {
  .paper-grid { grid-template-columns: 1fr; }
  .paper-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* --------------------------- ABSTRACT TOGGLE ---------------------------- */

.abstract {
  margin: 1.75rem 0;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--muted) / .6);
  overflow: hidden;
}
.abstract summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.1rem;
  cursor: pointer;
  font-size: .875rem; font-weight: 500;
  color: hsl(var(--foreground));
  list-style: none;
  transition: background .15s;
}
.abstract summary::-webkit-details-marker { display: none; }
.abstract summary:hover { background: hsl(var(--muted)); }
.abstract summary svg { transition: transform .25s ease; flex-shrink: 0; }
.abstract[open] summary svg { transform: rotate(180deg); }
.abstract[open] summary { border-bottom: 1px solid hsl(var(--border)); }

.abstract-body { padding: 1.2rem 1.1rem; }
.abstract-body p {
  font-size: .9rem; line-height: 1.7;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* ------------------------------ CARD IMAGE ------------------------------ */

.card-img {
  width: calc(100% + 3.5rem);
  margin: -1.75rem -1.75rem 1.5rem;
  max-width: none;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid hsl(var(--border));
}

/* ------------------------------- EDUCATION ------------------------------ */

.edu-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: clamp(1.5rem, 4vw, 2.75rem);
  box-shadow: var(--shadow);
}

.edu-head {
  display: flex; justify-content: space-between; align-items: start; gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}
.edu-degree { font-size: clamp(1.5rem, 3.2vw, 2.25rem); margin-bottom: .8rem; }
.edu-uni {
  font-size: 1.05rem; font-weight: 500;
  color: hsl(var(--accent));
  margin: 0 0 .25rem !important;
}
.edu-meta {
  font-family: var(--mono); font-size: .82rem;
  color: hsl(var(--muted-foreground));
  margin: 0 !important;
}

.edu-badge {
  flex-shrink: 0; text-align: center;
  border: 1px solid hsl(var(--accent) / .3);
  background: hsl(var(--accent) / .07);
  border-radius: var(--radius);
  padding: 1.1rem 1.5rem;
}
.edu-badge .stat-num { font-size: 2.75rem; }
.edu-badge .stat-unit { color: hsl(var(--muted-foreground)); }

.edu-intro {
  margin: 1.5rem 0 0 !important;
  color: hsl(var(--muted-foreground));
  max-width: 62ch;
}

.edu-modules {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2rem; margin-top: 1.75rem;
}
.edu-label {
  font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .14em;
  color: hsl(var(--muted-foreground));
  margin: 0 !important;
}
.edu-modules .tags { margin-top: .8rem; }

/* .tag-accent styling now comes from the badge system, nothing needed here. */

@media (max-width: 820px) {
  .edu-head { flex-direction: column; gap: 1.25rem; }
  .edu-modules { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ------------------------------ PLACEMENTS ------------------------------ */

.group-label {
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 1.1rem;
  display: flex; align-items: center; gap: .85rem;
}
.group-label::after {
  content: ""; flex: 1; height: 1px;
  background: hsl(var(--border));
}
.placements + .group-label { margin-top: 2.75rem; }

.placements { display: grid; gap: 1.25rem; }

.placement {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: 1.85rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
/* Accent spine down the left edge, appears on hover */
.placement::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: hsl(var(--accent));
  transform: scaleY(0); transform-origin: top;
  transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.placement:hover::before { transform: scaleY(1); }
.placement:hover {
  border-color: hsl(var(--ring));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.placement-side { display: flex; flex-direction: column; gap: .3rem; }
.placement-when {
  font-family: var(--mono); font-size: .8rem;
  color: hsl(var(--foreground));
}
.placement-len {
  font-size: .78rem;
  color: hsl(var(--muted-foreground));
}

.placement-top {
  display: flex; justify-content: space-between; align-items: start;
  gap: 1rem; margin-bottom: 1rem;
}
.placement-main h3 { font-size: 1.2rem; }
.placement-role {
  font-size: .9rem; font-weight: 500;
  color: hsl(var(--accent));
  margin: .3rem 0 0 !important;
}
.placement-main > p { color: hsl(var(--muted-foreground)); font-size: .93rem; }

.placement-list {
  margin: 1rem 0 0; padding: 0; list-style: none;
  display: grid; gap: .6rem;
}
.placement-list li {
  position: relative; padding-left: 1.4rem;
  font-size: .91rem; line-height: 1.6;
  color: hsl(var(--muted-foreground));
}
.placement-list li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 5px; height: 5px; border-radius: 50%;
  background: hsl(var(--accent) / .6);
}

@media (max-width: 760px) {
  .placement { grid-template-columns: 1fr; gap: 1rem; padding: 1.4rem; }
  .placement-side { flex-direction: row; gap: .75rem; align-items: baseline; }
}

/* ------------------------------- INTRO ---------------------------------- */

/* Zero unless the head script opts this load into the intro, so a no-JS or
   reduced-motion visitor gets the page immediately with no curtain at all. */
:root                  { --intro-delay: 0s; }
[data-loading="true"]  { --intro-delay: 1.08s; }

.preload { display: none; }

[data-loading="true"] .preload {
  display: flex;
  position: fixed; inset: 0; z-index: 200;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 1.15rem;
  background: hsl(var(--background));
  animation: curtain .58s cubic-bezier(.16,1,.3,1) 1s both;
}

.preload-mark {
  font-family: var(--mono);
  font-size: 1.5rem; font-weight: 500;
  letter-spacing: .34em; text-indent: .34em;   /* offsets the trailing tracking */
  color: hsl(var(--foreground));
  animation: markIn .7s cubic-bezier(.16,1,.3,1) both;
}

.preload-bar {
  width: 116px; height: 2px;
  background: hsl(var(--border));
  border-radius: 2px; overflow: hidden;
}
.preload-bar i {
  display: block; height: 100%;
  background: hsl(var(--foreground));
  transform: scaleX(0); transform-origin: left;
  animation: barFill 1s cubic-bezier(.5,0,.2,1) .06s both;
}

@keyframes curtain {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}
@keyframes markIn {
  from { opacity: 0; transform: translateY(6px); letter-spacing: .5em; }
  to   { opacity: 1; transform: none; letter-spacing: .34em; }
}
@keyframes barFill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------------------------- SCROLL REVEAL ----------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
  .preload, [data-loading="true"] .preload { display: none; }
}
