/* Self-hosted fonts (variable, Latin): no request to Google before the first paint */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Tektur";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/tektur-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Shared base styles and small UI components used on every page */
:root {
  --page-bg: #0f0c29;
  --text-color: #ffffff;
}
html.light-theme {
  --page-bg: #f8fafc;
  --text-color: #334155;
}
body {
  color: var(--text-color);
  background-color: var(--page-bg);
  transition: background-color 0.3s;
}

/* Reading progress along the top edge */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--primary, #40c4ff), var(--accent, #a78bfa));
  box-shadow: 0 0 10px var(--primary, #40c4ff);
  z-index: 100001;
  pointer-events: none;
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.2));
  background: var(--card, rgba(20, 25, 45, 0.82));
  color: var(--primary, #40c4ff);
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  translate: 0 16px;
  pointer-events: none;
  transition:
    opacity 0.3s,
    translate 0.3s,
    border-color 0.3s;
  z-index: 1200;
}
.back-to-top.is-shown {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}
.back-to-top:hover {
  border-color: var(--primary, #40c4ff);
}
/* Pages with the bottom pill bar keep the button clear of it */
.has-pill-nav .back-to-top {
  bottom: 84px;
}
@media (min-width: 1280px) {
  .has-pill-nav .back-to-top {
    bottom: 24px;
  }
}

/* Scroll reveal. Uses the standalone `translate` property so hover transforms keep working */
.reveal {
  opacity: 0;
  translate: 0 14px;
  transition:
    opacity 0.5s ease-out,
    translate 0.5s ease-out;
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

/* Image lightbox for galleries */
.sj-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(2, 2, 8, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sj-lightbox.is-open {
  display: flex;
}
.sj-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}
.sj-lightbox button {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 25, 45, 0.8);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}
.sj-lightbox .lb-close {
  top: 16px;
  right: 16px;
}
.sj-lightbox .lb-prev {
  left: 16px;
}
.sj-lightbox .lb-next {
  right: 16px;
}
.sj-lightbox .lb-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  translate: -50% 0;
  color: rgba(255, 255, 255, 0.8);
  font-family: Tektur, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 2px;
}
.is-zoomable {
  cursor: zoom-in;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    translate: none;
    transition: none;
  }
  .back-to-top {
    transition: none;
  }
}

/* Performance: the ambient flare layer stays still instead of repainting the whole screen every frame */
body::after {
  animation: none !important;
}

/* Text for screen readers only */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Circular profile photo (Home, About, Résumé). The photo is a transparent cut-out:
   it sits on a themed backdrop disc inside the gradient ring, and the head rises
   above the top of the ring while the shoulders stay clipped to the circle. */
.hero-avatar {
  --ring: 4px;
  --rim: 3px;
  --rim-color: #0b0d17;
  --pop: 1.22; /* cut-out box height relative to the disc: the extra 22% is head-room above the ring */
  --size: clamp(160px, 20vw + 82px, 232px);
  position: relative;
  flex-shrink: 0;
  width: var(--size);
  aspect-ratio: 1;
  margin-top: calc(var(--size) * 0.12);
  margin-bottom: 1.4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #a78bfa);
  box-shadow:
    0 0 0 6px rgba(11, 13, 23, 0.35),
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(0, 212, 255, 0.35);
}
.hero-avatar::before {
  content: "";
  position: absolute;
  inset: var(--ring);
  border-radius: 50%;
  border: var(--rim) solid var(--rim-color);
  background:
    radial-gradient(circle at 50% 36%, rgba(0, 212, 255, 0.42), transparent 58%),
    radial-gradient(circle at 80% 90%, rgba(167, 139, 250, 0.45), transparent 55%),
    linear-gradient(165deg, #1e1b4b 0%, #0f172a 70%, #0b0d17 100%);
}
html.light-theme .hero-avatar {
  --rim-color: #ffffff;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.4),
    0 12px 32px rgba(15, 23, 42, 0.3),
    0 0 28px rgba(0, 212, 255, 0.3);
}
html.light-theme .hero-avatar--lg {
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, 0.35),
    0 24px 60px rgba(15, 23, 42, 0.3),
    0 0 60px rgba(0, 212, 255, 0.3);
}
html.light-theme .hero-avatar::before {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.95), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(167, 139, 250, 0.35), transparent 55%),
    linear-gradient(165deg, #bae6fd 0%, #c7d2fe 100%);
}
.hero-avatar-cut {
  position: absolute;
  left: var(--ring);
  right: var(--ring);
  bottom: var(--ring);
  height: calc((100% - 2 * var(--ring)) * var(--pop));
  overflow-x: clip;
  /* Top part: full width down to the disc's centre line. Bottom part: the disc itself. */
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - 50% / var(--pop)) no-repeat,
    radial-gradient(closest-side, #000 calc(100% - 1px), transparent) bottom / 100% calc(100% / var(--pop)) no-repeat;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - 50% / var(--pop)) no-repeat,
    radial-gradient(closest-side, #000 calc(100% - 1px), transparent) bottom / 100% calc(100% / var(--pop)) no-repeat;
  pointer-events: none;
}
.hero-avatar-cut img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 118%;
  max-width: none;
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

/* Large hero avatar for desktop (beside the hero text); the small one shows above the name on smaller screens */
.hero-avatar--lg {
  --ring: 6px;
  --rim: 5px;
  --size: clamp(280px, 24vw, 400px);
  margin: 0;
  box-shadow:
    0 0 0 10px rgba(11, 13, 23, 0.3),
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 60px rgba(0, 212, 255, 0.35);
}
@media (min-width: 1025px) {
  .hero-avatar:not(.hero-avatar--lg):not(.hero-avatar--inline) {
    display: none;
  }
}
@media (max-width: 1024px) {
  .hero-avatar--lg:not(.hero-avatar--inline) {
    display: none;
  }
}

/* ==========================================================================
   Light theme background (pages without a photo hero): a bright surface with
   soft cyan and violet glows and a lighter grid, instead of flat grey-blue.
   body.light-theme outranks each page's .light-theme tokens.
   ========================================================================== */
body.light-theme {
  --bg-gradient:
    radial-gradient(1100px 620px at 8% -8%, rgba(14, 165, 233, 0.14), transparent 62%),
    radial-gradient(900px 560px at 100% 4%, rgba(124, 58, 237, 0.1), transparent 60%),
    radial-gradient(1000px 700px at 50% 110%, rgba(14, 165, 233, 0.08), transparent 65%),
    linear-gradient(180deg, #f8fafd 0%, #f2f5fb 100%);
  --grid-main: rgba(3, 105, 161, 0.07);
  --grid-sub: rgba(3, 105, 161, 0.03);
  --scanline: transparent;
  --card: rgba(255, 255, 255, 0.92);
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}
