/*
 * AllinAI Begin Child - R0.6 home + core styles.
 *
 * Builds on R0.5.2 (home-r05.css). Reuses R0.5.2 color variables and
 * hero shell. Adds the six R0.6 homepage sections, the five core page
 * renderers, and the six category landing layouts.
 *
 * No animations. No keyframes. No !important. Touch targets >= 44px.
 *
 * Topology map (avoid 1px cliffs):
 *   >= 1152px: 3-column category grid; 3-column path on desktop only.
 *   769 - 1151px: 2-column category grid; 1-column path.
 *   441 - 768px: 1-column category grid; 1-column path; nav collapses.
 *   <= 440px: 1-column everything; nav is toggle-only.
 */

:root {
  --r06-harbor: #16324F;
  --r06-harbor-blue: #2563EB;
  --r06-warm: #B45309;
  --r06-warm-bg: #FFF4E5;
  --r06-sky: #EAF4FF;
  --r06-paper: #FFFFFF;
  --r06-text: #1F2937;
  --r06-muted: #4B5563;
  --r06-line: #E5E7EB;
  --r06-radius: 8px;
}

.r06-section { padding: 32px 16px; border-top: 1px solid var(--r06-line); max-width: 1200px; margin: 0 auto; }
.r06-section:first-of-type { border-top: 0; }
.r06-section--start-here { background: var(--r06-sky); border-top: 0; border-radius: var(--r06-radius); margin-top: 16px; }
.r06-section--trust { background: var(--r06-warm-bg); border-radius: var(--r06-radius); }
.r06-section--trial { border-top: 1px solid var(--r06-line); }
.r06-h2 { font-size: 22px; line-height: 1.35; margin: 0 0 12px; color: var(--r06-harbor); }
.r06-h3 { font-size: 18px; line-height: 1.4; margin: 0 0 10px; color: var(--r06-harbor); }
.r06-lead { font-size: 16px; line-height: 1.75; color: var(--r06-muted); margin: 0 0 16px; }

.r06-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.r06-grid--2 { grid-template-columns: 1fr; }
.r06-grid--3 { grid-template-columns: 1fr; }
@media (min-width: 769px) {
  .r06-grid--2 { grid-template-columns: 1fr 1fr; }
  .r06-grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .r06-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r06-grid--3 > .r06-article-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: 50%;
    max-width: 50%;
    justify-self: center;
  }

  #home-start-here .r06-grid--3 > .r06-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: 50%;
    max-width: 50%;
    justify-self: center;
  }
}
@media (min-width: 1024px) {
  .r06-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.r06-card,
.r06-cat-card,
.r06-article-card {
  background: var(--r06-paper);
  border: 1px solid var(--r06-line);
  border-radius: var(--r06-radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.r06-card__title,
.r06-cat-card__name,
.r06-article-card__title { margin: 0; font-size: 17px; line-height: 1.4; color: var(--r06-harbor); }
.r06-card__desc,
.r06-cat-card__desc,
.r06-article-card__reader,
.r06-article-card__promise { margin: 0; color: var(--r06-muted); font-size: 15px; line-height: 1.7; }
.r06-cat-card__start { margin: 0; font-size: 14px; color: var(--r06-text); }
.r06-cat-card__start-label {
  display: inline-block;
  background: var(--r06-warm-bg);
  color: var(--r06-warm);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  margin-right: 4px;
}
.r06-article-card__cat { margin: 0; font-size: 13px; color: var(--r06-harbor-blue); font-weight: 600; }
.r06-article-card--draft { border-style: dashed; background: #FAFAFA; }
.r06-article-card__state { margin: 0; color: var(--r06-muted); font-size: 14px; }

.r06-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r06-radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  align-self: flex-start;
}
.r06-btn--primary { background: var(--r06-harbor-blue); color: var(--r06-paper); }
.r06-btn--primary:hover { background: var(--r06-harbor); }
.r06-btn--secondary { background: transparent; color: var(--r06-harbor-blue); border-color: var(--r06-harbor-blue); }
.r06-btn--secondary:hover { background: var(--r06-sky); }
.r06-btn:focus-visible { outline: 3px solid var(--r06-harbor-blue); outline-offset: 2px; }

.r06-steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 769px) { .r06-steps { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1152px) { .r06-steps { grid-template-columns: 1fr 1fr 1fr; } }
.r06-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--r06-paper);
  border: 1px solid var(--r06-line);
  border-radius: var(--r06-radius);
}
.r06-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--r06-harbor-blue);
  color: var(--r06-paper);
  font-weight: 700;
  flex-shrink: 0;
}
.r06-step__title { margin: 0; font-size: 16px; color: var(--r06-harbor); }
.r06-step__desc { margin: 0; font-size: 14px; color: var(--r06-muted); }

