/* ============================================================================
   ADVOKE CV — layout.css
   Page shells, header, footer, section rhythm, grid primitives, breakpoints.
   Mobile-first. Ranges covered: 320 · 360 · 390 · 430 · 768 · 1024 · 1280 · 1440.
   ============================================================================ */

/* ── 1. App shell ───────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  isolation: isolate;
}

.app > main {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── 2. Containers ──────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.container-wide {
  width: 100%;
  max-width: var(--page-max-wide);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.container-narrow {
  width: 100%;
  max-width: var(--page-max-narrow);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.container-full {
  width: 100%;
  padding-inline: var(--page-pad);
}

/* Container escape: full-bleed inside a container */
.bleed {
  margin-inline: calc(var(--page-pad) * -1);
  padding-inline: var(--page-pad);
}

/* ── 3. Sections ────────────────────────────────────────────────────────── */
.section {
  padding-block: var(--section-y);
}

.section-tight {
  padding-block: var(--section-y-tight);
}

.section-flush-top { padding-top: 0; }
.section-flush-bottom { padding-bottom: 0; }

.section-alt {
  background: var(--paper-3);
}

.section-warm {
  background:
    radial-gradient(120% 90% at 50% 0%, var(--y-50) 0%, transparent 60%),
    var(--paper);
}

.section-yellow {
  background: var(--y-500);
  color: var(--ink);
}

.section-ink {
  background: var(--ink);
  color: var(--paper);
}

.section-ink h1,
.section-ink h2,
.section-ink h3,
.section-ink h4,
.section-ink h5,
.section-ink h6 {
  color: var(--paper);
}

.section-ink .lede,
.section-ink p {
  color: #CBD5E1;
}

.section-divider {
  border-top: 1px solid var(--line-2);
}

/* ── 4. Section headers (title block) ──────────────────────────────────── */
.section-head {
  max-width: 62ch;
  margin-bottom: clamp(1.75rem, 3vw + 0.5rem, 3rem);
}

.section-head.centered {
  margin-inline: auto;
  text-align: center;
}

.section-head .eyebrow {
  margin-bottom: var(--s-3);
}

.section-head h2 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-tighter);
  margin-bottom: var(--s-3);
}

.section-head .lede {
  font-size: var(--fs-xl);
  color: var(--ink-2);
  line-height: var(--lh-snug);
  margin: 0;
}

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4) var(--s-6);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.section-head-row .section-head {
  margin-bottom: 0;
}

/* ── 5. Site header ─────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base), box-shadow var(--t-base), background-color var(--t-base);
  contain: layout style;
}

.site-header.is-stuck {
  border-bottom-color: var(--line-2);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), 0 6px 20px -18px rgba(15, 23, 42, 0.35);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--header-h);
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  font-weight: var(--fw-extrabold);
  font-size: 1.0625rem;
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 0.25rem 0.4rem;
  margin-inline-start: -0.4rem;
}

.brand:hover { color: var(--ink); }

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px var(--line),
    0 0 0 3px rgba(255, 193, 7, 0.16);
}

.brand__text { line-height: 1; }

.brand__text b {
  color: var(--y-700);
  font-weight: var(--fw-extrabold);
}

@media (min-width: 768px) {
  .brand { font-size: 1.125rem; }
  .brand__mark { width: 36px; height: 36px; border-radius: 10px; }
}

/* Primary nav */
.site-nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
  margin-inline-start: auto;
}

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

.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink-2);
  transition: background-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}

.site-nav__link:hover {
  background: var(--y-50);
  color: var(--ink);
}

.site-nav__link[aria-current="page"] {
  color: var(--ink);
  background: var(--y-100);
}

.site-nav__link svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

@media (min-width: 900px) {
  .header-actions { margin-inline-start: 0.5rem; }
}

/* Mobile menu toggle */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: background-color var(--t-fast);
}

.nav-toggle:hover { background: var(--paper-4); }

.nav-toggle svg { width: 22px; height: 22px; }

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

/* Mobile drawer */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  grid-template-columns: 1fr;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-base);
}

.mobile-nav[data-open="true"] {
  pointer-events: auto;
  opacity: 1;
}

.mobile-nav__scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.mobile-nav__panel {
  position: relative;
  margin-inline-start: auto;
  width: min(88vw, 360px);
  height: 100%;
  background: var(--paper);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  gap: var(--s-2);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-nav[data-open="true"] .mobile-nav__panel {
  transform: translateX(0);
}

.mobile-nav__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-2);
}

.mobile-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 0.9rem 1rem;
  border-radius: var(--r-md);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  transition: background-color var(--t-fast);
}

.mobile-nav__link:hover { background: var(--y-50); }

.mobile-nav__link svg {
  width: 18px;
  height: 18px;
  color: var(--ink-4);
}

.mobile-nav__foot {
  margin-top: auto;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-2);
  display: grid;
  gap: var(--s-2);
}

