/* Better Habits — betterhabits.online
   Design tokens, typography and layout. Plain CSS, no build step. */

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-400.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/assets/fonts/fraunces-variable.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --paper: #FBF8F2;
  --paper-2: #F3EDE1;
  --sand: #E6DCC8;
  --line: #DED5C2;
  /* Text */
  --ink: #1E2235;
  --ink-soft: #4B5066;
  --ink-mute: #6B7086;
  /* Brand */
  --indigo: #2E3F7F;
  --indigo-deep: #1F2C5C;
  --indigo-tint: #E6E9F5;
  --amber: #E0A030;
  --amber-tint: #F8E7C2;
  /* Pillars */
  --move: #B3532A;      --move-tint: #F6E1D6;    --move-ink: #6E3118;
  --rest: #3E5AA8;      --rest-tint: #E1E6F6;    --rest-ink: #24376B;
  --eat: #4F7A34;       --eat-tint: #E2EDD8;     --eat-ink: #2F4D1E;
  --mind: #9A6A16;      --mind-tint: #F5E8C9;    --mind-ink: #5E400C;
  --connect: #8A4A6E;   --connect-tint: #F1DFEA; --connect-ink: #552A43;
  /* Type */
  --font-body: "Atkinson Hyperlegible", "Segoe UI", Arial, Helvetica, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --fs-base: 19px;
  --lh: 1.65;
  /* Layout */
  --container: 1120px;
  --measure: 720px;
  --radius: 14px;
  --gutter: 20px;
}

html.text-large { --fs-base: 22px; }

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

html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--lh);
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: break-word;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.005em;
}
h1 { font-size: 2.35rem; }
h2 { font-size: 1.6rem; margin-top: 1.6em; }
h3 { font-size: 1.25rem; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1.15em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.45em; }
strong { font-weight: 700; }

a { color: var(--indigo); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--indigo-deep); text-decoration-thickness: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.container-narrow { width: 100%; max-width: var(--measure); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.section { padding: 3rem 0; }
.section-alt { background: var(--paper-2); }
.section-title { font-size: 1.9rem; margin: 0 0 1.2rem; }
.section-intro { max-width: var(--measure); color: var(--ink-soft); margin-bottom: 2rem; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--indigo); color: #fff; padding: 0.8rem 1.2rem; z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  padding: 0.95rem 1.5rem;
  min-height: 52px;
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.btn-primary:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--indigo); border-color: var(--indigo); }
.btn-secondary:hover { background: var(--indigo-tint); color: var(--indigo-deep); }

