/* ==========================================================================
   Layout: container, header, mobile menu, sections, CTA band, footer
   ========================================================================== */

.container { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo: large accent "S" behind the wordmark (desktop) */
.logo { text-decoration: none; display: inline-flex; align-items: center; }
.logo--overlay { position: relative; height: 48px; padding: 0 4px; }
.logo--overlay .logo__s {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -53%);
  font: 400 58px/1 var(--font-serif);
  color: var(--accent);
  z-index: 0;
}
.logo--overlay .logo__word {
  position: relative;
  z-index: 1;
  font: 500 21px var(--font-serif);
  letter-spacing: .12em;
  color: var(--ink);
  -webkit-text-stroke: 4px var(--bg);
  paint-order: stroke fill;
  white-space: nowrap;
}
/* Logo: badge + wordmark (mobile) */
.logo--badge { gap: 10px; }
.logo--badge .logo__s {
  width: 40px; height: 40px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font: 400 30px/1 var(--font-serif);
  padding-bottom: 3px;
}
.logo--badge .logo__word { font: 500 17px var(--font-serif); letter-spacing: .12em; color: var(--ink); }

.nav { display: flex; align-items: center; gap: 22px; }
.nav a {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: transparent; color: var(--ink);
  font: 500 13px var(--font-sans);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle__icon {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  flex: none;
}

.menu-toggle {
  width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer;
}
.menu-toggle span { width: 18px; height: 1.5px; background: currentColor; transition: transform .2s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-menu {
  border-top: 1px solid var(--line);
  padding: 8px var(--gutter) 20px;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.mobile-menu a.mobile-menu__link {
  font: 400 24px var(--font-serif);
  text-decoration: none; color: var(--ink);
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.mobile-menu a.mobile-menu__link[aria-current="page"] { color: var(--accent); }
.mobile-menu .btn { margin-top: 20px; }

.only-mobile { display: none; }

@media (max-width: 1039px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: flex; }
  .menu-toggle { display: flex; }
  .theme-toggle { width: 44px; height: 44px; padding: 0; border-radius: 8px; }
  .theme-toggle__icon { width: 16px; height: 16px; }
  .theme-toggle__label { display: none; }
  .header-actions { gap: 8px; }
}

/* Reading progress (article pages) */
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none; }
.read-progress__bar { height: 3px; width: 0; background: var(--accent); }

/* ---------- Sections ---------- */
.section { padding-bottom: clamp(64px, 8vw, 104px); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--ink);
  padding-top: 16px;
  margin-bottom: 32px;
}
.section-head__title { display: flex; align-items: baseline; gap: 14px; }
.section-head h2 { font: 500 clamp(26px, 3vw, 34px)/1.2 var(--font-serif); }
.section-head__meta { font: 400 12.5px var(--font-mono); color: var(--muted); }

/* Page hero for inner pages */
.page-hero { padding-top: clamp(48px, 7vw, 88px); }
.page-hero .eyebrow { margin-bottom: 20px; }
.page-hero h1 {
  font: 400 clamp(38px, 5.4vw, 64px)/1.08 var(--font-serif);
  max-width: 18ch;
  text-wrap: balance;
}
.page-hero__intro { max-width: 58ch; color: var(--muted); font-size: 19px; margin-top: 24px; }
.page-hero__note { margin-top: 20px; font: 400 13px var(--font-mono); color: var(--bronze-ink); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--accent); color: var(--accent-ink); }
.cta-band__inner {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(40px, 6vw, 72px);
  display: flex; flex-wrap: wrap; gap: 24px;
  align-items: center; justify-content: space-between;
}
.cta-band__eyebrow { display: flex; align-items: baseline; gap: 14px; font: 500 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; }
.cta-band h2 { font: 400 clamp(28px, 3.6vw, 42px)/1.15 var(--font-serif); max-width: 20ch; }
.cta-band .btn { height: 54px; padding: 0 26px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer__grid {
  padding-top: 56px; padding-bottom: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 40px;
}
.site-footer__brand { display: flex; flex-direction: column; gap: 18px; }
.site-footer__brand .logo { align-self: flex-start; }
.site-footer__brand p { color: var(--muted); font-size: 15px; max-width: 30ch; }
.site-footer__label { font: 500 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.site-footer__links { display: flex; flex-direction: column; gap: 8px; font-size: 15.5px; }
.site-footer__links a { color: var(--ink); text-decoration: none; }
.site-footer__links a:hover { color: var(--accent); }
.site-footer__bottom {
  padding-top: 20px; padding-bottom: 32px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: 14px; color: var(--muted);
}
.site-footer__bottom .mono { font-size: 12.5px; }

/* Social icon row */
.social { display: flex; gap: 10px; flex-wrap: wrap; }
.social a {
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.social a:hover { color: var(--accent); border-color: var(--accent); }
.social svg { width: 18px; height: 18px; }