@media (min-width: 900px) {
  .mobile-nav { display: none; }
}

/* ── 6. Site footer ─────────────────────────────────────────────────────── */
.site-footer {
  background: var(--paper-2);
  border-top: 1px solid var(--line-2);
  margin-top: auto;
  padding-block: clamp(2.5rem, 5vw, 4.5rem) var(--s-6);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 4vw, 3rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

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

@media (min-width: 1024px) {
  .site-footer__grid {
    grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr));
    gap: 3rem;
  }
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: 38ch;
}

.site-footer__brand .brand {
  margin-inline-start: 0;
  padding-inline-start: 0;
}

.site-footer__tagline {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  line-height: var(--lh-body);
}

.footer-col__title {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}

.footer-col__list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.footer-col__list a {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: color var(--t-fast);
}

.footer-col__list a:hover { color: var(--y-700); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
}

.site-footer__legal a { color: var(--ink-3); }
.site-footer__legal a:hover { color: var(--y-700); }

/* ── 7. Page header (inner pages) ──────────────────────────────────────── */
.page-hero {
  padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(1.75rem, 3vw, 2.5rem);
  background:
    radial-gradient(90% 100% at 15% 0%, var(--y-50) 0%, transparent 55%),
    var(--paper);
  border-bottom: 1px solid var(--line-2);
}

.page-hero__inner {
  max-width: 68ch;
}

.page-hero h1 {
  font-size: var(--fs-5xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-tighter);
  margin-bottom: var(--s-4);
}

.page-hero .lede {
  font-size: var(--fs-xl);
  color: var(--ink-2);
  line-height: var(--lh-snug);
  margin: 0;
}

.page-hero--center .page-hero__inner {
  margin-inline: auto;
  text-align: center;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: var(--s-4);
}

.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.35rem; }
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--y-700); }
.breadcrumbs svg { width: 12px; height: 12px; opacity: 0.5; }
.breadcrumbs [aria-current="page"] { color: var(--ink-2); font-weight: var(--fw-semibold); }

/* ── 8. Generic grid primitives ────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

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

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

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

/* Auto-fit helper (no media queries) */
.grid-auto {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.grid-auto-sm {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}

.grid-auto-lg {
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

/* ── 9. Flex primitives ────────────────────────────────────────────────── */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
}

.row-between {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  align-items: center;
  justify-content: space-between;
}

.row-start { align-items: flex-start; }
.row-end { justify-content: flex-end; }
.row-center { justify-content: center; }
.row-tight { gap: var(--s-2); }
.row-loose { gap: var(--s-7); }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.stack-tight { gap: var(--s-2); }
.stack-loose { gap: var(--s-6); }
.stack-xl { gap: var(--s-8); }

/* ── 10. Split layouts ─────────────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split-wide-left { grid-template-columns: 1.25fr 0.75fr; }
  .split-wide-right { grid-template-columns: 0.75fr 1.25fr; }
}

.split-top { align-items: start; }

/* ── 11. Sticky sidebar layout (editor) ────────────────────────────────── */
.with-aside {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}

@media (min-width: 1024px) {
  .with-aside {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: var(--s-8);
    align-items: start;
  }
  .with-aside--left {
    grid-template-columns: 340px minmax(0, 1fr);
  }
}

.aside-sticky {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
  align-self: start;
}

@media (max-width: 1023px) {
  .aside-sticky { position: static; }
}

/* ── 12. Responsive breakpoint helpers ─────────────────────────────────── */
.only-mobile { display: block; }
.only-desktop { display: none; }

@media (min-width: 768px) {
  .only-mobile { display: none; }
  .only-desktop { display: block; }
}

.hide-sm { display: none; }
@media (min-width: 560px) { .hide-sm { display: block; } }

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

.hide-lg { display: none; }
@media (min-width: 1024px) { .hide-lg { display: block; } }

.show-sm { display: block; }
@media (min-width: 560px) { .show-sm { display: none; } }

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

/* ── 13. Touch target guarantee ────────────────────────────────────────── */
.touch {
  min-width: 44px;
  min-height: 44px;
}

@media (pointer: coarse) {
  button,
  a.btn,
  [role="button"] {
    min-height: 44px;
  }
}

/* ── 14. Overflow protection — prevent horizontal scroll on mobile ─────── */
main,
section,
article,
aside,
header,
footer,
nav,
div {
  min-width: 0;
}

img,
video,
table,
pre,
code,
iframe {
  max-width: 100%;
}

/* ── 15. Wide breakpoint refinements (1280 / 1440) ─────────────────────── */
@media (min-width: 1280px) {
  :root {
    --page-pad: 2.5rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --page-max: 1240px;
    --page-max-wide: 1440px;
  }
}

/* ── 16. Print — hide app chrome (full rules in print.css) ─────────────── */
@media print {
  .site-header,
  .site-footer,
  .mobile-nav,
  .skip-link,
  .nav-toggle {
    display: none !important;
  }
}