 :root {
  --bg: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-header: rgba(252, 252, 252, 0.9);
  --text: #111827;
  --muted: #374151;
  --muted-soft: #6b7280;
  --border-subtle: rgba(15, 23, 42, 0.06);
  --border-soft: rgba(148, 163, 184, 0.4);
  --accent: #198754;
  --accent-soft: rgba(25, 135, 84, 0.12);
  --card: #e5e7eb;
  --card-soft: #f3f4f6;
  --shadow-soft: rgba(15, 23, 42, 0.12);
  --shadow-strong: rgba(15, 23, 42, 0.4);
}

[data-theme="dark"] {
  --bg: #020617;
  --bg-elevated: #020617;
  --bg-header: rgba(2, 6, 23, 0.9);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --muted-soft: #6b7280;
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-soft: rgba(31, 41, 55, 0.9);
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.16);
  --card: #0f172a;
  --card-soft: #020617;
  --shadow-soft: rgba(15, 23, 42, 0.85);
  --shadow-strong: rgba(0, 0, 0, 0.85);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Gelasio", Georgia, "Times New Roman", Times, serif;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-logo-orb {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: block;
  background: radial-gradient(circle at 30% 20%, #709e76, transparent 55%),
    radial-gradient(circle at 80% 80%, #5dcf6c, transparent 60%);
  box-shadow: 0 0 0 1px var(--border-subtle), 0 14px 30px var(--shadow-soft);
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.3s ease;
}

.site-logo:hover .site-logo-orb {
  transform: rotate(360deg) scale(1.03);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 18px 40px var(--shadow-soft);
}

.site-nav {
  display: flex;
  gap: 12px;
}

.nav-link {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--muted-soft);
  padding: 4px 2px;
  cursor: pointer;
  position: relative;
  transition: color 0.16s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.16s ease;
}

.nav-link.is-active {
  color: var(--text);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

[data-theme="dark"] .nav-link {
  color: #e5e7eb;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.is-active {
  color: #ffffff;
}

.theme-toggle {
  border: none;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--text);
}

[data-theme="dark"] .theme-toggle-icon {
  color: #fff;
}

/* Toggle icon: moon in light, sun in dark */
.theme-toggle-icon .theme-icon-sun {
  display: none;
}

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

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

.page {
  max-width: 920px;
  margin: 0 auto 64px;
  padding: 48px 20px 40px;
}

.page-section {
  display: none;
}

.page-section.is-visible {
  display: block;
}

.page-section-inner {
  max-width: 720px;
}

.home-content h1 {
  font-size: clamp(32px, 4vw, 40px);
  line-height: 1.1;
  margin: 0 0 18px;
}

.home-content p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 24px;
}

.home-email {
  margin-top: 18px;
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  position: relative;
}

.external-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: rgba(15, 23, 42, 0.3);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.16s ease;
}

.external-link:hover::after {
  transform: scaleX(1);
}

.external-icon {
  font-size: 12px;
  transform: translateY(-1px);
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}

.inline-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%; 
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.16s ease;
}

.inline-link:hover::after {
  transform: scaleX(1);
}

h2 {
  font-size: 22px;
  margin: 0 0 10px;
}

.section-intro {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.section-intro.secondary {
  font-size: 14px;
  color: var(--muted-soft);
}

.work-content {
  max-width: 780px;
}

.work-entry {
  display: block;
  padding: 16px 0 18px;
  border-top: 1px solid var(--border-soft);
}

.work-entry:last-of-type {
  border-bottom: 1px solid var(--border-soft);
}

.work-title {
  margin: 0 0 4px;
  font-size: 16px;
}

.work-text h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.work-meta {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted-soft);
}

