:root {
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #050505;
  --bg-elevated: #111111;
  --card: #141414;
  --card-hover: #1a1a1a;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --accent: #34d399;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-hover: #f0f0f2;
  --border: rgba(0, 0, 0, 0.08);
  --text: #0a0a0a;
  --muted: #52525b;
  --accent: #059669;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.top {
  position: sticky;
  top: 0.75rem;
  z-index: 50;
  padding-bottom: 0.25rem;
  background: linear-gradient(to bottom, var(--bg) 60%, transparent);
}

.nav-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .nav-icon {
    width: 34px;
    height: 34px;
  }
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-icon:hover {
  color: var(--text);
  background: var(--card-hover);
}

.nav-icon.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-elevated);
}

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

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

main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.section.card {
  padding: 1.35rem 1.35rem 1.45rem;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
}

.hero-card .hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}
.eyebrow.tight {
  margin-bottom: 0.5rem;
}

.dot,
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.badge-avail {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  white-space: nowrap;
}
.badge-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 520px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-card .hero-top {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-ctas {
    justify-content: center;
  }
  .hero-visual {
    justify-self: center;
  }
}

.hero-name {
  margin: 0 0 0.65rem;
  font-size: clamp(1.65rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-bio {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn-outline:hover {
  background: var(--card-hover);
}

.avatar-ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--text) 35%, transparent), var(--border));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 106px;
  height: 106px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.avatar-img.is-fallback-hidden {
  display: none !important;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.05em;
  color: var(--muted);
}

.avatar-ring .avatar-fallback {
  width: 106px;
  height: 106px;
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.8125rem;
}
.link-arrow {
  text-decoration: none;
  color: var(--muted);
}
.link-arrow:hover {
  color: var(--text);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.item-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  background: var(--bg-elevated);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.item-row:hover {
  background: var(--card-hover);
  border-color: var(--border);
}

.item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--icon-bg, #333);
  flex-shrink: 0;
}

.item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.item-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.item-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.item-chev,
.item-external {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1;
}

.cta-card .section-title {
  font-size: 1.5rem;
}
.cta-card .section-lead {
  margin-bottom: 1.25rem;
}

.social-row {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.social-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.social-link:hover {
  background: var(--card-hover);
  color: var(--text);
}
.social-link svg {
  flex-shrink: 0;
}

.footer {
  text-align: center;
  margin-top: 2rem;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease);
  z-index: 100;
}
.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

/* —— TL;DR / Full subsection —— */
.subsection {
  margin-top: 1.15rem;
}
.subsection:first-of-type {
  margin-top: 0.35rem;
}
.subsection-label {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* —— Row with hover preview (desktop) + link to detail —— */
.item-block {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.item-block:hover,
.item-block:focus-within {
  background: var(--card-hover);
  border-color: var(--border);
}

.item-row-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
}

.item-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--icon-bg, #333);
}

.item-initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  z-index: 0;
  letter-spacing: -0.02em;
}

.item-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  /* Shows through transparent PNG pixels instead of the coloured --icon-bg chip */
  background: var(--bg-elevated);
}

.item-logo-fallback[data-logo-fit="contain"] .item-logo {
  object-fit: contain;
  padding: 5px;
}

/* Dual-theme logos use a single <img.item-logo--theme>; src is swapped in main.js */

/* Single black asset: invert in dark mode for visibility on dark UI.
   background must be transparent so the filter doesn't invert the element's
   own background-color (which would make it near-white and hide the logo). */
html[data-theme="dark"] .item-logo-fallback > .item-logo--invert-dark {
  filter: invert(1);
  background: transparent;
}

.item-logo.is-fallback-hidden {
  display: none;
}

