/* ============================================================
   Clearmind Collective — Shared Design System
   All pages link this single stylesheet for consistency.
   ============================================================ */

:root {
  --bg: #fbfcfa;
  --bg-soft: #f1f6f4;
  --sky: #d4e6ec;
  --sky-deep: #6ea3b3;
  --leaf: #c9ddc8;
  --leaf-deep: #6b9572;
  --ink: #1f2d2f;
  --ink-soft: #4a5a5d;
  --ink-mute: #7a8688;
  --accent: #1d4a52;
  --warm: #d4a583;
  --line: #e3ebe8;
  --crisis: #a8443a;

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* ============ CRISIS BANNER ============ */
.crisis-banner {
  background: var(--ink);
  color: #fff;
  padding: 10px 0;
  font-size: 14px;
}
.crisis-banner .wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap; text-align: center;
}
.crisis-banner strong { color: #fff; font-weight: 600; }
.crisis-banner a {
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.4);
  padding-bottom: 1px;
}
.crisis-banner a:hover { border-color: #fff; text-decoration: none; }
.crisis-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--crisis);
  box-shadow: 0 0 0 0 rgba(168,68,58,0.6);
  animation: pulse 2.4s infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(168,68,58,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(168,68,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(168,68,58,0); }
}

/* ============ NAV ============ */
nav.top {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(251,252,250,0.92);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; }
.logo {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.logo-mark { width: 28px; height: 28px; flex-shrink: 0; }
.nav-links {
  display: flex; gap: 32px;
  list-style: none; align-items: center;
}
.nav-links a {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.btn-donate {
  background: var(--accent);
  color: #fff !important;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-weight: 500;
}
.btn-donate:hover { background: var(--ink); text-decoration: none; }
.back-link {
  font-size: 14px;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.container { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.container-wide { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 26px;
  border-radius: var(--r-sm);
  font-size: 15px; font-weight: 500;
  font-family: var(--sans);
  cursor: pointer; border: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--ink); text-decoration: none; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn-secondary:hover { background: var(--ink); color: #fff; text-decoration: none; }

/* ============ HEADINGS ============ */
h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 26px;
}
h1 em {
  font-style: italic;
  font-variation-settings: "opsz" 144;
  color: var(--accent);
}
h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 18px;
}
h2 em { font-style: italic; color: var(--sky-deep); }
.eyebrow, .section-eyebrow {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  margin-bottom: 22px;
  display: inline-flex; align-items: center; gap: 8px;
}
.section-eyebrow { color: var(--leaf-deep); font-weight: 600; margin-bottom: 14px; }
.section-head { max-width: 720px; margin-bottom: 56px; }
.section-lead { font-size: 18px; color: var(--ink-soft); line-height: 1.6; }

section.block { padding: 96px 0; }

/* ============ ARTICLE PAGES ============ */
.article-head {
  padding: 80px 0 48px;
  border-bottom: 1px solid var(--line);
}
.breadcrumbs {
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 24px;
}
.breadcrumbs a { color: var(--ink-mute); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.article-head h1 { font-size: clamp(40px, 5vw, 56px); line-height: 1.1; }
.deck {
  font-size: 21px;
  color: var(--ink-soft);
  line-height: 1.55;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  max-width: 620px;
}
.meta {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 32px;
  font-size: 13px;
  color: var(--ink-mute);
}
.meta-tag { display: inline-flex; align-items: center; gap: 6px; }
.meta-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--leaf-deep);
}

article { padding: 56px 0 80px; }
article h2 { font-size: 30px; margin: 56px 0 18px; }
article h2:first-child { margin-top: 0; }
article h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 36px 0 14px;
}
article p {
  margin-bottom: 22px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.75;
}
article p.intro { font-size: 19px; }
article ul, article ol { margin: 0 0 22px 22px; color: var(--ink); }
article li { margin-bottom: 8px; font-size: 18px; line-height: 1.7; }

/* Example pullquote */
.example {
  background: var(--bg-soft);
  border-left: 3px solid var(--sky-deep);
  padding: 28px 32px;
  margin: 36px 0;
  border-radius: 0 8px 8px 0;
}
.example-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leaf-deep);
  font-weight: 600;
  margin-bottom: 12px;
}
.example p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 0;
}

