/*
 * Spitfire child theme — site customizations
 *
 * This file loads after Quark 2's theme.css.
 */

/* Half of Quark 2's built-in section-tight spacing. */
.section-tighter {
  padding-block: clamp(1rem, 2.5vw, 1.75rem);
}

/* Feature-card icon and heading colors */
.modular-features .feature-icon i {
  color: var(--q2-accent);
}

.modular-features h6 {
  color: var(--q2-text-strong);
}

/* Keep the hero title group compact */
body.title-h1h2 .hero h1 + h2 {
  margin-bottom: 1rem;
}

/*
 * Features introduction
 *
 * Headings span the full width. Introductory content becomes two balanced
 * columns on wider screens and automatically remains one column on mobile.
 */
@media (min-width: 860px) {
  .modular-features .feature-intro-columns {
    column-count: 2;
    column-gap: clamp(2.5rem, 5vw, 4rem);
    column-fill: balance;
  }

  .modular-features .feature-intro-columns > :is(h1, h2) {
    column-span: all;
  }

  .modular-features .feature-intro-columns > h2 {
    margin-bottom: 1rem;
  }

  .modular-features
    .feature-intro-columns
    > :is(p, ul, ol, blockquote) {
    /*
     * Padding provides paragraph spacing without Safari carrying a margin
     * across the column break.
     */
    margin-block: 0;
    padding-block-end: 1rem;

    break-inside: avoid-column;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;

    orphans: 3;
    widows: 3;
  }

  .modular-features .feature-intro-columns > :last-child {
    padding-block-end: 0;
  }
}

/*
 * Modular text image layout
 *
 * Allows text to wrap beside an image and continue at full width beneath it.
 */
.modular-text.image-layout-wrap .text-flow {
  display: flow-root;
}

.modular-text.image-layout-wrap .flow-image {
  width: min(48%, 34rem);
  margin-top: 2rem;
  margin-bottom: 1.5rem;
}

.modular-text.image-layout-wrap .text-flow.align-right .flow-image {
  float: right;
  margin-left: 3.5rem;
}

.modular-text.image-layout-wrap .text-flow.align-left .flow-image {
  float: left;
  margin-right: 3.5rem;
}

.modular-text.image-layout-wrap .flow-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Stack wrapped images above their text on smaller screens */
@media (max-width: 859px) {
  .modular-text.image-layout-wrap .flow-image,
  .modular-text.image-layout-wrap
    .text-flow.align-left
    .flow-image,
  .modular-text.image-layout-wrap
    .text-flow.align-right
    .flow-image {
    float: none;
    width: 100%;
    margin: 0 0 1.75rem;
  }
}

/*
 * Modular forms
 *
 * Provides a reusable, contained layout for a form placed after a modular
 * hero. Form definitions remain owned by the modular form page itself.
 */
.modular-form .container {
  max-width: 880px;
}

.modular-form-inner > h1:first-child {
  margin-bottom: 0.6rem;
}

.modular-form-inner > h1:first-child ~ p {
  max-width: 760px;
}

.modular-form-inner form {
  margin-top: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  box-shadow: var(--q2-shadow-card);
}

.modular-form-inner textarea {
  min-height: 12rem;
  resize: vertical;
}

@media (max-width: 600px) {
  .modular-form-inner form {
    padding: 1rem;
  }
}

/* Archive landing page */
body.archive-hub #body-wrapper > .container > .content-item,
body.newsletter-index #body-wrapper > .container > .content-item {
  max-width: 1100px;
}

.archive-directory,
.newsletter-issues,
.newsletter-years {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block: 2rem;
}

.archive-directory-card,
.newsletter-issues > a,
.newsletter-years > a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 7.5rem;
  padding: 1.25rem;
  color: var(--q2-text);
  text-decoration: none;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.archive-directory-card:hover,
.newsletter-issues > a:hover,
.newsletter-years > a:hover {
  color: var(--q2-text);
  text-decoration: none;
  border-color: var(--q2-accent);
  box-shadow: var(--q2-shadow-card);
  transform: translateY(-2px);
}

