@import url("cursor.css");

/* Stop 3 — global site shell */

:root {
  --top-nav-height: 72px;
  --section-inline: clamp(24px, 5vw, 72px);
  --shell-surface: rgba(8, 15, 23, 0.88);
  --shell-border: rgba(151, 173, 200, 0.22);
  --shell-accent: #00d8e7;
  --shell-violet: #8069ff;
}

/* Clear the 48px homepage rail and keep matching space on the right. */
@media (min-width: 900px) {
  body[data-page="home"] {
    --section-inline: clamp(88px, 8vw, 112px);
  }
}

body.lightmode {
  --page-background: #edf4ff;
  --primary-text: #0c1936;
  --secondary-text: #43536d;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(40, 78, 135, 0.22);
  --accent-cyan: #078bac;
  --accent-blue: #4169e8;
  --locked-text: #667087;
  --background: var(--page-background);
  --foreground: var(--primary-text);
  --shell-surface: var(--surface-strong);
  --shell-border: var(--border);
  --shell-accent: var(--accent-cyan);
  --shell-violet: #6650e8;

  background-color: var(--page-background);
  color: var(--primary-text);
}

/* Neutralize legacy `header { position: fixed; height: 6vh }` in style.css */
header.site-header {
  position: relative;
  height: auto;
  width: auto;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 100;
}

/* Dedicated archive and 404 pages: compact sticky nav, no homepage rail */
body[data-page="experience"] header.site-header,
body[data-page="certifications"] header.site-header,
body[data-page="404"] header.site-header {
  position: sticky;
  top: 16px;
  z-index: 100;
  width: min(1260px, calc(100% - 40px));
  margin: 16px auto 0;
}

body[data-page="experience"] .site-topnav,
body[data-page="certifications"] .site-topnav,
body[data-page="404"] .site-topnav {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--shell-violet);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.site-topnav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(1240px, calc(100vw - 48px));
  height: var(--top-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  border-radius: 20px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  transition: height 0.2s ease, box-shadow 0.2s ease;
}

.site-topnav.is-scrolled {
  height: 66px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

.site-topnav__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--foreground);
  min-width: 0;
  flex-shrink: 0;
}

.site-topnav__mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #02070d;
  background: linear-gradient(135deg, var(--shell-accent), var(--shell-violet));
  flex-shrink: 0;
}

.site-topnav__name {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-topnav__links {
  display: none;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-topnav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  font-size: 1.3rem;
  color: var(--foreground);
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.site-topnav__link:hover,
.site-topnav__link:focus-visible {
  color: var(--shell-accent);
  background: rgba(0, 216, 231, 0.08);
  outline: none;
}

.site-topnav__link[aria-current="page"] {
  color: var(--shell-accent);
}

.site-topnav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--shell-accent);
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--shell-accent);
}

.site-topnav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.site-topnav__cv {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--shell-violet), #5b8cff);
}

.site-topnav__cv:hover {
  filter: brightness(1.08);
}

#dark-mode-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--shell-border);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

#dark-mode-toggle img {
  width: 22px;
  height: 22px;
}

.mobile-menu-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 2rem;
}

.mobile-menu-panel {
  position: fixed;
  top: calc(var(--top-nav-height) + 28px);
  right: max(24px, calc((100vw - min(1240px, calc(100vw - 48px))) / 2));
  z-index: 90;
  min-width: 220px;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
  display: none;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-menu-panel.is-open {
  display: flex;
}

.mobile-menu-panel a {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 1.4rem;
  color: var(--foreground);
  text-decoration: none;
  border-radius: 10px;
}

.mobile-menu-panel a:hover,
.mobile-menu-panel a:focus-visible {
  background: rgba(0, 216, 231, 0.1);
  outline: none;
}

.mobile-menu-panel a[aria-current="page"] {
  color: var(--shell-accent);
}

body.menu-open {
  overflow: hidden;
}

/* Homepage section rail */
.home-rail {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: var(--home-rail-width, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 0.5rem 0;
}

.home-rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  bottom: 12px;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 216, 231, 0.35) 15%,
    rgba(0, 216, 231, 0.35) 85%,
    transparent
  );
  z-index: 0;
  pointer-events: none;
}

