/* ==========================================================================
   Amir Dehsarvi — site theme
   Hand-written design system. No framework dependencies.
   ========================================================================== */

/* ---------- Self-hosted variable fonts ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("/assets/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("/assets/fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("/assets/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --bg:            #ffffff;
  --bg-alt:        #f4f7f9;
  --bg-deep:       #0c1720;
  --surface:       #ffffff;
  --surface-2:     #f9fbfc;
  --border:        #e2e8ee;
  --border-strong: #cfd8e0;
  --ink:           #0f1a24;
  --ink-2:         #33424f;
  --muted:         #63727f;
  --accent:        #0b6e7f;
  --accent-ink:    #08525f;
  --accent-soft:   rgba(11, 110, 127, 0.09);
  --accent-line:   rgba(11, 110, 127, 0.28);
  --navy:          #10344c;
  --shadow-sm:     0 1px 2px rgba(15, 26, 36, 0.05);
  --shadow-md:     0 6px 24px -12px rgba(15, 26, 36, 0.18);
  --shadow-lg:     0 24px 60px -28px rgba(15, 26, 36, 0.30);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1140px;
  --wrap-narrow: 760px;
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="dark"] {
  --bg:            #0a1017;
  --bg-alt:        #0e1721;
  --bg-deep:       #060c12;
  --surface:       #111b25;
  --surface-2:     #0f1922;
  --border:        #1e2b37;
  --border-strong: #2a3a48;
  --ink:           #e9eff5;
  --ink-2:         #c2ced9;
  --muted:         #8a99a7;
  --accent:        #4cb9c9;
  --accent-ink:    #7fd4e0;
  --accent-soft:   rgba(76, 185, 201, 0.13);
  --accent-line:   rgba(76, 185, 201, 0.32);
  --navy:          #9fc4dc;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:     0 8px 28px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg:     0 28px 70px -32px rgba(0, 0, 0, 0.85);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  font-feature-settings: "kern" 1, "liga" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2.3rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.24rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1.1em; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
a:hover { color: var(--accent-ink); text-decoration: underline; }

img { max-width: 100%; height: auto; }

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2.6rem 0;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}
code {
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 0.12em 0.4em;
  border-radius: 5px;
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; color: inherit; }

blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--accent-line);
  color: var(--muted);
  font-style: italic;
}

::selection { background: var(--accent-soft); color: var(--ink); }

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

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.2rem, 4vw, 2.2rem);
}
.wrap--narrow { max-width: var(--wrap-narrow); }

.section { padding: clamp(4rem, 8vw, 6.5rem) 0; }
.section--tight { padding: clamp(3rem, 5vw, 4rem) 0; }
.section--alt { background: var(--bg-alt); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
}

.section__head { max-width: 640px; margin-bottom: clamp(2.2rem, 4vw, 3.2rem); }
.section__head p { color: var(--muted); font-size: 1.05rem; margin-bottom: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 550;
  line-height: 1;
  padding: 0.82rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
              background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn--primary:hover { background: var(--accent-ink); color: #fff; }
html[data-theme="dark"] .btn--primary { color: #04161a; }
html[data-theme="dark"] .btn--primary:hover { color: #04161a; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn--sm { padding: 0.6rem 1rem; font-size: 0.86rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 550;
  font-size: 0.95rem;
}
.link-arrow::after {
  content: "→";
  transition: transform 0.25s var(--ease);
}
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: transparent;
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.site-header.is-stuck::before { opacity: 1; }
.site-header.is-stuck { border-bottom-color: var(--border); }

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 78px;
  transition: height 0.3s var(--ease);
}
.site-header.is-stuck .site-header__inner { height: 64px; }

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); text-decoration: none; }
.brand span {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav { display: flex; align-items: center; gap: 0.15rem; }
.nav a {
  position: relative;
  padding: 0.5rem 0.8rem;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 8px;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.28rem;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }
.nav a.is-active { color: var(--ink); }

.header-tools { display: flex; align-items: center; gap: 0.4rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .moon { display: none; }
html[data-theme="dark"] .icon-btn .sun { display: none; }
html[data-theme="dark"] .icon-btn .moon { display: block; }

.nav-toggle { display: none; }

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--navy));
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.site-header.is-stuck .scroll-progress { opacity: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(8rem, 15vh, 11rem) 0 clamp(4rem, 8vw, 6rem);
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 15% 0%, var(--accent-soft) 0%, transparent 55%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.42rem 0.9rem 0.42rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.hero__status i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero h1 { margin-bottom: 0.35rem; }
.hero__role {
  font-family: var(--font-sans);
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 1.4rem;
  letter-spacing: -0.005em;
}
.hero__role a { color: var(--ink-2); border-bottom: 1px solid var(--accent-line); }
.hero__role a:hover { color: var(--accent); }
.hero__lead {
  font-size: clamp(1.03rem, 1.5vw, 1.14rem);
  color: var(--muted);
  max-width: 34em;
  margin-bottom: 2rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 2rem; }

.hero__portrait { position: relative; justify-self: center; width: min(340px, 100%); }
.hero__portrait img {
  width: 100%;
  border-radius: 50%;
  display: block;
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%);
}
.hero__portrait::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.hero__portrait::after {
  content: "";
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  border: 1px dashed var(--accent-line);
  opacity: 0.55;
  animation: spin 46s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.socials { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: all 0.24s var(--ease);
}
.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  text-decoration: none;
}
.socials svg { width: 17px; height: 17px; fill: currentColor; }

.scroll-cue {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue { 0%,100% { opacity: 0.25; transform: scaleY(0.7); } 50% { opacity: 1; transform: scaleY(1); } }

/* ---------- Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-block: 1px solid var(--border);
}
.metric {
  background: var(--bg);
  padding: clamp(1.6rem, 3vw, 2.3rem) clamp(1rem, 2vw, 1.6rem);
}
.metric__value {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.08em;
}
.metric__value small { font-size: 0.5em; color: var(--accent); font-family: var(--font-sans); font-weight: 600; }
.metric__label {
  margin-top: 0.65rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1.3rem; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 2.5vw, 2rem);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card:hover::before { transform: scaleX(1); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 0.96rem; margin-bottom: 0; }
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1.1rem;
}
.card__icon svg { width: 20px; height: 20px; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.2rem; }
.tag {
  font-size: 0.74rem;
  font-weight: 550;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
}

/* Work cards */
.work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem;
}
.work__item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.6rem, 2.6vw, 2.1rem);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.work__item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.work__meta {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}
.work__item h3 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.work__item p { color: var(--muted); font-size: 0.97rem; }
.work__item .tags { margin-top: auto; padding-top: 1rem; }

