/* ═══════════════════════════════════════════════════
   PHANTOM ZENITH ORIGIN — BASE STYLES
   assets/css/base.css
   ─────────────────────────────────────────────────
   Depends on: tokens.css (must be linked before this)

   Covers:
     - Box-sizing reset
     - Scroll behavior
     - Custom scrollbar (webkit + Firefox fallback)
     - Body: font, background, overflow
     - body::before  — scanline overlay
     - body::after   — cyan grid background
     - .page         — centered layout wrapper
     - .page-header, .page-eyebrow, .page-title, .page-subtitle
       (shared sub-page header pattern used by operations & field-reference)
     - .construction-banner / .banner-tag / .banner-text
     - .section-header / .section-title / .section-line
       (used on home page and potentially elsewhere)
     - .site-footer / footer  (both class name variants used across pages)
     - @keyframes fadeUp, @keyframes pulse
   ═══════════════════════════════════════════════════ */

/* ─── RESET ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

/* ─── CUSTOM SCROLLBAR ─── */
/* Webkit browsers (Chrome, Edge, Safari) */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar               { width: 6px; background: var(--bg-deep); }
  ::-webkit-scrollbar-track         { background: var(--bg-deep); }
  ::-webkit-scrollbar-track-piece   { background: var(--bg-deep); }
  ::-webkit-scrollbar-button        { display: none; height: 0; width: 0; }
  ::-webkit-scrollbar-corner        { background: var(--bg-deep); }
  ::-webkit-scrollbar-thumb         { background: var(--cyan-dim); border-radius: 999px; }
  ::-webkit-scrollbar-thumb:hover   { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
}

/* Firefox fallback */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent; }
}

/* ─── BODY ─── */
body {
  font-family: var(--body);
  background: var(--bg-deep);
  color: var(--text-hi);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCANLINE OVERLAY ─── */
/* Fixed pseudo-element that lays a subtle horizontal scanline pattern over
   the entire viewport. z-index 999 keeps it above page content but below
   any modal-level UI you might add later. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 999;
}

/* ─── GRID BACKGROUND ─── */
/* A very faint cyan grid lines the entire background. z-index 0 keeps it
   behind all content (.page uses z-index: 1). */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ─── LAYOUT WRAPPER ─── */
/* Sits at z-index 1 so it renders above the grid background. */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── SHARED PAGE HEADER (operations, field-reference) ─── */
.page-header {
  padding: 48px 0 32px;
}

.page-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.page-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-hi) 0%, var(--cyan) 60%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-mid);
  font-weight: 300;
  line-height: 1.6;
}

/* ─── CONSTRUCTION BANNER ─── */
/* The orange WIP warning strip shared across all pages. */
.construction-banner {
  background: linear-gradient(90deg, var(--bg-panel), var(--bg-surface), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* Some pages use margin-bottom: 40px on the banner — override locally if needed. */

.banner-tag {
  background: rgba(253, 186, 116, 0.12);
  color: var(--orange);
  border: 1px solid rgba(253, 186, 116, 0.3);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.banner-text            { color: var(--text-mid); line-height: 1.5; }
.banner-text strong     { color: var(--text-hi); }

/* ─── SECTION HEADER (home page pattern) ─── */
/* A flex row: label on the left, a fading line extending to the right. */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ─── FOOTER ─── */
/* Both class-name variants (.site-footer used by operations/field-reference,
   plain footer element used on index) are styled identically. */
footer,
.site-footer {
  border-top: 1px solid var(--border-dim);
  padding-top: 24px;
  margin-top: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-lo);
}

.footer-sig { color: var(--cyan-dim); }

/* ─── ERROR BOUNDARY FALLBACK ─── */
.error-boundary {
  max-width: 600px;
  margin: 80px auto;
  padding: 48px 36px 40px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(61, 13, 13, 0.5) 0%, rgba(15, 25, 35, 0.9) 60%);
  text-align: center;
}

.error-boundary-icon {
  font-size: 2.4rem;
  color: var(--red-dim);
  filter: drop-shadow(0 0 12px rgba(248, 113, 113, 0.5));
  margin-bottom: 16px;
}

.error-boundary-code {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-dim);
  margin-bottom: 10px;
}

.error-boundary-title {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--red-dim);
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.4);
  margin-bottom: 14px;
}

.error-boundary-body {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.7;
  max-width: 440px;
  margin: 0 auto 28px;
}

.error-boundary-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 6px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.error-boundary-retry:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.2);
  color: #fff;
}

/* ─── SHARED KEYFRAMES ─── */

/* Used by page-level entrance animations. */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Used by the topbar status dot. Defined here so topbar.css can reference it
   without redefining it. If both files are loaded the browser de-dupes. */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