.home-rail__link {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--foreground);
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  font-size: 1.6rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

body.lightmode .home-rail__link {
  color: var(--primary-text);
  background: var(--surface-strong);
  border-color: var(--border);
  box-shadow: 0 5px 14px rgba(35, 68, 116, 0.12);
}

body.lightmode .home-rail__link.is-active,
body.lightmode .home-rail__link[aria-current="location"] {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(7, 139, 172, 0.3);
}

.home-rail__link:hover,
.home-rail__link:focus-visible {
  border-color: var(--shell-accent);
  color: var(--shell-accent);
  outline: none;
}

.home-rail__link.is-active,
.home-rail__link[aria-current="location"] {
  border-color: var(--shell-accent);
  color: var(--shell-accent);
  box-shadow: 0 0 14px rgba(0, 216, 231, 0.35);
}

.home-rail__link .home-rail__tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 0.35rem 0.6rem;
  font-size: 1.1rem;
  white-space: nowrap;
  border-radius: 6px;
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.home-rail__link:hover .home-rail__tooltip,
.home-rail__link:focus-visible .home-rail__tooltip {
  opacity: 1;
}

.home-chapter,
.home-chapter-stub {
  position: relative;
  scroll-margin-top: calc(var(--top-nav-height) + 16px);
}

.home-chapter-stub {
  display: grid;
  place-items: center;
  text-align: center;
}

.home-chapter-stub h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.75rem;
}

.home-chapter-stub p {
  font-size: 1.4rem;
  opacity: 0.8;
  max-width: 36rem;
}

/* Stop 4 — homepage viewport chapters */
@media (min-width: 900px) {
  body[data-page="home"] .home-chapter:not(.home-hero),
  body[data-page="home"] .home-chapter-stub {
    min-height: calc(100svh - var(--top-nav-height));
    display: grid;
    align-items: center;
    padding:
      calc(var(--top-nav-height) + 24px)
      var(--section-inline)
      clamp(48px, 6vh, 88px);
  }

  body[data-page="home"] .home-chapter--experience {
    min-height: calc(1.55 * (100svh - var(--top-nav-height)));
    align-items: start;
  }

  body[data-page="home"] .home-hero.home-chapter {
    min-height: 100svh;
    min-height: 100dvh;
    display: block;
    padding: 0;
    overflow: clip;
  }

  body[data-page="home"] .home-chapter > .container,
  body[data-page="home"] .home-chapter > .w-layout-blockcontainer,
  body[data-page="home"] .home-chapter > .hero-content,
  body[data-page="home"] .home-chapter .contact-container {
    width: 100%;
  }

  body[data-page="home"] .home-chapter:not(#contact):not(.home-hero)::after,
  body[data-page="home"] .home-chapter-stub::after {
    content: "";
    position: absolute;
    bottom: clamp(12px, 2vh, 24px);
    left: 50%;
    transform: translateX(-50%);
    width: min(40%, 420px);
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(0, 216, 231, 0.35),
      transparent
    );
    pointer-events: none;
    z-index: 1;
  }

  body[data-page="home"] .home-chapter--experience .timeline-container {
    padding: 1.15rem 36px 1.25rem;
  }

  body[data-page="home"] .home-chapter--experience .timeline-header {
    margin-bottom: 2rem;
  }

  body[data-page="home"] .home-chapter--experience .timeline {
    margin-top: 1rem;
    padding-bottom: 2rem;
  }

  body[data-page="home"] .featured-projects.home-chapter {
    padding:
      calc(var(--top-nav-height) + 24px)
      var(--section-inline)
      clamp(48px, 6vh, 88px);
  }

  /* #arsenal, #about, #contact padding lives in css/arsenal.css, css/about.css, css/contact.css */
}

