/* Header */
.header {
  backdrop-filter: blur(2px) saturate(.5);
  background-color: color-mix(in oklab, var(--color-surface-primary) 92%, transparent);
  border-bottom: 1px solid var(--color-surface-secondary);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.header__menu-toggle {
  background: none;
  border: none;
  color: var(--color-text-primary);
  cursor: pointer;
  display: block;
  font-size: 1.5rem;
}

.header__menu-toggle .icon {
  height: 1.5rem;
  vertical-align: middle;
  width: 1.5rem;
}

.header__menu-toggle .icon--close {
  display: none;
}

.header__menu-toggle[aria-expanded="true"] .icon--menu {
  display: none;
}

.header__menu-toggle[aria-expanded="true"] .icon--close {
  display: inline;
}

.header__container {
  align-items: center;
  display: flex;
  height: 4rem;
  justify-content: space-between;
}

.header__logo {
  align-items: center;
  color: var(--color-text-primary);
  display: flex;
}

.header__logo a {
  color: inherit;
}

.header__logotype {
  display: block;
  height: 2em;
  min-height: 1.6rem;
  position: relative;
  width: auto;

  &:before {
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    content: '';
    display: block;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: -1;
  }
}

.header__logo-text {
  color: var(--color-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.header__nav {
  display: none;
}

@media (min-width: 768px) {
  .header__menu-toggle {
    display: none;
  }

  .header__nav {
    display: block;
    margin-inline-start: auto;
  }
}

/* Show nav when toggle is active (add/remove .is-open via JS) */
.header__nav.is-open {
  background-color: var(--color-surface-primary);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  left: 0;
  padding: var(--space-sm);
  position: absolute;
  right: 0;
  top: 100%;
  z-index: var(--z-overlay);
}

.header__nav.is-open .nav {
  flex-direction: column;
}

/* Navigation */
.nav {
  display: flex;
  gap: var(--space-xs);
  margin-block: 0;
}

.nav__item {
  position: relative;
}

.nav__link {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-xs);
  transition: color var(--transition-fast);
}

.nav__link:hover {
  color: var(--color-primary-base);
  text-decoration: none;
}

.nav__item--active .nav__link {
  color: var(--color-primary-dark);
}

/*.nav__item:hover::after {*/
/*  background-color: var(--color-secondary-base);*/
/*  border-radius: var(--radius-full);*/
/*  bottom: -4px;*/
/*  content: '';*/
/*  height: 2px;*/
/*  left: 0;*/
/*  position: absolute;*/
/*  width: 100%;*/
/*}*/

.nav__item--active::after {
  background-color: var(--color-accent);
}


/* Hero Section */
.hero {
  background: linear-gradient(180deg, var(--color-surface-primary), var(--color-surface-secondary));
  overflow: clip;
  padding: var(--space-4xl) 0 var(--space-xl);
  position: relative;
  text-align: center;
}

.hero__container {
  position: relative;
}

.hero__media {
  aspect-ratio: 1;
  display: grid;
  margin-block: 0 -2rem;
  margin-inline: auto;
  max-width: min(75%, 12rem);
  place-content: center;
  position: relative;
  width: auto;

  &:before {
    aspect-ratio: 1;
    background-color: var(--color-secondary-lighter);
    border: 8px solid var(--color-secondary-darker);
    border-radius: 35%;
    box-shadow: 0 0 12px 6px inset rgba(0, 0, 0, 0.35), 0 0 32px 11px rgba(163, 253, 177, 0.6) !important;
    content: ' ';
    filter: blur(-1px);
    inset: 0;
    mix-blend-mode: overlay;
    opacity: 0.73;
    position: absolute;
    scale: 1.5;
    z-index: 4;
  }
}

.hero__logotype {
  display: block;
  margin: 0 auto var(--space-xs);
  margin-block-start: -1rem;
  margin-bottom: -1rem;
  margin-inline: auto;
  max-height: 6rem;
  max-width: min(36rem, 80vw);
  overflow: clip;
  scale: 1;

  svg {
    height: 2.5rem;
    width: auto;
  }
}

.hero__logo {
  display: block;
  filter: drop-shadow(2px 4px 8px #03021A) contrast(1.05);
  scale: 1.05;
  transition: all var(--transition-slow);
  width: 100%;
}

.hero:hover .hero__logo {
  scale: 1.15;
}

.hero__title {
  font-size: var(--font-size-5xl);
  font-weight: lighter;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 2;
}

.hero__subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  font-weight: 200;
  margin-bottom: var(--space-xl);
  margin-inline: auto;
  max-width: 36rem;
  position: relative;
  text-wrap: balance;
  z-index: 2;
}

.hero__actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-xl);
  position: relative;
  z-index: 2;
}

/* Hero adjustments for small screens */
@media (max-width: 640px) {
  .hero {
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .hero__title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-medium);
    letter-spacing: normal;
  }

  .hero__subtitle {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-lg);
  }

  .hero__actions {
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
  }

  .hero__media {
    max-inline-size: 20vw;
  }
}

.hero__visual {
  margin: 0 auto;
  max-width: 48rem;
}

.hero__shadow {
  filter: grayscale(1) opacity(.45);
  height: 20vw;
  left: 50%;
  mix-blend-mode: overlay;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(2.5);
  transform-origin: center;
  width: 20vw;
  z-index: 0;
}


/* Page Header */

