/* Impeccable · direction: The Skill Set (see design canvas) · macrostructure: skill-bar index (home) + long-document (articles) · code-led */
@import url("tokens.css");
@import url("https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@400;500;600;700&family=Public+Sans:wght@400;500;600;700&display=swap");

/* ---------------------------------------------------------------
   Reset + base
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  font-weight: 400;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-style: normal;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  color: var(--color-ink);
  overflow-wrap: anywhere;
  min-width: 0;
}
p { max-width: var(--measure); }
::selection { background: color-mix(in oklch, var(--color-accent) 25%, transparent); color: var(--color-ink); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--color-paper); }
::-webkit-scrollbar-thumb { background: var(--color-rule-2); border-radius: var(--radius-pill); border: 3px solid var(--color-paper); }

.wrap { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-gutter); }

/* ---------------------------------------------------------------
   Nav: a real, visible bar
   --------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-nav);
  background: color-mix(in oklch, var(--color-paper) 92%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}
.nav__inner {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  height: var(--nav-height);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-lg);
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  white-space: nowrap;
  min-height: 44px;
}
.logo-mark { flex-shrink: 0; }
.nav__center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}
.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink-2);
  white-space: nowrap;
  padding-block: var(--space-2xs);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.nav__link:hover, .nav__link:focus-visible { color: var(--color-ink); border-color: var(--color-rule-2); }
.nav__link[aria-current="page"] { color: var(--color-ink); border-color: var(--color-accent); }
.nav__right { display: flex; align-items: center; gap: var(--space-md); justify-self: end; }
.nav__quiz-cta { display: none; }
.nav__link--mobile-only { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-xs) var(--space-lg);
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-short) var(--ease-out),
              color var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out),
              transform 100ms var(--ease-out);
}
.btn--accent {
  background: var(--color-accent-bright);
  color: var(--color-panel);
}
.btn--accent:hover { background: color-mix(in oklch, var(--color-accent-bright) 85%, white); }
.btn--accent:active { transform: translateY(1px); }
.btn--outline {
  background: transparent;
  color: var(--color-panel-ink);
  border: 1px solid var(--color-panel-rule);
}
.btn--outline:hover { border-color: var(--color-accent-bright); color: var(--color-accent-bright); }
.btn--outline:active { transform: translateY(1px); }
/* Outline button used outside the dark panel (nav, footer areas) needs the light-side palette */
.nav .btn--outline, .foot-line .btn--outline {
  color: var(--color-ink);
  border-color: var(--color-rule-2);
}
.nav .btn--outline:hover, .foot-line .btn--outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Mobile nav: checkbox-driven disclosure, no JS. */
.nav__toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.nav__toggle {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-input);
  background: var(--color-paper);
  cursor: pointer;
}
.nav__toggle span, .nav__toggle span::before, .nav__toggle span::after {
  content: ""; display: block; width: 18px; height: 2px; background: var(--color-ink);
  position: relative; transition: transform var(--dur-short) var(--ease-out), opacity var(--dur-short) var(--ease-out);
}
.nav__toggle span::before { position: absolute; top: -6px; }
.nav__toggle span::after { position: absolute; top: 6px; }
.nav__toggle-input:checked ~ .nav__right .nav__toggle span { background: transparent; }
.nav__toggle-input:checked ~ .nav__right .nav__toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav__toggle-input:checked ~ .nav__right .nav__toggle span::after { transform: translateY(-6px) rotate(-45deg); }
.nav__toggle-input:focus-visible ~ .nav__right .nav__toggle { outline: 2px solid var(--color-focus); outline-offset: 2px; }

@media (max-width: 54rem) {
  .nav__inner { grid-template-columns: auto 1fr; position: relative; }
  .nav__toggle { display: inline-flex; }
  .nav__contact { display: none; }
  .nav__quiz-cta { display: inline-flex; }
  .nav__link--mobile-only { display: block; }
  .nav__brand { font-size: var(--text-sm); }
  .nav__center {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--color-paper);
    border-bottom: var(--rule-hair) solid var(--color-rule);
    box-shadow: 0 12px 24px -16px oklch(20% 0.02 40 / 0.25);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--dur-long) var(--ease-out);
  }
  .nav__toggle-input:checked ~ .nav__center { max-height: 16rem; }
  .nav__center .nav__link {
    padding: var(--space-md) var(--page-gutter);
    border-bottom: 1px solid var(--color-rule-2);
    border-radius: 0;
    width: 100%;
  }
  .nav__center .nav__link:last-child { border-bottom: none; }
}

