/* ── 180 Habits — Production CSS ── */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1a1a1a;
  --border: #252525;
  --text: #e4e4e4;
  --text-muted: #888;
  --accent: #6ee7b7;
  --accent-hover: #34d399;
  --danger: #e05555;
  --warning: #fbbf24;
  --radius: 10px;
  --max-width: 720px;
  --max-width-wide: 1080px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* ── Navigation ── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo-accent { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }

.nav-crisis {
  color: var(--danger) !important;
  font-weight: 600 !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 12px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ── Main Content ── */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.homepage { max-width: var(--max-width-wide); }

/* ── Article Page ── */
.article-page { }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.article-silo {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
}

.article-hero {
  margin: 0 -24px 36px;
}

.article-hero img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
}

@media (max-width: 768px) {
  .article-hero { margin: 0 -16px 28px; }
  .article-hero img { border-radius: 0; }
}

.article-hero figcaption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
  padding: 0 24px;
}

.article-hero figcaption a { color: var(--text-muted); }

/* ── Article Body Typography ── */
.article-body h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}

.article-body h2 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 48px 0 16px;
  line-height: 1.3;
}

.article-body h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 18px;
}

.article-body strong { color: #fff; }

.article-body ul, .article-body ol {
  margin: 0 0 20px 24px;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 24px 0;
  padding: 14px 20px;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.article-body th {
  background: var(--surface);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: #fff;
  border-bottom: 2px solid var(--border);
}

.article-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.article-body tr:hover td {
  background: var(--surface);
}

.article-body code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.article-body em {
  color: var(--text-muted);
}

/* ── Medical Notice ── */
.medical-notice {
  background: #1a1400;
  border: 1px solid #3a2a00;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 40px 0 20px;
  font-size: 14px;
  line-height: 1.65;
}

.medical-notice a { color: var(--warning); }

/* ── Footer ── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 60px 24px 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
}

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
}

.footer-logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.6;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 600px) {
  .footer-links { grid-template-columns: 1fr 1fr; }
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 0;
  transition: color 0.15s;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  max-width: var(--max-width-wide);
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.footer-bottom a { color: var(--text-muted); }

/* ── Homepage specific ── */
/* Only target direct children / top-level text — not card internals */
.homepage > h1,
.homepage > .hero-banner .hero-title {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.15;
  font-weight: 800;
  color: #fff;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.homepage > h2 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 48px 0 20px;
}

.homepage > h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 8px;
}

.homepage > p { margin-bottom: 16px; }
.homepage strong { color: #fff; }
.homepage > hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.homepage > .hero-banner img { border-radius: 0; }

/* ── Hero Banner ── */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 48px;
}

.hero-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
  filter: brightness(0.55);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 48px;
  max-width: 720px;
}

.hero-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin: 0 0 16px;
}

.hero-text {
  font-size: clamp(15px, 1.8vw, 19px);
  color: #ddd;
  margin: 0 0 12px;
  line-height: 1.6;
}

.hero-cta {
  font-size: clamp(15px, 1.8vw, 19px);
  color: #fff;
  margin: 0;
  line-height: 1.6;
  font-weight: 600;
}

/* ── Category Card Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 24px 0 40px;
}

.category-grid--bottom {
  margin-bottom: 48px;
}

.category-card-link {
  text-decoration: none;
  color: inherit;
}

.category-card {
  background: var(--surface2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  overflow: hidden;
}

.category-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.category-card-body {
  padding: 14px 16px;
}

.category-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
}

.category-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.category-card-cta {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.badge-new {
  font-size: 10px;
  background: var(--accent);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
}

/* ── Tools Grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0 48px;
}

.tools-card {
  background: var(--surface2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  overflow: hidden;
}

.tools-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.tools-card-body {
  padding: 14px 16px;
}

.tools-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
}

.tools-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ── Stage Grid (Where Are You Right Now?) ── */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 28px 0 48px;
}

.stage-card {
  background: #111;
  border: 1px solid #222;
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stage-card--crisis {
  background: #1a0a0a;
  border-color: #3a1a1a;
}

.stage-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 8px;
}

.stage-label--crisis {
  color: var(--danger);
}

.stage-text {
  font-size: 14px;
  color: #ccc;
  margin: 0;
  line-height: 1.65;
}

