/* ============================================================
   Amir Alizadehshiraz — personal academic site
   Design system + components. No build step, no dependencies.
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  /* Palette — warm paper, deep ink, coral signal, teal support */
  --paper:        #fbfaf7;
  --paper-2:      #f3f1ec;
  --paper-3:      #e9e5dd;
  --surface:      #ffffff;
  --ink:          #14171c;
  --ink-2:        #414751;
  /* Darkened from #6d747f: the old value was 4.18:1 on --paper-2, under AA. */
  --ink-3:        #656c77;
  --line:         #e2ded5;

  /* Coral, darkened from #d64828. The old value measured 4.18:1 on --paper
     and 4.36:1 for white-on-accent, both under the 4.5:1 AA floor for body
     text. This one is 5.04:1 and 5.26:1. */
  --accent:       #c43b1c;
  --accent-soft:  #fbeee9;
  --accent-deep:  #9c2f14;
  --teal:         #14666a;
  --teal-soft:    #e3f0f0;

  --shadow-sm: 0 1px 2px rgba(20, 23, 28, .06), 0 2px 8px rgba(20, 23, 28, .04);
  --shadow-md: 0 2px 6px rgba(20, 23, 28, .07), 0 12px 32px rgba(20, 23, 28, .08);
  --shadow-lg: 0 4px 12px rgba(20, 23, 28, .08), 0 24px 64px rgba(20, 23, 28, .12);

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Fluid scale. --step--2 is the floor for micro-labels: never below 12px. */
  --step--2: clamp(.75rem, .73rem + .09vw, .8rem);
  --step--1: clamp(.82rem, .79rem + .14vw, .9rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.09rem);
  --step-1:  clamp(1.2rem, 1.12rem + .38vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.3rem + .74vw, 1.95rem);
  --step-3:  clamp(1.75rem, 1.48rem + 1.35vw, 2.65rem);
  --step-4:  clamp(2.1rem, 1.6rem + 2.5vw, 3.75rem);
  --step-5:  clamp(2.5rem, 1.65rem + 4.2vw, 5.25rem);

  /* Layout */
  --wrap: 1180px;
  --wrap-narrow: 760px;
  --gutter: clamp(1.15rem, .7rem + 2.2vw, 3rem);
  --radius: 14px;
  --radius-lg: 22px;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

:root[data-theme="dark"] {
  --paper:        #0e1116;
  --paper-2:      #151a21;
  --paper-3:      #1d232c;
  --surface:      #161b23;
  --ink:          #edeef1;
  --ink-2:        #b3b9c4;
  --ink-3:        #838b98;
  --line:         #2a313b;

  --accent:       #ff6b47;
  --accent-soft:  #2c1912;
  --accent-deep:  #ff8b6d;
  --teal:         #4bc4c8;
  --teal-soft:    #10262a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .45), 0 24px 64px rgba(0, 0, 0, .5);
}

/* ---------- 2. Reset & base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 110px;   /* clears the sticky header on anchor jumps */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; display: block; }
img { height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.018em;
  margin: 0 0 .55em;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1.15em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }

ul, ol { margin: 0 0 1.15em; padding-left: 1.3em; }
li { margin-bottom: .4em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

::selection { background: var(--accent); color: #fff; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: .75rem 1.25rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 3. Layout ---------- */

.wrap {
  width: min(100% - (var(--gutter) * 2), var(--wrap));
  margin-inline: auto;
}
.wrap--narrow { max-width: var(--wrap-narrow); width: min(100% - (var(--gutter) * 2), var(--wrap-narrow)); }

.section { padding-block: clamp(3.5rem, 2rem + 6vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }
.section--alt { background: var(--paper-2); }

.section-head { margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem); max-width: 62ch; }
.section-head p { color: var(--ink-2); font-size: var(--step-1); line-height: 1.5; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: ""; width: 26px; height: 2px; background: currentColor; border-radius: 2px;
}

.lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-2); }

/* ---------- 4. Header / nav ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 92px;   /* room for the 69px avatar */
}

.brand {
  display: flex; align-items: center; gap: .7rem;
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.06rem; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand .mark {
  width: 69px; height: 69px; flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-3);
  box-shadow: 0 0 0 1px var(--line);
  transition: transform .35s var(--ease), box-shadow .3s var(--ease);
}
.brand .mark img { width: 100%; height: 100%; object-fit: cover; }
.brand:hover .mark { transform: scale(1.07); box-shadow: 0 0 0 2px var(--accent); }
.brand .brand-sub {
  display: block; font-family: var(--font-mono); font-size: var(--step--2);
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3);
  font-weight: 500; margin-top: 2px;
}
/* On the narrowest screens the subtitle competes with the nav toggle. */
@media (max-width: 420px) { .brand .brand-sub { display: none; } }