/* ---------------------------------------------------------------
   Hero + skill index, merged into one first viewport: the index IS
   the hero's visual, not a stock photo and not a section below it.
   --------------------------------------------------------------- */
.hero-index {
  background: var(--color-panel);
  padding: var(--space-3xl) var(--page-gutter);
}
.hero-index__inner {
  max-width: var(--page-max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: center;
}
@media (min-width: 60rem) {
  .hero-index__inner { grid-template-columns: 1fr 1fr; }
  .hero-index--single .hero-index__inner { grid-template-columns: minmax(0, 1fr); max-width: 46rem; }
}
.hero-index h1 {
  font-size: var(--text-display);
  color: var(--color-panel-ink);
  margin: 0 0 var(--space-md);
}
.hero-index p.lede {
  font-size: var(--text-md);
  color: var(--color-panel-ink-2);
  line-height: var(--lh-relaxed);
  max-width: 46ch;
  margin: 0 0 var(--space-lg);
}
.hero-index__actions { display: flex; gap: var(--space-md); flex-wrap: wrap; }

/* Proportional skill-bar index: bar length reflects the real article
   count filed under that skill. No decorative numbering: DBT's four
   skills have no inherent order, so a rank number would just be noise. */
.skill-index__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-accent-bright);
  margin: 0 0 var(--space-md);
}
.skill-bars { display: flex; flex-direction: column; gap: var(--space-md); }
.skill-bar__link { display: block; }
.skill-bar__row { display: flex; justify-content: space-between; font-size: var(--text-sm); font-weight: 600; color: var(--color-panel-ink); margin-bottom: var(--space-2xs); }
.skill-bar__count { color: var(--color-accent-bright); }
.skill-bar__count--empty { color: var(--color-panel-ink-2); }
.skill-bar__track { height: 8px; background: var(--color-panel-rule); border-radius: var(--radius-pill); overflow: hidden; }
.skill-bar__fill { height: 100%; background: var(--color-accent-bright); border-radius: var(--radius-pill); }

/* ---------------------------------------------------------------
   Article index rows: reused for both the DBT and CBT sections.
   No photography on this site, the bar index and typography carry
   the visual weight instead.
   --------------------------------------------------------------- */
.reading-list {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--space-2xl) var(--page-gutter) 0;
}
.reading-list__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}
.reading-list__head h2 { font-size: var(--text-2xl); margin: 0; }
.reading-list__head p { color: var(--color-muted); font-size: var(--text-sm); margin: 0; }

.module-group { padding: 0 var(--page-gutter); max-width: var(--page-max); margin-inline: auto; scroll-margin-top: calc(var(--nav-height) + var(--space-md)); }
.module-group__head { font-size: var(--text-md); color: var(--color-accent); margin: var(--space-xl) 0 var(--space-xs); }
.module-group:first-of-type .module-group__head { margin-top: var(--space-lg); }
.module-group__empty { font-size: var(--text-sm); color: var(--color-muted); margin: 0 0 var(--space-lg); }

.reading-rows { display: flex; flex-direction: column; }
.reading-row__link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  transition: color var(--dur-short) var(--ease-out);
}
.reading-rows .reading-row:last-child .reading-row__link { border-bottom: none; }
.reading-row__link:hover, .reading-row__link:focus-visible { color: var(--color-accent); }
.reading-row__title { font-weight: 600; font-size: var(--text-md); min-width: 0; }
.reading-row__date { font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; flex-shrink: 0; }

/* CBT index: a plain grid, deliberately not mapped onto the DBT skill
   bars above, forcing that taxonomy onto CBT content would be inaccurate. */
.topic-grid {
  padding: 0 var(--page-gutter) var(--space-3xl);
  max-width: var(--page-max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm) var(--space-lg);
}
@media (max-width: 40rem) {
  .topic-grid { grid-template-columns: minmax(0, 1fr); }
}
/* flex + min-height, not padding: guarantees a 44px tap target on phones
   where these are the only way into the CBT articles, without changing
   where the text sits on the 3-up desktop grid. */
.topic-grid a {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-ink);
}
.topic-grid a:hover, .topic-grid a:focus-visible { color: var(--color-accent); }

/* ---------------------------------------------------------------
   Article · long document
   --------------------------------------------------------------- */
