:root {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-muted: #f4f4f5;
  --text: #09090b;
  --text-secondary: #3f3f46;
  --text-muted: #52525b;
  --primary: #18181b;
  --cta: #2563eb;
  --cta-hover: #1d4ed8;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --focus-ring: rgba(37, 99, 235, 0.45);
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow-md: 0 4px 16px rgba(9, 9, 11, 0.08);
  --shadow-nav: 0 8px 30px rgba(9, 9, 11, 0.08);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: clamp(2.5rem, 6vw, 3.75rem);
  --text-4xl: clamp(3rem, 8vw, 4.5rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 5rem;

  --content-width: 40rem;
  --page-width: 68rem;
  --page-padding-inline: clamp(1rem, 4vw, 2rem);
  --nav-offset: 1rem;
  --header-height: 3.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --transition: 200ms ease-out;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: manipulation;
}

body.nav-open {
  overflow: hidden;
}

button {
  font-family: inherit;
}

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

a {
  color: var(--cta);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--transition);
  cursor: pointer;
}

a:hover {
  color: var(--cta-hover);
}

a.project-card:hover {
  color: var(--text);
}

a.btn--secondary:hover {
  color: var(--text) !important;
}

button,
.btn,
.nav-toggle,
.social a,
.project-card,
.entries__link,
.site-nav__links a {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100%;
  z-index: 1000;
  padding: var(--space-1) var(--space-2);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-2);
}

/* One shared left edge for nav, hero, and every section title */
.page {
  --rail-inner: min(
    var(--page-width),
    100% - 2 * var(--page-padding-inline)
  );
  box-sizing: border-box;
  display: grid;
  grid-template-columns:
    minmax(var(--page-padding-inline), 1fr)
    minmax(0, var(--rail-inner))
    minmax(var(--page-padding-inline), 1fr);
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: 0;
}

.page > * {
  grid-column: 2;
  min-width: 0;
}

/* Floating header shell */
.header-shell {
  position: sticky;
  top: var(--nav-offset);
  z-index: 100;
  padding: var(--nav-offset) 0 0;
  margin-bottom: var(--space-2);
}

.site-header {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    box-shadow var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.site-header.is-scrolled {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--header-height);
  padding-inline: var(--space-3);
}

.nav-toggle {
  display: none;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  color: var(--text);
  line-height: 0;
}

.nav-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.site-nav {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.site-nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color var(--transition);
}

.site-nav__links a:hover,
.site-nav__links a.is-active {
  color: var(--text);
}

.site-nav__links a.is-active {
  box-shadow: inset 0 -2px 0 var(--cta);
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.25;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.site-header__email {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
}

.btn-nav--ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: transparent;
}

.btn-nav--ghost:hover {
  background: var(--bg-muted);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-nav--primary {
  color: #fff;
  background: var(--cta);
  border: 1px solid var(--cta);
}

.btn-nav--primary:hover {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
  color: #fff !important;
}

@media (max-width: 960px) {
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.4);
    z-index: 105;
    pointer-events: auto;
  }

  .header-shell {
    z-index: 110;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: fixed;
    left: 50%;
    right: auto;
    width: min(
      calc(var(--page-width) - 2 * var(--page-padding-inline)),
      calc(100vw - 2 * var(--page-padding-inline))
    );
    top: calc(var(--header-height) + var(--nav-offset) * 3);
    z-index: 110;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - var(--header-height) - var(--nav-offset) * 4);
    overflow-y: auto;
    transform: translate(-50%, -8px);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity var(--transition),
      transform var(--transition);
  }

  .site-nav.is-open {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav__links {
    flex-direction: column;
    gap: 0;
  }

  .site-nav__links a {
    padding: 0.65rem 0;
  }

  .site-header__inner {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .site-nav {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
    justify-content: stretch;
  }

  .site-header__email {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
  }
}

/* Sections */
.section {
  padding: var(--space-7) 0;
  scroll-margin-top: calc(
    var(--header-height) + var(--nav-offset) * 2 + var(--space-2)
  );
}

@media (max-width: 640px) {
  .section {
    padding: var(--space-5) 0;
  }

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

  .hero__title {
    font-size: var(--text-3xl);
  }

  .hero__lead {
    font-size: var(--text-lg);
  }
}

.section > .page {
  padding-top: 0;
  padding-bottom: 0;
}

.section--muted {
  background: var(--bg-muted);
  border-block: 1px solid var(--border);
}

.section__inner {
  width: 100%;
}

/* Keep section titles on the global left rail; narrow only body content */
.section__inner--narrow {
  max-width: none;
}

.section__inner--narrow > :not(.section-header) {
  max-width: var(--content-width);
}

.section__inner--centered {
  text-align: center;
}

.section__inner--centered .section-header {
  text-align: center;
}

.section__inner--centered .entries {
  max-width: var(--content-width);
  margin-inline: auto;
  text-align: left;
}

.section-header {
  margin-bottom: var(--space-5);
  text-align: left;
  width: 100%;
}

.hero__title,
.section-title {
  margin-inline: 0;
  padding-inline: 0;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cta);
  margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
  color: var(--text);
}

