/* =========================================================================
   Torch Help — marketing-aligned skin
   System sans throughout, mint paper background, maroon/coral accents to
   match torch.io. Structure (topic grouping, sidebar, drawer, accordions,
   etc.) is unchanged from the editorial version; only tokens + a few
   targeted rules changed.
   ========================================================================= */

:root {
  /* Type stacks — system sans for everything, no remote fonts. Matches the
     modern-SaaS feel of torch.io. */
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code",
    Menlo, Consolas, monospace;

  /* Marketing palette */
  --paper: #EAF6F4;          /* mint paper — softer than the marketing hero
                                so 17px body text reads comfortably */
  --paper-warm: #F4FAF9;     /* slightly lighter mint — card surface */
  --paper-deep: #D3F3F2;     /* full marketing-hero mint — accent band */
  --paper-edge: #BFE6E2;     /* deeper border / shadow */

  --ink: #0F1A26;            /* near-black navy — matches marketing body */
  --ink-2: #1E2A38;
  --ink-muted: #4B5560;
  --ink-soft: #7A8590;

  --rule: #CAE4E0;
  --rule-soft: #DDEDEA;

  --ember: #8B1A1A;          /* primary accent — the Torch wordmark maroon */
  --ember-bright: #B8331F;   /* hover / highlight (the coral marketing uses) */
  --ember-tint: #F4D5D0;     /* tinted background */
  --ember-deep: #6B1212;     /* link color: slightly darker than ember */

  --gold: #F6C03B;           /* used sparingly — marketing's yellow swoosh */

  /* Sizes */
  --col-aside: 260px;
  --col-gap: 48px;
  --col-max: 1180px;
  --read-max: 70ch;

  /* Motion */
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* -----------------------------------------------------------------------
   Reset + base
   ----------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--ember-deep);
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(107, 18, 18, 0.4);
  transition: color 160ms var(--ease-soft),
              text-decoration-color 160ms var(--ease-soft);
}
a:hover {
  color: var(--ember-bright);
  text-decoration-color: var(--ember-bright);
}

::selection { background: var(--ember-tint); color: var(--ink); }

/* -----------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(234, 246, 244, 0.92);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--ember-deep); }
.brand__logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand__divider {
  color: var(--ink-soft);
  font-weight: 400;
}
.brand__sub {
  color: var(--ink-muted);
  font-weight: 400;
  font-size: 0.95rem;
}

.site-header__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.95rem;
}
.site-header__nav a {
  color: var(--ink-2);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  font-weight: 500;
}
.site-header__nav a:hover { color: var(--ember-deep); }
.site-header__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--ember);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 220ms var(--ease-soft);
}
.site-header__nav a:hover::after { transform: scaleX(1); }

/* Mobile drawer — CSS-only checkbox toggle (unchanged behavior). */

.nav-toggle { display: none; }
.nav-toggle__label {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-warm);
  transition: border-color 160ms var(--ease-soft);
}
.nav-toggle__label:hover { border-color: var(--ember); }
.nav-toggle__icon {
  width: 18px;
  height: 14px;
  position: relative;
}
.nav-toggle__icon::before,
.nav-toggle__icon::after,
.nav-toggle__icon span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 220ms var(--ease-soft), opacity 160ms var(--ease-soft);
}
.nav-toggle__icon::before { top: 0; }
.nav-toggle__icon span { top: 6px; }
.nav-toggle__icon::after { bottom: 0; }

.nav-toggle:checked ~ .nav-toggle__label .nav-toggle__icon::before {
  top: 6px; transform: rotate(45deg);
}
.nav-toggle:checked ~ .nav-toggle__label .nav-toggle__icon::after {
  bottom: 6px; transform: rotate(-45deg);
}
.nav-toggle:checked ~ .nav-toggle__label .nav-toggle__icon span { opacity: 0; }

/* -----------------------------------------------------------------------
   Layout shell
   ----------------------------------------------------------------------- */

.page {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 56px 32px 80px;
}