.item-title-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.item-title {
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.item-block:hover .item-title,
.item-block:focus-within .item-title {
  border-bottom-color: color-mix(in srgb, var(--muted) 45%, transparent);
}

.item-block--full:hover .item-title,
.item-block--full:focus-within .item-title {
  border-bottom-color: transparent;
}

.item-row-main--static {
  cursor: default;
}

.item-full-detail {
  padding: 0 0.85rem 0.75rem;
  border-top: 1px solid var(--border);
  margin: 0 0.25rem;
}

.item-detail-bullets {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.item-detail-bullets li {
  margin-bottom: 0.4rem;
}

.item-detail-bullets li:last-child {
  margin-bottom: 0;
}

.item-full-lead {
  margin: 0;
  line-height: 1.45;
}

.item-preview {
  display: none;
  padding: 0 0.85rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin: 0 0.25rem;
}
.item-preview-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.85;
}

@media (hover: hover) and (pointer: fine) {
  .item-block:hover .item-preview,
  .item-block:focus-within .item-preview {
    display: block;
  }
}

.item-meta-touch {
  display: none;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (hover: none), (pointer: coarse) {
  .item-meta-touch {
    display: block;
  }
}

/* —— Detail (subpages) —— */
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.back-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--card);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.back-link:hover {
  color: var(--text);
  background: var(--card-hover);
}

.detail-card .detail-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.detail-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.detail-meta {
  margin: 0 0 1.1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.detail-bullets {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.detail-bullets li {
  margin-bottom: 0.5rem;
}
.detail-bullets li:last-child {
  margin-bottom: 0;
}

.detail-gallery {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.detail-gallery h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.gallery-cell {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  padding: 0.5rem;
}

.gallery-cell--photo {
  padding: 0;
  border-style: solid;
  border-color: var(--border);
  overflow: hidden;
}

.gallery-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
}

.gallery-thumb {
  cursor: pointer;
  font: inherit;
  color: inherit;
  border: 1px solid var(--border);
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.gallery-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gallery-hint {
  margin: 0 0 0.5rem;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, black);
  backdrop-filter: blur(6px);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.gallery-lightbox__panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto;
  grid-template-areas: "prev fig next";
  align-items: center;
  gap: 0.35rem;
  max-width: min(96vw, 1100px);
  max-height: min(92vh, 900px);
  width: 100%;
}

.gallery-lightbox__prev {
  grid-area: prev;
}

.gallery-lightbox__next {
  grid-area: next;
}

.gallery-lightbox__figure {
  grid-area: fig;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  max-height: min(92vh, 900px);
}

.gallery-lightbox__figure img {
  max-width: 100%;
  max-height: min(78vh, 760px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.gallery-lightbox__caption {
  margin: 0;
  padding: 0 0.5rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  max-width: 52ch;
}

.gallery-lightbox__counter {
  margin: 0;
}

.gallery-lightbox__nav,
.gallery-lightbox__close {
  position: relative;
  z-index: 2;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: background 0.15s var(--ease);
}

.gallery-lightbox__nav:hover,
.gallery-lightbox__close:hover {
  background: var(--card-hover);
}

.gallery-lightbox__nav:focus-visible,
.gallery-lightbox__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gallery-lightbox__nav {
  width: 2.5rem;
  height: 2.75rem;
  font-size: 1.75rem;
  padding: 0 0.15rem 0.15rem;
  flex-shrink: 0;
  align-self: center;
}

.gallery-lightbox__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.35rem;
  padding: 0;
  margin: -0.25rem -0.25rem 0 0;
}

@media (max-width: 640px) {
  .gallery-lightbox__panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "fig fig"
      "prev next";
    max-height: none;
    gap: 0.5rem;
  }

  .gallery-lightbox__prev {
    grid-area: prev;
    justify-self: stretch;
    width: 100%;
  }

  .gallery-lightbox__figure {
    grid-area: fig;
    max-height: none;
  }

  .gallery-lightbox__figure img {
    max-height: min(62vh, 520px);
  }

  .gallery-lightbox__next {
    grid-area: next;
    justify-self: stretch;
    width: 100%;
  }

  .gallery-lightbox__nav {
    height: 2.5rem;
    font-size: 1.5rem;
  }
}

.detail-placeholder {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 0.85rem;
  color: var(--muted);
}

.subtle-code {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

/* —— Homepage / detail featured photo (SEO + social previews) —— */
.highlight-card .section-title {
  margin-bottom: 0.65rem;
}

.highlight-figure {
  margin: 0;
}

.highlight-figure--tight {
  margin-bottom: 1rem;
}

.highlight-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.highlight-caption {
  margin: 0.5rem 0 0;
  line-height: 1.4;
}

.section-title--sm {
  font-size: 1.05rem;
}

.highlight-more {
  margin-top: 0.75rem;
}

.section-lead--tight {
  margin-bottom: 0.75rem;
}

.is-hidden {
  display: none !important;
}

.depth-toggle {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.depth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.depth-tab.is-active {
  background: var(--card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.cv-branch + .cv-branch {
  margin-top: 1.2rem;
}

.branch-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.branch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

@keyframes dot-shimmer {
  0%, 100% {
    box-shadow: 0 0 0 2.5px color-mix(in srgb, #a78bfa 28%, transparent);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, #a78bfa 10%, transparent);
    opacity: 0.75;
  }
}

.branch-label.is-active .branch-dot {
  background: #a78bfa;
  box-shadow: 0 0 0 2.5px color-mix(in srgb, #a78bfa 28%, transparent);
  animation: dot-shimmer 1.8s ease-in-out infinite;
}