/* ---------- Timeline ---------- */
.timeline { position: relative; margin-top: 1rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline__progress {
  position: absolute;
  left: 7px;
  top: 6px;
  width: 1px;
  height: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-line));
}
.tl {
  position: relative;
  padding: 0 0 2.4rem 2.4rem;
}
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tl.is-visible::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl__date {
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.tl h3 { font-size: 1.16rem; margin-bottom: 0.18rem; }
.tl__org { font-size: 0.93rem; color: var(--ink-2); font-weight: 500; margin-bottom: 0.5rem; }
.tl p { color: var(--muted); font-size: 0.95rem; margin-bottom: 0; }

/* ---------- Publications ---------- */
.pub-list { display: flex; flex-direction: column; }
.pub {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 1.6rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--border);
  transition: background-color 0.3s var(--ease);
}
.pub:last-child { border-bottom: 1px solid var(--border); }
.pub__year {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  transition: color 0.3s var(--ease);
}
.pub:hover .pub__year { color: var(--accent); }
.pub__title {
  font-family: var(--font-serif);
  font-size: 1.14rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 0.4rem;
  display: block;
}
.pub__title:hover { color: var(--accent); text-decoration: none; }
.pub__venue {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 550;
  margin-bottom: 0.5rem;
}
.pub__excerpt { font-size: 0.94rem; color: var(--muted); margin: 0 0 0.6rem; }
.pub__links { display: flex; gap: 1rem; font-size: 0.86rem; font-weight: 550; }