.nav-links { display: flex; align-items: center; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.nav-links li { margin: 0; }
.nav-links a {
  position: relative;
  /* 44px minimum: the WCAG / platform touch-target floor. */
  display: flex; align-items: center; min-height: 44px;
  padding: .5rem .8rem;
  color: var(--ink-2); text-decoration: none;
  font-size: .93rem; font-weight: 500; border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--paper-3); }
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: .4rem; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; color: var(--ink-2);
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; }

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

.nav-toggle { display: none; }

@media (max-width: 940px) {
  .nav-toggle { display: grid; }
  .nav-links {
    /* The header has a backdrop-filter, which makes it the containing block
       for fixed children. top:100% therefore pins the drawer to the header's
       bottom edge and stays correct if the header height changes. */
    position: fixed; top: 100%; left: 0; right: 0; bottom: auto;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: .75rem var(--gutter) 1.5rem;
    box-shadow: var(--shadow-md);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
    max-height: calc(100dvh - 92px); overflow-y: auto;
  }
  /* Below ~520px the 69px avatar plus the full name plus the two icon buttons
     no longer fit on one line, which pushed the buttons off-screen. */
  @media (max-width: 520px) {
    .nav { gap: .6rem; }
    .brand { font-size: 1rem; min-width: 0; }
    .brand .mark { width: 56px; height: 56px; }
    .nav { min-height: 80px; }
  }
  .nav-links.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: .85rem .5rem; font-size: 1.05rem; border-radius: 8px; }
}

/* ---------- 5. Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .82rem 1.5rem;
  border-radius: 100px; border: 1px solid transparent;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease),
              background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-deep); color: #fff; box-shadow: var(--shadow-md); }
:root[data-theme="dark"] .btn--primary { color: #16110f; }
:root[data-theme="dark"] .btn--primary:hover { color: #16110f; }

.btn--ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); box-shadow: var(--shadow-sm); }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

.textlink {
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 600; font-size: .93rem; text-decoration: none;
  color: var(--accent);
}
.textlink svg { width: 15px; height: 15px; transition: transform .25s var(--ease); }
.textlink:hover svg { transform: translateX(4px); }

/* ---------- 6. Hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(3.5rem, 2rem + 8vw, 8rem) clamp(3rem, 2rem + 5vw, 6rem);
  overflow: hidden;
}

.hero-viz {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: .78;
}
:root[data-theme="dark"] .hero-viz { opacity: .68; }

/* Taller than the text needs, to give the wave field room to run. Kept as a
   block box: .wrap sizes itself and would be squashed as a flex item. */
.hero { min-height: min(86vh, 760px); }

/* Same scrim idea as .page-hero: keeps the headline readable over the waves. */
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    var(--paper) 6%,
    color-mix(in srgb, var(--paper) 68%, transparent) 44%,
    color-mix(in srgb, var(--paper) 8%, transparent) 80%
  );
}

.hero > .wrap { position: relative; z-index: 1; pointer-events: none; }
.hero .wrap a, .hero .wrap button { pointer-events: auto; }

.hero h1 {
  font-size: var(--step-5);
  margin-bottom: .3em;
  letter-spacing: -.03em;
  max-width: 15ch;
}

.hero-roles {
  display: flex; flex-direction: column; gap: .35rem;
  margin: 0 0 1.75rem;
  font-size: var(--step-1);
  color: var(--ink-2);
  line-height: 1.4;
}
.hero-roles strong { color: var(--ink); font-weight: 600; }
.hero-roles span { display: flex; align-items: baseline; gap: .6rem; }
.hero-roles span::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-radius: 50%; background: var(--accent); transform: translateY(-2px);
}
.hero-roles span:nth-child(2)::before { background: var(--teal); }

.hero-blurb { max-width: 54ch; color: var(--ink-2); margin-bottom: 2rem; }