.page--with-aside {
  display: grid;
  grid-template-columns: var(--col-aside) minmax(0, 1fr);
  gap: var(--col-gap);
}

.main-col { min-width: 0; }

/* -----------------------------------------------------------------------
   Topic aside (per-article sidebar)
   ----------------------------------------------------------------------- */

.topic-aside {
  position: sticky;
  top: 96px;
  align-self: start;
  font-size: 0.93rem;
}
.topic-aside__eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ember);
  font-weight: 700;
  margin: 0 0 6px;
}
.topic-aside__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--ink);
  line-height: 1.22;
}
.topic-aside__blurb {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0 0 18px;
  line-height: 1.45;
}
.topic-aside__list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  border-top: 1px solid var(--rule-soft);
}
.topic-aside__list li { border-bottom: 1px solid var(--rule-soft); }
.topic-aside__link {
  display: block;
  padding: 10px 0 10px 14px;
  color: var(--ink-2);
  text-decoration: none;
  position: relative;
  line-height: 1.35;
  transition: color 160ms var(--ease-soft);
}
.topic-aside__link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-soft);
  transform: translateY(-50%);
  transition: background 160ms var(--ease-soft), width 160ms var(--ease-soft),
              height 160ms var(--ease-soft);
}
.topic-aside__link:hover { color: var(--ember-deep); }
.topic-aside__link:hover::before { background: var(--ember); }
.topic-aside__link[aria-current="page"] {
  color: var(--ember-deep);
  font-weight: 600;
}
.topic-aside__link[aria-current="page"]::before {
  background: var(--ember);
  width: 6px;
  height: 6px;
}
.topic-aside__back {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-decoration: none;
  padding-top: 0;
}
.topic-aside__back:hover { color: var(--ember-deep); }
.topic-aside__back::before { content: "← "; }

/* -----------------------------------------------------------------------
   Hero / homepage chrome
   ----------------------------------------------------------------------- */

.hero {
  padding: 32px 0 56px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
  position: relative;
}
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ember);
  margin: 0 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--ember);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0 0 22px;
  color: var(--ink);
  max-width: 20ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--ember-deep);
  position: relative;
}
/* Marketing's hand-drawn underline under emphasized word. CSS-only — a
   thick, slightly-rotated decoration via box-shadow. */
.hero h1 em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.04em;
  height: 0.12em;
  background: var(--ember-bright);
  border-radius: 1em;
  transform: skewY(-1.2deg);
  opacity: 0.85;
  pointer-events: none;
}
.hero__lede {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 56ch;
  margin: 0;
}

/* -----------------------------------------------------------------------
   Featured tiles
   ----------------------------------------------------------------------- */

.featured {
  margin-bottom: 64px;
}
.featured__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
}
.featured__heading h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
}
.featured__heading .small-caps {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color 200ms var(--ease-soft),
              box-shadow 200ms var(--ease-soft),
              transform 200ms var(--ease-soft);
}
.tile:hover {
  border-color: var(--ember);
  box-shadow: 0 6px 20px -10px rgba(15, 26, 38, 0.18);
  text-decoration: none;
  transform: translateY(-1px);
}
.tile::after {
  content: "→";
  position: absolute;
  top: 18px;
  right: 22px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink-soft);
  transition: transform 200ms var(--ease-soft), color 200ms var(--ease-soft);
}
.tile:hover::after {
  transform: translateX(3px);
  color: var(--ember);
}
.tile__label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
  font-weight: 700;
}
.tile__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.008em;
  color: var(--ink);
  line-height: 1.3;
}
.tile__desc {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -----------------------------------------------------------------------
   Topic index (homepage browse-by-topic)
   ----------------------------------------------------------------------- */

.topics {
  display: grid;
  gap: 56px;
}
.topics__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 10px;
}
.topics__heading h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
}

.topic-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  scroll-margin-top: 96px;
}
.topic-section__head {
  position: relative;
}
.topic-section__num {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ember);
  margin: 0 0 6px;
}
.topic-section__title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.18;
}
.topic-section__blurb {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin: 0;
  max-width: 28ch;
}