/* ---------- Contact ---------- */
.cta {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  border-radius: var(--radius);
  padding: clamp(2.6rem, 6vw, 4.2rem);
  text-align: center;
  color: #e8f2f7;
}
html[data-theme="dark"] .cta { background: var(--surface); border: 1px solid var(--border); }
.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 120% at 50% 0%, rgba(76, 185, 201, 0.22), transparent 60%);
  pointer-events: none;
}
.cta > * { position: relative; z-index: 2; }
.cta h2 { color: #fff; }
html[data-theme="dark"] .cta h2 { color: var(--ink); }
.cta p { color: rgba(232, 242, 247, 0.78); max-width: 46ch; margin-inline: auto; }
html[data-theme="dark"] .cta p { color: var(--muted); }
.cta .eyebrow { color: #7fd4e0; }
.cta .eyebrow::before { background: #7fd4e0; }
.cta .btn--ghost { color: #fff; border-color: rgba(255,255,255,0.35); }
.cta .btn--ghost:hover { color: #fff; border-color: #fff; background: rgba(255,255,255,0.1); }
html[data-theme="dark"] .cta .btn--ghost { color: var(--ink); border-color: var(--border-strong); }
.cta__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; margin-top: 1.8rem; }

/* ---------- Page headers (inner pages) ---------- */
.page-head {
  position: relative;
  padding: clamp(7.5rem, 14vh, 9.5rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 130% at 0% 0%, var(--accent-soft), transparent 60%);
  pointer-events: none;
}
.page-head > * { position: relative; z-index: 2; }
.page-head h1 { margin-bottom: 0.4rem; }
.page-head__sub { color: var(--muted); font-size: 1.06rem; max-width: 60ch; margin: 0; }

.breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- Prose ---------- */
.prose { padding: clamp(2.6rem, 6vw, 4rem) 0; }
.prose h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  margin-top: 2.6rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.9rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0 0 1.2rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li > ul { margin-top: 0.5rem; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.94rem; }
.prose th, .prose td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.prose th { color: var(--ink); font-weight: 600; }
.prose img { border-radius: var(--radius-sm); }

/* Panels used inside About / CV */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.1rem);
  margin-bottom: 1.5rem;
}
.panel > h2, .panel > h3 { margin-top: 0; }

/* ---------- Archive list (talks / teaching) ---------- */
.entry {
  display: block;
  padding: 1.6rem 0 1.7rem;
  border-top: 1px solid var(--border);
}
.entry:last-child { border-bottom: 1px solid var(--border); }
.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.entry__meta b { color: var(--accent); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.76rem; }
.entry h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.entry h3 a { color: var(--ink); }
.entry h3 a:hover { color: var(--accent); text-decoration: none; }
.entry p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* Filter bar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.filters button {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 550;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.22s var(--ease);
}
.filters button:hover { color: var(--accent); border-color: var(--accent); }
.filters button.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] .filters button.is-active { color: #04161a; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: clamp(3rem, 5vw, 4rem) 0 2rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.site-footer h4 {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.site-footer__brand p { color: var(--muted); font-size: 0.94rem; max-width: 34ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.55rem; }
.site-footer li a { color: var(--ink-2); font-size: 0.94rem; }
.site-footer li a:hover { color: var(--accent); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero__inner { grid-template-columns: 1fr; text-align: left; }
  .hero__portrait { order: -1; width: min(200px, 46%); justify-self: start; margin: 0 0 0 1.4rem; }
  .hero__portrait::before { inset: -9px; }
  .hero__portrait::after { inset: -20px; }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }
  .nav-toggle svg { width: 18px; height: 18px; }
  .nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 64px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.8rem clamp(1.2rem, 4vw, 2.2rem) 1.4rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: 0.75rem 0.2rem; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav a::after { display: none; }
  .nav a:last-child { border-bottom: 0; }

  .grid--3, .grid--2, .work { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 0.5rem; }
  .pub__year { font-size: 1rem; }
  .site-footer__grid { grid-template-columns: 1fr; gap: 2rem; }
  body { font-size: 16px; }
}

@media (max-width: 560px) {
  .brand span { display: none; }
  .brand { font-size: 1.02rem; }
}

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

@media print {
  .site-header, .site-footer, .scroll-cue, .hero__bg, .cta { display: none !important; }
  body { color: #000; background: #fff; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

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

/* ---------- Inline SVG icons ---------- */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1em; height: 1em; display: block; flex: none; }
.socials .ic { width: 17px; height: 17px; }
.icon-btn .ic { width: 17px; height: 17px; }
.nav-toggle .ic { width: 18px; height: 18px; }
.card__icon .ic { width: 20px; height: 20px; }
.btn .ic { width: 15px; height: 15px; }

/* ---------- Prose extras ---------- */
.muted-line {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}
.prose p:has(> .muted-line) { margin-top: -0.15rem; margin-bottom: 0.9rem; }
.role {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.role-sub { color: var(--ink-2); font-weight: 500; }
.prose p:has(> .role) { margin-top: 2.1rem; margin-bottom: 0.15rem; }
.prose h2 + p:has(> .role), .prose h3 + p:has(> .role) { margin-top: 0; }
.tags--lg { gap: 0.5rem; margin-top: 0.6rem; }
.tags--lg .tag { font-size: 0.83rem; padding: 0.4rem 0.85rem; }
.entry-list { margin-top: 0.5rem; }

/* ---------- CV inline lists ---------- */
.cv-list { list-style: none; padding-left: 0; }
.cv-list li {
  position: relative;
  padding: 0.55rem 0 0.55rem 3.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.96rem;
  line-height: 1.5;
}
.cv-list li:last-child { border-bottom: 0; }
.cv-list__year {
  position: absolute;
  left: 0;
  top: 0.55rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cv-list em { color: var(--muted); font-style: normal; display: block; font-size: 0.89rem; margin-top: 0.1rem; }
@media (max-width: 560px) {
  .cv-list li { padding-left: 0; padding-top: 1.5rem; }
  .cv-list__year { top: 0; }
}
