/* ==========================================================================
   Personal website of Brahim Mahmoudi
   Colors and fonts follow the original Google Site (burgundy/red, PT Sans + Comfortaa).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  --brand: #980000;
  --brand-2: #7f1146;
  --brand-grad: linear-gradient(135deg, #a10a0a 0%, #7f1146 100%);

  --accent: #980000;
  --accent-soft: #f8e9ea;
  --bg: #ffffff;
  --bg-alt: #faf6f5;
  --surface: #ffffff;
  --surface-2: #f5efee;
  --ink: #1d1a1b;
  --ink-2: #463f41;
  --muted: #6b6365;
  --line: #ebe3e2;
  --focus: #7f1146;

  --shadow-sm: 0 1px 2px rgb(40 10 20 / 0.06);
  --shadow: 0 1px 2px rgb(40 10 20 / 0.05), 0 12px 32px -12px rgb(40 10 20 / 0.2);

  --radius: 18px;
  --font-sans: "PT Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-round: "Comfortaa", "PT Sans", system-ui, sans-serif;
  --container: 1120px;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #ff8f9c;
    --accent-soft: rgb(255 120 140 / 0.12);
    --bg: #121013;
    --bg-alt: #18151a;
    --surface: #1e1b20;
    --surface-2: #27232a;
    --ink: #f4eff0;
    --ink-2: #d9d1d3;
    --muted: #aaa0a4;
    --line: #2f2a31;
    --focus: #ff8f9c;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 14px 36px -14px rgb(0 0 0 / 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #ff8f9c;
  --accent-soft: rgb(255 120 140 / 0.12);
  --bg: #121013;
  --bg-alt: #18151a;
  --surface: #1e1b20;
  --surface-2: #27232a;
  --ink: #f4eff0;
  --ink-2: #d9d1d3;
  --muted: #aaa0a4;
  --line: #2f2a31;
  --focus: #ff8f9c;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 14px 36px -14px rgb(0 0 0 / 0.7);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

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

body.no-scroll { overflow: hidden; }

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

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 0.14em; }

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

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}
@media (min-width: 720px) {
  .container { width: min(100% - 64px, var(--container)); }
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.hi { color: var(--accent); font-weight: 700; }

mark {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
  padding: 0 0.08em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 10px 24px -10px rgb(152 0 0 / 0.85);
}
.btn-primary:hover { box-shadow: 0 16px 30px -12px rgb(152 0 0 / 0.95); }

.btn-ghost {
  color: #fff;
  border-color: rgb(255 255 255 / 0.45);
  background: rgb(255 255 255 / 0.06);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover { background: rgb(255 255 255 / 0.16); }

.btn-light {
  color: #7f1146;
  background: #fff;
  box-shadow: 0 10px 26px -12px rgb(0 0 0 / 0.6);
}

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.chip-link .icon { color: var(--accent); }
.chip-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

/* ---------- Header / navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  color: #fff;
  transition: background-color 0.3s, box-shadow 0.3s, color 0.3s;
}

.site-header.is-solid,
.site-header.nav-open {
  color: var(--ink);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-grad);
  color: #fff;
  font-family: var(--font-round);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px -6px rgb(152 0 0 / 0.7);
}

.brand-name { font-size: 1.05rem; letter-spacing: 0.01em; }

.site-nav { margin-left: auto; }

.site-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  color: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.86;
  transition: background-color 0.2s, opacity 0.2s, color 0.2s;
}
.site-nav a:hover { opacity: 1; background: rgb(255 255 255 / 0.12); }
.site-nav a[aria-current] { opacity: 1; background: rgb(255 255 255 / 0.18); }

.site-header.is-solid .site-nav a:hover { background: var(--surface-2); }
.site-header.is-solid .site-nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: inherit;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:hover { background: rgb(255 255 255 / 0.18); }

.site-header.is-solid .icon-btn,
.site-header.nav-open .icon-btn {
  border-color: var(--line);
  background: var(--surface);
}
.site-header.is-solid .icon-btn:hover,
.site-header.nav-open .icon-btn:hover { background: var(--surface-2); }

/* Theme icon: moon in light mode, sun in dark mode */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }

@media (max-width: 959px) {
  .nav-toggle { display: inline-grid; }
  .nav-open .nav-toggle .icon-close { display: block; }
  .nav-open .nav-toggle .icon-menu { display: none; }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 8px 16px 18px;
    background: var(--bg);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }
  .nav-open .site-nav { opacity: 1; visibility: visible; transform: none; }

  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: 12px 14px; border-radius: 12px; font-size: 1.05rem; opacity: 1; }
  .site-nav a:hover { background: var(--surface-2); }
  .site-nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }

  .header-actions { margin-left: auto; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: min(100vh, 880px);
  padding: calc(var(--header-h) + 48px) 0 104px;
  color: #fff;
  background: #1a0a10;
}
@supports (min-height: 100svh) {
  .hero { min-height: min(100svh, 880px); }
}