.archive-directory-card strong,
.newsletter-issues > a strong,
.newsletter-years > a strong {
  color: var(--q2-text-strong);
  font-size: 1.1rem;
}

.archive-directory-card span,
.newsletter-issues > a span,
.newsletter-years > a span {
  color: var(--q2-text-muted);
}

.newsletter-issues > a {
  min-height: 0;
}

.newsletter-years > a {
  min-height: 8.5rem;
}

.newsletter-years > a strong {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

/* Manuals and documentation archive */
body.manuals-documentation #body-wrapper > .container > .content-item,
body.manual-document #body-wrapper > .container > .content-item {
  max-width: 1120px;
}

.manual-era-grid,
.manual-chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block: 2rem 2.5rem;
}

.manual-era-card,
.manual-chapter-link {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  padding: 1.25rem;
  color: var(--q2-text);
  text-decoration: none;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.manual-era-card:hover,
.manual-chapter-link:hover {
  color: var(--q2-text);
  text-decoration: none;
  border-color: var(--q2-accent);
  box-shadow: var(--q2-shadow-card);
  transform: translateY(-2px);
}

.manual-era-card strong,
.manual-chapter-link strong {
  color: var(--q2-text-strong);
  font-size: 1.08rem;
}

.manual-era-label {
  color: var(--q2-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.manual-primary-card {
  grid-column: 1 / -1;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--q2-accent) 10%, transparent), transparent 66%),
    var(--q2-bg-muted);
}

.manual-era-card-future {
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--q2-accent) 10%, transparent), transparent 66%),
    var(--q2-bg-muted);
}

.manual-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-block: 1.25rem 2rem;
  padding: 0.9rem 1rem;
  color: var(--q2-text-muted);
  font-size: 0.83rem;
  background: var(--q2-bg-muted);
  border-left: 3px solid var(--q2-accent);
  border-radius: 0 var(--q2-radius-sm) var(--q2-radius-sm) 0;
}

.manual-meta strong {
  color: var(--q2-text-strong);
}

.manual-chapter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.manual-chapter-link {
  justify-content: center;
  padding: 0.85rem 1rem;
}

.manual-chapter-link strong {
  font-size: 0.92rem;
}

.manual-chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-block: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-sm);
}

.manual-chapter-nav a:nth-child(2) {
  text-align: center;
}

.manual-chapter-nav a:last-child {
  text-align: right;
}

.legacy-manual-text {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-block: 1.5rem 2.25rem;
  padding: clamp(1rem, 2.5vw, 1.75rem);
  overflow-x: auto;
  color: var(--q2-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.76rem, 1.45vw, 0.9rem);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: normal;
  tab-size: 4;
  background: color-mix(in srgb, var(--q2-bg-muted) 88%, var(--q2-bg));
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  box-shadow: var(--q2-shadow-card);
}

@media (max-width: 860px) {
  .manual-chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .manual-era-grid,
  .manual-chapter-grid {
    grid-template-columns: 1fr;
  }

  .manual-primary-card {
    grid-column: auto;
  }

  .manual-chapter-nav {
    grid-template-columns: 1fr 1fr;
  }

  .manual-chapter-nav a:nth-child(2) {
    display: none;
  }
}

/*
 * SPITFIRE NG project and documentation
 *
 * The modern project uses the site's typography and color system, but has a
 * distinct product-documentation layout. Legacy manual pages remain scoped to
 * their existing styles above.
 */
body.sfng-project #body-wrapper > .container > .content-item {
  max-width: 1180px;
  padding: 0;
  overflow: hidden;
}

.sfng-project-hero {
  position: relative;
  padding: clamp(2rem, 3.75vw, 4rem) clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--q2-accent) 28%, transparent), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--q2-bg-elev) 82%, var(--q2-accent)), var(--q2-bg-elev) 62%);
  border-bottom: 1px solid var(--q2-divider);
}