@media (max-width: 899px) {
  body[data-page="home"] .home-hero.home-chapter {
    min-height: 100svh;
    min-height: 100dvh;
    display: block;
    padding: 0;
  }

  body[data-page="home"] .home-chapter:not(.home-hero),
  body[data-page="home"] .home-chapter-stub {
    min-height: 0;
    align-items: start;
    display: grid;
    padding:
      calc(var(--top-nav-height) + 32px)
      var(--section-inline)
      3rem;
  }

  body[data-page="home"] .home-chapter-stub {
    place-items: center;
    text-align: center;
  }
}

body[data-page="home"] .home-hero.home-chapter {
  height: auto;
}

body[data-page="home"] .featured-projects.home-chapter {
  height: auto;
  overflow: visible;
}

body[data-page="home"] .starry-section.home-chapter {
  overflow: visible;
}

body[data-page="home"] #about.home-chapter.about-section,
body[data-page="home"] #contact.home-chapter.contact-section {
  height: auto;
  overflow: visible;
  padding-bottom: max(48px, calc(76px + env(safe-area-inset-bottom, 0px)));
}

.hero-scroll-cue {
  position: absolute;
  bottom: clamp(1.25rem, 3vh, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--shell-border);
  color: var(--shell-accent);
  font-size: 2.4rem;
  text-decoration: none;
  background: rgba(8, 15, 23, 0.45);
  opacity: 0.85;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.hero-scroll-cue:hover,
.hero-scroll-cue:focus-visible {
  opacity: 1;
  border-color: var(--shell-accent);
  outline: none;
}

body.lightmode .hero-scroll-cue {
  color: #08758a;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.stub-page {
  min-height: 100svh;
  padding: calc(var(--top-nav-height) + 56px) var(--section-inline) 4rem;
  display: grid;
  place-items: center;
  text-align: center;
}

.stub-page h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  margin-bottom: 1rem;
}

.stub-page p {
  font-size: 1.5rem;
  opacity: 0.85;
  max-width: 32rem;
}

.stub-page__actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.stub-page__actions a {
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: 1.3rem;
  border: 1px solid var(--shell-border);
  color: var(--foreground);
}

.stub-page__actions a.primary {
  background: linear-gradient(135deg, var(--shell-violet), var(--shell-accent));
  color: #fff;
  border: none;
}

main.stub-page {
  padding-top: calc(var(--top-nav-height) + 24px);
}

body[data-page="home"] main#main-content {
  padding-top: 0;
}

@media (min-width: 900px) {
  .site-topnav__links {
    display: flex;
  }

  .site-topnav__cv {
    display: inline-flex;
  }

  .mobile-menu-toggle {
    display: none;
  }
}

@media (max-width: 899px) {
  .home-rail {
    display: none;
  }

  .site-topnav__name {
    font-size: 1.15rem;
    max-width: 42vw;
  }
}

@media (max-width: 760px) {
  .site-topnav {
    width: calc(100vw - 24px);
    padding: 0 0.75rem;
  }

  .mobile-menu-panel {
    right: 12px;
    left: 12px;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-topnav,
  .home-rail__link {
    transition: none;
  }
}

/* Legacy layout — removed in Stop 3 */
.headTopnav,
.headSidenav,
.sidebar {
  display: none !important;
}

body:has(.site-topnav) main:not(.stub-page) {
  margin-left: 0;
}

body:has(.home-rail) main:not(.stub-page) {
  padding-left: 0;
}

/* Shared navigation typography for the readability pass. */
.skip-link,
.site-topnav__mark,
.site-topnav__name,
.site-topnav__link,
.site-topnav__cv,
.mobile-menu-panel a,
.home-rail__link .home-rail__tooltip {
  font-size: 14px;
}
