:root{
  --bg:#0b0d0f;
  --panel:#0f1316;
  --muted:#9aa3a8;
  --text:#e6eef2;
  --accent:#5fb06a; /* restrained/neutral green */
  --accent-bg:rgba(95,176,106,0.12);
  --accent-bg-hover:rgba(95,176,106,0.2);
  --max-width:880px;
  --radius:10px;
  --gap:18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

*{ box-sizing:border-box }

html,body{
  height:100%;
  margin:0;
  background:linear-gradient(180deg,var(--bg) 0%, #070809 100%);
  color:var(--text);
  font-size:16px;
  line-height:1.45;
}

.page{
  min-height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:32px 20px;
}

.site-header{
  width:100%;
  max-width:var(--max-width);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:var(--gap);
  padding:20px 24px;
  background:rgba(255,255,255,0.02);
  border-radius:var(--radius);
}

.brand h1{
  margin:0;
  font-size:1.35rem;
  font-weight:600;
}

.subtitle{
  margin:4px 0 0;
  color:var(--muted);
}

.status{
  padding:8px 12px;
  background:rgba(95,176,106,0.12);
  color:var(--accent);
  border-radius:8px;
  font-weight:600;
  font-size:0.9rem;
}

.content{
  width:100%;
  max-width:var(--max-width);
  padding:28px;
  background:var(--panel);
  border-radius:var(--radius);
  margin-top:20px;
}

.explicit{
  font-weight:600;
  padding:10px;
  border-left:4px solid rgba(95,176,106,0.3);
}

.site-footer{
  margin-top:20px;
  color:var(--muted);
  font-size:0.85rem;
}

/* ========================================
   Accessibility Baseline (WCAG 2.2 AA)
   Digital Quality Pack v1
   ======================================== */

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to main content link */
.skip-link,
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent, #5fb06a);
  color: #000;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 100;
  border-radius: 0 0 4px 0;
}

.skip-link:focus,
.skip-to-content:focus {
  top: 0;
}

/* Focus visible styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent, #5fb06a);
  outline-offset: 2px;
}

/* Remove outline for mouse users (preserve for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent, #5fb06a);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Minimum touch target size (24x24px, WCAG 2.2 AA) */
a,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  min-height: 24px;
  min-width: 24px;
}

/* Ensure link targets have adequate padding for touch */
nav a,
.site-nav a,
.footer-nav a,
.site-footer__link {
  padding: 8px 12px;
  display: inline-block;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :focus-visible {
    outline-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   Icon System (Local SVG)
   Digital Quality Pack v1
   ======================================== */

/* Icon wrapper for inline SVG icons */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
  stroke: currentColor;
}

/* Icon spacing when used with text */
.icon + span,
a .icon {
  margin-right: 0.375em;
}

/* RTL support for icons */
[dir="rtl"] .icon + span,
[dir="rtl"] a .icon {
  margin-right: 0;
  margin-left: 0.375em;
}

/* Navigation icons */
.site-nav .icon,
.footer-nav .icon {
  width: 1.125em;
  height: 1.125em;
  vertical-align: -0.2em;
}

/* Ensure decorative icons are hidden from screen readers */
.icon[aria-hidden="true"] {
  pointer-events: none;
}

/* ========================================
   Daily Indicator (Gate 2I)
   Minimal badge styling for status display
   ======================================== */

.daily-indicator {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  border: 1px solid rgba(255,255,255,0.05);
}

.daily-indicator-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.indicator-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.indicator-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.indicator-status {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.indicator-details p {
  margin: 8px 0;
}

.indicator-designation {
  font-size: 1.05rem;
}

.indicator-summary {
  color: var(--muted);
  font-size: 0.95rem;
}

.indicator-timestamp {
  color: var(--muted);
  font-size: 0.85rem;
}

.indicator-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.meta-tag {
  background: rgba(255,255,255,0.05);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.indicator-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.indicator-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  background: var(--accent-bg);
  border-radius: 6px;
  transition: background 0.2s;
}

.indicator-link:hover {
  background: var(--accent-bg-hover);
}

.indicator-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========================================
   Mobile Readability Patch
   Institutional, Multilingual, Static-only
   ======================================== */
@media (max-width: 768px) {
  body {
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
  }

  p, li, dd {
    line-height: 1.7;
    font-weight: 500;
  }
}

/* ==========================================================================
   Contrast fix — scoped variable overrides for muted text on dark sections
   WCAG AA aware (≥4.5:1 target), governance-safe, mobile-reinforced
   Only affects .site-footer, .daily-indicator, and mobile .content
   No global/root changes — brand palette preserved
   ========================================================================== */

/* Footer: strongest offender (uses var(--muted) heavily) */
.site-footer {
  --muted: #c0d4e8;     /* lighter cool blue-gray for better contrast on dark */
}

/* Daily indicator: lift timestamps/meta/secondary text */
.daily-indicator {
  --muted: #c0d4e8;
}

/* Mobile-only: small screens need higher contrast for muted text within content */
@media (max-width: 768px) {
  .content {
    --muted: #d0e0f5;   /* higher lightness for mobile readability */
  }
}

/* Safety net: headings/titles must never look "muted" in these dark blocks */
.site-footer :is(h1, h2, h3, h4, h5, h6),
.daily-indicator :is(h1, h2, h3, h4, h5, h6) {
  color: var(--text) !important;
}

/* ==========================================================================
   Mobile contrast fix — blue titles & DOI links inside dark content
   Scoped, mobile-only, governance-safe
   ========================================================================== */

@media (max-width: 768px) {
  /* Section titles inside content must never be dark-blue on dark bg */
  .content h2,
  .content h3,
  .content .section-title,
  .content .governance-title {
    color: var(--text) !important; /* high-contrast light text */
  }

  /* DOI and governance links inside dark content */
  .content a[href*="zenodo"],
  .content a[href^="https://doi.org"],
  .content .doi,
  .content .governance-link {
    color: #a3c9ff !important; /* light blue, WCAG-safe on dark */
  }
}

/* ==========================================================================
   Dark-container text token override (final contrast fix)
   Fixes: dark titles (.section__title / h2) rendered with light-theme tokens on dark backgrounds
   Scope: only inside existing dark containers: .content, .daily-indicator, .site-footer
   No HTML changes. No :root changes. Append-only. Governance-safe.
   ========================================================================== */

/* 1) Establish dark-container tokens locally (do NOT touch :root) */
.content,
.daily-indicator,
.site-footer {
  --color-text: var(--text);
  --color-text-medium: var(--muted);
  --color-text-muted: var(--muted);
}

/* 2) Force section headings/descriptions to use corrected tokens inside dark containers */
.content .section__title,
.content h1, .content h2, .content h3,
.daily-indicator .section__title,
.daily-indicator h1, .daily-indicator h2, .daily-indicator h3,
.site-footer .section__title,
.site-footer h1, .site-footer h2, .site-footer h3 {
  color: var(--color-text) !important;
}

.content .section__description,
.daily-indicator .section__description,
.site-footer .section__description {
  color: var(--color-text-medium) !important;
}

/* 3) Mobile reinforcement (small screens + glare) */
@media (max-width: 768px) {
  .content .section__title,
  .content h1, .content h2, .content h3 {
    color: var(--text) !important;
  }
  .content .section__description {
    color: var(--muted) !important;
  }
}
