/* ==========================================================================
   HUBEMPLOYMENT.WORLD — Shift Briefing + Field Manual Archive
   D3: 12-col grid | D4: full-bleed bands | D7: section-role alignment
   ========================================================================== */

/* --------------------------------------------------------------------------
   TOKENS — spacing, width, typography, surfaces, borders
   -------------------------------------------------------------------------- */
:root {
  /* Spacing scale (rhythmic) */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 2.5rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 5rem;

  /* Width tokens (D4) */
  --w-narrow: min(45rem, 90vw);
  --w-base: min(60rem, 92vw);
  --w-wide: min(72rem, 94vw);
  --w-extra: min(84rem, 96vw);
  --w-inset: min(18rem, 85vw);
  --w-full: 100%;

  /* Typography scale */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Consolas", monospace;

  --text-xs: 0.75rem;
  --text-s: 0.875rem;
  --text-base: 1rem;
  --text-m: 1.125rem;
  --text-l: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.25rem;

  --line-tight: 1.25;
  --line-normal: 1.5;
  --line-relaxed: 1.65;
  --line-loose: 1.8;

  /* Surfaces */
  --surface-page: #faf9f7;
  --surface-card: #ffffff;
  --surface-band: #f2f0ed;
  --surface-accent: #e8e5e0;
  --surface-invert: #1a1a1a;

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #6b6b6b;
  --text-invert: #faf9f7;

  /* Borders & radii */
  --border-subtle: 1px solid #e0ddd8;
  --border-strong: 1px solid #c9c5be;
  --radius-s: 2px;
  --radius-m: 4px;
  --radius-l: 6px;

  /* Gaps (D3: GG4 rhythmic_variable) */
  --gap-tight: var(--space-s);
  --gap-base: var(--space-m);
  --gap-wide: var(--space-l);
  --gap-section: var(--space-2xl);

  /* Transitions */
  --ease-out: 0.2s ease-out;
}

/* --------------------------------------------------------------------------
   BASE — reset, defaults
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  color: var(--text-primary);
  background: var(--surface-page);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--line-tight);
  margin-top: 0;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-l); }
h4, h5, h6 { font-size: var(--text-m); }

p {
  margin: 0 0 var(--space-m);
}

p:last-child {
  margin-bottom: 0;
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   LAYOUT GRID — D3: 12-col consistent
   -------------------------------------------------------------------------- */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap-base);
  width: 100%;
}

.hero-split {
  grid-template-columns: 8fr 4fr;
}

.hero-aside {
  /* aside panel; CL4: aside_to_inline_panel on mobile */
}

/* Section spacing (BT2 spacer_buffer_transition) */
.steps-section,
.featured-section,
.archive-section,
.about-section {
  padding-block: var(--space-2xl);
}

/* Span utilities */
.span-12 { grid-column: 1 / -1; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

/* --------------------------------------------------------------------------
   CONTAINERS — D4: full-bleed bands with contained content
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-m);
}

.container--narrow { max-width: var(--w-narrow); }
.container--base { max-width: var(--w-base); }
.container--wide { max-width: var(--w-wide); }
.container--extra { max-width: var(--w-extra); }

.band {
  width: var(--w-full);
  background: var(--surface-band);
}

.band .container {
  padding-block: var(--space-2xl);
}

/* --------------------------------------------------------------------------
   COMPONENTS
   -------------------------------------------------------------------------- */

/* Nav */
.site-header {
  background: var(--surface-card);
  border-bottom: var(--border-subtle);
}

.site-header .container {
  padding-block: var(--space-s);
}

.nav-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
}

.site-logo {
  font-weight: 700;
  font-size: var(--text-m);
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: underline;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: var(--text-s);
  text-decoration: none;
}

.nav-links a:hover {
  text-decoration: underline;
}

.shift-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2xs);
}

/* Checklist rail (hero aside) */
.checklist-rail {
  background: var(--surface-card);
  border: var(--border-subtle);
  border-radius: var(--radius-m);
  padding: var(--space-m);
}

.checklist-rail h3 {
  font-size: var(--text-s);
  margin: 0 0 var(--space-s);
  font-weight: 600;
}

.checklist-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
  font-size: var(--text-s);
  border-bottom: var(--border-subtle);
}

.checklist-list li:last-child {
  border-bottom: none;
}