.topic-section__list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 32px;
}
.topic-section__list li {
  break-inside: avoid;
  margin-bottom: 4px;
}
.topic-section__list a {
  display: block;
  padding: 8px 12px 8px 0;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-soft);
  line-height: 1.35;
  font-size: 0.96rem;
  position: relative;
  transition: padding 180ms var(--ease-soft), color 180ms var(--ease-soft),
              border-bottom-color 180ms var(--ease-soft);
}
.topic-section__list a:hover {
  color: var(--ember-deep);
  padding-left: 6px;
  text-decoration: none;
  border-bottom-color: var(--ember);
}

/* -----------------------------------------------------------------------
   Breadcrumbs
   ----------------------------------------------------------------------- */

.crumbs {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.crumbs li { display: inline-flex; align-items: center; gap: 8px; }
.crumbs li + li::before {
  content: "›";
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-right: 4px;
}
.crumbs a {
  color: var(--ink-muted);
  text-decoration: none;
}
.crumbs a:hover { color: var(--ember-deep); }
.crumbs__current { color: var(--ink); font-weight: 600; }

/* -----------------------------------------------------------------------
   Article
   ----------------------------------------------------------------------- */

.article { max-width: var(--read-max); }
.article__topic {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ember);
  font-weight: 700;
  margin: 0 0 16px;
}
.article__topic a { color: inherit; text-decoration: none; }
.article__topic a:hover { color: var(--ember-bright); }
.article__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
  margin: 0 0 18px;
  color: var(--ink);
}
.article__deck {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0 0 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  max-width: 60ch;
}

.article__body {
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.article__body p { margin: 0 0 1.1em; }
.article__body h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 2.2em 0 0.5em;
  color: var(--ink);
  line-height: 1.2;
  scroll-margin-top: 96px;
}
.article__body h3 {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 1.8em 0 0.4em;
  color: var(--ink);
  scroll-margin-top: 96px;
}
.article__body h4 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--ember-deep);
  margin: 1.6em 0 0.4em;
}
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.article__body li { margin-bottom: 0.45em; }
.article__body ul > li::marker { color: var(--ember); }
.article__body ol > li::marker { color: var(--ember); font-weight: 600; }
.article__body strong { color: var(--ink); }
.article__body em { font-style: italic; }

.article__body img {
  display: block;
  margin: 1.6em 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 4px 16px -10px rgba(15, 26, 38, 0.18);
  background: var(--paper-warm);
}
.article__body figure { margin: 1.6em 0; }
.article__body figcaption {
  font-style: italic;
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-top: 0.5em;
  text-align: center;
}

.article__body iframe {
  display: block;
  width: 100% !important;
  max-width: 720px !important;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 1.8em auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--ink);
}

.article__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.96rem;
  background: var(--paper-warm);
  border-radius: 8px;
  overflow: hidden;
}
.article__body th, .article__body td {
  border-bottom: 1px solid var(--rule);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
.article__body th {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.74rem;
  color: var(--ink);
  background: var(--paper-deep);
  border-bottom: 2px solid var(--rule);
  font-weight: 700;
}

.article__body blockquote {
  border-left: 4px solid var(--ember);
  margin: 1.6em 0;
  padding: 8px 22px;
  background: var(--paper-warm);
  color: var(--ink-2);
  font-size: 1.04rem;
  line-height: 1.55;
  border-radius: 0 8px 8px 0;
}

.article__body code {
  font-family: var(--font-mono);
  background: var(--paper-deep);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--ink-2);
}
.article__body pre {
  background: var(--ink);
  color: var(--paper);
  padding: 18px 22px;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 1.6em 0;
}
.article__body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  border: none;
}

.article__body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.4em 0;
}

.article__body a {
  color: var(--ember-deep);
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.18em;
}
.article__body a:hover { color: var(--ember-bright); }