/* Social row */
.social-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.social-row a {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px;
  padding: .5rem 1rem;
  border: 1px solid var(--line); border-radius: 100px;
  background: var(--surface);
  color: var(--ink-2); text-decoration: none;
  font-size: .85rem; font-weight: 500;
  transition: all .2s var(--ease);
}
.social-row a:hover {
  color: var(--ink); border-color: var(--ink-3);
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.social-row svg { width: 16px; height: 16px; flex: none; }

/* ---------- 7. Interactive visual panels ---------- */

.viz-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.viz-panel canvas { display: block; width: 100%; }

.viz-panel--propagation canvas { height: clamp(260px, 26vw, 400px); }
.viz-panel--skyline canvas { height: clamp(180px, 18vw, 260px); }
.viz-panel--wide canvas { height: clamp(200px, 20vw, 300px); }

.viz-legend {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  justify-content: space-between; align-items: baseline;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: var(--step--2); letter-spacing: .06em;
  color: var(--ink-3);
}
.viz-legend strong {
  color: var(--ink); font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}
.viz-hint {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--accent);
}
.viz-hint::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: pulse 2.2s var(--ease) infinite;
}

/* ---------- 8. Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(1rem, .6rem + 1.4vw, 1.75rem);
}

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 1.2rem + .9vw, 2.15rem);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--paper-3); }
.card:hover::after { transform: scaleX(1); }
.card h3 { margin-bottom: .55rem; }
.card p { color: var(--ink-2); font-size: .96rem; }
.card .textlink { margin-top: auto; padding-top: 1.25rem; }

.card-num {
  font-family: var(--font-mono); font-size: var(--step--2); font-weight: 500;
  letter-spacing: .14em; color: var(--accent); margin-bottom: 1rem;
}

.card-icon {
  width: 46px; height: 46px; margin-bottom: 1.2rem;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.card-icon svg { width: 23px; height: 23px; }
.card:nth-child(2n) .card-icon { background: var(--teal-soft); color: var(--teal); }
.card:nth-child(2n)::after { background: var(--teal); }

/* ---------- 9. Page banner ---------- */

.page-hero {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  overflow: hidden;
}
/* The subpage visual sits behind the heading rather than above it, so the
   whole band is a live surface the pointer can push around. */
.page-hero-viz {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: .72;
}
:root[data-theme="dark"] .page-hero-viz { opacity: .62; }

/* Scrim between the canvas and the heading. Sits above the visual (both are
   z-index 0, and ::after paints later) but below .wrap, which is z-index 1. */
.page-hero::after {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    var(--paper-2) 8%,
    color-mix(in srgb, var(--paper-2) 72%, transparent) 46%,
    color-mix(in srgb, var(--paper-2) 15%, transparent) 82%
  );
}

.page-hero > .wrap { position: relative; z-index: 1; pointer-events: none; }
.page-hero > .wrap a { pointer-events: auto; }

.page-hero-text { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }
.page-hero-text h1 { margin-bottom: .3em; }
.page-hero-text p { color: var(--ink-2); font-size: var(--step-1); max-width: 62ch; line-height: 1.5; }

.breadcrumb {
  font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 1rem;
}
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- 10. Publications ---------- */

.pub-filters {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.pub-filter {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: .5rem 1.15rem;
  border: 1px solid var(--line); border-radius: 100px;
  background: transparent; color: var(--ink-2);
  font-family: var(--font-body); font-size: .87rem; font-weight: 500;
  cursor: pointer; transition: all .2s var(--ease);
}
.pub-filter:hover { border-color: var(--ink-3); color: var(--ink); }
.pub-filter[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}

.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.pub:first-child { border-top: 1px solid var(--line); }
@media (max-width: 620px) {
  .pub { grid-template-columns: 1fr; gap: .75rem; }
}

.pub-year {
  font-family: var(--font-mono); font-size: .95rem; font-weight: 500;
  color: var(--ink-3); padding-top: .18rem;
}
.pub-title {
  font-family: var(--font-display); font-size: var(--step-1);
  font-weight: 600; line-height: 1.3; letter-spacing: -.015em;
  margin: 0 0 .55rem;
}
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent); }

.pub-authors { font-size: .92rem; color: var(--ink-2); margin: 0 0 .4rem; }
.pub-authors .me { color: var(--ink); font-weight: 700; }

.pub-venue { font-size: .9rem; color: var(--ink-3); font-style: italic; margin: 0 0 .9rem; }

.pub-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.tag {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .68rem;
  border-radius: 100px;
  font-family: var(--font-mono); font-size: var(--step--2);
  letter-spacing: .07em; text-transform: uppercase; font-weight: 500;
  border: 1px solid var(--line); color: var(--ink-3);
  text-decoration: none;
  transition: all .2s var(--ease);
}
/* DOI links are inline metadata, so a full 44px would bloat the row. 34px with
   the 8px gap below keeps them comfortably tappable without dominating. */