.sfng-project-hero::after {
  position: absolute;
  right: -5rem;
  bottom: -8rem;
  width: 24rem;
  height: 24rem;
  content: "";
  border: 1px solid color-mix(in srgb, var(--q2-accent) 32%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 0 3rem color-mix(in srgb, var(--q2-accent) 5%, transparent),
    0 0 0 7rem color-mix(in srgb, var(--q2-accent) 4%, transparent);
  pointer-events: none;
}

.sfng-project-logo {
  position: relative;
  z-index: 1;
  width: clamp(17.5rem, 34vw, 20rem);
  max-width: 100%;
}

.sfng-project-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.sfng-project-logo .sfng-project-logo-light,
:root[data-theme="light"] .sfng-project-logo-dark {
  display: none;
}

:root[data-theme="light"] .sfng-project-logo-light {
  display: block;
}

.sfng-section-heading > span,
.sfng-current-focus > div > span,
.sfng-final-cta span,
.sfng-home-eyebrow {
  color: var(--q2-accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sfng-project-status {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.45rem 0.7rem;
  color: var(--q2-text-strong);
  font-size: 0.78rem;
  font-weight: 650;
  background: color-mix(in srgb, var(--q2-bg-elev) 78%, transparent);
  border: 1px solid var(--q2-divider);
  border-radius: 999px;
}

.sfng-project-status span,
.sfng-status-label i {
  width: 0.55rem;
  height: 0.55rem;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0.22rem color-mix(in srgb, #22c55e 16%, transparent);
}

.sfng-project-hero h1 {
  max-width: 800px;
  margin-block: 1rem;
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.sfng-project-hero p {
  max-width: 760px;
  color: var(--q2-text-muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.65;
}

.sfng-project-actions,
.sfng-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.sfng-at-a-glance,
body.sfng-project .content-item > h2,
body.sfng-project .content-item > p,
body.sfng-project .content-item > .sfng-project-actions,
body.sfng-project .content-item > .markdown-alert,
body.sfng-project .content-item > .md-alert,
.sfng-capability-grid,
.sfng-current-focus,
.sfng-final-cta {
  margin-inline: clamp(1.5rem, 6vw, 5rem);
}

.sfng-at-a-glance {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--q2-divider);
}

.sfng-section-heading {
  max-width: 760px;
}

.sfng-section-heading h2 {
  margin-block: 0.35rem 0.75rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.sfng-section-heading h2::before,
.sfng-current-focus h2::before {
  display: none;
}

.sfng-section-heading p {
  margin: 0;
  color: var(--q2-text-muted);
  font-size: 1.08rem;
}

.sfng-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 2rem;
  overflow: hidden;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

.sfng-stat-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.25rem;
}

.sfng-stat-grid > div + div {
  border-left: 1px solid var(--q2-divider);
}

.sfng-stat-grid strong {
  color: var(--q2-text-strong);
  font-size: 1.12rem;
}

.sfng-stat-grid span {
  color: var(--q2-text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

body.sfng-project .content-item > h2 {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}

body.sfng-project .content-item > p {
  max-width: 820px;
}

.sfng-capability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-block: 1.5rem 4rem;
}

.sfng-capability-grid > div {
  padding: 1.35rem;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

.sfng-capability-grid > div > span {
  color: var(--q2-accent);
  font-size: 0.72rem;
  font-weight: 750;
}

.sfng-capability-grid strong {
  display: block;
  margin-block: 0.55rem 0.35rem;
  color: var(--q2-text-strong);
  font-size: 1.05rem;
}

.sfng-capability-grid p {
  margin: 0;
  color: var(--q2-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.sfng-current-focus {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 4rem);
  margin-block: 4rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, color-mix(in srgb, var(--q2-accent) 9%, var(--q2-bg-muted)), var(--q2-bg-muted));
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-lg);
}

.sfng-current-focus h2 {
  margin-block: 0.45rem 0;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

.sfng-current-focus ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: sfng-focus;
}

.sfng-current-focus li {
  position: relative;
  display: grid;
  gap: 0.2rem;
  padding: 0 0 1rem 2.5rem;
  counter-increment: sfng-focus;
}

.sfng-current-focus li + li {
  padding-top: 1rem;
  border-top: 1px solid var(--q2-divider);
}

.sfng-current-focus li::before {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--q2-accent);
  font-size: 0.8rem;
  font-weight: 750;
  content: "0" counter(sfng-focus);
}

.sfng-current-focus li + li::before {
  top: 1rem;
}

.sfng-current-focus li span {
  color: var(--q2-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.sfng-final-cta {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  margin-block: 4rem clamp(1.5rem, 6vw, 5rem);
  padding: 1.5rem;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

body.sfng-project #body-wrapper > .container > .content-item {
  padding-bottom: clamp(2.5rem, 6vw, 5rem);
}

.sfng-final-cta div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sfng-final-cta strong {
  color: var(--q2-text-strong);
  font-size: 1.05rem;
}

/* Homepage project status panel */
.modular-text.sfng-home-module {
  background: var(--q2-bg);
}

.sfng-home-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(15rem, 0.65fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(1.75rem, 5vw, 3.5rem);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--q2-accent) 10%, transparent), transparent 55%),
    var(--q2-bg-elev);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-lg);
  box-shadow: var(--q2-shadow-card);
}

.sfng-home-copy h2 {
  margin-block: 0.5rem 0.8rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.sfng-home-copy h2::before {
  display: none;
}

.sfng-home-copy p {
  max-width: 720px;
  margin: 0;
  color: var(--q2-text-muted);
  font-size: 1.05rem;
}

.sfng-home-status {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--q2-bg-muted) 80%, transparent);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

.sfng-status-label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--q2-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sfng-status-label i {
  flex: 0 0 auto;
  display: block;
}

.sfng-home-status > strong {
  color: var(--q2-text-strong);
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

.sfng-home-status > span:not(.sfng-status-label) {
  margin-top: 0.3rem;
  color: var(--q2-accent);
  font-size: 1.15rem;
  font-weight: 700;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.sfng-home-status small {
  margin-top: 1.5rem;
  color: var(--q2-text-muted);
  line-height: 1.5;
}

/* Keep Markdown alerts responsive without browser-inserted hyphens. */
.md-alert,
.md-alert-title,
.md-alert-body {
  hyphens: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

/* Modern documentation shell */
body.sfng-documentation #body-wrapper > .container {
  max-width: 1360px;
}

body.archive-documentation #body-wrapper > .container {
  max-width: 1400px;
}

.sfng-doc-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

.sfng-doc-sidebar {
  position: sticky;
  top: 6.5rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-lg);
  box-shadow: var(--q2-shadow-card);
}

.sfng-doc-brand {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 1.25rem;
  color: var(--q2-text);
  text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--q2-accent) 13%, transparent), transparent);
  border-bottom: 1px solid var(--q2-divider);
}