.section-desc {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--text-lg);
  max-width: 36rem;
}

.section.is-visible {
  animation: reveal 0.45s ease-out forwards;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .section.is-visible {
    animation: none;
    opacity: 1;
  }
}

/* Hero */
.hero {
  padding-top: var(--space-4);
  padding-bottom: var(--space-6);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  align-items: center;
}

@media (min-width: 900px) {
  .hero {
    padding-top: var(--space-5);
  }

  .hero__grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: var(--space-6);
  }
}

.hero__badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: var(--space-3);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.hero__lead {
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
  line-height: 1.4;
}

.hero__intro {
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  max-width: 32rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.hero__photo {
  margin: 0 auto;
  width: min(100%, 16rem);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--bg-elevated);
}

@media (min-width: 900px) {
  .hero__photo {
    margin: 0;
    width: 100%;
    max-width: 18rem;
    justify-self: center;
  }
}

.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.social a:hover {
  color: var(--cta);
  border-color: var(--cta);
  background: #eff6ff;
}

.social svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

/* Timeline — editorial stacked cards (no rail/dots) */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.timeline__item {
  margin: 0;
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
  width: fit-content;
  max-width: 100%;
  padding: 0.35rem 0.65rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
}

.section--muted .timeline__date {
  background: var(--bg);
}

.timeline__content {
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.timeline__item:hover .timeline__content {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.timeline__content h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.timeline__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 0.2rem;
}

.timeline__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.timeline__link:hover {
  color: var(--cta);
  border-color: var(--cta);
  background: #eff6ff;
}

.timeline__link svg {
  width: 1rem;
  height: 1rem;
}

.timeline__head + .timeline__intro {
  margin-top: var(--space-2);
}

.timeline__role {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.timeline__content > .timeline__role {
  margin-bottom: var(--space-2);
}

.timeline__intro {
  margin: 0 0 var(--space-3);
}

.timeline__roles {
  display: grid;
  gap: var(--space-3);
}

.timeline__role-block {
  display: grid;
  gap: var(--space-2);
}

.timeline__role-block--past .timeline__role {
  color: var(--text-secondary);
}

.timeline__role-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.timeline__role-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline__role-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timeline__role-divider::before,
.timeline__role-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.timeline__role-divider span {
  flex-shrink: 0;
}

.timeline__content p {
  margin: 0 0 var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  overflow-wrap: break-word;
}

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

.timeline__note {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timeline__content--future {
  border-style: dashed;
  background: var(--bg-muted);
}

.timeline__date--future {
  color: var(--cta);
  border-color: rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.06);
}

/* Publications list */
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.entries__item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.entries__item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.entries__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.entries__head h3 {
  flex: 1 1 12rem;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.entries__head h3 a {
  color: var(--text);
  text-decoration: none;
}

.entries__head h3 a:hover {
  color: var(--cta);
}

.entries__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.entries__link:hover {
  color: var(--cta);
  border-color: var(--cta);
  background: #eff6ff;
}

.entries__link svg {
  width: 1rem;
  height: 1rem;
}

.entries__item > p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Project grid */
.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.project-card:hover {
  border-color: var(--cta);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.project-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.project-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
}

.project-card__icon {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition);
}

.project-card:hover .project-card__icon {
  color: var(--cta);
}

.project-card__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
}

.tag-list li {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
}

.project-card__desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* References carousel */
.references-carousel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--space-2);
  row-gap: var(--space-3);
}

.references-carousel__btn--prev {
  grid-column: 1;
  grid-row: 1;
}

.references-carousel__viewport {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  overflow: hidden;
  outline: none;
  touch-action: pan-y pinch-zoom;
  overscroll-behavior-x: contain;
  border-radius: var(--radius-lg);
}

.references-carousel__btn--next {
  grid-column: 3;
  grid-row: 1;
}

.references-carousel__controls {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

@media (max-width: 640px) {
  .references-carousel__viewport {
    grid-column: 1 / -1;
  }

  .references-carousel__btn--prev,
  .references-carousel__btn--next,
  .references-carousel__controls {
    grid-row: 2;
  }

  .references-carousel__controls {
    grid-column: 2;
    flex-wrap: nowrap;
  }
}

.references-carousel__track {
  display: flex;
  width: 100%;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.references-carousel--reduced .references-carousel__track {
  transition: none;
}

.references-carousel .reference {
  flex: 0 0 100%;
  margin: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
  min-width: 0;
}

.references-carousel__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.references-carousel__btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.references-carousel__btn:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.references-carousel__btn:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 2px;
}

.references-carousel__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.references-carousel__dots {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.references-carousel__dot {
  position: relative;
  width: 0.55rem;
  height: 0.55rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition);
}

.references-carousel__dot::before {
  content: "";
  position: absolute;
  inset: -0.75rem;
}

.references-carousel__dot:hover {
  background: var(--text-muted);
}

.references-carousel__dot:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 2px;
}

.references-carousel__dot.is-active {
  background: var(--cta);
  transform: scale(1.15);
}