.checklist-list .check {
  flex-shrink: 0;
  width: 1em;
  color: var(--text-muted);
}

/* Theme chips */
.theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-m);
}

.chip {
  display: inline-block;
  padding: var(--space-2xs) var(--space-xs);
  font-size: var(--text-xs);
  background: var(--surface-accent);
  border-radius: var(--radius-s);
  text-decoration: none;
}

.chip:hover {
  background: var(--surface-band);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: var(--space-xs) var(--space-m);
  font-size: var(--text-s);
  font-weight: 600;
  text-decoration: none;
  border: var(--border-strong);
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: background var(--ease-out);
}

.btn:hover {
  background: var(--surface-accent);
}

.btn--primary {
  background: var(--surface-invert);
  color: var(--text-invert);
  border-color: var(--surface-invert);
}

.btn--primary:hover {
  background: #333;
  color: var(--text-invert);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-m);
}

/* Timeline rail (steps) — D2:P4 timeline_rail v2 */
.timeline-rail {
  position: relative;
  padding-left: 2rem;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-strong);
}

.timeline-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: var(--space-m);
  padding-bottom: var(--space-l);
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  width: 8px;
  height: 8px;
  margin-top: 0.35rem;
  margin-left: 0.25rem;
  background: var(--surface-invert);
  border-radius: 50%;
}

.step-num {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-mono);
  font-size: var(--text-s);
  font-weight: 600;
  color: var(--text-muted);
}

.step-content {
  grid-column: 2;
  grid-row: 1;
}

.step-content h3 {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-m);
}

.step-note {
  font-size: var(--text-s);
  color: var(--text-secondary);
  margin-top: var(--space-2xs);
}

/* Protocol / principle badges */
.principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-m);
}

.principle-badge {
  padding: var(--space-m);
  background: var(--surface-card);
  border: var(--border-subtle);
  border-radius: var(--radius-m);
}

.principle-badge h4 {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-s);
}

.principle-badge p {
  margin: 0;
  font-size: var(--text-s);
  color: var(--text-secondary);
}

/* Safety note panel */
.safety-note {
  margin-top: var(--space-l);
  padding: var(--space-m);
  background: var(--surface-accent);
  border-radius: var(--radius-m);
  font-size: var(--text-s);
}

/* Featured resource */
.featured-spotlight {
  padding: var(--space-l);
  background: var(--surface-card);
  border: var(--border-strong);
  border-radius: var(--radius-l);
}

.featured-spotlight .eyebrow {
  margin-bottom: var(--space-2xs);
}

.featured-spotlight h2 {
  margin: 0 0 var(--space-s);
}

.featured-excerpt {
  color: var(--text-secondary);
  margin-bottom: var(--space-m);
}

.next-reads {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: var(--border-subtle);
  padding-top: var(--space-m);
}

.next-reads li {
  padding: var(--space-2xs) 0;
  border-bottom: var(--border-subtle);
}

.next-reads li:last-child {
  border-bottom: none;
}

.next-reads a {
  text-decoration: none;
}

.next-reads a:hover {
  text-decoration: underline;
}

/* Manual index category blocks */
.manual-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-l);
}

.manual-group {
  padding: var(--space-m);
  background: var(--surface-card);
  border: var(--border-subtle);
  border-radius: var(--radius-m);
}

.manual-group h3 {
  margin: 0 0 var(--space-s);
  font-size: var(--text-m);
}

.manual-group p {
  font-size: var(--text-s);
  color: var(--text-secondary);
  margin: 0 0 var(--space-s);
}

.manual-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.manual-links li {
  padding: var(--space-2xs) 0;
  border-bottom: var(--border-subtle);
}

.manual-links li:last-child {
  border-bottom: none;
}

.manual-links a {
  font-size: var(--text-s);
  text-decoration: none;
}

.manual-links a:hover {
  text-decoration: underline;
}

/* Archive rows */
.archive-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.archive-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-m);
  align-items: baseline;
  padding: var(--space-s) 0;
  border-bottom: var(--border-subtle);
}

.archive-row:last-child {
  border-bottom: none;
}

.archive-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-m);
}

.archive-row a {
  text-decoration: none;
}

.archive-row a:hover {
  text-decoration: underline;
}

/* About / content + aside */
.content-aside {
  display: grid;
  grid-template-columns: 1fr var(--w-inset);
  gap: var(--space-xl);
  align-items: start;
}