/* Header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 84px; padding-top: 0.6rem; padding-bottom: 0.6rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); }
.brand .logo-mark { width: 44px; height: 44px; flex: none; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.55rem; letter-spacing: -0.01em; line-height: 1; white-space: nowrap; }
.brand-tag { display: none; font-size: 0.85rem; color: var(--ink-mute); margin-left: 0.2rem; white-space: nowrap; }

.menu-toggle {
  font: inherit; font-weight: 700; font-size: 1rem;
  background: var(--paper-2); color: var(--ink);
  border: 2px solid var(--line); border-radius: 999px;
  padding: 0.6rem 1.1rem; min-height: 48px; cursor: pointer;
}
.menu-toggle[aria-expanded="true"] { background: var(--indigo-tint); border-color: var(--indigo); }
@media (max-width: 599px) {
  .header-inner { gap: 0.6rem; min-height: 72px; }
  .brand { gap: 0.5rem; }
  .brand .logo-mark { width: 38px; height: 38px; }
  .brand-name { font-size: 1.3rem; }
  .menu-toggle { padding: 0.5rem 0.9rem; min-height: 46px; font-size: 0.95rem; }
  .hero h1 { font-size: 2.5rem; }
  h1 { font-size: 2.05rem; }
  .article-header h1 { font-size: 2.1rem; }
}

.site-nav { display: none; width: 100%; padding-bottom: 0.6rem; }
.site-nav.is-open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.site-nav a {
  display: block; padding: 0.75rem 0.6rem; font-weight: 700; text-decoration: none;
  color: var(--ink); border-radius: 10px; min-height: 48px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--indigo-tint); color: var(--indigo-deep); }
.text-size {
  font: inherit; font-weight: 700; font-size: 0.95rem;
  background: transparent; color: var(--indigo);
  border: 2px solid var(--indigo); border-radius: 999px;
  padding: 0.5rem 1rem; min-height: 46px; cursor: pointer; margin-top: 0.6rem;
}
.text-size[aria-pressed="true"] { background: var(--indigo); color: #fff; }

@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .header-inner { flex-wrap: nowrap; }
  .site-nav { display: flex; width: auto; align-items: center; gap: 0.6rem; padding-bottom: 0; }
  .site-nav ul { flex-direction: row; gap: 0.1rem; }
  .site-nav a { padding: 0.55rem 0.7rem; white-space: nowrap; font-size: 0.95rem; }
  .text-size { margin-top: 0; margin-left: 0.4rem; white-space: nowrap; }
}
@media (min-width: 1180px) {
  .brand-tag { display: inline; }
  .site-nav a { padding: 0.55rem 0.85rem; font-size: 1rem; }
}

/* Hero */
.hero { background: var(--paper-2); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; gap: 2rem; padding-top: 3rem; padding-bottom: 3rem; align-items: center; }
.eyebrow { font-weight: 700; color: var(--move); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; margin-bottom: 0.8rem; }
.hero h1 { font-size: 2.9rem; line-height: 1.08; margin-bottom: 1rem; }
.hero-lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.hero-art img { border-radius: var(--radius); }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 3rem; padding-top: 4rem; padding-bottom: 4rem; }
  .hero h1 { font-size: 3.4rem; }
}

/* Cards */
.card-grid { display: grid; gap: 1.5rem; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } .card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.card-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card-body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; }
.card h3, .card h2 { font-size: 1.3rem; margin: 0.2rem 0 0.2rem; line-height: 1.25; }
.card h3 a, .card h2 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover, .card h2 a:hover { color: var(--indigo); text-decoration: underline; }
.card p { margin: 0; color: var(--ink-soft); }
.card-meta { font-size: 0.9rem; color: var(--ink-mute); margin-top: auto; padding-top: 0.5rem; }

.card-featured { grid-column: 1 / -1; }
@media (min-width: 800px) {
  .card-featured { display: grid; grid-template-columns: 1.15fr 1fr; }
  .card-featured .card-media img { height: 100%; aspect-ratio: auto; min-height: 320px; }
  .card-featured .card-body { padding: 2rem 2.2rem; justify-content: center; }
  .card-featured h2 { font-size: 1.9rem; }
  .card-featured p { font-size: 1.08rem; }
}

/* Pillar badges */
.badge {
  display: inline-block; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.3rem 0.75rem; border-radius: 999px; text-decoration: none; line-height: 1.3;
}
.badge-move { background: var(--move-tint); color: var(--move-ink); }
.badge-rest { background: var(--rest-tint); color: var(--rest-ink); }
.badge-eat { background: var(--eat-tint); color: var(--eat-ink); }
.badge-mind { background: var(--mind-tint); color: var(--mind-ink); }
.badge-connect { background: var(--connect-tint); color: var(--connect-ink); }
a.badge:hover { filter: brightness(0.95); }

/* Pillar cards */
.pillar-grid { display: grid; gap: 1.2rem; }
@media (min-width: 640px) { .pillar-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .pillar-grid { grid-template-columns: repeat(5, 1fr); } }
.pillar-card {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.3rem; min-height: 100%;
}
.pillar-card:hover { border-color: var(--indigo); }
.pillar-card .pillar-icon-wrap {
  width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.9rem;
}
.pillar-card h3 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.pillar-card p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.pillar-card .pillar-count { display: block; margin-top: 0.8rem; font-size: 0.88rem; color: var(--indigo); font-weight: 700; }
.pillar-move .pillar-icon-wrap { background: var(--move-tint); color: var(--move); }
.pillar-rest .pillar-icon-wrap { background: var(--rest-tint); color: var(--rest); }
.pillar-eat .pillar-icon-wrap { background: var(--eat-tint); color: var(--eat); }
.pillar-mind .pillar-icon-wrap { background: var(--mind-tint); color: var(--mind); }
.pillar-connect .pillar-icon-wrap { background: var(--connect-tint); color: var(--connect); }