.sfng-doc-brand:hover {
  color: var(--q2-text);
  text-decoration: none;
}

.sfng-doc-brand span {
  color: var(--q2-accent);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sfng-doc-brand strong {
  color: var(--q2-text-strong);
  font-size: 1.15rem;
}

.sfng-doc-brand small {
  color: var(--q2-text-muted);
  font-size: 0.75rem;
}

.sfng-doc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem;
}

.sfng-doc-nav a {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.48rem 0.65rem;
  color: var(--q2-text-muted);
  font-size: 0.84rem;
  font-weight: 550;
  line-height: 1.3;
  text-decoration: none;
  border-radius: var(--q2-radius-xs);
}

.sfng-doc-nav a:hover {
  color: var(--q2-text-strong);
  background: var(--q2-bg-muted);
}

.sfng-doc-nav a.active {
  color: var(--q2-accent);
  background: color-mix(in srgb, var(--q2-accent) 10%, transparent);
}

.sfng-doc-nav-icon,
.sfng-doc-chevron {
  display: block;
  flex: none;
  color: currentColor;
}

.sfng-doc-group {
  min-width: 0;
  margin: 0;
}

.sfng-doc-group-toggle {
  display: grid;
  width: 100%;
  grid-template-columns: 1rem minmax(0, 1fr) 0.9rem;
  gap: 0.65rem;
  align-items: center;
  padding: 0.48rem 0.65rem;
  color: var(--q2-text-muted);
  font-size: 0.84rem;
  font-weight: 550;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: var(--q2-radius-xs);
  box-shadow: none;
  list-style: none;
}