.references-carousel__progress {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reference p {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
}

.reference__author {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  margin: 0 0 0.15rem;
  color: var(--text);
}

.reference__role {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0.75rem 1.35rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.btn--primary {
  background: var(--cta);
  color: #fff;
  border-color: var(--cta);
}

.btn--primary:hover {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
  color: #fff !important;
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text) !important;
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  background: var(--bg-muted);
  color: var(--text) !important;
  border-color: var(--text-muted);
}

/* Dialog */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 32rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-md);
  background: var(--bg-elevated);
}

dialog::backdrop {
  background: rgba(9, 9, 11, 0.5);
}

.dialog__inner {
  padding: var(--space-5);
}

.dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.dialog__header h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.03em;
}

.dialog__close {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 0;
  border-radius: var(--radius);
  transition:
    color var(--transition),
    border-color var(--transition);
}

.dialog__close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.dialog__close svg {
  width: 1.125rem;
  height: 1.125rem;
}

.form-field {
  margin-bottom: var(--space-3);
}

.form-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  width: 100%;
  font: inherit;
  font-size: var(--text-base);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--cta);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-field textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-note {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
  line-height: 1.55;
}

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(9, 9, 11, 0.55);
}

.success-overlay[hidden] {
  display: none;
}

.success-overlay__card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 24rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.success-overlay__card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 var(--space-1);
}

.success-overlay__card p {
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
}

.site-footer {
  padding: var(--space-5) 0 var(--space-7);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.page-404 {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.page-404 h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.03em;
}

.page-404 p {
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
}

@media print {
  .header-shell,
  .social,
  dialog,
  .success-overlay,
  .nav-toggle,
  .hero__actions {
    display: none !important;
  }

  .section {
    padding: var(--space-3) 0;
    break-inside: avoid;
  }
}

/* ── Hub landing page ─────────────────────────────── */

.hub-grid {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .hub-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

a.hub-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--text);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

a.hub-card:hover {
  border-color: var(--cta);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.hub-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.hub-card:hover .hub-card__icon {
  color: var(--cta);
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.25);
}

.hub-card__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.hub-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.hub-card__desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.hub-card__cta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

.hub-card:hover .hub-card__cta {
  color: var(--cta);
}

.hub-card__cta svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* ── Books ──────────────────────────────────────────── */

.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

a.book-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  text-decoration: none;
  color: var(--text);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

@media (min-width: 480px) {
  a.book-item {
    gap: var(--space-4);
  }
}

a.book-item:hover {
  border-color: var(--cta);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.book-cover {
  flex-shrink: 0;
  width: 4.5rem;
}

@media (min-width: 480px) {
  .book-cover {
    width: 5.5rem;
  }
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 0.2rem;
  box-shadow: 2px 4px 12px rgba(9, 9, 11, 0.18);
  display: block;
}

.book-cover__placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-strong);
}

.book-cover__placeholder svg {
  width: 1.5rem;
  height: 1.5rem;
}

.book-meta {
  min-width: 0;
  flex: 1;
}

.book-meta__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem var(--space-2);
  margin-bottom: 0.35rem;
}

.book-meta__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.book-meta__author {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}

.book-status {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.book-status--reading {
  color: var(--cta);
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.25);
}

.book-status--read {
  color: var(--text-muted);
  background: var(--bg-muted);
  border-color: var(--border);
}

/* ── Dark theme ─────────────────────────────────────── */

:root {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --bg-elevated: #18181b;
  --bg-muted: #1c1c1f;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --primary: #e4e4e7;
  --cta: #3b82f6;
  --cta-hover: #60a5fa;
  --border: #27272a;
  --border-strong: #3f3f46;
  --focus-ring: rgba(59, 130, 246, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-nav: 0 8px 30px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .site-header {
  background: rgba(18, 18, 20, 0.9);
}

[data-theme="dark"] .social a:hover,
[data-theme="dark"] .timeline__link:hover,
[data-theme="dark"] .entries__link:hover,
[data-theme="dark"] .hub-card:hover .hub-card__icon {
  background: rgba(59, 130, 246, 0.15);
}

/* ── Theme toggle ────────────────────────────────────── */

.site-header__actions {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 960px) {
  .site-header__actions {
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-muted);
}

.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

/* ── Nav separator ──────────────────────────────────── */

.site-nav__sep {
  width: 1px;
  align-self: stretch;
  background: var(--border-strong);
  margin: 0.2rem 0.1rem;
}

@media (max-width: 960px) {
  .site-nav__sep {
    width: 100%;
    height: 1px;
    margin: 0.35rem 0;
    align-self: auto;
  }
}

/* ── About-page section hierarchy ─────────────────── */

.site-nav__sep--into {
  width: auto;
  align-self: center;
  background: none;
  margin: 0 0.25rem;
}

.site-nav__sep--into::after {
  content: "›";
  display: block;
  font-size: 1rem;
  line-height: 1;
  color: var(--border-strong);
}

.site-nav__child a {
  font-size: 0.8125rem;
}

@media (max-width: 960px) {
  .site-nav__sep--into {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0 0.25rem;
  }

  .site-nav__sep--into::after {
    display: none;
  }

  .site-nav__child a {
    padding-left: var(--space-2);
    font-size: var(--text-sm);
  }
}