/* Strip leftover Document360 inline colors that fight the new palette. */
.article__body span[style*="color: rgb(55, 53, 47)"],
.article__body span[style*="color:rgb(55, 53, 47)"] { color: inherit !important; }
.article__body span[style*="color: rgb(0, 112, 192)"],
.article__body span[style*="color:rgb(0, 112, 192)"] {
  color: var(--ember-deep) !important;
}

/* Collapsible <details> (accordion) blocks from the upstream editor. */
.article__body .details-wrapper {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-warm);
  margin: 1.6em 0;
  overflow: hidden;
}
.article__body .details-wrapper + .details-wrapper {
  margin-top: -1px;
  border-radius: 0;
}
.article__body .details-wrapper > button { display: none; }
.article__body details + details { border-top: 1px solid var(--rule); }
.article__body summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 160ms var(--ease-soft);
  -webkit-tap-highlight-color: transparent;
}
.article__body summary::-webkit-details-marker { display: none; }
.article__body summary::marker { content: ""; font-size: 0; }
.article__body summary:hover { background: var(--paper); }
.article__body summary:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: -2px;
}
.article__body summary::after {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ember);
  border-bottom: 2px solid var(--ember);
  transform: rotate(-45deg);
  margin-right: 4px;
  transition: transform 220ms var(--ease-soft);
}
.article__body details[open] > summary::after {
  transform: rotate(45deg);
}
.article__body summary > h2,
.article__body summary > h3,
.article__body summary > h4,
.article__body summary > h5 {
  margin: 0 !important;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  scroll-margin-top: 0;
  line-height: 1.35;
}
.article__body details > div[data-type="details-content"] {
  padding: 4px 22px 20px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.article__body details > div[data-type="details-content"] > h4:first-child,
.article__body details > div[data-type="details-content"] > h3:first-child {
  margin-top: 1em;
}

/* -----------------------------------------------------------------------
   Related articles (article footer)
   ----------------------------------------------------------------------- */

.related {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.related__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ember);
  margin: 0 0 6px;
}
.related__heading {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 22px;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.related__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.related__list li { background: var(--paper-warm); border-radius: 10px; border: 1px solid var(--rule); }
.related__link {
  display: block;
  padding: 18px 22px 20px;
  text-decoration: none;
  color: var(--ink-2);
  transition: border-color 180ms var(--ease-soft), transform 180ms var(--ease-soft);
  height: 100%;
  border-radius: 10px;
}
.related__link:hover {
  background: var(--paper);
  text-decoration: none;
  transform: translateY(-1px);
}
.related__list li:hover { border-color: var(--ember); }
.related__link .related__title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}
.related__link .related__topic {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ember);
  font-weight: 700;
  margin: 0 0 6px;
}

/* Prev / next */
.pagenav {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pagenav a {
  display: block;
  padding: 18px 22px;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-2);
  transition: border-color 180ms var(--ease-soft), background 180ms var(--ease-soft);
}
.pagenav a:hover {
  background: var(--paper);
  border-color: var(--ember);
  text-decoration: none;
}
.pagenav__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 6px;
}
.pagenav__title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.pagenav__next { text-align: right; }
.pagenav__prev .pagenav__title::before { content: "← "; color: var(--ember); }
.pagenav__next .pagenav__title::after  { content: " →"; color: var(--ember); }

/* -----------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  margin-top: 64px;
}
.site-footer__inner {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 36px 32px 44px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
}
.site-footer__brand {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-footer__brand-logo {
  height: 20px;
  width: auto;
  display: block;
}
.site-footer__copy {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin: 0;
  max-width: 50ch;
}
.site-footer__copy a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
}
.site-footer__copy a:hover { color: var(--ember-deep); text-decoration-color: var(--ember); }
.site-footer__nav { display: flex; gap: 22px; }
.site-footer__nav a {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 700;
}
.site-footer__nav a:hover { color: var(--ember-deep); }

/* -----------------------------------------------------------------------
   404
   ----------------------------------------------------------------------- */