.sfng-doc-group-toggle::-webkit-details-marker {
  display: none;
}

.sfng-doc-group-toggle::marker {
  content: "";
}

.sfng-doc-group-toggle:hover,
.sfng-doc-group-toggle.active-parent {
  color: var(--q2-text-strong);
  background: var(--q2-bg-muted);
}

.sfng-doc-group-toggle:focus-visible,
.sfng-doc-nav a:focus-visible {
  outline: 2px solid var(--q2-accent);
  outline-offset: 2px;
}

.sfng-doc-chevron {
  justify-self: end;
  transition: transform 160ms ease;
}

.sfng-doc-group[open] > .sfng-doc-group-toggle .sfng-doc-chevron {
  transform: rotate(180deg);
}

.sfng-doc-subnav[hidden] {
  display: none;
}

.sfng-doc-subnav {
  display: flex;
  flex-direction: column;
  margin: -0.05rem 0 0.2rem 0.65rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--q2-divider);
}

.sfng-doc-subnav a {
  font-size: 0.78rem;
}

.sfng-doc-subnav .sfng-doc-group-toggle {
  font-size: 0.78rem;
}

.sfng-doc-subnav .sfng-doc-subnav {
  margin-left: 0.45rem;
}

.sfng-doc-milestone {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  margin: 0 0.8rem 0.8rem;
  padding: 0.75rem;
  background: color-mix(in srgb, #22c55e 7%, var(--q2-bg-muted));
  border: 1px solid color-mix(in srgb, #22c55e 20%, var(--q2-divider));
  border-radius: var(--q2-radius-sm);
}

.sfng-doc-milestone > span {
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  color: #15803d;
  font-size: 0.72rem;
  font-weight: 800;
  place-items: center;
  background: color-mix(in srgb, #22c55e 18%, transparent);
  border-radius: 50%;
}

.sfng-doc-milestone p {
  margin: 0;
  color: var(--q2-text-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.sfng-doc-milestone strong {
  color: var(--q2-text-strong);
}

.sfng-doc-content {
  min-width: 0;
  max-width: 940px;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--q2-bg-elev);
  border-radius: var(--q2-radius-lg);
  box-shadow:
    rgba(19, 19, 22, 0.04) 0 1px 2px,
    rgba(19, 19, 22, 0.04) 0 8px 24px -8px;
}

/* Historical documentation variant */
.archive-doc-shell {
  grid-template-columns: 300px minmax(0, 1fr);
}

.archive-doc-sidebar {
  --archive-doc-accent: #d3a24f;
}

.archive-doc-sidebar .sfng-doc-brand {
  background: linear-gradient(135deg, color-mix(in srgb, var(--archive-doc-accent) 15%, transparent), transparent);
}

.archive-doc-sidebar .sfng-doc-brand span,
.archive-doc-sidebar .sfng-doc-nav a.active {
  color: var(--archive-doc-accent);
}

.archive-doc-sidebar .sfng-doc-nav a.active {
  background: color-mix(in srgb, var(--archive-doc-accent) 11%, transparent);
}

.archive-doc-sidebar .sfng-doc-group-toggle:focus-visible,
.archive-doc-sidebar .sfng-doc-nav a:focus-visible {
  outline-color: var(--archive-doc-accent);
}

.archive-doc-provenance {
  background: color-mix(in srgb, var(--archive-doc-accent) 8%, var(--q2-bg-muted));
  border-color: color-mix(in srgb, var(--archive-doc-accent) 24%, var(--q2-divider));
}

.archive-doc-provenance > span {
  color: color-mix(in srgb, var(--archive-doc-accent) 82%, var(--q2-text-strong));
  background: color-mix(in srgb, var(--archive-doc-accent) 18%, transparent);
}

.archive-doc-content {
  max-width: 980px;
}

.sfng-doc-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-start;
  margin-bottom: 1.5rem;
  color: var(--q2-text-muted);
  font-size: 0.76rem;
}

.sfng-doc-breadcrumbs a {
  color: var(--q2-text-muted);
  text-decoration: none;
}

.sfng-doc-breadcrumbs a:hover {
  color: var(--q2-accent);
}

.sfng-doc-content > h1 {
  max-width: 760px;
  margin-bottom: 0.65rem;
  font-size: clamp(2.15rem, 4.5vw, 3.5rem);
  letter-spacing: -0.035em;
}

.sfng-doc-content > h1 + .manual-meta {
  margin-top: 1rem;
}

.sfng-doc-content > p:first-of-type,
.sfng-doc-content > .manual-meta + p {
  max-width: 780px;
  color: var(--q2-text-muted);
  font-size: 1.08rem;
}

.sfng-doc-content h2 {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--q2-divider);
}

.sfng-doc-content h2::before {
  width: 1.8rem;
}

.sfng-doc-content pre {
  padding: 1.15rem 1.25rem;
  color: var(--q2-text-strong);
  background: color-mix(in srgb, var(--q2-bg-muted) 92%, var(--q2-bg-elev));
  border: 1px solid var(--q2-divider);
  box-shadow: none;
}

.sfng-doc-content pre code {
  color: inherit;
}

.sfng-doc-content .manual-meta {
  gap: 0.5rem;
  padding: 0;
  background: transparent;
  border: 0;
}

.sfng-doc-content .manual-meta > span {
  padding: 0.42rem 0.65rem;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: 999px;
}

.sfng-doc-content .manual-era-grid {
  gap: 0.85rem;
}

.sfng-doc-content .manual-era-card {
  background: color-mix(in srgb, var(--q2-bg-muted) 88%, var(--q2-bg-elev));
}

@media (max-width: 960px) {
  .sfng-doc-shell {
    grid-template-columns: 1fr;
  }

  .sfng-doc-sidebar {
    position: static;
    max-height: none;
  }

  .archive-doc-sidebar {
    max-height: min(64vh, 34rem);
  }

  .sfng-doc-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sfng-doc-group {
    grid-column: 1 / -1;
  }

  .sfng-doc-milestone {
    display: none;
  }

  .sfng-doc-content {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .sfng-stat-grid,
  .sfng-capability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sfng-stat-grid > div:nth-child(3) {
    border-left: 0;
  }

  .sfng-stat-grid > div:nth-child(n + 3) {
    border-top: 1px solid var(--q2-divider);
  }

  .sfng-current-focus,
  .sfng-home-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sfng-project-hero h1 br {
    display: none;
  }

  .sfng-project-actions .btn,
  .sfng-home-actions .btn,
  .sfng-final-cta .btn {
    width: 100%;
    text-align: center;
  }

  .sfng-stat-grid,
  .sfng-capability-grid {
    grid-template-columns: 1fr;
  }

  .sfng-stat-grid > div + div,
  .sfng-stat-grid > div:nth-child(3) {
    border-top: 1px solid var(--q2-divider);
    border-left: 0;
  }

  .sfng-final-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .sfng-doc-nav {
    grid-template-columns: 1fr;
  }

  .sfng-doc-content {
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sfng-doc-chevron {
    transition: none;
  }
}

/* Long-form project history */
body.spitfire-story #body-wrapper > .container > .content-item {
  max-width: 800px;
}

body.spitfire-story .content-item > h1 + p {
  font-size: 1.2rem;
  color: var(--q2-text-strong);
}

/* SPITFIRE history — long-form narrative, statistics and timeline */
body.spitfire-history #body-wrapper > .container > .content-item {
  max-width: 1080px;
}

body.spitfire-history .content-item > h1 + p {
  max-width: 900px;
  margin-bottom: 1rem;
  color: var(--q2-text-strong);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  line-height: 1.55;
}

body.spitfire-history .content-item > h1 + p + p {
  max-width: 900px;
  color: var(--q2-text-muted);
  font-size: 1.08rem;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-block: 2.25rem 3rem;
  overflow: hidden;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

.history-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding: 1.25rem 1.4rem;
}

.history-stats > div + div {
  border-left: 1px solid var(--q2-divider);
}

.history-stats strong {
  color: var(--q2-text-strong);
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1;
}

.history-stats span {
  color: var(--q2-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-pullquote {
  margin-block: 2.75rem;
  padding: clamp(1.4rem, 3vw, 2rem);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--q2-accent) 13%, transparent), transparent 62%),
    var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-left: 4px solid var(--q2-accent);
  border-radius: var(--q2-radius-md);
}

.history-pullquote p {
  margin: 0;
  color: var(--q2-text-strong);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 650;
  line-height: 1.45;
}

.history-cite {
  margin-left: 0.15em;
  font-size: 0.7em;
  font-weight: 700;
  vertical-align: super;
}

.history-cite a {
  text-decoration: none;
}

.history-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-block: 2rem 3rem;
  padding: 0;
  list-style: none;
}

