/* ===========================================================
   Dharma Wellness Institute — main stylesheet
   Requires tokens.css loaded first.

   Class inventory (what pages may use):
     Layout      .container  .container--narrow  .container--wide  .section  .section--tint  .section--surface
     Header      .site-header  .site-brand  .nav  .nav-links  .nav-toggle
     Sub-nav     .subnav  .subnav__list  .subnav__item  .subnav__link (Therapy section; base.njk includes it)
     Hero        .hero  .hero__eyebrow  .hero__title  .hero__lede  .hero__actions
     Content     .prose  .lede  .text-caps  .text-muted  .divider  .divider--short
     Actions     .btn  .btn-primary  .btn-secondary  .btn--small  ([disabled] / [aria-disabled="true"] styled)
     Cards/Grid  .card  .card__title  .card__body  .grid-2  .grid-3
     Notices     .notice  .notice--pending
     Footer      .footer
     Utility     .skip-link  .visually-hidden  .text-center  .mt-*  .mb-*
   =========================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { padding-left: 1.25em; }
address { font-style: normal; }
hr { border: 0; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  color: var(--ink);
  margin: 0 0 var(--space-3);
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(var(--text-2xl), 5vw, var(--text-3xl)); font-weight: 300; }
h2 { font-size: clamp(var(--text-xl), 3.6vw, var(--text-2xl)); }
h3 { font-size: var(--text-lg); font-weight: 500; }
h4 { font-size: var(--text-md); font-weight: 500; }
p { margin: 0 0 var(--space-3); }

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--duration) var(--ease);
}
a:hover { color: var(--color-link-hover); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

em { font-style: italic; }
small { font-size: var(--text-sm); }

.lede {
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
}
.text-caps {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}
.text-muted { color: var(--color-text-muted); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--maxw-narrow); }
.container--wide   { max-width: var(--maxw-wide); }

.section { padding-block: var(--space-6); }
.section--tint    { background: var(--sage-pale); }
.section--surface { background: var(--color-surface); }
@media (min-width: 768px) {
  .section { padding-block: var(--space-7); }
}

.site-main { min-height: 60vh; }

/* Markdown body copy lives in .prose — a comfortable reading measure. */
.prose {
  max-width: var(--maxw-narrow);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: var(--space-6);
}
.prose > * + * { margin-top: var(--space-3); }
.prose h2 { margin-top: var(--space-6); }
.prose h3 { margin-top: var(--space-5); }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: var(--space-1); }
.prose blockquote {
  margin: var(--space-5) 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--sage-soft);
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--ink-muted);
}
.prose img { border-radius: var(--radius-md); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.prose th, .prose td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--rule); }

.divider {
  height: 1px;
  background: var(--rule);
  margin-block: var(--space-5);
}
.divider--short {
  width: 4rem;
  height: 1px;
  background: var(--gold);
  margin-inline: auto;
}

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 10;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 4.5rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--ink);
}
.site-brand__mark { width: 2.625rem; height: 2.625rem; flex: none; object-fit: contain; }
.site-brand__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav { display: flex; align-items: center; }
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-4);
}
.nav-links__link {
  display: inline-block;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}
.nav-links__link:hover { color: var(--sage-deep); border-bottom-color: var(--sage-soft); }
.nav-links__link.is-active { border-bottom-color: var(--sage); color: var(--sage-deep); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
}
.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  margin: 3px 0;
}
.nav-toggle__label { font-size: var(--text-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; }

@media (max-width: 767.98px) {
  /* Header row overflowed at ≤390px (nowrap brand + pill toggle > content box).
     Let the brand shrink and wrap; keep the toggle rigid so it stays inside the gutter. */
  .site-brand { min-width: 0; }
  .site-brand__name { white-space: normal; line-height: 1.1; }
  .nav-toggle { display: inline-flex; flex: none; }
  .nav-toggle .nav-toggle__bar { display: none; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--rule);
    padding: var(--space-2) var(--gutter) var(--space-4);
    box-shadow: var(--shadow-md);
  }
  .nav.is-open .nav-links { display: flex; }
  .nav-links__link { display: block; padding: var(--space-3) 0; border-bottom: 1px solid var(--rule); }
  .nav-links__link.is-active { border-bottom-color: var(--rule); }
}

/* ---------- Section sub-nav (Therapy) ---------- */
.subnav {
  border-bottom: 1px solid var(--rule);
  background: var(--color-bg);
  font-size: var(--text-sm);
}
.subnav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}
.subnav__link {
  display: inline-block;
  padding: var(--space-2) 0;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}