/* ── Featured Grid ── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 28px 0 48px;
}

.featured-card {
  background: var(--surface2);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  overflow: hidden;
}

.featured-card-inner {
  padding: 22px;
}

.featured-card-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 8px;
}

.featured-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.4;
}

.featured-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── CTA Banner ── */
.cta-banner {
  background: linear-gradient(135deg, #1a0000, #2a0808);
  border: 1px solid #5a1a1a;
  border-radius: 12px;
  padding: 28px 32px;
  margin: 48px 0 24px;
  text-align: center;
}

.cta-banner h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.5;
}

.cta-banner p {
  font-size: 15px;
  color: #ccc;
  margin: 0 0 18px;
}

.cta-banner a {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 8px;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.cta-banner a:hover {
  color: #fff;
  filter: brightness(1.1);
}

/* ── Table Scroll Wrapper ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
}

.table-scroll table {
  margin: 0;
}

/* ── Mobile: 768px ── */
@media (max-width: 768px) {
  /* Nav touch targets */
  .nav { padding: 12px 16px; }
  .nav-toggle { padding: 10px 14px; font-size: 22px; min-width: 44px; min-height: 44px; }
  .nav-links a { font-size: 16px; padding: 8px 0; }

  /* Main content spacing */
  .main { padding: 24px 16px 60px; }

  /* Hero: stack text below image */
  .hero-banner { border-radius: 8px; margin-bottom: 32px; }
  .hero-img { max-height: 260px; filter: brightness(0.65); }
  .hero-overlay {
    position: relative;
    inset: auto;
    padding: 20px 20px 24px;
    max-width: 100%;
    background: var(--surface);
  }
  .hero-title { font-size: clamp(22px, 5vw, 32px); margin: 0 0 12px; }
  .hero-text { font-size: 15px; }
  .hero-cta { font-size: 15px; }

  /* Category grids: 2 columns */
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0 32px; }
  .category-grid--bottom { margin-bottom: 36px; }
  .category-card img { height: 120px; }
  .category-card-body { padding: 10px 12px; }
  .category-card h3 { font-size: 14px; }
  .category-card p { font-size: 12px; margin-bottom: 6px; }
  .category-card-cta { font-size: 11px; }

  /* Tools grid */
  .tools-grid { grid-template-columns: 1fr; gap: 12px; margin: 16px 0 32px; }
  .tools-card img { height: 120px; }

  /* Stage grid */
  .stage-grid { grid-template-columns: 1fr; gap: 12px; margin: 20px 0 32px; }
  .stage-card { padding: 16px 18px; }

  /* Featured grid */
  .featured-grid { grid-template-columns: 1fr; gap: 12px; margin: 20px 0 32px; }
  .featured-card-inner { padding: 18px; }

  /* CTA banner */
  .cta-banner { padding: 22px 20px; margin: 32px 0 16px; }
  .cta-banner h3 { font-size: 16px; }
  .cta-banner p { font-size: 14px; margin-bottom: 14px; }
  .cta-banner a { padding: 10px 22px; font-size: 14px; }

  /* Article body spacing */
  .article-body h2 { margin-top: 36px; font-size: 21px; }
  .article-body h3 { font-size: 17px; margin-top: 24px; }
  .article-body blockquote { padding: 12px 16px; margin: 18px 0; }
  .article-body hr { margin: 28px 0; }

  /* Table horizontal scroll */
  .article-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Homepage spacing tweaks */
  .homepage h2 { margin: 32px 0 14px; font-size: 21px; }
  .homepage hr { margin: 28px 0; }

  /* Footer adjustments */
  .footer { padding: 40px 16px 20px; margin-top: 48px; }
  .footer-links { gap: 16px; }
}

/* ── Mobile: 480px (small phones) ── */
@media (max-width: 480px) {
  /* Category grids: single column */
  .category-grid { grid-template-columns: 1fr; }
  .category-card img { height: 140px; }

  /* Hero refinements */
  .hero-overlay { padding: 16px 16px 20px; }
  .hero-title { font-size: 20px; }
  .hero-text { font-size: 14px; }
  .hero-cta { font-size: 14px; }

  /* Footer single column */
  .footer-links { grid-template-columns: 1fr; }
  .footer-inner { gap: 24px; }
}

/* ── Utilities ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