.history-timeline::before {
  position: absolute;
  top: 0.8rem;
  bottom: 0.8rem;
  left: 7.35rem;
  width: 2px;
  content: "";
  background: var(--q2-divider);
}

.history-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: 0.9rem;
}

.history-timeline li::before {
  position: absolute;
  top: 1.42rem;
  left: 7rem;
  width: 0.72rem;
  height: 0.72rem;
  content: "";
  background: var(--q2-accent);
  border: 3px solid var(--q2-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--q2-divider);
}

.history-timeline time {
  padding-top: 0.25rem;
  color: var(--q2-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: right;
  text-transform: uppercase;
}

.history-timeline h3 {
  margin: 0 0 0.35rem;
  color: var(--q2-text-strong);
  font-size: 1.1rem;
}

.history-timeline p {
  margin: 0;
  color: var(--q2-text-muted);
}

.history-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-block: 2rem 3rem;
}

.history-next a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.2rem 1.25rem;
  color: var(--q2-text);
  text-decoration: none;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.history-next a:hover {
  color: var(--q2-text);
  text-decoration: none;
  border-color: var(--q2-accent);
  box-shadow: var(--q2-shadow-card);
  transform: translateY(-2px);
}

.history-next strong {
  color: var(--q2-text-strong);
  font-size: 1.05rem;
}