.errorpage {
  text-align: center;
  padding: 80px 0 40px;
}
.errorpage h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 0 0 8px;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-weight: 700;
}
.errorpage__numerals {
  font-family: var(--font-display);
  font-size: clamp(6rem, 18vw, 11rem);
  margin: 0 0 16px;
  color: var(--ember);
  line-height: 0.85;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.errorpage p {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin: 0 auto 24px;
  max-width: 40ch;
  line-height: 1.55;
}

/* -----------------------------------------------------------------------
   Gate (auth wall for /coaches/*) — rendered by functions/_middleware.ts
   ----------------------------------------------------------------------- */

.gate {
  max-width: 440px;
  margin: 88px auto 0;
  padding: 40px 36px 36px;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 12px 36px -16px rgba(15, 26, 38, 0.22);
}
.gate__brand {
  display: block;
  margin: 0 auto 28px;
  width: fit-content;
}
.gate__brand img {
  height: 30px;
  width: auto;
  display: block;
}
.gate__eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ember);
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.gate__eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--ember);
}
.gate h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0 0 12px;
  color: var(--ink);
  letter-spacing: -0.018em;
  line-height: 1.18;
  font-weight: 700;
}
.gate__lede {
  color: var(--ink-muted);
  margin: 0 0 26px;
  font-size: 0.95rem;
  line-height: 1.55;
}
.gate label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ember-deep);
  font-weight: 700;
  margin: 0 0 10px;
}
.gate input[type="password"],
.gate input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  transition: border-color 160ms var(--ease-soft), box-shadow 160ms var(--ease-soft);
}
.gate input[type="password"]:focus,
.gate input[type="email"]:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.15);
}
.gate button {
  margin-top: 22px;
  width: 100%;
  padding: 13px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 160ms var(--ease-soft);
}
.gate button:hover { background: var(--ember-deep); }
.gate__error {
  color: var(--ember-deep);
  font-size: 0.9rem;
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--ember-tint);
  border-left: 3px solid var(--ember);
  border-radius: 0 8px 8px 0;
}
.gate__notice {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--paper-deep);
  border-left: 3px solid var(--ember);
  border-radius: 0 8px 8px 0;
}
.gate__notice a {
  color: var(--ember-deep);
  text-decoration: underline;
}
.gate__notice a:hover { color: var(--ember-bright); }

/* =======================================================================
   Responsive — drawer behavior
   ======================================================================= */

@media (max-width: 960px) {
  .site-header__inner { padding: 14px 20px; gap: 16px; }
  .brand__divider, .brand__sub { display: none; }
  .site-header__nav { display: none; }
  .nav-toggle__label { display: inline-flex; }

  .topic-drawer {
    position: fixed;
    inset: 64px 0 0 0;
    background: var(--paper);
    padding: 24px 24px 64px;
    overflow-y: auto;
    border-top: 1px solid var(--rule);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 200ms var(--ease-soft), transform 220ms var(--ease-soft);
    z-index: 15;
  }
  .nav-toggle:checked ~ .topic-drawer {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .topic-aside { display: none; }
  .page--with-aside { grid-template-columns: 1fr; }
  .page { padding: 32px 20px 56px; }

  .hero { padding: 16px 0 36px; margin-bottom: 36px; }
  .topic-section { grid-template-columns: 1fr; gap: 18px; }
  .topic-section__list { columns: 1; }

  .site-footer__inner { grid-template-columns: 1fr; gap: 18px; }
  .site-footer__nav { justify-self: start; }

  .pagenav { grid-template-columns: 1fr; }
  .pagenav__next { text-align: left; }
}

@media (min-width: 961px) {
  .topic-drawer { display: none; }
  .nav-toggle, .nav-toggle__label { display: none; }
}

@media print {
  .site-header, .topic-aside, .topic-drawer, .related, .pagenav,
  .site-footer, .nav-toggle, .nav-toggle__label { display: none !important; }
  body { background: white; color: black; }
  .page { padding: 0; }
  .article { max-width: 100%; }
}