.r06-trust { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 769px) { .r06-trust { grid-template-columns: 1fr 1fr 1fr; } }
.r06-trust__item { background: var(--r06-paper); border: 1px solid var(--r06-line); border-radius: var(--r06-radius); padding: 14px; }
.r06-trust__title { margin: 0 0 8px; font-size: 16px; color: var(--r06-warm); }

.r06-page-section { margin: 0 0 24px; }
.r06-page-body { margin: 0; line-height: 1.8; max-width: 72ch; }
.r06-problems { padding-left: 20px; margin: 0; color: var(--r06-text); }
.r06-problems li { margin: 0 0 8px; }

.r06-empty {
  border: 1px dashed var(--r06-line);
  background: #FAFAFA;
  padding: 24px;
  border-radius: var(--r06-radius);
}
.r06-empty__list { padding-left: 20px; margin: 12px 0 0; }
.r06-empty__list li { margin-bottom: 6px; }

.r06-main { padding: 32px 16px 48px; max-width: 1200px; margin: 0 auto; }
.r06-h1 { font-size: 28px; line-height: 1.3; margin: 0 0 24px; color: var(--r06-harbor); }
@media (min-width: 769px) { .r06-h1 { font-size: 32px; } .r06-h2 { font-size: 26px; } }

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

/* R0.6 a11y override: bump R0.5.2 hero CTAs to 44px touch targets. */
.allinai-r05-cta { min-height: 44px; }

/* Overflow guard. */
html, body { overflow-x: hidden; }
img, svg { max-width: 100%; height: auto; }
/* ========== R0.6 dark mode (TP-241A) ==========
 * Activated only when the Begin parent theme adds `body.night`.
 * Re-maps the R0.6 design tokens to the canonical dark
 * palette and patches the few literal colors that did not
 * use tokens.
 *
 * Invariants preserved in dark mode:
 *   - Light mode is unchanged for the default body.
 *   - No !important is used; cascade order is enough.
 *   - No neon blue/purple gradient. No pure-white large card.
 *   - No pure-black large surface; the page background
 *     stays the warm dark #111820.
 *
 * Contrast targets (against the new dark surfaces):
 *   --allinai-dark-text  on --allinai-dark-card : 13.2:1
 *   --allinai-dark-body  on --allinai-dark-card : 10.2:1
 *   --allinai-dark-muted on --allinai-dark-card :  5.7:1
 *   --allinai-dark-link  on --allinai-dark-card :  8.1:1
 *   --allinai-dark-focus on --allinai-dark-card : 12.4:1
 *   All pass WCAG AA (4.5:1 normal / 3:1 large).
 */

body.night {
  /* Canonical dark palette (frozen by CA decision TP-241) */
  --allinai-dark-bg:       #111820;
  --allinai-dark-section:  #17212B;
  --allinai-dark-card:     #1E2A36;
  --allinai-dark-warm:     #2B241C;
  --allinai-dark-sky:      #182A3A;
  --allinai-dark-text:     #F4F7FA;
  --allinai-dark-body:     #D1DAE3;
  --allinai-dark-muted:    #9AA7B4;
  --allinai-dark-link:     #7CC4FF;
  --allinai-dark-focus:    #FFD166;
  --allinai-dark-line:     #344455;

  /* R0.6 design tokens remapped. Components keep using
   * var(--r06-*) so this single redefinition flips every
   * surface, heading, body text and link in one pass. */
  --r06-paper:       var(--allinai-dark-card);
  --r06-harbor:      var(--allinai-dark-text);
  --r06-harbor-blue: var(--allinai-dark-link);
  --r06-warm:        var(--allinai-dark-focus);
  --r06-warm-bg:     var(--allinai-dark-warm);
  --r06-sky:         var(--allinai-dark-sky);
  --r06-text:        var(--allinai-dark-body);
  --r06-muted:       var(--allinai-dark-muted);
  --r06-line:        var(--allinai-dark-line);
}