.work-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.work-description {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.work-photos-stack {
  position: relative;
  margin: 0px 0 0px;
  min-height: 180px;
}

.photo-layer {
  position: absolute;
  transition: left 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
    right 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
    top 240ms cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.photo-layer.photo-left {
  left: 0;
  top: 18px;
  transform: rotate(-6deg);
}

.photo-layer.photo-center {
  left: 50%;
  transform: translateX(-50%) rotate(1.5deg);
  z-index: 2;
}

.photo-layer.photo-right {
  right: 0;
  top: 12px;
  transform: rotate(6deg);
}

.photo-card {
  border-radius: 18px;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 12px;
  color: var(--muted-soft);
  box-shadow: 0 10px 24px var(--shadow-soft);
}


.photo-card-marque {
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 12px;
  color: var(--muted-soft);
  box-shadow: 0 10px 24px var(--shadow-soft);
}

.photo-card-marque.small {
  width: 144px;
  height: 108px;
}


.photo-card.large {
  width: 220px;
  height: 170px;
}

.photo-card.medium {
  width: 160px;
  height: 130px;
}

.photo-card.small {
  width: 120px;
  height: 90px;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.logo-card {
  box-shadow: none;
  background: transparent;
  border-radius: 18px;
  overflow: hidden;
}

.logo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  padding: 0;
  background: transparent;
}

.work-photos-stoke {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  min-height: 255px;
}

.work-photos-stoke .photo-card.large {
  width: 360px;
  height: 240px;
}

/* havoc + fedtech: collapsed stack, expands on hover */
.work-photos-havoc,
.work-photos-fedtech {
  margin-top: 30px;
  min-height: 190px;
}

.work-photos-havoc .photo-layer.photo-left,
.work-photos-fedtech .photo-layer.photo-left {
  left: 22%;
  top: 18px;
  transform: rotate(-3deg);
}

.work-photos-havoc .photo-layer.photo-right,
.work-photos-fedtech .photo-layer.photo-right {
  right: 22%;
  top: 14px;
  transform: rotate(3deg);
}

.work-photos-havoc .photo-layer.photo-center,
.work-photos-fedtech .photo-layer.photo-center {
  left: 50%;
  transform: translateX(-50%) rotate(0.5deg);
}

.work-photos-havoc:hover .photo-layer.photo-left,
.work-photos-fedtech:hover .photo-layer.photo-left {
  left: 0;
  top: 18px;
  transform: rotate(-6deg);
}

.work-photos-havoc:hover .photo-layer.photo-right,
.work-photos-fedtech:hover .photo-layer.photo-right {
  right: 0;
  top: 12px;
  transform: rotate(6deg);
}

.work-photos-havoc:hover .photo-layer.photo-center,
.work-photos-fedtech:hover .photo-layer.photo-center {
  left: 50%;
  transform: translateX(-50%) rotate(1.5deg);
}

.fellowship-photos-ilf {
  min-height: auto;
}

.fellowship-photos-ilf .photo-card.small {
  width: 160px;
  height: 110px;
}

.work-photos-havoc .photo-card,
.work-photos-fedtech .photo-card {
  min-width: 140px;
  min-height: 110px;
}

.fellowships {
  margin-top: 30px;
}

.fellowships h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.fellowship-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr);
  gap: 20px;
  margin-top: 16px;
}