.page-header {
  background: linear-gradient(180deg, var(--color-surface-primary), var(--color-surface-secondary));
  padding: var(--space-xl) 0;
  position: relative;
  text-align: center;
}

.page-header__container {
  margin: 0 auto;
  max-width: var(--container-lg);
  padding: 0 var(--space-lg);
  position: relative;
}

.page-header__title {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
}

.page-header__subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
  margin: 0 auto;
  max-width: 42rem;
}


.toc-layout {
  display: grid;
  gap: var(--space-3xl);
  grid-template-columns: 300px 1fr;
}

.toc-toggle {
  align-items: center;
  background-color: var(--color-surface-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  cursor: pointer;
  display: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  transition: background-color var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
  width: 100%;
}

.toc-toggle:hover {
  background-color: var(--color-surface-tertiary);
}

.toc-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.toc-layout__toc {
  display: flex;
  flex-direction: column;
  padding-top: 2rem;

  .toc {
    position: sticky;
    top: 6rem;
  }
}

.toc-layout__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow-wrap: anywhere;
  word-break: break-word;

  > pre {
    display: grid;
    margin-bottom: var(--space-lg);
  }

  > ul > li:not(:has(ul,li,p)) {
    list-style: initial;
    margin-inline-start: var(--space-md);
  }
}

@media (max-width: 1023px) {
  .toc-layout {
    gap: var(--space-xl);
    grid-template-columns: 1fr;
  }

  .toc-layout__toc {
    padding-top: 0;
  }

  .toc-layout.has-toc-toggle .toc-toggle {
    display: flex;
  }

  .toc-layout.has-toc-toggle .toc-layout__toc {
    display: none;
  }

  .toc-layout.has-toc-toggle .toc-layout__toc.is-open {
    display: flex;
    margin-bottom: var(--space-md);
  }

  .toc-layout__toc .toc {
    position: static;
  }
}


/* Footer */

.footer {
  background-color: var(--color-surface-secondary);
  border-top: 1px solid var(--color-footer-border);
  padding: var(--space-xl) 0 0;
}

.footer__content {
  display: grid;
  gap: 0; /* <600px: no gap */
  grid-template-columns: 1fr; /* <600px: single column */
}

/* >=600px: four columns, first spans 3 fractions */
@media (min-width: 600px) {
  .footer__content {
    gap: var(--space-2xl);
    grid-template-columns: 3fr 1fr 1fr 1fr;
  }
}

.footer__heading {
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
}


.footer__text {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-lg);
}

.footer__heading {
  align-items: center;
  color: var(--color-text-primary);
  display: flex;
  font-size: var(--font-size-lg);
  justify-items: first start;
  margin-bottom: var(--space-lg);
}

.footer__list {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.footer__link {
  color: var(--color-text-secondary);
  padding: var(--space-2xs) 0;
  transition: color var(--transition-normal);
}

.footer__link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.footer__bottom {
  border-top: 1px solid var(--color-footer-border);
  margin-inline: auto;
  margin-top: var(--space-md);
  padding-block: var(--space-md);
  text-align: center;

  p {
    margin: 0;
    padding-inline: var(--space-md);
  }

  a {
    text-decoration: none;
  }
}

.footer__credit,
.footer__bottom {
  color: inherit;

  &:hover {
    color: var(--color-primary);
  }
}

.footer__copyright {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

/* Extra small screens */
@media (max-width: 480px) {
  .footer {
    padding: var(--space-lg) 0;
  }

  .footer__content {
    gap: 0;
  }

  .footer__bottom {
    max-width: 32rem;
  }
}

/* Show CTA on desktop only; show menu button on mobile */
.header__cta {
  display: none;
}

@media (min-width: 768px) {
  .header__cta {
    display: block;
  }
}

@media (max-width: 767px) {
  .header__container {
    align-items: center;
    display: grid;
    gap: var(--space-sm);
    grid-auto-flow: column;
    grid-template-columns: auto 1fr auto;
    height: auto; /* prevent content from overflowing out of header */
    min-height: 4rem; /* keep a comfortable touch target */
  }

  .header__container > * {
    min-width: 0;
  }

  /* keep logo centered without absolute positioning */
  .header__logo {
    grid-column: 2;
    justify-self: center;
    position: static;
  }

  .header__logotype {
    height: 1.75rem;
  }

  /* keep actions tight on small screens */
  .header__buttons {
    white-space: nowrap;
  }

  .icon-button {
    padding: 0;
  }

.header__menu-toggle {
  grid-column: 1;
  justify-self: start;
}

.header__logo {
  grid-column: 2;
  justify-self: center;
}

.header__buttons, .header__cta {
  grid-column: 3;
  justify-self: end;
}

.header__nav {
  background-color: var(--color-surface-primary);
  border-top: 1px solid var(--color-border-light);
  left: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 var(--space-sm);
  position: absolute;
  right: 0;
  top: 100%;
  transform: translateY(-4px);
  transition: max-height 240ms ease, opacity 200ms ease, transform 200ms ease, padding 200ms ease;
  z-index: var(--z-overlay);
}

.header__nav .nav {
  flex-direction: column;
  gap: var(--space-xs);
  margin-block: var(--space-xs);
}

.header__nav.is-open {
  max-height: 70vh;
  opacity: 1;
  padding: var(--space-sm);
  transform: translateY(0);
}

}
