/* app.css
   Single source of truth
   Stable, accessible, mobile-first baseline
*/

/* =========================
   1. Reset & accessibility
   ========================= */

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

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  line-height: 1.65;
  background-color: #fbfbfa;
  color: #1f2f4a;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
}

a {
  color: #1f2f4a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid #1f2f4a;
  outline-offset: 2px;
}

:focus-visible {
  scroll-margin-top: 80px;
}

/* Visually hidden (still readable by screen readers) */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* =========================
   2. Typography
   ========================= */

h1,
h2,
h3 {
  font-family: "Libre Baskerville", serif;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 18px;
}

p {
  margin: 0;
  color: #111111;
}

p + p {
  margin-top: 14px;
}

/* =========================================================
   Interior pages — unified reading column
   Applies only to content pages (About, blog posts)
   ========================================================= */

.page-content > h1,
.page-content > h2,
.page-content > h3,
.page-content > h4,
.page-content > p,
.page-content > ul,
.page-content > ol,
.page-content > blockquote,
.page-content > img {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* Ensure images stay responsive within the column */
.page-content > img {
  display: block;
  height: auto;
}

/* Lists align cleanly with body text */
.page-content > ul,
.page-content > ol {
  padding-left: 1.25rem;
}

/* =========================
   Global vertical rhythm
   ========================= */

/* Headings need breathing room */
h1 {
  margin-bottom: 14px;
}

h2 {
  margin-top: 28px;
  margin-bottom: 12px;
}

h3 {
  margin-top: 24px;
  margin-bottom: 10px;
}

/* First paragraph after a heading should sit closer */
h1 + p,
h2 + p,
h3 + p {
  margin-top: 0;
}

/* Paragraph spacing everywhere */
p {
  margin-bottom: 14px;
}

/* Images inside content need calm spacing */
main img {
  margin: 28px 0;
}

/* =========================
   3. Layout primitives
   ========================= */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Ensure pages without a .container still center properly */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section {
  padding: 64px 0;
}

/* Give the main content a little top/bottom rhythm */
.page-content {
  padding-bottom: 48px;
}

/* =========================
   4. Homepage structure
   ========================= */

/* MAGAZINE STACK (homepage)
   Text lane is centered, cards stay wide.
   This replaces the old homepage "unify text sections" block.
*/
:root {
  --home-text-col: 760px;
  --home-text-col-wide: 900px;
}

/* Opening magazine image */
.section.opening-image {
  padding: 28px 0 10px;
}

.section.opening-image img {
  width: 100%;
  height: 380px;
  object-fit: cover;
  border-radius: 14px;
}

@media (max-width: 640px) {
  .section.opening-image img {
    height: 220px;
  }
}

/* Hero text block (below opening image) */
.hero {
  padding: 18px 0 28px;
}

/* Hero text sits in the text lane */
.hero-content {
  max-width: var(--home-text-col);
  margin-left: auto;
  margin-right: auto;
}

/* Give the hero a bit more room on desktop so subtext doesn’t feel crammed */
@media (min-width: 900px) {
  .hero-content {
    max-width: var(--home-text-col-wide);
  }
}

/* Editorial landing page rhythm for hero text */
.hero-content .statement {
  line-height: 1.5;
}

.hero-content .statement br {
  display: block;
  margin-bottom: 6px;
}

.hero-content .statement {
  margin-bottom: 32px;
}

.hero-content h1 {
  max-width: none;
}

/* Hero subtext should flow naturally (aim for ~2 lines), not forced into 1 line */
.hero-content p {
  margin-top: 14px;
  max-width: 60ch;
  color: #2b2b2b;
  line-height: 1.55;
}

/* If the markup uses <br>, neutralize it on desktop so wrapping stays natural */
@media (min-width: 900px) {
  .hero-content p br {
    display: none;
  }
}

/* Text lane for homepage sections (but NOT for latest-insights cards) */
.page-content
  > .section:not(.opening-image):not(.latest-insights)
  > :where(h2, p, ul, ol, blockquote, .statement, img),
.page-content
  > .section:not(.opening-image):not(.latest-insights)
  .container
  > :where(h2, p, ul, ol, blockquote, .statement, img) {
  max-width: var(--home-text-col);
  margin-left: auto;
  margin-right: auto;
}

/* Latest insights: keep heading in text lane, keep grid wide */
.section.latest-insights h2 {
  max-width: var(--home-text-col);
  margin-left: auto;
  margin-right: auto;
}

.section.latest-insights {
  padding-top: 36px;
}

/* Intro-wide (kept as-is in case you use it) */
.section.intro-wide h2 {
  margin-bottom: 16px;
}

.section.intro-wide .statement {
  max-width: 68ch;
  color: #1a1a1a;
}
/* Homepage: statement block should feel intentional (not like stacked paragraphs) */
.section.intro-wide .statement {
  max-width: 56ch;
  font-size: 18px;
  line-height: 1.6;
}

/* If statement uses <br>, soften the breaks so it reads as a single block */
.section.intro-wide .statement br {
  display: block;
  margin-bottom: 10px;
}

.section.intro-wide .read-more {
  display: inline-block;
  margin-top: 18px;
}

/* Latest insights */
.section.latest-insights h2 {
  margin-bottom: 18px;
}

/* Blog card grid */
.blog-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 900px) {
  .blog-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .blog-cards {
    grid-template-columns: 1fr;
  }
}

.blog-card {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
  text-decoration: none;
}

.blog-card:hover {
  border-color: rgba(31, 47, 74, 0.28);
}

.blog-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.blog-card-content {
  padding: 14px 14px 16px;
}

.blog-card-content h3 {
  margin: 0;
}

.blog-card-content p {
  margin-top: 8px;
  color: #4a4a4a;
  line-height: 1.55;
}

/* Prevent underline weirdness on card titles (cards are clickable already) */
.blog-card h3,
.blog-card p {
  text-decoration: none;
}

/* =========================
   Header + Horizontal Nav
   ========================= */

.site-header {
  width: 100%;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
  padding-bottom: 18px;
}

/* Brand */
.site-header .brand,
.site-header a.brand {
  display: inline-block;
  text-decoration: none;
  line-height: 1.1;
  white-space: nowrap;
}

/* Nav (desktop default) */
.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  padding: 6px 2px;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.site-nav .active > a,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* Desktop: hide only true menu toggles (no broad guessing) */
@media (min-width: 721px) {
  .site-header button[aria-expanded],
  .site-header button[aria-controls],
  .site-header a[aria-expanded],
  .site-header a[aria-controls] {
    display: none !important;
  }
}

/* Mobile: stack cleanly, keep links visible (no dependency on hamburger) */
@media (max-width: 720px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .site-nav ul {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px 16px;
  }
}
