/* sharpbyte.dev — roadmap-inspired system (Syne + JetBrains Mono) */

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

:root {
  color-scheme: light;
  /* Path pages: sticky section nav sits under topbar — keep >= rendered bar height */
  --site-topbar-sticky-offset: 3.75rem;
  --bg: #f5f2eb;
  --surface: #faf8f3;
  --card: #fffdf9;
  --border: #c8c1b3;
  --accent1: #5cefb8;
  --accent2: #7b8cff;
  --accent3: #ff6b6b;
  --accent4: #ffd166;
  --text: #1a1612;
  --muted: #4a433b;
  /* Darker phase inks for readable highlights on light background */
  --phase1: #1a6b4a;
  --phase2: #1a3d6b;
  --phase3: #c0392b;
  --phase4: #8a5a00;
  --phase5: #5c2d8a;
}

html {
  scroll-behavior: smooth;
}

body {
  background: radial-gradient(circle at 20% -10%, rgba(123, 140, 255, 0.11), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(92, 239, 184, 0.12), transparent 38%), var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 29px,
    rgba(0, 0, 0, 0.035) 29px,
    rgba(0, 0, 0, 0.035) 30px
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

main,
.hero,
.legend,
.footer,
.timeline-wrap {
  position: relative;
  z-index: 1;
}

/* Site brand — grid row aligns SVG + text reliably (Safari flex vs. img). */
.site-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  min-height: var(--site-topbar-sticky-offset);
  padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  background: rgba(250, 248, 243, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.site-topbar .learn-back {
  flex-shrink: 0;
  margin: 0;
  align-self: center;
  line-height: 1.25;
  border-bottom: none !important;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (min-width: 400px) {
  .site-topbar .learn-back {
    font-size: 12px;
  }
}

.site-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(8px, 2.2vw, 12px);
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(0.88rem, 3.4vw, 1.05rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
}

.site-topbar:has(.learn-back) .site-brand {
  max-width: calc(100% - 8.5rem);
}

.site-brand:hover {
  color: var(--phase1);
  border-bottom: none;
}

.site-brand img {
  display: block;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  /* Safari: own layer avoids blurry misalignment next to backdrop-filter */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.site-brand:focus-visible,
.site-topbar .site-brand:focus-visible {
  outline: none;
}

/* Logo mark + dotted orbit (all pages) */
.site-brand > .site-brand__mark {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.site-brand__ring {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  margin: auto;
  border-radius: 50%;
  border: 1px dotted rgba(26, 107, 74, 0.38);
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(26, 61, 107, 0.1);
  pointer-events: none;
  z-index: 0;
  opacity: 0.92;
  transition:
    border-color 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.site-brand:hover .site-brand__ring,
.site-brand:focus-visible .site-brand__ring,
.site-topbar .site-brand:hover .site-brand__ring,
.site-topbar .site-brand:focus-visible .site-brand__ring {
  opacity: 1;
  border-color: rgba(92, 239, 184, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(26, 61, 107, 0.1),
    0 0 0 2px rgba(92, 239, 184, 0.85),
    0 0 0 4px rgba(123, 140, 255, 0.42),
    0 0 18px rgba(92, 239, 184, 0.4),
    0 0 34px rgba(123, 140, 255, 0.25);
}

.site-brand__arm {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 21px;
  height: 1px;
  margin-left: -21px;
  margin-top: -0.5px;
  transform-origin: 100% 50%;
  animation: site-brand-orbit-arm 18s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.site-brand__arm--b {
  animation-duration: 13.5s;
  animation-direction: reverse;
}

.site-brand__sat {
  position: absolute;
  right: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  margin-right: -3px;
  border-radius: 50%;
  background: var(--accent1);
  box-shadow: 0 0 12px rgba(92, 239, 184, 0.5);
}

.site-brand__sat--violet {
  background: var(--accent2);
  box-shadow: 0 0 12px rgba(123, 140, 255, 0.45);
}

@keyframes site-brand-orbit-arm {
  to {
    transform: rotate(360deg);
  }
}

.site-brand .site-brand__mark img {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  grid-column: unset;
  grid-row: unset;
  justify-self: unset;
  align-self: unset;
}

@media (prefers-reduced-motion: reduce) {
  .site-brand__ring {
    transition-duration: 0.01ms;
  }

  .site-brand__arm {
    animation: none;
  }
}

.site-brand > span {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  line-height: 1.15;
  min-width: 0;
}

@media (max-width: 420px) {
  .site-topbar:has(.learn-back) .site-brand {
    max-width: calc(100% - 7.5rem);
  }

  .site-brand {
    font-size: clamp(0.82rem, 4vw, 0.95rem);
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .site-brand > .site-brand__mark {
    width: 40px;
    height: 40px;
  }

  .site-brand__arm {
    width: 17px;
    margin-left: -17px;
  }

  .site-brand img {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
  }

  .site-topbar {
    gap: 8px 10px;
  }
}

.site-brand__tld {
  color: var(--phase1);
  font-weight: 800;
}

a {
  color: #1a6b4a;
  text-decoration: none;
  border-bottom: 1px dashed rgba(26, 107, 74, 0.3);
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: #14563b;
  border-bottom-color: rgba(20, 86, 59, 0.55);
}

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

.accent {
  color: var(--phase1);
}

/* ── HERO ── */
.hero {
  position: relative;
  padding: 56px 24px 48px;
  text-align: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 100vw);
  height: 420px;
  background: radial-gradient(ellipse at center, rgba(92, 239, 184, 0.17) 0%, transparent 68%);
  pointer-events: none;
}

.hero-glow--2 {
  top: 40px;
  width: min(560px, 90vw);
  height: 320px;
  background: radial-gradient(ellipse at center, rgba(123, 140, 255, 0.14) 0%, transparent 70%);
}

.hero__avatar-ring {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.avatar-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--phase1), var(--phase2), var(--phase3));
  box-shadow: 0 0 40px rgba(92, 239, 184, 0.2), 0 0 80px rgba(123, 140, 255, 0.08);
}

.avatar-wrap::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--card);
  z-index: 0;
}

.avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  display: none;
  position: absolute;
  inset: 3px;
  z-index: 2;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
  color: var(--phase1);
  background: linear-gradient(160deg, var(--surface), var(--card));
}

.avatar-wrap.is-fallback .avatar {
  display: none;
}

.avatar-wrap.is-fallback .avatar-fallback {
  display: flex;
}

.hero-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0f5b3d;
  border: 1px solid rgba(26, 107, 74, 0.66);
  background: rgba(26, 107, 74, 0.13);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 22px;
  max-width: min(560px, 100%);
  line-height: 1.5;
}

.hero h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 5.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.hero h1 span {
  color: #1a6b4a;
  text-shadow: 0 0 22px rgba(26, 107, 74, 0.2);
}

.hero-sub {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.75;
  position: relative;
  z-index: 1;
}

.hero-contact {
  list-style: none;
  margin: 22px auto 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  justify-content: center;
  font-size: 12px;
  max-width: 640px;
  position: relative;
  z-index: 1;
}

.hero-contact a {
  border-bottom: none;
  color: #1f1a16;
}

.hero-contact a:hover {
  color: var(--phase1);
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* Home hero: compact (no full-viewport stretch) */
.hero--home {
  padding: 40px 24px 32px;
}

.edu.site-home-about {
  padding: 0 24px 24px;
}

.edu.site-home-contact {
  padding: 0 24px 36px;
}

.site-home-contact .section-title {
  margin-bottom: 14px;
}

.site-home-contact__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.site-home-contact__about {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

body.site-home .footer {
  padding: 20px 24px 36px;
}

/* Subscribe / RSS landing (avoid opening raw XML by default) */
.subscribe-page .subscribe-main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 28px 24px 40px;
  position: relative;
  z-index: 1;
}

.subscribe-main__title {
  font-family: "Syne", system-ui, sans-serif;
  font-size: clamp(1.45rem, 4.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 12px;
}

.subscribe-main__lede {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.65;
  max-width: 36rem;
}

.subscribe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.subscribe-field {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.subscribe-url-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}

.subscribe-url-input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  background: var(--card);
  color: var(--text);
}

.subscribe-copy {
  flex-shrink: 0;
}

.subscribe-hint {
  min-height: 1.4em;
  font-size: 12px;
  color: var(--phase1);
  margin-top: 10px;
}

.subscribe-footnote {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.subscribe-footnote a {
  color: var(--phase2);
  border-bottom: none;
}

.subscribe-emdash {
  color: var(--border);
  margin: 0 0.15em;
}

.subscribe-back {
  margin-top: 20px;
  font-size: 13px;
}

.subscribe-back a {
  color: var(--phase1);
  border-bottom: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(135deg, #1a6b4a, #2c8f66);
  color: #f5fff9;
  border: none;
  box-shadow: 0 10px 28px rgba(26, 107, 74, 0.28);
}

.btn--primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 36px rgba(26, 107, 74, 0.36);
}

/* Home hero — primary CTA: silver arrow sheen (faster glide + stronger shine on hover) */
.btn--cta-start {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  font-family: "Syne", system-ui, sans-serif;
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
  line-height: 1.15;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 10px 28px rgba(26, 107, 74, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.btn--cta-start__label {
  position: relative;
  z-index: 2;
}

/* Right-pointing arrow silhouette, filled with a metallic sweep (not a diagonal slash) */
.btn--cta-start::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: min(48%, 10.5rem);
  height: 1.55em;
  margin-top: calc(-0.775em);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  clip-path: polygon(
    0% 34%,
    59% 34%,
    59% 16%,
    100% 50%,
    59% 84%,
    59% 66%,
    0% 66%
  );
  background: linear-gradient(
    92deg,
    rgba(255, 255, 255, 0) 2%,
    rgba(255, 255, 255, 0.28) 22%,
    rgba(255, 255, 255, 0.92) 45%,
    #ffffff 50%,
    rgba(232, 250, 255, 0.95) 55%,
    rgba(255, 255, 255, 0.32) 78%,
    rgba(255, 255, 255, 0) 98%
  );
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.55)) drop-shadow(0 0 4px rgba(200, 235, 255, 0.45));
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

.btn--cta-start:hover {
  filter: brightness(1.06);
  box-shadow:
    0 14px 40px rgba(26, 107, 74, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset;
}

@media (hover: hover) and (pointer: fine) {
  .btn--cta-start:hover::after {
    animation: cta-arrow-sheen 2.2s linear infinite;
  }
}

.btn--cta-start:not(:hover)::after {
  animation: none;
  opacity: 0;
  transform: translateX(-180%);
}

@keyframes cta-arrow-sheen {
  /* Visible from frame one; constant-speed glide (linear); fade only at the end before loop */
  0% {
    transform: translateX(calc(-100% + 28%));
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    transform: translateX(calc(100% + 85%));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn--cta-start::after {
    display: none;
  }

  .btn--cta-start:hover {
    filter: brightness(1.05);
  }
}

.btn--ghost {
  border-color: rgba(26, 107, 74, 0.25);
  color: #1f1a16;
  background: rgba(255, 255, 255, 0.65);
}

.btn--ghost:hover {
  border-color: var(--phase1);
  color: var(--phase1);
}

/* Reveal: hero / above-the-fold (runs on load) */
.reveal-hero {
  opacity: 0;
  transform: translateY(18px);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-hero--delay-1 {
  animation-delay: 0.09s;
}
.reveal-hero--delay-2 {
  animation-delay: 0.18s;
}
.reveal-hero--delay-3 {
  animation-delay: 0.27s;
}

.legend .reveal-hero:nth-child(1) {
  animation-delay: 0.34s;
}
.legend .reveal-hero:nth-child(2) {
  animation-delay: 0.4s;
}
.legend .reveal-hero:nth-child(3) {
  animation-delay: 0.46s;
}
.legend .reveal-hero:nth-child(4) {
  animation-delay: 0.52s;
}
.legend .reveal-hero:nth-child(5) {
  animation-delay: 0.58s;
}

/* Reveal: scroll (IntersectionObserver adds .is-visible) */
.reveal-scroll {
  opacity: 0;
  transform: translateY(22px);
}

.reveal-scroll.is-visible {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal-scroll.is-visible.reveal-scroll--delay-1 {
  animation-delay: 0.06s;
}
.reveal-scroll.is-visible.reveal-scroll--delay-2 {
  animation-delay: 0.12s;
}
.reveal-scroll.is-visible.reveal-scroll--delay-3 {
  animation-delay: 0.18s;
}
.reveal-scroll.is-visible.reveal-scroll--delay-4 {
  animation-delay: 0.24s;
}
.reveal-scroll.is-visible.reveal-scroll--delay-5 {
  animation-delay: 0.3s;
}

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

/* ── LEGEND ── */
.legend {
  max-width: 960px;
  margin: 0 auto 28px;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 22px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── SECTION TITLES ── */
.section-title {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text);
}

.section-lede {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.75;
  padding: 0 20px;
}

/* ── TIMELINE ── */
.timeline-wrap {
  padding: 20px 0 12px;
}

.timeline {
  position: relative;
  max-width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) 56px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border) 8%, var(--border) 92%, transparent);
  transform: translateX(-50%);
}

.phase {
  position: relative;
  margin-bottom: 52px;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.phase.visible {
  opacity: 1;
  transform: translateY(0);
}

.phase-badge {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 15px;
  z-index: 2;
  box-shadow: 0 0 22px var(--c, var(--phase1));
}

.phase-header {
  width: calc(50% - 48px);
  margin-right: auto;
  text-align: right;
  padding-right: clamp(20px, 3vw, 40px);
}

.phase:nth-child(even) .phase-header {
  margin-right: 0;
  margin-left: auto;
  text-align: left;
  padding-right: 0;
  padding-left: clamp(20px, 3vw, 40px);
}

.phase-title {
  font-family: "Syne", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.phase-duration {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.phase-projects {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  container-type: inline-size;
  container-name: phase-projects;
}

.phase-projects__kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.project-accordion {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

.project-accordion--two-col {
  grid-template-columns: 1fr;
}

@container phase-projects (min-width: 520px) {
  .project-accordion--two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project-card {
  margin: 0;
  text-align: inherit;
}

.project-card__hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.project-card__hit:focus {
  outline: none;
}

.project-card:focus-within {
  outline: 2px solid var(--c, var(--phase1));
  outline-offset: 2px;
}

.phase:nth-child(odd) .phase-header .phase-projects {
  text-align: right;
}

.phase:nth-child(odd) .phase-header .phase-projects .project-card .tags {
  justify-content: flex-end;
}

/* Timeline phases (OptivalueTek, Wipro, TCS) using stacked experience cards + nested skill tiles */
.phase.p1.phase--experience-layout .phase-header--p1,
.phase.p2.phase--experience-layout .phase-header--p2,
.phase.p3.phase--experience-layout .phase-header--p3 {
  width: 100%;
  max-width: min(1320px, calc(100vw - 32px));
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 6px;
  padding: 0 clamp(16px, 3vw, 40px);
  text-align: left;
}

.phase.p2.phase--experience-layout .phase-header--p2 {
  text-align: right;
}

.phase.p1 .experience-stack,
.phase.p2 .experience-stack,
.phase.p3 .experience-stack {
  width: 100%;
  max-width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 12px clamp(16px, 3vw, 40px) 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.experience-card {
  --ec-accent: var(--c, var(--phase1));
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px clamp(18px, 2.5vw, 28px) 24px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 10px 36px rgba(26, 61, 107, 0.09);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.experience-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ec-accent);
  border-radius: 4px 0 0 4px;
}

.experience-card:hover {
  border-color: color-mix(in srgb, var(--ec-accent) 42%, var(--border));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 14px 44px rgba(26, 61, 107, 0.12);
}

.experience-card__intro {
  width: 100%;
  max-width: none;
}

.experience-card__title {
  font-family: "Syne", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ec-accent);
  margin: 0;
}

.experience-card__overview {
  margin: 12px 0 0;
  width: 100%;
  max-width: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.72;
}

.experience-card__cta {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--ec-accent) 50%, transparent);
  background: color-mix(in srgb, var(--ec-accent) 12%, transparent);
  color: var(--ec-accent);
  font-family: "Syne", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.experience-card__cta:hover {
  background: color-mix(in srgb, var(--ec-accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--ec-accent) 65%, transparent);
}

.experience-card__cta:focus {
  outline: none;
}

.experience-card__cta:focus-visible {
  outline: 2px solid var(--ec-accent);
  outline-offset: 3px;
}

.experience-card__grid {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  /* auto-fill keeps empty tracks so last-row cards stay the same width as above */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.experience-card .tags {
  justify-content: flex-start;
}

.card--nested {
  padding: 8px 10px 9px;
}

.experience-card .card--nested {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

.card--nested:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.card--nested .card-title {
  font-size: 0.82rem;
  line-height: 1.28;
  font-weight: 600;
}

.experience-card .card--nested .tags {
  margin-top: auto;
  padding-top: 8px;
  gap: 4px;
}

.experience-card .card--nested .tag {
  font-size: 9.5px;
  padding: 2px 6px;
  letter-spacing: 0.05em;
}

.card--nested .card-desc {
  font-size: 12px;
}

.phase:nth-child(even) .phase-left {
  width: calc(50% - 48px);
  margin-left: 0;
  margin-right: auto;
  padding-right: clamp(20px, 3vw, 40px);
  padding-left: 0;
  margin-top: -38px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  text-align: right;
}

.phase:nth-child(even) .phase-left .phase-projects {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 0;
  order: 0;
}


.phase:nth-child(even) .phase-left .cards {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  margin-top: 0;
  order: 1;
}

.cards {
  width: calc(50% - 48px);
  margin-left: auto;
  padding-left: clamp(20px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: -38px;
}

.phase:nth-child(even) .cards {
  margin-left: 0;
  margin-right: auto;
  padding-left: 0;
  padding-right: clamp(20px, 3vw, 40px);
  text-align: right;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--c, var(--phase1));
  border-radius: 3px 0 0 3px;
}

.phase:nth-child(even) .card::before {
  left: auto;
  right: 0;
  border-radius: 0 3px 3px 0;
}

.card:hover {
  border-color: var(--c, var(--phase1));
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.card-title {
  font-family: "Syne", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.card-desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 6px;
  line-height: 1.65;
}

.tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.phase:nth-child(even) .tags {
  justify-content: flex-end;
}

.tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(26, 22, 18, 0.04);
  border: 1px solid rgba(26, 22, 18, 0.16);
  color: #3f382f;
}

.p1 {
  --c: var(--phase1);
}
.p2 {
  --c: var(--phase2);
}
.p3 {
  --c: var(--phase3);
}
.p4 {
  --c: var(--phase4);
}
.p5 {
  --c: var(--phase5);
}

.phase-title.p1 {
  color: var(--phase1);
}
.phase-title.p2 {
  color: var(--phase2);
}
.phase-title.p3 {
  color: var(--phase3);
}

.phase-badge.p1 {
  background: rgba(26, 107, 74, 0.12);
  color: var(--phase1);
  border: 1.5px solid var(--phase1);
}
.phase-badge.p2 {
  background: rgba(26, 61, 107, 0.12);
  color: var(--phase2);
  border: 1.5px solid var(--phase2);
}
.phase-badge.p3 {
  background: rgba(192, 57, 43, 0.12);
  color: var(--phase3);
  border: 1.5px solid var(--phase3);
}

/* ── KEY METRICS ── */
.metrics {
  max-width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 40px) 40px;
}

.metrics-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 18px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--c, var(--phase1));
  border-radius: 3px 0 0 3px;
}

.metric:hover {
  border-color: var(--c, var(--phase1));
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}

.metric__value {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
}

.metric__unit {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c, var(--phase1));
  font-weight: 600;
}

.metric__label {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── TECHNOLOGY GRID + MODAL ── */
.stack-section {
  max-width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 12px clamp(16px, 3vw, 40px) 56px;
}

.tech-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 620px) {
  .tech-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .tech-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tech-tile {
  appearance: none;
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 16px 15px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tech-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--c, var(--phase1));
  border-radius: 3px 0 0 3px;
}

.tech-tile:hover {
  border-color: var(--c, var(--phase1));
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.tech-tile:focus-visible {
  outline: 2px solid var(--phase1);
  outline-offset: 2px;
}

.tech-tile__name {
  display: block;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text);
}

.tech-tile__hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.tech-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

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

.tech-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(4px);
}

.tech-modal__dialog {
  position: relative;
  width: min(720px, calc(100vw - 24px));
  max-height: min(80vh, 760px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #fffdf9 0%, #f7f3eb 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.52);
  padding: 22px 22px 18px;
}

.tech-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #b8ae9d;
  background: rgba(26, 22, 18, 0.06);
  color: #2a231d;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.tech-modal__close:hover {
  border-color: var(--phase1);
  color: var(--phase1);
}

.tech-modal__content h3 {
  font-family: "Syne", sans-serif;
  font-size: 1.45rem;
  margin: 0 0 8px;
}

.tech-modal__content p {
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 13px;
}

.tech-modal__content ul {
  margin: 0;
  padding-left: 1.12rem;
  display: grid;
  gap: 9px;
  color: #2f2821;
  font-size: 12.5px;
}

.tech-templates {
  display: none;
}

/* ── PROJECT DETAIL MODAL (about timeline) ── */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

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

.project-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.78);
  backdrop-filter: blur(6px);
}

.project-modal__dialog {
  position: relative;
  width: min(1040px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(200, 193, 179, 0.55);
  background: linear-gradient(155deg, #fffdf9 0%, #f3efe6 55%, #ebe4d8 100%);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.45) inset;
  padding: 26px 28px 24px;
}

.project-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #b8ae9d;
  background: rgba(255, 253, 249, 0.92);
  color: #2a231d;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.project-modal__close:hover {
  border-color: var(--phase1);
  color: var(--phase1);
  background: #fffdf9;
}

.project-modal__content {
  color: #2f2821;
  padding-top: 8px;
}

.project-modal__content .project-detail__title:first-of-type {
  padding-right: 44px;
}

.project-detail__hero {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(26, 22, 18, 0.1);
}

.project-detail__eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.project-detail__title {
  font-family: "Syne", system-ui, sans-serif;
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.2;
  color: var(--text);
}

.project-detail__lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

.project-detail__block {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(26, 22, 18, 0.08);
  background: rgba(255, 253, 249, 0.65);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.project-detail__h {
  font-family: "Syne", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--phase1);
  margin: 0 0 10px;
}

.project-detail__block p {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.72;
  color: #3a342c;
}

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

.project-detail--stub .project-detail__title {
  margin-bottom: 8px;
}

.project-modal-templates {
  display: none;
}

/* ── EDU NOTE ── */
.edu {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 26px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.85;
  text-align: center;
}

.note strong {
  color: var(--phase1);
}

.note .education-download {
  margin-top: 16px;
  margin-bottom: 0;
}

.note .education-download a {
  color: var(--phase1);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--phase1) 45%, transparent);
}

.note .education-download a:hover {
  border-bottom-color: var(--phase1);
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 28px 24px 64px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid #c8c1b3;
}

.footer a {
  color: var(--phase1);
  border: none;
}

.footer__meta {
  color: var(--muted);
}

.footer__meta a {
  font-weight: 600;
}

/* ── RESPONSIVE: timeline mobile ── */
@media (max-width: 700px) {
  .timeline::before {
    left: 20px;
  }
  .phase-badge {
    left: 20px;
    transform: none;
  }
  .phase-header {
    width: 100%;
    text-align: left;
    padding-left: 56px;
    padding-right: 0;
    margin: 0 0 12px;
  }
  .phase:nth-child(even) .phase-header {
    text-align: left;
    padding-left: 56px;
    padding-right: 0;
  }
  .cards {
    width: 100%;
    padding-left: 56px;
    padding-right: 0;
    margin-top: 0;
  }
  .phase:nth-child(even) .cards {
    padding-right: 0;
    padding-left: 56px;
    text-align: left;
  }
  .phase:nth-child(even) .tags {
    justify-content: flex-start;
  }
  .phase:nth-child(even) .phase-left {
    width: 100%;
    margin-top: 0;
    padding-left: 56px;
    padding-right: 0;
    text-align: left;
  }
  .phase:nth-child(even) .phase-left .phase-projects {
    border-bottom: none;
    border-top: 1px solid var(--border);
    padding-bottom: 0;
    padding-top: 12px;
    margin-top: 0;
  }
  .phase:nth-child(even) .phase-left .cards {
    padding-left: 0;
    padding-right: 0;
  }
  .phase:nth-child(odd) .phase-header .phase-projects {
    padding-left: 0;
    text-align: left;
  }
  .phase:nth-child(odd) .phase-header .phase-projects .project-card .tags {
    justify-content: flex-start;
  }

  .phase.p1.phase--experience-layout .phase-header--p1,
  .phase.p2.phase--experience-layout .phase-header--p2,
  .phase.p3.phase--experience-layout .phase-header--p3 {
    padding-left: 56px;
    padding-right: 16px;
  }

  .phase.p1 .experience-stack,
  .phase.p2 .experience-stack,
  .phase.p3 .experience-stack {
    padding-left: 56px;
    padding-right: 16px;
  }

  .experience-card__grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .phase {
    opacity: 1;
    transform: none;
  }
  .reveal-hero {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  .reveal-scroll,
  .reveal-scroll.is-visible {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

/* Inline code inside notes (site home, etc.) */
.note code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.92em;
  background: rgba(26, 22, 18, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---- Site search (command palette) ---- */
body.site-search-open {
  overflow: hidden;
}

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

.site-topbar:has(.site-topbar__mid) .site-brand {
  max-width: min(11rem, 36vw);
}

@media (min-width: 520px) {
  .site-topbar:has(.site-topbar__mid) .site-brand {
    max-width: min(14rem, 34vw);
  }
}

.site-topbar__mid {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: end;
  align-items: center;
  padding: 0 8px;
}

.site-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(26, 22, 18, 0.12);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.95), rgba(250, 248, 243, 0.75));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65),
    0 8px 22px rgba(26, 61, 107, 0.07);
  color: var(--muted);
  font-family: "Syne", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.site-search-trigger:hover {
  color: var(--text);
  border-color: rgba(26, 107, 74, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 28px rgba(92, 239, 184, 0.12);
}

.site-search-trigger:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

.site-search-trigger__icon {
  display: flex;
  color: var(--phase1);
  opacity: 0.9;
  flex-shrink: 0;
}

.site-search-trigger__label.site-search-typehint {
  flex: 1 1 auto;
  text-align: left;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(74, 67, 59, 0.65);
  white-space: nowrap;
  overflow: hidden;
}

.site-search-trigger:hover .site-search-trigger__label.site-search-typehint {
  color: rgba(74, 67, 59, 0.88);
}

.site-search-trigger .site-search-typehint__caret {
  height: 0.92em;
  margin-left: 2px;
}

.site-search-trigger__kbd {
  flex-shrink: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.9);
  color: var(--muted);
}

@media (max-width: 560px) {
  .site-search-trigger {
    max-width: min(300px, 74vw);
    justify-content: flex-start;
    padding-inline: 10px 12px;
  }
  .site-search-trigger__label.site-search-typehint {
    font-size: 11px;
    letter-spacing: 0.01em;
  }
  .site-search-trigger__kbd {
    display: none;
  }
}

.site-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background: rgba(26, 22, 18, 0.38);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}

/* `display: grid` above wins over the native [hidden] rule unless we restate it. */
.site-search-overlay[hidden] {
  display: none !important;
}

.site-search-panel {
  width: min(100%, 520px);
  max-height: min(calc(100vh - 48px), calc(100dvh - 48px));
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.96);
  box-shadow:
    0 24px 64px rgba(26, 61, 107, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  padding: 18px 18px 14px;
  animation: site-search-pop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes site-search-pop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.site-search-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.site-search-panel__title {
  font-family: "Syne", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
}

.site-search-close {
  border: none;
  background: rgba(26, 22, 18, 0.06);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.site-search-close:hover {
  background: rgba(26, 22, 18, 0.1);
  color: var(--text);
}

.site-search-scope {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(26, 22, 18, 0.04);
}

.site-search-scope__btn {
  flex: 1;
  border: none;
  border-radius: 9px;
  padding: 8px 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.site-search-scope__btn:hover {
  color: var(--text);
}

.site-search-scope__btn.is-active {
  background: var(--card);
  color: var(--phase2);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(26, 61, 107, 0.1);
}

.site-search-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 4px 14px;
  border-radius: 12px;
  border: 1px solid rgba(26, 22, 18, 0.12);
  background: #fffdf9;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.site-search-field__icon {
  grid-row: 1;
  display: flex;
  color: var(--phase1);
  opacity: 0.85;
}

.site-search-typehint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.site-search-typehint__caret {
  width: 2px;
  height: 1.1em;
  margin-left: 1px;
  border-radius: 1px;
  background: var(--phase1);
  opacity: 1;
  animation: site-search-caret-blink 1.05s steps(1, end) infinite;
}

@keyframes site-search-caret-blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-search-typehint__caret {
    animation: none;
    opacity: 1;
  }
}

.site-search-field:focus-within {
  border-color: rgba(123, 140, 255, 0.55);
  box-shadow:
    0 0 0 3px rgba(123, 140, 255, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.site-search-input {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 15px;
  padding: 12px 0;
  color: var(--text);
  white-space: nowrap;
  overflow-x: auto;
  caret-color: var(--phase1);
}

@supports (caret-shape: bar) {
  .site-search-input {
    caret-shape: bar;
  }
}

.site-search-input::placeholder {
  color: rgba(74, 67, 59, 0.55);
}

.site-search-input:focus {
  outline: none;
}

.site-search-hint {
  margin-top: 12px;
  min-height: 1.4em;
  font-size: 12px;
  color: var(--muted);
}

.site-search-results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: min(48vh, 320px);
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(26, 22, 18, 0.08);
}

.site-search-result {
  margin: 0;
  border-bottom: 1px solid rgba(26, 22, 18, 0.06);
}

.site-search-result:last-child {
  border-bottom: none;
}

.site-search-result__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: none;
  transition: background 0.12s ease;
}

.site-search-result__link:hover {
  background: rgba(92, 239, 184, 0.12);
  border-bottom: none;
}

.site-search-result__title {
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-search-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(26, 22, 18, 0.08);
  font-size: 11px;
  color: var(--muted);
}

.site-search-footer kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(250, 248, 243, 0.9);
}

mark.site-search-hit {
  background: rgba(92, 239, 184, 0.42);
  color: inherit;
  padding: 1px 2px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(26, 107, 74, 0.12);
}

mark.site-search-hit--active {
  background: rgba(123, 140, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(123, 140, 255, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .site-search-panel {
    animation: none;
  }
}

@media print {
  .site-topbar,
  .site-topbar__mid,
  .site-search-overlay,
  .tech-modal,
  .project-modal {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  body::before {
    display: none !important;
  }
}