/* How we work strip */
.principles { display: grid; gap: 1.5rem; }
@media (min-width: 800px) { .principles { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.principle h3 { margin-top: 0; font-size: 1.25rem; }
.principle p { color: var(--ink-soft); margin: 0; }
.principle .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: var(--amber); color: var(--ink);
  font-weight: 700; font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 0.7rem;
}

/* Page header (static pages, topics, index) */
.page-header { padding: 2.5rem 0 1rem; }
.page-header .kicker { font-weight: 700; color: var(--indigo); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; margin: 0 0 0.6rem; }
.page-header h1 { margin-bottom: 0.6rem; }
.page-header .lead, .lead { font-size: 1.2rem; color: var(--ink-soft); }
.page-meta { color: var(--ink-mute); font-size: 0.95rem; }
.page-body { padding-bottom: 3rem; }
.page-body h2 { font-size: 1.5rem; }
.page-body h3 { font-size: 1.2rem; }

.topic-hero { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 0.8rem; }
.topic-hero .pillar-icon-wrap { width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex: none; }
.topic-hero .pillar-icon { width: 34px; height: 34px; }

/* Article */
.article-header { padding: 2.5rem 0 1.2rem; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0 0 1.1rem; display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.92rem; color: var(--ink-mute); }
.breadcrumb li + li::before { content: "/"; margin: 0 0.4rem; color: var(--line); }
.breadcrumb a { color: var(--ink-mute); text-decoration: none; }
.breadcrumb a:hover { color: var(--indigo); text-decoration: underline; }
.article-header .kicker { margin: 0 0 0.9rem; }
.article-header h1 { font-size: 2.5rem; line-height: 1.12; margin-bottom: 0.8rem; }
.dek { font-size: 1.2rem; color: var(--ink-soft); margin-bottom: 1.2rem; }
.article-meta { font-size: 0.95rem; color: var(--ink-mute); display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; margin: 0; }
.article-meta .sep::before { content: "\00b7"; }
.article-figure { margin: 0.6rem auto 2rem; }
.article-figure img { border-radius: var(--radius); width: 100%; }

.habit-box {
  background: var(--amber-tint); border-left: 6px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.2rem 1.4rem; margin: 0 0 2rem;
}
.habit-box-title { font-family: var(--font-body); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--mind-ink); margin: 0 0 0.4rem; }
.habit-box p { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; line-height: 1.35; }

.article-body { font-size: 1.05rem; }
.article-body h2 { font-size: 1.55rem; margin-top: 2em; }
.article-body ul { padding-left: 1.2em; }
.article-body li { margin-bottom: 0.7em; }

.clinician-box {
  background: var(--indigo-tint); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin-top: 2.5rem;
}
.clinician-box h2 { margin-top: 0; font-size: 1.35rem; }
.clinician-box p:last-child { margin-bottom: 0; }

.sources { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.5rem; }
.sources h2 { margin-top: 0; font-size: 1.35rem; }
.sources p { color: var(--ink-soft); font-size: 0.98rem; }
.sources ul { list-style: none; padding: 0; margin: 0; }
.sources li { padding: 0.6rem 0; border-bottom: 1px dashed var(--line); font-size: 0.98rem; }
.sources li:last-child { border-bottom: 0; }
.sources .src-org { font-weight: 700; display: block; }
.sources .src-link { font-size: 0.9rem; }
.disclaimer-note { font-size: 0.92rem; color: var(--ink-mute); margin: 1.5rem 0 0; padding: 1rem 0; border-top: 1px solid var(--line); }

.article-nav { margin-top: 2rem; }
.correction-note { font-size: 0.95rem; color: var(--ink-soft); background: var(--paper-2); padding: 0.9rem 1.1rem; border-radius: 10px; }