.article-head {
  padding: var(--space-2xl) var(--page-gutter) var(--space-lg);
  max-width: 44rem;
  margin-inline: auto;
}
.article-head__module {
  display: inline-block;
  background: var(--color-panel);
  color: var(--color-accent-bright);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--space-2xs) var(--space-md);
  border-radius: var(--radius-pill);
  margin: 0 0 var(--space-md);
}
.article-head h1 { font-size: var(--text-display-s); margin: 0 0 var(--space-sm); }
.article-head__date { font-size: var(--text-sm); color: var(--color-muted); margin: 0; }

.prose { max-width: 44rem; margin-inline: auto; padding: var(--space-lg) var(--page-gutter) var(--space-3xl); }
.prose p.lede {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: var(--lh-relaxed);
  color: var(--color-ink);
}
.prose p { margin: 0 0 var(--space-md); line-height: var(--lh-relaxed); }
.prose h2.inline {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  margin: var(--space-xl) 0 var(--space-sm);
  color: var(--color-ink);
}
.prose ol, .prose ul { padding-left: 1.3em; margin: 0 0 var(--space-md); }
.prose li { margin-bottom: var(--space-2xs); line-height: var(--lh-relaxed); }
.prose a {
  color: var(--color-accent);
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, var(--color-accent) 40%, transparent);
  transition: text-decoration-color var(--dur-short) var(--ease-out);
}
.prose a:hover, .prose a:focus-visible { text-decoration-color: var(--color-accent); }
.prose .further-reading {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  color: var(--color-ink-2);
}
.prose .tags { margin-top: var(--space-xl); display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.prose .tags a {
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  color: var(--color-muted);
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill);
  padding: var(--space-3xs) var(--space-sm);
}
.prose .tags a:hover, .prose .tags a:focus-visible { color: var(--color-accent); border-color: var(--color-accent); }

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.foot-line {
  border-top: var(--rule-hair) solid var(--color-rule);
  padding: var(--space-lg) var(--page-gutter);
}
.foot-line__inner {
  max-width: var(--page-max);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.foot-line a { text-decoration: underline; text-underline-offset: 2px; }
.foot-line a:hover, .foot-line a:focus-visible { color: var(--color-accent); }

/* ---------------------------------------------------------------
   Article quiz promo, dismissible slide-in, non-blocking
   --------------------------------------------------------------- */
.quiz-promo {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: var(--z-sticky-nav);
  width: min(22rem, calc(100vw - 2 * var(--space-lg)));
  background: var(--color-paper);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 40px -20px oklch(20% 0.03 40 / 0.45);
  padding: var(--space-lg);
  transform: translateY(calc(100% + var(--space-lg)));
  opacity: 0;
  pointer-events: none;
  transition: transform var(--dur-long) var(--ease-out), opacity var(--dur-long) var(--ease-out);
}
.quiz-promo.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.quiz-promo__close {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--color-muted);
  background: transparent;
  border-radius: var(--radius-pill);
}
.quiz-promo__close:hover, .quiz-promo__close:focus-visible { color: var(--color-ink); background: var(--color-paper-2); }
.quiz-promo__eyebrow { font-size: var(--text-xs); color: var(--color-accent); font-weight: 600; margin: 0 0 var(--space-2xs); }
.quiz-promo__title { font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; margin: 0 0 var(--space-2xs); padding-right: var(--space-lg); }
.quiz-promo__desc { font-size: var(--text-sm); color: var(--color-ink-2); line-height: var(--lh-relaxed); margin: 0 0 var(--space-md); }
.quiz-promo__cta { width: 100%; }

/* ---------------------------------------------------------------
   Responsive: 320 / 375 / 414 / 768
   --------------------------------------------------------------- */
@media (max-width: 40rem) {
  .hero-index { padding: var(--space-2xl) var(--page-gutter); }
  .hero-index h1 { font-size: var(--text-display-s); }
  .reading-row__link { flex-direction: column; align-items: flex-start; gap: var(--space-3xs); }
}

@media (max-width: 26rem) {
  .nav__brand { font-size: var(--text-xs); gap: var(--space-3xs); }
  .logo-mark { width: 22px; height: 22px; }
  .nav__quiz-cta { padding: var(--space-2xs) var(--space-sm); font-size: var(--text-xs); }
  .nav__toggle { width: 34px; height: 34px; }
}

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