.fellowship-card {
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fellowship-text h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.fellowship-text > p:not(.work-meta) {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.fellowship-photos {
  display: flex;
  justify-content: flex-start;
  position: relative;
}

.fellowship-photos .photo-card,
.photo-card-marque {
  margin-block: 10px;
}

.fellowship-photos-ilf {
  min-height: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.builds-grid,
.life-grid {
  display: block;
  column-count: 3;
  column-gap: 18px;
  margin-top: 16px;
}

/* Life uses grid-based masonry to preserve chronological order. */
.gallery-grid.life-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.life-grid-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.builds-grid .gallery-item,
.life-grid .gallery-item {
  break-inside: avoid;
  margin-bottom: 18px;
  display: block;
  width: 100%;
}

.life-grid .gallery-item {
  margin: 0;
  margin-bottom: 0;
  line-height: 0;
}

.builds-grid .gallery-thumb,
.life-grid .gallery-thumb {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px var(--shadow-soft);
}

.builds-grid .gallery-thumb img,
.life-grid .gallery-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
}

.gallery-item {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.gallery-thumb {
  border-radius: 22px;
  overflow: hidden;
  background: transparent;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 13px;
  color: var(--muted-soft);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Diagonal photo reveal animation (top-left to bottom-right). */
.page-section img.photo-reveal {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 320ms ease, transform 320ms ease;
}

.page-section img.photo-reveal.is-loaded {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item:hover .gallery-thumb {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px var(--shadow-soft);
}

.placeholder-photo {
  background: linear-gradient(135deg, var(--card), var(--card-soft));
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
}

.note-item:hover {
  color: var(--accent);
}

.note-chevron {
  font-size: 16px;
  color: var(--muted-soft);
}

.note-modal[hidden] {
  display: none;
}

.note-modal {
  position: fixed;
  inset: 0;
  z-index: 210;
  pointer-events: none;
}

.note-modal:not([hidden]) {
  pointer-events: auto;
}

.note-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
}

.note-modal.is-closing .note-modal-backdrop {
  display: none;
}

.note-modal-dialog {
  position: relative;
  max-width: 520px;
  margin: 80px auto;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 18px 20px 20px;
  box-shadow: 0 22px 50px var(--shadow-strong);
  max-height: calc(100vh - 160px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.note-modal.is-open .note-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.note-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.note-modal-title {
  margin: 4px 0 10px;
  font-size: 18px;
}

.note-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Keep scrollbar from covering text */
  padding-right: 18px;
  min-height: 0;
}

.note-modal-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.note-modal-text p {
  margin: 0 0 10px;
}

.note-quote-text {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  color: var(--text);
}

.note-quote-attrib {
  text-align: right;
  font-size: 13px;
  color: var(--muted-soft);
  margin-top: 4px;
}

.note-quote-expl {
  margin-top: 10px;
}

.note-quote-block {
  margin-bottom: 18px;
}

.note-modal-text ul {
  margin: 6px 0 0 22px;
  padding: 0;
}

.note-modal-text li {
  margin-bottom: 8px;
}

.note-modal-text a,
.note-modal-text a:visited {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}

.note-modal-text a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.16s ease;
}

.note-modal-text a:hover::after {
  transform: scaleX(1);
}

.build-modal[hidden] {
  display: none;
}

.build-modal {
  position: fixed;
  inset: 0;
  z-index: 215;
  pointer-events: none;
}

.build-modal:not([hidden]) {
  pointer-events: auto;
}

.build-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
}

.build-modal.is-closing .build-modal-backdrop {
  display: none;
}

.build-modal-dialog {
  position: relative;
  max-width: 560px;
  margin: 80px auto;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 18px 20px 20px;
  box-shadow: 0 22px 50px var(--shadow-strong);
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.build-modal.is-open .build-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.build-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.build-modal-title {
  margin: 4px 0 10px;
  font-size: 18px;
}

.build-modal-text {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.build-modal-text a,
.build-modal-text a:visited {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}

.build-modal-text a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.16s ease;
}

.build-modal-text a:hover::after {
  transform: scaleX(1);
}

.build-modal-sub-images {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.build-modal-sub-images img {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 10px 24px var(--shadow-soft);
}

.build-modal-sub-images iframe {
  width: min(420px, 100%);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 10px 24px var(--shadow-soft);
}

.life-modal[hidden] {
  display: none;
}

/* No opacity on the root: fading the whole layer delayed the backdrop blur. Blur is instant; only the dialog animates. */
.life-modal {
  position: fixed;
  inset: 0;
  z-index: 218;
  pointer-events: none;
}

.life-modal:not([hidden]) {
  pointer-events: auto;
}

.life-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
}

.life-modal.is-closing .life-modal-backdrop {
  display: none;
}

.life-modal-dialog {
  position: relative;
  max-width: 520px;
  margin: 72px auto;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 18px 20px 20px;
  box-shadow: 0 22px 50px var(--shadow-strong);
  transform: translateY(8px) scale(0.985);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.life-modal.is-open .life-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.life-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.life-modal-image-wrap {
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--card);
}

.life-modal-image {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  display: block;
}

.life-modal-title {
  margin: 0 0 6px;
  font-size: 17px;
}

.life-modal-date {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted-soft);
}

.life-modal-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

@media (max-width: 768px) {
  .site-header-inner {
    padding-inline: 14px;
  }

  .page {
    padding-inline: 16px;
  }

  .work-entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .fellowship-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .builds-grid,
  .life-grid {
    column-count: 2;
  }

  .gallery-grid.life-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fellowship-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