.history-next span,
.history-source-note {
  color: var(--q2-text-muted);
}

.history-references {
  padding-left: 1.25rem;
  font-size: 0.92rem;
}

.history-references li {
  margin-bottom: 0.75rem;
  padding-left: 0.35rem;
  scroll-margin-top: 6rem;
}

.history-references li:target {
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--q2-accent) 12%, transparent);
  border-radius: var(--q2-radius-sm);
}

.history-source-note {
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  font-size: 0.9rem;
  background: var(--q2-bg-muted);
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
}

@media (max-width: 760px) {
  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-stats > div + div {
    border-left: 0;
  }

  .history-stats > div:nth-child(even) {
    border-left: 1px solid var(--q2-divider);
  }

  .history-stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--q2-divider);
  }

  .history-timeline::before {
    left: 0.35rem;
  }

  .history-timeline li {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding: 0.9rem 0 0.9rem 1.75rem;
  }

  .history-timeline li::before {
    top: 1.35rem;
    left: 0;
  }

  .history-timeline time {
    padding: 0;
    text-align: left;
  }

  .history-next {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .history-stats {
    grid-template-columns: 1fr;
  }

  .history-stats > div:nth-child(even) {
    border-left: 0;
  }

  .history-stats > div + div {
    border-top: 1px solid var(--q2-divider);
  }
}

/* Faithful DOS newsletter transcripts */
body.newsletter-issue #body-wrapper > .container > .content-item {
  max-width: 1120px;
}

body.newsletter-issue .content-item pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1.25rem;
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  background: var(--q2-bg-muted);
}