/* Newsletter */
.newsletter-block { background: var(--indigo); color: #fff; padding: 3rem 0; margin-top: 3rem; }
.newsletter-block .container { display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 900px) { .newsletter-block .container { grid-template-columns: 1.1fr 1fr; gap: 3rem; } }
.newsletter-block h2 { color: #fff; margin-top: 0; font-size: 1.9rem; }
.newsletter-block p { color: #E8EBF7; margin-bottom: 0; }
.newsletter-block a { color: #fff; }
.newsletter-form { display: flex; flex-direction: column; gap: 0.75rem; }
.newsletter-form label { font-weight: 700; }
.newsletter-form input[type="email"] {
  font: inherit; font-size: 1.05rem; padding: 0.9rem 1rem; min-height: 54px; border-radius: 12px;
  border: 2px solid #C7CEEA; width: 100%; color: var(--ink); background: #fff;
}
.newsletter-form .btn { align-self: flex-start; background: var(--amber); color: var(--ink); border-color: var(--amber); }
.newsletter-form .btn:hover { background: #F0B347; border-color: #F0B347; color: var(--ink); }
.newsletter-form .fine-print { font-size: 0.88rem; color: #D6DBF2; margin: 0; }
.newsletter-form .fine-print a { color: #fff; }
.newsletter-page .newsletter-form input[type="email"] { border-color: var(--line); }
.newsletter-page .newsletter-form .fine-print { color: var(--ink-mute); }
.newsletter-page .newsletter-form .fine-print a { color: var(--indigo); }
.newsletter-page .newsletter-form { max-width: 520px; background: var(--paper-2); padding: 1.5rem; border-radius: var(--radius); }

/* Contact */
.contact-card { background: var(--paper-2); border-radius: var(--radius); padding: 1.4rem 1.6rem; margin: 1.5rem 0; }
.contact-card h2 { margin-top: 0; font-size: 1.3rem; }
.contact-card p:last-child, .contact-card address:last-child { margin-bottom: 0; }
.contact-email { font-size: 1.35rem; font-weight: 700; }
.address-block { font-style: normal; line-height: 1.55; margin: 0 0 1.15em; }
.link-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.link-list a { display: inline-block; padding: 0.6rem 1.1rem; border: 2px solid var(--indigo); border-radius: 999px; text-decoration: none; font-weight: 700; min-height: 48px; }
.link-list a:hover { background: var(--indigo-tint); }

/* Footer */
.site-footer { background: var(--ink); color: #D9DCE8; margin-top: 4rem; padding: 3rem 0 2rem; font-size: 0.95rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--amber); }
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.footer-brand .brand { color: #fff; margin-bottom: 0.8rem; }
.footer-brand p { color: #B9BED2; max-width: 32em; }
.site-footer h2 { color: #fff; font-family: var(--font-body); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.2rem; }
.site-footer nav a { display: inline-block; padding: 0.35rem 0; text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }
.footer-legal { border-top: 1px solid #383E58; margin-top: 2.5rem; padding-top: 1.5rem; color: #B9BED2; font-size: 0.9rem; }
.footer-legal p { margin-bottom: 0.5em; }

/* Cookie bar */
.cookie-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: #fff; border-top: 3px solid var(--indigo);
  box-shadow: 0 -4px 20px rgba(30, 34, 53, 0.12);
  padding: 1rem var(--gutter);
}
.cookie-bar[hidden] { display: none; }
.cookie-inner { max-width: var(--container); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.5rem; }
.cookie-inner p { margin: 0; flex: 1 1 320px; font-size: 0.95rem; color: var(--ink-soft); }
.cookie-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.cookie-actions .btn { min-height: 48px; padding: 0.7rem 1.3rem; font-size: 0.95rem; }

/* 404 / welcome */
.center-page { text-align: center; padding: 4rem var(--gutter) 2rem; max-width: 640px; margin: 0 auto; }
.center-page h1 { font-size: 2.4rem; }
.center-page .lead { font-size: 1.2rem; }
.big-mark { margin: 0 auto 1.5rem; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .cookie-bar, .newsletter-block, .menu-toggle, .text-size { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
