/* ==========================================================================
   Graveyard Keeper 2 Planner — Shared Stylesheet (00B Visual Baseline)
   Tokens, typography, reading container, responsive layout, calculator UI.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Color Palette Tokens */
  --bg-base: #101418;
  --bg-surface: #171d24;
  --bg-surface-elevated: #1f2731;
  --bg-surface-hover: #26313d;
  --border-subtle: #283340;
  --border-strong: #3b4b5c;
  --border-accent: #536980;

  --text-main: #f5f1e8;
  --text-muted: #adb9c5;
  --text-dim: #798999;

  --accent-green: #9edc5c;
  --accent-green-hover: #b4ea7c;
  --accent-green-dim: rgba(158, 220, 92, 0.15);

  --accent-gold: #f4c264;
  --accent-gold-hover: #ffd68a;
  --accent-gold-dim: rgba(244, 194, 100, 0.15);

  --accent-blue: #6cb6f5;
  --accent-blue-dim: rgba(108, 182, 245, 0.15);

  --accent-red: #f87171;
  --accent-red-dim: rgba(248, 113, 113, 0.15);

  --focus-ring: #f4c264;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Measures & Spacing */
  --container-max: 76rem;
  --measure-normal: 68ch;
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Base Typography */
h1, h2, h3, h4 {
  color: var(--text-main);
  line-height: 1.25;
  margin-top: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.625rem;
}

p {
  margin: 0 0 1.25rem;
  max-width: var(--measure-normal);
  color: var(--text-muted);
  line-height: 1.7;
}

p strong, li strong {
  color: var(--text-main);
}

a {
  color: var(--accent-green);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-green-hover);
}

/* External Link Marker (00B 4B.1 compliant) */
.external-link {
  color: var(--accent-green);
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
}

.external-link::after {
  content: "↗";
  font-size: 0.85em;
  font-weight: 700;
  opacity: 0.85;
}

.citation-ref {
  font-size: 0.8em;
  vertical-align: super;
  text-decoration: none;
  font-weight: 700;
  color: var(--accent-gold);
  padding: 0 0.15em;
}

.citation-ref:hover {
  text-decoration: underline;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 0.75rem;
}

/* Layout Containers */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 20, 24, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.25rem;
}

.nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.125rem;
  font-weight: 750;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-links a:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.main-content {
  flex: 1;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Hero Section */
.hero-section {
  padding: 2rem 0 3rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1rem;
  }
}

.hero-text {
  max-width: 42rem;
}

.hero-actions {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-green);
  color: #0c1209;
}

.btn-primary:hover {
  background: var(--accent-green-hover);
  color: #0c1209;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-accent);
  color: var(--text-main);
}

.status-callout {
  margin-top: 1.5rem;
  padding: 0.875rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border-left: 4px solid var(--accent-gold);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  font-size: 0.875rem;
}

.status-callout p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.status-callout strong {
  color: var(--accent-gold);
}

/* Media Figures */
figure {
  margin: 0 0 1.5rem;
}

.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.media-card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  line-height: 1.5;
}

figcaption strong {
  color: var(--text-muted);
}

/* Section Components */
.content-section {
  margin-bottom: 4rem;
}

.section-intro {
  margin-bottom: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 840px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title h3 {
  margin: 0;
  font-size: 1.15rem;
}

/* Badge System */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  line-height: 1;
}

.badge-green {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(158, 220, 92, 0.3);
}

.badge-gold {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border: 1px solid rgba(244, 194, 100, 0.3);
}

.badge-blue {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  border: 1px solid rgba(108, 182, 245, 0.3);
}

.badge-red {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

/* Calculator UI */
.calculator-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.calc-group {
  margin-bottom: 1.25rem;
}

.calc-group label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.925rem;
  color: var(--text-main);
}

.calc-group .item-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 400;
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calc-input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.15s ease;
}

.calc-input:focus {
  border-color: var(--accent-gold);
  outline: none;
}

.calc-btn-step {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
}

.calc-btn-step:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-accent);
}

.calc-results-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.score-display {
  text-align: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.score-number {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  color: var(--accent-green);
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
}

.calc-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.calc-stat-row:last-child {
  border-bottom: none;
}

.calc-advice {
  margin-top: 1.25rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Diagnostics / Blocker List */
.diagnostic-tree {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.diagnostic-item {
  position: relative;
  padding: 1rem 1.25rem 1rem 3rem;
  margin-bottom: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.diagnostic-step {
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagnostic-item h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.diagnostic-item p {
  margin: 0;
  font-size: 0.875rem;
}

/* Citation / Sources Section (4B.1 compliant) */
.sources-section {
  padding: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 3rem;
}

.sources-list {
  padding-left: 1.5rem;
  margin: 1rem 0 0;
}

.sources-list li {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.back-to-ref {
  text-decoration: none;
  font-size: 0.8em;
  margin-left: 0.4rem;
  color: var(--accent-gold);
}

/* Compact Shared Footer (00B compliant) */
.site-footer {
  background: var(--bg-base);
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 1.25rem 3rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.footer-container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.25rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--accent-green);
  text-decoration: underline;
}

.footer-disclaimer {
  max-width: var(--container-max);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

/* Reusable article shell for NOW queue pages; scoped so the homepage layout is unchanged. */
.article-page .main-content {
  padding-top: 2.5rem;
}

.breadcrumbs {
  max-width: var(--measure-normal);
  margin: 0 auto 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.breadcrumbs a {
  color: var(--accent-green);
}

.article-header,
.article-body {
  max-width: var(--measure-normal);
  margin-left: auto;
  margin-right: auto;
}

.article-header {
  margin-bottom: 2rem;
}

.article-header h1 {
  margin-bottom: 1rem;
}

.article-lede {
  font-size: 1.12rem;
  color: var(--text-muted);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 1rem;
}

.article-body > * + * {
  margin-top: 1.25rem;
}

.article-body h2 {
  margin-top: 2.75rem;
}

.article-body h3 {
  margin-top: 2rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35rem;
}

.article-body li + li {
  margin-top: 0.55rem;
}

.article-body figure {
  margin: 1.75rem 0;
}

.article-body figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.article-body figcaption {
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.55;
}

.article-callout {
  padding: 1rem 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius-md);
}

.article-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.article-table-wrap table {
  min-width: 38rem;
}

.article-form {
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.article-form label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  font-weight: 650;
}

.article-form input,
.article-form select,
.article-form button {
  min-height: 2.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-main);
  font: inherit;
}

.article-form input,
.article-form select {
  width: 100%;
}

.article-form button {
  background: var(--accent-green);
  color: #101418;
  font-weight: 750;
  cursor: pointer;
}

.article-form button:hover {
  filter: brightness(1.08);
}

.article-form output {
  display: block;
  margin-top: 0.9rem;
  color: var(--text-main);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(158, 220, 92, 0.12);
  color: var(--accent-green);
  font-size: 0.78rem;
  font-weight: 750;
}

.status-chip.is-limited {
  background: rgba(244, 194, 100, 0.12);
  color: var(--accent-gold);
}

.trust-page .article-body {
  min-height: 18rem;
}

@media (max-width: 640px) {
  .article-page .main-content {
    padding-top: 1.5rem;
  }

  .article-table-wrap table {
    min-width: 32rem;
  }
}