.hero > .container { width: min(100% - 32px, var(--container)); }
@media (min-width: 720px) {
  .hero > .container { width: min(100% - 64px, var(--container)); }
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 32%;
  animation: hero-zoom 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(18 5 10 / 0.94) 0%, rgb(58 8 26 / 0.74) 40%, rgb(18 5 10 / 0.3) 72%, rgb(18 5 10 / 0.12) 100%),
    linear-gradient(0deg, rgb(18 5 10 / 0.65) 0%, transparent 38%);
}

.hero-content { max-width: 620px; }
.hero-content > * { animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero-content > :nth-child(2) { animation-delay: 0.08s; }
.hero-content > :nth-child(3) { animation-delay: 0.16s; }
.hero-content > :nth-child(4) { animation-delay: 0.24s; }
.hero-content > :nth-child(5) { animation-delay: 0.32s; }
.hero-content > :nth-child(6) { animation-delay: 0.4s; }

.hero-avatar {
  width: 112px;
  height: 112px;
  margin-bottom: 24px;
  border: 3px solid rgb(255 255 255 / 0.92);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 7px rgb(152 0 0 / 0.45), 0 16px 34px -10px rgb(0 0 0 / 0.7);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: #ffc9d0;
  font-family: var(--font-round);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.hero-title {
  margin-bottom: 20px;
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.hero-title span { display: block; }
.hero-title .last { font-weight: 700; letter-spacing: 0.02em; }

.hero-lead {
  max-width: 34em;
  margin-bottom: 24px;
  color: rgb(255 255 255 / 0.88);
  font-size: clamp(1.08rem, 1.7vw, 1.25rem);
}
.hero-lead em {
  color: #fff;
  font-style: normal;
  font-weight: 700;
  background: linear-gradient(transparent 64%, rgb(190 20 40 / 0.8) 64%);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
  color: rgb(255 255 255 / 0.82);
  font-size: 0.97rem;
}
.hero-meta li { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta .icon { color: #ffb3bd; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid rgb(255 255 255 / 0.6);
  border-radius: 14px;
}
.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  animation: cue 1.8s ease-in-out infinite;
}

@media (max-width: 719px) {
  .hero { align-items: flex-end; padding-bottom: 88px; }
  .hero-bg { object-position: 60% 30%; }
  .hero-overlay {
    background: linear-gradient(180deg, rgb(18 5 10 / 0.45) 0%, rgb(40 6 18 / 0.72) 42%, rgb(18 5 10 / 0.95) 100%);
  }
  .hero-avatar { width: 92px; height: 92px; }
  .scroll-cue { display: none; }
}

@keyframes hero-zoom {
  from { transform: scale(1.12); }
  to { transform: scale(1.03); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes cue {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 120px) 0; }
.section-alt { background: var(--bg-alt); }

.section-head {
  max-width: 700px;
  margin-bottom: clamp(36px, 5vw, 56px);
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--font-round);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.section-kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.section-title {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: clamp(40px, 6vw, 72px);
  align-items: start;
}
.about-photo {
  position: relative;
  isolation: isolate;
  margin: 0 18px 18px 0;
}

@media (min-width: 880px) {
  .about-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .about-photo { position: sticky; top: calc(var(--header-h) + 24px); }
}
.about-photo::before {
  content: "";
  position: absolute;
  inset: 18px -18px -18px 18px;
  z-index: -1;
  border-radius: var(--radius);
  background: var(--brand-grad);
  opacity: 0.16;
}
.about-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 62%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.badge-float {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}
.badge-float .icon {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 11px;
  background: var(--brand-grad);
  color: #fff;
}
.badge-float strong { display: block; color: var(--ink); }

.about-body > p:not(.section-kicker) { color: var(--ink-2); }

.facts {
  display: grid;
  gap: 12px;
  margin: 30px 0 26px;
  padding: 0;
  list-style: none;
}
@media (min-width: 600px) {
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.fact-label {
  color: var(--accent);
  font-family: var(--font-round);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.fact-title { color: var(--ink); font-weight: 700; line-height: 1.3; }
.fact-sub { color: var(--muted); font-size: 0.92rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag {
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

/* ---------- Projects ---------- */
.projects { display: grid; gap: clamp(56px, 8vw, 96px); }

.project {
  display: grid;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
@media (min-width: 880px) {
  .project { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
  .project:nth-child(even) .project-figure { order: 2; }
}

.project-figure {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(14px, 2.5vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff; /* diagrams have a white background, keep it in dark mode too */
  box-shadow: var(--shadow);
  cursor: zoom-in;
}
.project-figure img {
  width: auto;
  max-height: 380px;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.project-figure:hover img { transform: scale(1.025); }

.zoom-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgb(20 10 14 / 0.72);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.project-figure:hover .zoom-hint,
.project-figure:focus-visible .zoom-hint { opacity: 1; }
@media (hover: none) {
  .zoom-hint { opacity: 1; }
}

.project-venue {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-round);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-title {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.project-tagline {
  margin-bottom: 14px;
  color: var(--ink-2);
  font-family: var(--font-round);
  font-size: 1.06rem;
  line-height: 1.6;
}

.project-desc { color: var(--muted); }

/* ---------- Master (feature) ---------- */
.feature {
  display: grid;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
@media (min-width: 960px) {
  .feature { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
}

.feature-body > p:not(.project-venue) { color: var(--ink-2); }

.note {
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: var(--muted) !important;
  font-style: italic;
}

.feature-media {
  position: relative;
  padding: 0 44px 56px 0;
}
.feature-cover {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32%;
  max-width: 170px;
  border: 4px solid var(--surface);
  border-radius: 10px;
  box-shadow: 0 20px 44px -14px rgb(0 0 0 / 0.5);
  transform: rotate(4deg);
}

/* ---------- Publications ---------- */
.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter .count { margin-left: 2px; font-weight: 400; opacity: 0.65; }

.pub-count { margin: 0; color: var(--muted); font-size: 0.95rem; }

.pub-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pub:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: var(--shadow);
}
.pub[hidden] { display: none; }
@media (max-width: 559px) {
  .pub { grid-template-columns: 1fr; gap: 6px; padding: 18px; }
}

.pub-year {
  margin: 0;
  padding-top: 2px;
  color: var(--accent);
  font-family: var(--font-round);
  font-size: 1.05rem;
  font-weight: 700;
}

.pub-title { margin-bottom: 6px; font-size: 1.18rem; line-height: 1.35; text-wrap: pretty; }
.pub-authors { margin-bottom: 4px; color: var(--ink-2); font-size: 0.98rem; }
.pub-authors b {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.2em;
}
.pub-venue { margin-bottom: 14px; color: var(--muted); font-size: 0.96rem; font-style: italic; }
.pub-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pub-actions .chip-link { padding: 6px 13px; font-size: 0.88rem; }

/* ---------- Blog ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 22px;
}

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.post-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.post-cover { aspect-ratio: 16 / 9; overflow: hidden; background: #e8e4d9; }
.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.post-card:hover .post-cover img { transform: scale(1.05); }

.post-body { flex: 1; display: flex; flex-direction: column; padding: 20px 22px 22px; }
.post-meta { margin-bottom: 8px; color: var(--muted); font-size: 0.86rem; }
.post-title { margin-bottom: 18px; font-size: 1.2rem; line-height: 1.35; text-wrap: balance; }
.post-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}
.post-more .icon { transition: transform 0.2s; }
.post-card:hover .post-more .icon { transform: translateX(4px); }

/* ---------- Talks ---------- */
.talk {
  display: grid;
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 880px) {
  .talk { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
}

.talk-more { margin: 22px 0 0; color: var(--muted); font-size: 0.95rem; }

.embed {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 22%, rgb(255 255 255 / 0.14) 0 14%, transparent 15%),
    radial-gradient(circle at 86% 80%, rgb(255 255 255 / 0.1) 0 20%, transparent 21%),
    var(--brand-grad);
}
.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.embed-poster { padding: 24px; text-align: center; }
.embed-kicker {
  margin-bottom: 4px;
  color: rgb(255 255 255 / 0.8);
  font-family: var(--font-round);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.embed-big {
  margin-bottom: 18px;
  font-family: var(--font-round);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
}

/* ---------- Contact ---------- */
.contact-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 32px;
  padding: clamp(22px, 5vw, 60px);
  border-radius: 28px;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 30px 60px -30px rgb(127 17 70 / 0.75);
}
.contact-card::before,
.contact-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.07);
}
.contact-card::before { width: 380px; height: 380px; top: -160px; right: -120px; }
.contact-card::after { width: 240px; height: 240px; bottom: -120px; left: 30%; }
@media (min-width: 880px) {
  .contact-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}

.contact-card .section-kicker { color: #ffd0d6; }
.contact-card .section-title { color: #fff; }
.contact-intro p:last-child { margin: 0; color: rgb(255 255 255 / 0.86); font-size: 1.1rem; }

.contact-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.contact-row { display: flex; gap: 8px; }

.contact-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.2s;
}
.contact-item span { min-width: 0; overflow-wrap: anywhere; }
a.contact-item:hover { background: rgb(255 255 255 / 0.2); }

.copy-btn {
  flex: none;
  width: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s;
}
.copy-btn:hover { background: rgb(255 255 255 / 0.2); }
.contact-card :focus-visible { outline-color: #fff; }

/* ---------- Photography (dark gallery section) ---------- */
.section-dark {
  color-scheme: dark;
  --accent: #ff8f9c;
  --accent-soft: rgb(255 120 140 / 0.14);
  --surface: #1e1b20;
  --surface-2: #29252c;
  --ink: #f4eff0;
  --ink-2: #d9d1d3;
  --muted: #aaa0a4;
  --line: #352f37;
  --focus: #ff8f9c;
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 88% -8%, rgb(127 17 70 / 0.38), transparent 62%),
    radial-gradient(900px 420px at -10% 108%, rgb(152 0 0 / 0.22), transparent 60%),
    #121013;
}

.gallery-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.gallery-hint .icon { color: var(--accent); }

/* Justified rows: every photo keeps its own ratio, all photos of a row share the same height */
/* --row = base row height, tuned so rows stay even (measured at 343 to 1120 px wide) */
.gallery {
  --row: 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (min-width: 600px) {
  .gallery { --row: 130px; gap: 10px; }
}
@media (min-width: 1000px) {
  .gallery { --row: 200px; gap: 12px; }
}
.gallery::after { content: ""; flex-grow: 999999; }

.photo {
  position: relative;
  isolation: isolate;
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--row));
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  cursor: zoom-in;
}
.photo img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar);
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s, opacity 0.6s;
}
.js .photo img:not(.is-loaded) { opacity: 0; }
.photo:hover img { transform: scale(1.05); }
.gallery:has(.photo:hover) .photo:not(:hover) img { filter: brightness(0.55) saturate(0.85); }
.js .gallery:not(.is-expanded) .photo.is-extra { display: none; }

.photo-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 40px 10px 10px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.72));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.photo-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.16);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-family: var(--font-round);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.photo-meta .lens,
.photo-meta .date { display: none; }
.photo:hover .photo-meta,
.photo:focus-visible .photo-meta { opacity: 1; transform: none; }
@media (hover: none), (max-width: 599px) {
  .photo-meta { display: none; }
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

/* Full screen viewer */
.viewer {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: rgb(10 8 10 / 0.97);
  color: #fff;
}
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: rgb(0 0 0 / 0.85); }

.viewer-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  margin: 0;
  padding: 64px 84px 28px;
}
.viewer-stage img {
  width: auto;
  height: auto;
  max-width: min(100%, 1800px);
  max-height: calc(100vh - 180px);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6);
  object-fit: contain;
}
@supports (height: 100dvh) {
  .viewer-stage img { max-height: calc(100dvh - 180px); }
}

.viewer-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
}
.viewer-count { color: #fff; font-family: var(--font-round); font-size: 0.9rem; font-weight: 700; }
.viewer-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.viewer-meta span {
  padding: 4px 10px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  font-family: var(--font-round);
  font-size: 0.76rem;
  font-weight: 700;
}

.viewer-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s;
}
.viewer-btn:hover { background: rgb(255 255 255 / 0.2); }
.viewer-btn .icon { width: 24px; height: 24px; }
.viewer-btn:focus-visible { outline-color: #fff; }
.viewer-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 18px; top: 50%; transform: translateY(-50%); }
.viewer-close { top: 16px; right: 18px; }

@media (max-width: 599px) {
  .viewer-stage { padding: 64px 12px 96px; }
  .viewer-stage img { max-height: calc(100vh - 230px); }
  .viewer-prev,
  .viewer-next { top: auto; bottom: 22px; transform: none; }
  .viewer-prev { left: calc(50% - 64px); }
  .viewer-next { right: calc(50% - 64px); }
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-inner p { margin: 0; }
.to-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.to-top:hover { color: var(--accent); }

/* ---------- Lightbox ---------- */
.lightbox {
  max-width: min(1200px, 94vw);
  max-height: 92vh;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}
.lightbox::backdrop {
  background: rgb(12 6 9 / 0.84);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.lightbox figure {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}
.lightbox img { width: auto; max-height: calc(92vh - 90px); margin: 0 auto; }
.lightbox figcaption { margin-top: 10px; color: #444; font-size: 0.92rem; text-align: center; }
.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #111;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.35);
  cursor: pointer;
}
@media (max-width: 600px) {
  .lightbox-close { top: 8px; right: 8px; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Scroll reveal (only when JS is running) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0s),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0s);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

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

/* ---------- Print ---------- */
@media print {
  .site-header, .scroll-cue, .hero-bg, .hero-overlay, .embed, .copy-btn, .pub-actions button, .lightbox, .viewer, .gallery-more, .toast { display: none !important; }
  .hero { min-height: 0; padding: 0 0 24px; color: #000; background: none; }
  .hero-lead, .hero-meta, .eyebrow { color: #333; }
  .btn { display: none; }
  .section { padding: 24px 0; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .contact-card { color: #000; background: none; box-shadow: none; }
  .contact-item { color: #000; border-color: #ccc; }
}