.content-main {
  min-width: 0;
}

.aside-panel {
  padding: var(--space-m);
  background: var(--surface-card);
  border: var(--border-subtle);
  border-radius: var(--radius-m);
}

.aside-panel h4 {
  margin: 0 0 var(--space-s);
  font-size: var(--text-s);
}

.aside-panel p,
.aside-panel ul {
  font-size: var(--text-s);
  margin: 0;
}

.aside-panel ul {
  padding-left: var(--space-m);
}

/* Contact CTA panel */
.cta-panel {
  padding: var(--space-xl);
  background: var(--surface-card);
  border: var(--border-strong);
  border-radius: var(--radius-l);
  text-align: left;
}

.cta-panel h2 {
  margin: 0 0 var(--space-s);
}

.cta-panel p {
  margin: 0 0 var(--space-m);
  color: var(--text-secondary);
}

/* Form inputs (contact stub) */
input, textarea {
  font-family: inherit;
  font-size: var(--text-base);
  padding: var(--space-xs);
  border: var(--border-subtle);
  border-radius: var(--radius-s);
  max-width: 100%;
}

input:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
}

/* Footer */
.site-footer {
  background: var(--surface-band);
  border-top: var(--border-subtle);
  padding-block: var(--space-l);
  margin-top: var(--space-3xl);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-m);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  font-size: var(--text-s);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   ARTICLE / POST TEMPLATE
   -------------------------------------------------------------------------- */
.article-utility {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-2xs) 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  font-size: var(--text-s);
  margin-bottom: var(--space-m);
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb span {
  color: var(--text-muted);
}

.article-header {
  margin-bottom: var(--space-xl);
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  font-size: var(--text-s);
  color: var(--text-muted);
  margin-top: var(--space-s);
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr var(--w-inset);
  gap: var(--space-xl);
  align-items: start;
}

.article-body {
  min-width: 0;
  max-width: 42rem;
}

.article-body h2 {
  margin-top: var(--space-2xl);
  padding-top: var(--space-m);
  border-top: var(--border-subtle);
}

.article-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-body h3 {
  margin-top: var(--space-xl);
}

.article-body ul,
.article-body ol {
  margin: 0 0 var(--space-m);
  padding-left: var(--space-l);
}

.article-body li {
  margin-bottom: var(--space-2xs);
}

.field-notes-panel {
  padding: var(--space-m);
  background: var(--surface-accent);
  border: var(--border-subtle);
  border-radius: var(--radius-m);
  position: sticky;
  top: var(--space-m);
}

.field-notes-panel h4 {
  margin: 0 0 var(--space-s);
  font-size: var(--text-s);
}

.field-notes-panel .toggle-btn {
  display: none;
}

.related-manuals {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: var(--border-subtle);
}

.related-manuals h3 {
  margin: 0 0 var(--space-m);
}

.related-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.related-group h4 {
  font-size: var(--text-s);
  margin: 0 0 var(--space-2xs);
  color: var(--text-muted);
}

.related-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-group li {
  padding: var(--space-2xs) 0;
}

.related-group a {
  text-decoration: none;
}

.related-group a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   UTILITIES
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   RESPONSIVE — 4 breakpoints, CL1/CL3/CL4
   -------------------------------------------------------------------------- */
@media (max-width: 64rem) {
  .manual-index {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}

@media (max-width: 48rem) {
  .hero-split {
    grid-template-columns: 1fr;
  }

  .hero-aside {
    order: -1;
  }

  .span-8,
  .span-4 {
    grid-column: 1 / -1;
  }

  .content-aside,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .aside-panel,
  .field-notes-panel {
    position: static;
  }

  .field-notes-panel .toggle-btn {
    display: inline-block;
    margin-bottom: var(--space-s);
  }

  .field-notes-panel.is-collapsed .panel-content {
    display: none;
  }

  .archive-row {
    grid-template-columns: 1fr;
    gap: var(--space-2xs);
  }

  .archive-meta {
    flex-wrap: wrap;
  }

  .principle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 36rem) {
  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .theme-chips {
    gap: var(--space-2xs);
  }

  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: var(--border-strong);
  padding: var(--space-xs);
  cursor: pointer;
  font-size: var(--text-m);
}

@media (max-width: 48rem) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
  }

  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
}