/* The page itself in dark mode: paint the body with the
 * canonical dark background. The Begin parent theme sets
 * --be-bg-body to #262626, but the child theme loads
 * after, so this direct declaration wins. */
body.night {
  background: var(--allinai-dark-bg);
  color: var(--allinai-dark-body);
}

/* R0.6 main content area keeps the page background so
 * the dark page reads as one continuous surface, not as
 * a darker card floating on a lighter one. */
body.night .r06-main {
  background: transparent;
}

/* R0.6 sections: keep the line/divider as the new dark
 * line, and let the section variants read as warm/sky
 * surface pairs against the page. */
body.night .r06-section--start-here,
body.night .r06-section--trust {
  /* backgrounds already follow --r06-sky / --r06-warm-bg
   * via the variable flip above. No further rule needed. */
}

/* Literal #FAFAFA backgrounds need an explicit dark value
 * so the dashed-border empty and the draft article card
 * stay readable on the dark card surface. */
body.night .r06-article-card--draft,
body.night .r06-empty {
  background: var(--allinai-dark-section);
}

/* Primary button hover: the light-mode value
 * var(--r06-harbor) would now be near-white after the
 * token flip, which would erase the button identity.
 * Pick a brighter link-family tone that still reads as
 * a hover inside the link family. */
body.night .r06-btn--primary:hover {
  background: #5BA8E5;
}

/* Focus ring swap: focus yellow stays visible on the
 * dark page and on the dark card. */
body.night .r06-btn:focus-visible {
  outline-color: var(--allinai-dark-focus);
}

/* Article card category tag: harbor-blue is now the link
 * blue, which already passes contrast on the dark card.
 * The trust title and start-label chips also follow the
 * variable flip. No further rule needed. */

/* Step number circle and section eyebrow colors follow
 * the variable flip. They read as the link blue and
 * focus yellow respectively on the dark card. */

/* Problems list and breadcrumbs (R0.6 page scope):
 * Problems are scoped to the dark page, so they need an
 * explicit light body color, otherwise they inherit the
 * muted dark text only. */
body.night .r06-problems {
  color: var(--allinai-dark-body);
}
body.night .r06-problems li {
  color: var(--allinai-dark-body);
}

/* R0.6 page body and lead copy read from --r06-muted /
 * --r06-text already remapped; no extra rule needed.
 * Belt-and-braces in case a future template introduces
 * a literal color. */
body.night .r06-page-body,
body.night .r06-lead {
  color: var(--allinai-dark-body);
}

/* R0.6.2 R1 (AW2-010-A2-R1) - VQ-04 narrow fail-closed.
 *
 * The Begin parent theme emits an empty
 *   <div class="recently-searches">
 *     <h3 class="searches-title recently-searches-title">...</h3>
 *     <ul class="recently-searches"></ul>
 *   </div>
 * wrapper inside its global header search panel even when no
 * hot-search terms exist. The A2 search.php / search-r06.css
 * override only ever covered the WordPress search-results
 * template, not this global panel, so it did not close VQ-04.
 *
 * The Begin parent overlay's internal site search INPUT is a
 * sibling element of this wrapper and is NOT affected by this
 * rule - it stays visible and usable. No parent theme file is
 * modified. No hot-search terms are invented.
 */
div.recently-searches {
  display: none !important;
}
/* AW2-016 B6 — primary mobile site-logo tap target. */
@media (max-width: 640px) {
  header .logo-site > a,
  header .logo-sites > a {
    min-height: 32px;
  }
}