body.newsletter-issue .content-item pre code {
  white-space: pre;
  font-size: clamp(0.72rem, 1.45vw, 0.9rem);
  line-height: 1.35;
}

body.archive-source-record #body-wrapper > .container > .content-item {
  max-width: 1120px;
}

body.archive-source-record .content-item pre {
  max-width: 100%;
  overflow-x: auto;
}

.newsletter-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--q2-divider);
}

.newsletter-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--q2-text-muted);
  font-size: 0.88rem;
}

.newsletter-breadcrumbs a {
  color: var(--q2-text-muted);
  text-decoration: none;
}

.newsletter-breadcrumbs a:hover {
  color: var(--q2-accent);
  text-decoration: underline;
}

.newsletter-pagination > a {
  min-width: 0;
}

.newsletter-pagination-previous,
.newsletter-pagination-next {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
}

.newsletter-pagination-previous span,
.newsletter-pagination-next span {
  color: var(--q2-text-muted);
  font-size: 0.8rem;
}

.newsletter-pagination-previous strong,
.newsletter-pagination-next strong {
  overflow-wrap: anywhere;
}

.newsletter-pagination-next {
  text-align: right;
}

.newsletter-pagination-up {
  text-align: center;
}

@media (max-width: 700px) {
  .archive-directory,
  .newsletter-issues,
  .newsletter-years {
    grid-template-columns: 1fr;
  }

  .newsletter-pagination {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .newsletter-pagination-up {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--q2-divider);
  }

  .newsletter-pagination-spacer {
    display: none;
  }
}

/* Compact frontend account control. Quark2 supplies the Login plugin status
 * text in the action area; SPITFIRE replaces it with one quiet navigation
 * icon that also remains available in the mobile overlay. */
#header .login-status-wrapper {
  display: none;
}

.dropmenu .spitfire-account-trigger {
  width: 36px;
  height: 36px;
  justify-content: center;
  padding: 0;
  border-radius: var(--q2-radius-pill);
}

.dropmenu .spitfire-account-nav.has-children > .spitfire-account-trigger::after {
  content: none;
}

.spitfire-account-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spitfire-account-dot {
  position: absolute;
  top: -0.2rem;
  right: -0.32rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--q2-accent);
  box-shadow: 0 0 0 2px var(--q2-nav-bg);
}

.spitfire-account-label {
  display: none;
}

.dropmenu .spitfire-account-nav > .spitfire-account-menu {
  inset-inline-start: auto;
  inset-inline-end: 0;
  min-width: 230px;
}

.dropmenu .spitfire-account-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.spitfire-account-identity > span {
  display: block;
  padding: 0.45rem 0.875rem 0.6rem;
  color: var(--q2-text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  border-bottom: 1px solid var(--q2-divider);
}

@media (max-width: 860px) {
  .overlay .spitfire-account-trigger {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .overlay .spitfire-account-label {
    display: inline;
  }

  .overlay .spitfire-account-identity > span {
    display: block;
    padding: 0.5rem 0 0.5rem 0.75rem;
  }

  .overlay .spitfire-account-menu a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
  }

  .overlay .spitfire-account-dot {
    box-shadow: 0 0 0 2px var(--q2-bg);
  }
}

/* Keep wide reference tables contained and mobile documentation easy to reach. */
.sfng-doc-content { min-width: 0; overflow-wrap: anywhere; }
.sfng-doc-content table { display: block; max-width: 100%; overflow-x: auto; }
.sfng-doc-content pre { max-width: 100%; overflow-x: auto; }
.sfng-doc-disclosure > summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; }
.sfng-doc-disclosure > summary:focus-visible { outline: 3px solid var(--q2-accent); outline-offset: -4px; }
@media (min-width: 961px) { .sfng-doc-disclosure > summary { display: none; } }
.fv-item-path { flex-wrap: wrap; overflow-wrap: anywhere; }
.fv-item-path > * { min-width: 0; }
@media (min-width: 481px) and (max-width: 960px) {
  .fv-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
