/* ---------- Base ---------- */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f3f2ef;
  --color-text: #111111;
  --color-muted: #555555;
  --color-line: #747474;
  /* Header once scrolled past the hero (over the hero it floats with no background) */
  --color-header-bg: rgba(255, 255, 255, 0.72);
  --color-header-text: #f2f0eb;
  /* Soft shadow that lifts the header text off light images */
  --header-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 14px rgba(0, 0, 0, 0.35);
  --color-nav-bg: rgba(255, 255, 255, 0.85);
  --color-hero-bg: #2b2b2b;
  /* Darkening at the top of the hero, behind the header: 0 = none */
  --hero-scrim: 0.3;
  --header-height: 64px;
  --gutter: 24px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-title: "Archivo", var(--font);
  --fade: 1.5s;
}

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

html {
  scroll-behavior: smooth;
}

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

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

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--gutter);
  transition: background-color 0.3s ease;
}

/* Past the hero (set by tempfolio2026-script.js): dark text on a light, blurred bar */
.site-header.is-solid {
  --color-header-text: var(--color-text);
  --header-shadow: none;
  background: var(--color-header-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.site-title {
  color: var(--color-header-text);
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  text-shadow: var(--header-shadow);
  transition: color 0.3s ease;
}

/* ---------- Hamburger ---------- */

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-right: -10px;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle__bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-header-text);
  box-shadow: var(--header-shadow);
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.3s ease;
}

/* Turn into an X when open */
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Navigation (dropdown) ---------- */

/* Mobile first: full width under the header, large tap targets */
.site-nav {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--color-nav-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-line);
  /* Hidden until opened; visibility also keeps the links out of the tab order */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.site-header.is-open .site-nav {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li + li {
  border-top: 1px solid rgba(17, 17, 17, 0.15);
}

.site-nav a {
  display: block;
  padding: 16px var(--gutter);
  font-size: 1.25rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Wider screens: a panel under the hamburger instead of full width */
@media (min-width: 720px) {
  .site-nav {
    left: auto;
    width: 260px;
    border-left: 1px solid var(--color-line);
  }

  .site-nav a {
    padding: 12px var(--gutter);
    font-size: 1.125rem;
  }
}

/* ---------- Hero slideshow ---------- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--color-hero-bg);
}

/* Soft darkening at the top so the floating header stays readable over light images */
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  height: 160px;
  background: linear-gradient(rgba(0, 0, 0, var(--hero-scrim)), transparent);
  pointer-events: none;
}

.hero__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--fade) ease;
  /* Behave like a background: no hover buttons from extensions (e.g. Pinterest), no "save image" on
     right-click or long-press, no dragging */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* The incoming slide fades in on top; the outgoing one stays visible underneath until it is covered */
.hero__slide.is-active {
  z-index: 2;
  opacity: 1;
}

.hero__slide.is-leaving {
  z-index: 1;
  opacity: 1;
  transition: none;
}

/* Down chevron at the bottom of the hero */
.hero__scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  margin-left: -22px;
}

.hero__scroll::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 13px;
  width: 16px;
  height: 16px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.6));
}

/* ---------- Sections ---------- */

.section {
  padding: 96px var(--gutter);
  background: var(--color-bg);
  scroll-margin-top: var(--header-height);
}

.section--alt {
  background: var(--color-bg-alt);
}

.section__inner {
  max-width: 720px;
  margin: 0 auto;
}

.section h2 {
  margin: 0 0 24px;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

.section h3 {
  margin: 40px 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
}

.section p {
  margin: 0 0 16px;
  color: var(--color-muted);
}

@media (max-width: 719px) {
  .section {
    padding: 64px var(--gutter);
  }

  .section h2 {
    font-size: 1.625rem;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--color-line);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .site-nav,
  .menu-toggle__bar,
  .hero__slide {
    transition: none;
  }
}