/* Reframe steps */
.reframe {
  background: #fff;
  border: 1px solid var(--leaf);
  border-radius: 12px;
  padding: 32px;
  margin: 40px 0;
}
.reframe-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--leaf-deep);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.reframe-label::before { content: ''; width: 16px; height: 1px; background: var(--leaf-deep); }
.reframe ol { list-style: none; counter-reset: step; margin: 0; }
.reframe ol li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 18px;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.6;
}
.reframe ol li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* Help callout */
.help-callout {
  background: var(--ink);
  color: #fff;
  padding: 32px;
  border-radius: 12px;
  margin: 48px 0;
}
.help-callout h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 12px;
}
.help-callout p { color: #c8d4d2; margin-bottom: 14px; font-size: 16px; }
.help-callout a { color: var(--leaf); }

/* Citations */
.citations-block {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.citations-block h3 {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 16px;
}
.citations-block ol {
  list-style: decimal;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}
.citations-block li { margin-bottom: 10px; font-size: 14px; }
.citations-block cite { color: var(--accent); font-style: italic; }

/* Next/prev nav at end of article */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.article-nav a {
  display: block;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.article-nav a:hover {
  border-color: var(--sky-deep);
  text-decoration: none;
  transform: translateY(-2px);
}
.article-nav .nav-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  display: block;
}
.article-nav .nav-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.article-nav .next { text-align: right; }

/* ============ FOOTER ============ */
footer {
  background: var(--ink);
  color: #a8b8b5;
  padding: 64px 0 32px;
  font-size: 14px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
footer h4 {
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
footer ul { list-style: none; }
footer ul li { margin-bottom: 10px; }
footer a { color: #a8b8b5; }
footer a:hover { color: #fff; text-decoration: none; }
.footer-about p { line-height: 1.6; margin-bottom: 14px; }
.disclaimer {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 28px;
  font-size: 13px;
  color: #8a9896;
  line-height: 1.6;
}
.disclaimer p { margin-bottom: 10px; }
.disclaimer strong { color: #c8d4d2; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .nav-links { gap: 18px; }
  .nav-links li.hide-mobile { display: none; }
  section.block { padding: 64px 0; }
  .article-nav { grid-template-columns: 1fr; }
}

/* ============ MOBILE-NARROW (tablet portrait & below) ============ */
@media (max-width: 720px) {
  /* Nav collapses to a more compact arrangement.
     Logo shrinks, nav links shrink and wrap onto a second row if needed. */
  nav.top { padding: 14px 0; }
  .nav-wrap {
    flex-wrap: wrap;
    gap: 12px 16px;
    justify-content: space-between;
  }
  .logo {
    font-size: 17px;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
  }
  .logo-mark { width: 24px; height: 24px; }
  .nav-links {
    gap: 14px;
    font-size: 14px;
    flex-wrap: wrap;
  }
  .nav-links a { font-size: 14px; }
  .btn-donate { padding: 8px 14px; font-size: 14px; }
  .back-link { font-size: 13px; }

  /* Crisis banner: smaller text, tighter wrap */
  .crisis-banner { font-size: 13px; padding: 8px 0; }
  .crisis-banner .wrap { gap: 10px 14px; }
}

/* ============ MOBILE (phone portrait) ============ */
@media (max-width: 600px) {
  /* Footer collapses to single column */
  .footer-grid { grid-template-columns: 1fr; }

  /* Article headings shrink */
  .article-head { padding: 48px 0 32px; }
  .article-head h1 { font-size: 36px; }
  .deck { font-size: 19px; }
  article p { font-size: 17px; }
  .reframe, .help-callout { padding: 24px; }

  /* Container padding tightens to give content more room */
  .container, .container-wide { padding: 0 20px; }

  /* Nav: hide secondary items entirely, keep core CTAs */
  .nav-links {
    gap: 12px;
    font-size: 13px;
  }
  .nav-links a { font-size: 13px; }
  .btn-donate { padding: 8px 12px; font-size: 13px; }

  /* Buttons in hero/CTA contexts become full-width for consistent presentation */
  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 12px;
  }
  .hero-ctas .btn {
    width: 100%;
    justify-content: center;
    padding: 16px 24px;
  }

  /* Heading sizes a touch smaller for very narrow screens */
  h1 { font-size: clamp(32px, 8vw, 44px); }
  h2 { font-size: clamp(26px, 6vw, 34px); }

  /* Crisis card on Get Help: reduce negative margin so it doesn't clip */
  .crisis-card {
    padding: 24px 22px !important;
    margin-top: -24px !important;
  }
  .crisis-resource { padding: 18px !important; }
  .crisis-resource .contact { font-size: 19px !important; }

  /* Section padding tightens up */
  section.block { padding: 48px 0; }

  /* Ensure no element causes horizontal overflow */
  body { overflow-x: hidden; }
  img, svg { max-width: 100%; height: auto; }
}

/* ============ SMALL PHONE (under 380px) ============ */
@media (max-width: 380px) {
  .container, .container-wide { padding: 0 16px; }
  .logo { font-size: 15px; }
  .crisis-banner { font-size: 12px; }
  h1 { font-size: 28px; }
  .deck { font-size: 17px; }
}

/* Focus styles */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--sky-deep);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  z-index: 1000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Animations */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.9s ease forwards;
}
.fade-up:nth-child(2) { animation-delay: 0.1s; }
.fade-up:nth-child(3) { animation-delay: 0.2s; }
.fade-up:nth-child(4) { animation-delay: 0.3s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   IMAGE COMPONENTS
   Picture-frame pattern with graceful fallback.
   Images load when present; layout is preserved when absent.
   ============================================================ */

/* Generic illustration frame — preserves aspect ratio and centers content */
.illustration {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--bg-soft) 0%, #fff 100%);
}
.illustration.illo-square { aspect-ratio: 1 / 1; }
.illustration.illo-landscape { aspect-ratio: 16 / 9; }
.illustration.illo-portrait { aspect-ratio: 4 / 5; }
.illustration.illo-banner { aspect-ratio: 4 / 1; }

.illustration img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* The fallback layer sits behind the image. If the image fails to load
   or hasn't been added yet, the SVG fallback shows through. */
.illustration .illo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}
.illustration .illo-fallback svg {
  width: 100%;
  height: 100%;
  display: block;
}
.illustration img {
  position: relative;
  z-index: 1;
}
/* When img has no src or fails, hide it so fallback shows */
.illustration img[src=""], .illustration img:not([src]) {
  display: none;
}

/* Hero illustration variant — softer rounded, no background */
.hero-illustration {
  border-radius: var(--r-lg);
  background: transparent;
}

/* Distortion header image — full-bleed banner on article pages */
.distortion-header-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 360px;
  overflow: hidden;
  border-radius: var(--r-md);
  margin: 32px 0 48px;
  background: linear-gradient(135deg, var(--bg-soft), #fff);
  position: relative;
}
.distortion-header-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.distortion-header-img img:not([src]), .distortion-header-img img[src=""] {
  display: none;
}

/* Triptych grid for the Notice / Examine / Reframe section */
.triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 56px;
}
.triptych .panel {
  display: flex;
  flex-direction: column;
}
.triptych .illustration {
  margin-bottom: 24px;
  aspect-ratio: 4 / 5;
}

/* Section divider flourishes */
.divider-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 64px 0;
  opacity: 0.8;
}
.divider-flourish img {
  max-width: 240px;
  width: 100%;
  height: auto;
}
.divider-flourish .divider-fallback {
  width: 240px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line) 20%, var(--line) 80%, transparent);
  position: relative;
}
.divider-flourish .divider-fallback::after {
  content: '✦';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 12px;
  color: var(--sky-deep);
  font-size: 14px;
}

/* Distortion landing page gallery cards (richer than the basic cards) */
.dist-gallery-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.dist-gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--sky-deep);
  box-shadow: 0 12px 28px -16px rgba(31,45,47,0.18);
  text-decoration: none;
}
.dist-gallery-card .illustration {
  border-radius: 0;
  aspect-ratio: 16 / 9;
}
.dist-gallery-card .card-body {
  padding: 24px 26px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.dist-gallery-card .dist-num {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: block;
}
.dist-gallery-card h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 10px;
}
.dist-gallery-card p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

@media (max-width: 900px) {
  .triptych { grid-template-columns: 1fr; gap: 32px; }
  .distortion-header-img { margin: 24px 0 32px; }
}
