/* ============================================================
   LAYOUT
   Page structure: header/nav, the about block, project grid +
   expand behaviour, skills/experience/contact grids, footer,
   and all responsive rules (kept together at the bottom).
   ============================================================ */

/* ---- Header / Nav ---- */
/* In-flow inside #lead; .stuck (see ui.js) fixes it to the viewport top */
.header-anchor {
  width: 100%;
  margin-top: 0.5em;
}

.header {
  position: relative;
  width: 100%;
  z-index: 10;
}

.header.stuck {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  gap: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 67px;
  margin: 5px auto;
}
.nav-links a { font-size: 14px; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.nav-toggle-lines {
  display: inline-block;
  width: 18px; height: 12px;
  opacity: 0.9;
  background:
    linear-gradient(var(--text), var(--text)) 0 0   / 100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 50%  / 100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 100% / 100% 2px no-repeat;
}

.header-sentinel {
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* ---- Lead block ---- */
.lead {
  width: 80vw;
  max-width: 80vw;
  min-height: 100dvh;
  box-sizing: border-box;

  /* ONE knob: scales the whole block. Raise it to fill more of the 80vw.
     Everything below is in em, so proportions never change. */
  font-size: 2vw;

  padding: 3em 0 5em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  text-align: center;
}
.lead .headline {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: 2.25em;
}

/* Hero nav — same scale as kicker; compacts when .stuck */
.lead .header:not(.stuck) .nav-links {
  gap: 2.5em;
  margin: 0 auto;
}
.lead .header:not(.stuck) .nav-links a {
  font-size: 0.4em;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.lead .header:not(.stuck) .nav-links a:hover {
  color: var(--text);
}

/* ---- About block ---- */
.about {
  padding: 24px 0 24px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  align-items: start;
}
.about-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 22px;
}

/* ---- Generic grids ---- */
.grid { display: grid; gap: 14px; }
.skills-grid  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.contact-grid { grid-template-columns: 1.2fr 0.8fr; }

/* ---- Project filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 18px;
}

/* ---- Project grid ---- */
.projects-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}
.projects-grid .project {
  min-width: 0;
}

/* Expanded card spans the full row */
.projects-grid .project.is-expanded { grid-column: 1 / -1; }

/* Equal-height cards per row, expand control pinned to the bottom */
.projects-grid .project:not(.is-expanded) .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.projects-grid .project:not(.is-expanded) .card__row { margin-top: auto; }

/* Project header */
.project-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.project-top h3 { margin: 0; font-size: 18px; }
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Expanding detail panel */
.project-expanded {
  display: none;
}
.project.is-expanded .project-expanded {
  display: block;
}
.project-expanded-inner h4 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.project-expanded-inner p  { margin: 0 0 12px; color: var(--text-muted); }
.project-expanded-inner ul { margin: 0 0 24px; color: var(--text-muted); }

/* Media inside an expanded project */
.video-image-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.video-image-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}
.video-image-item img,
.video-image-item video {
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* Generic action button row */
.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Experience (stacked timeline cards) ---- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.timeline-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 102px;
}
.timeline-head-row .muted { flex-shrink: 0; }
.timeline-head h3 { margin: 0; }
.timeline-head p  { margin: 3px 0 0; }

/* ---- Footer ---- */
.footer {
  padding: 28px 0 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .about         { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid   { grid-template-columns: 1fr 1fr; }
  .contact-grid  { grid-template-columns: 1fr; }
}

/* Lead name + in-hero nav, mid widths (landscape phones / small tablets).
   The hero's em/2vw scaling is sized for full-width desktop; between the
   720px phone rules and this 980px layout breakpoint it collapses the nav
   to ~6px. Give the lead explicit, readable sizes across this band too. */
@media (min-width: 721px) and (max-width: 980px) {
  .lead .headline {
    font-size: clamp(2.75rem, 6.5vw, 3.75rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
  }
  .lead .header:not(.stuck) .nav-links a {
    font-size: clamp(0.875rem, 1.8vw, 1rem);
  }
}

@media (max-width: 720px) {
  .section { padding: 44px 0; }

  /* Lead name + in-hero nav (explicit sizes — em/2vw stay too small on phones) */
  .lead .headline {
    font-size: clamp(2.75rem, 12vw, 3.75rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
  }
  .lead .header:not(.stuck) .nav-links a {
    font-size: clamp(0.8125rem, 3.6vw, 1rem);
  }

  .card { padding: 14px; border-radius: 16px; }

  .projects-grid { gap: 12px; }
  .project-top h3 { font-size: 16px; }
  .project-expanded-inner h4 { font-size: 14px; }

  .btn { padding: 11px 12px; font-size: 13px; }
  .btn.small { padding: 9px 10px; border-radius: 12px; }
  .actions { gap: 8px; }

  .tag { font-size: 10.5px; padding: 4px 7px; }

  /* In the lead: text links under the name (same as desktop hero) */
  .lead .header:not(.stuck) .nav {
    flex-direction: column;
    align-items: center;
  }
  .lead .header:not(.stuck) .nav-links {
    display: flex;
    flex-direction: column;
    position: static;
    gap: 1.25em;
    min-width: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
  }
  .lead .header:not(.stuck) .nav-links a {
    padding: 0;
    border-radius: 0;
  }
  .lead .header:not(.stuck) .nav-links a:hover {
    background: transparent;
  }

  /* After scrolling past the lead: hamburger dropdown */
  .header.stuck .nav-toggle {
    display: inline-flex;
  }
  .header.stuck .nav {
    position: relative;
    flex-direction: row;
    justify-content: flex-end;
  }
  .header.stuck .nav-links {
    display: none;
    position: absolute;
    right: 0;
    top: 58px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 220px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg);
  }
  .header.stuck .nav-links a {
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
  }
  .header.stuck .nav-links.open { display: flex; }
  .header.stuck .nav-links a:hover { background: var(--surface-1); }

  .video-image-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
}