a.tag { min-height: 34px; padding-inline: .8rem; }
a.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag--journal { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag--conference { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.tag--preprint { background: var(--paper-3); color: var(--ink-2); border-color: transparent; }
.tag--cites { border-color: var(--line); color: var(--ink-2); }
.tag--first { background: var(--ink); color: var(--paper); border-color: transparent; }

/* ---------- 11. Timeline (funding / CV) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px;
  width: 2px; background: var(--line);
}
.timeline > li {
  position: relative;
  padding: 0 0 2.25rem 2.5rem;
  margin: 0;
}
.timeline > li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--accent);
}
.timeline > li:last-child { padding-bottom: 0; }
.tl-date {
  font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: .3rem;
}
.tl-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; margin: 0 0 .2rem; }
.tl-org { color: var(--accent); font-weight: 600; font-size: .93rem; margin: 0 0 .55rem; }
.tl-body { color: var(--ink-2); font-size: .96rem; margin: 0; }

/* ---------- 12. Prose blocks ---------- */

.prose { max-width: 68ch; }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 2rem; }
.prose > :first-child { margin-top: 0; }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  padding: 1.35rem 1.6rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 2rem 0;
}
.callout p { color: var(--ink-2); font-size: .96rem; }
.callout strong { color: var(--ink); }

/* ---------- 13. Work-in-progress panel (software) ---------- */

.wip {
  position: relative;
  text-align: center;
  padding: clamp(3rem, 2rem + 5vw, 6rem) clamp(1.5rem, 1rem + 3vw, 4rem);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background:
    repeating-linear-gradient(
      -45deg,
      transparent, transparent 14px,
      color-mix(in srgb, var(--accent) 4%, transparent) 14px,
      color-mix(in srgb, var(--accent) 4%, transparent) 28px
    );
}
.wip .badge {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .45rem 1.1rem; margin-bottom: 1.75rem;
  border-radius: 100px;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: var(--step--2);
  letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
}
:root[data-theme="dark"] .wip .badge { color: #16110f; }
.wip .badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.8s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}
.wip h2 { margin-bottom: .5em; }
.wip p { color: var(--ink-2); max-width: 52ch; margin-inline: auto; }

/* ---------- 14. Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.contact-card .label {
  font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: .6rem;
}
.contact-card a { font-weight: 600; text-decoration: none; word-break: break-word; }
.contact-card a:hover { text-decoration: underline; }
.contact-card .note { font-size: .88rem; color: var(--ink-3); margin: .5rem 0 0; }

/* ---------- 15. Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem) 2rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-grid h4 {
  font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 1rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: .55rem; }
.footer-grid ul a {
  /* Standalone nav links, not inline prose, so they need a real hit area.
     ~28px tall plus the 9px gap below clears the 24px WCAG 2.5.8 target. */
  display: inline-block; padding: .3rem 0;
  color: var(--ink-2); text-decoration: none; font-size: .92rem;
  transition: color .2s var(--ease);
}
.footer-grid ul a:hover { color: var(--accent); }
.footer-about p { font-size: .92rem; color: var(--ink-3); max-width: 38ch; }

.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  align-items: center;
  padding-top: 1.75rem; border-top: 1px solid var(--line);
  font-size: .84rem; color: var(--ink-3);
}
.footer-bottom p { margin: 0; }

/* ---------- 15b. Spacing utilities ----------
   These exist so that no element needs a style="" attribute. That in turn lets
   the Content-Security-Policy drop 'unsafe-inline' from style-src, which is
   the single biggest hardening win available to a static site. Do not
   reintroduce inline style attributes: they will be blocked by the CSP. */

.mt-0  { margin-top: 0; }
.mt-md { margin-top: 2rem; }
.mt-lg { margin-top: 2.5rem; }
.mb-xs { margin-bottom: 1.5rem; }
.mb-sm { margin-bottom: 1.75rem; }
.mb-md { margin-bottom: 3.5rem; }
.mb-lg { margin-bottom: 4rem; }
.mb-xl { margin-bottom: 4.5rem; }

.justify-center { justify-content: center; }
.measure-center { margin-inline: auto; max-width: 46ch; }
.page-center {
  min-height: 80vh;
  display: grid; place-items: center;
  text-align: center;
}

/* ---------- 16. Scroll reveal ---------- */

/* Scoped to html.js so that if JavaScript fails or is blocked, nothing is
   left stranded at opacity 0. Without JS the content simply shows. */
html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
html.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html.js .reveal { opacity: 1; transform: none; }
}

/* ---------- 17. Print ---------- */

@media print {
  .site-header, .site-footer, .btn, .pub-filters,
  .viz-panel, canvas[data-viz] { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section { padding-block: 1rem; }
  a { color: #000; text-decoration: underline; }
}