.subnav__link:hover { color: var(--sage-deep); border-bottom-color: var(--sage-soft); }
.subnav__link.is-active { color: var(--sage-deep); border-bottom-color: var(--sage); }

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-7);
  text-align: center;
  background: var(--color-bg);
}
.hero__eyebrow { margin-bottom: var(--space-3); }
.hero__title { max-width: 16ch; margin-inline: auto; }
.hero__lede {
  max-width: 44ch;
  margin: var(--space-3) auto 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
@media (min-width: 768px) {
  .hero { padding-block: var(--space-8); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.8em 1.6em;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.2;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.btn-primary { background: var(--sage); color: var(--white); border-color: var(--sage); }
.btn-primary:hover { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--white); }
.btn-secondary { background: transparent; color: var(--clay-deep); border-color: var(--clay-deep); }
.btn-secondary:hover { background: var(--clay-deep); color: var(--white); }
.btn--small { padding: 0.55em 1.1em; font-size: var(--text-xs); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Cards / grids ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.card__title { margin-bottom: var(--space-2); }
.card__body { color: var(--ink-muted); font-size: var(--text-sm); }
.card__body > :last-child { margin-bottom: 0; }

.grid-2, .grid-3 {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Blog list (collections.posts, see _includes/post-list.njk) ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list__item + .post-list__item { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.post-list__title { margin-bottom: var(--space-1); font-size: var(--text-lg); }
.post-list__title a { text-decoration: none; border-bottom: 1px solid var(--sage-soft); }
.post-list__title a:hover { border-bottom-color: var(--sage); }
.post-list__date { display: block; margin-bottom: var(--space-2); }
.post__meta { margin-bottom: var(--space-4); }

/* ---------- Notice ---------- */
.notice {
  margin-block: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  background: var(--cream-deep);
  font-size: var(--text-sm);
}
.notice > :last-child { margin-bottom: 0; }
.notice__label { margin-bottom: var(--space-1); color: var(--gold-text); }

/* ---------- Footer ---------- */
.footer {
  margin-top: var(--space-7);
  padding-block: var(--space-6) var(--space-5);
  border-top: 1px solid var(--rule);
  background: var(--cream-deep);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
.footer a { color: var(--sage-deep); }
.footer a:hover { color: var(--ink); }
.footer__grid { gap: var(--space-5); }
.footer__brand { margin: 0 0 var(--space-5); }
.footer__logo { width: 120px; height: auto; }
.footer__name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--ink);
  margin-bottom: var(--space-2);
}
.footer__heading { margin-bottom: var(--space-1); }
.footer__heading + p { margin-bottom: var(--space-4); }
.footer .divider { margin-block: var(--space-5) var(--space-3); }
.footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin: 0;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

/* ---------- Figures (photography) ---------- */
.figure { margin: 0; }
.figure__img {
  width: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  aspect-ratio: 3 / 2;
  background: var(--cream-deep);
}
.figure--portrait .figure__img { aspect-ratio: 4 / 5; }
.figure--band { margin-inline: auto; max-width: var(--maxw); padding-inline: var(--gutter); }
.figure--band .figure__img { aspect-ratio: 21 / 9; }
.figure__caption {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
@media (max-width: 639px) {
  .figure--band .figure__img { aspect-ratio: 3 / 2; }
}
.split { display: grid; gap: var(--space-5); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .split { grid-template-columns: 1.1fr 1fr; }
  .split--media-right .split__media { order: 2; }
}

/* ---------- Forms (Netlify Forms, contact page) ---------- */
.form { display: grid; gap: var(--space-4); }
.form__row { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; } }
.form__field { display: grid; gap: var(--space-1); }
.form__label { font-size: var(--text-sm); font-weight: 500; color: var(--ink); }
.form__hint { font-size: var(--text-xs); color: var(--ink-muted); }
.form__input, .form__textarea {
  width: 100%;
  padding: 0.7em 0.9em;
  font: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--color-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form__input:focus, .form__textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--sage-pale);
}
.form__textarea { min-height: 9rem; resize: vertical; }
.form__note { font-size: var(--text-xs); color: var(--ink-muted); margin: 0; }
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Utilities ---------- */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100%;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-3); }

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

.mt-3 { margin-top: var(--space-3); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-5 { margin-bottom: var(--space-5); }
.text-center { text-align: center; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
