/* ==========================================================================
   Bleeding Pages Design System — Core Tokens
   Reference: University Press Journal & Literature Publishing House
   Implementing Section 5 of docs/BRIEF.md
   ========================================================================== */

:root {
  /* --- PALETTE: Warm Off-White Paper, Near-Black Ink, ONE Oxblood Accent --- */
  --bp-bg-paper: #FBF9F5;              /* Warm off-white unbleached book paper */
  --bp-bg-surface: #FFFFFF;            /* Pure parchment white */
  --bp-bg-subtle: #F4EFEB;             /* Subtle warm tint for callouts & tables */
  --bp-bg-hover: #ECE6E0;              /* Restrained neutral hover */

  --bp-text-primary: #1A1716;          /* Near-black ink, high legibility */
  --bp-text-secondary: #474340;        /* Deep graphite charcoal */
  --bp-text-muted: #6E6864;            /* Academic slate for secondary notes */
  --bp-text-subtle: #8C847E;           /* Small-caps and date stamps */

  /* The Single Accent: Deep Oxblood (Used sparingly for links, rules, issue numerals) */
  --bp-color-oxblood: #701020;         /* Deep academic oxblood / dried blood */
  --bp-color-oxblood-hover: #4D0914;   /* Darkened oxblood on hover */
  --bp-color-oxblood-subtle: #F7EBEF;  /* Very soft oxblood wash for active track indicators */
  --bp-color-oxblood-border: #9E2B3E;  /* Focused oxblood borders */

  /* Hairline Rules (No shadows, borders instead of elevation) */
  --bp-border-hairline: #D9D2C9;       /* 1px light bookbinder rule */
  --bp-border-medium: #474340;         /* 1px deep rule for masthead dividers */
  --bp-border-strong: #1A1716;         /* 2px bold academic running head rule */
  --bp-border-oxblood: #701020;        /* Hairline oxblood accent rule */

  /* --- TYPOGRAPHY SCALE --- */
  --bp-font-serif: 'Source Serif 4', Georgia, 'Noto Serif Devanagari', 'Noto Serif Bengali', 'Noto Serif Tamil', serif;
  --bp-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bp-font-mono: 'Consolas', 'Courier New', monospace;

  /* Font Sizes based on classical typographic scale (1.25 major third) */
  --bp-text-xs: 0.75rem;    /* 12px: Small metadata, tiny running headers */
  --bp-text-sm: 0.84375rem; /* 13.5px: Footnotes, sidenotes, table figures */
  --bp-text-base: 1.0625rem;/* 17px: Reading body text (comfortable reading measure) */
  --bp-text-md: 1.25rem;    /* 20px: Subheadings, section titles */
  --bp-text-lg: 1.5625rem;  /* 25px: Article titles on archive rows */
  --bp-text-xl: 1.953rem;   /* 31.25px: Page level titles */
  --bp-text-2xl: 2.441rem;  /* 39px: Primary masthead titles */

  /* Line Heights */
  --bp-leading-tight: 1.25;
  --bp-leading-normal: 1.45;
  --bp-leading-reading: 1.7; /* Generous breathing measure for body text */

  /* Reading Measure (Strictly 60–75 characters per line for endurance) */
  --bp-measure-narrow: 55ch;
  --bp-measure-reading: 68ch;
  --bp-measure-wide: 80ch;
  --bp-container-max: 1180px;

  /* --- SPACING GRID (4px baseline) --- */
  --bp-space-1: 4px;
  --bp-space-2: 8px;
  --bp-space-3: 12px;
  --bp-space-4: 16px;
  --bp-space-5: 20px;
  --bp-space-6: 24px;
  --bp-space-8: 32px;
  --bp-space-10: 40px;
  --bp-space-12: 48px;
  --bp-space-16: 64px;
  --bp-space-20: 80px;

  /* --- ACADEMIC RESTRAINT TOKENS --- */
  --bp-radius: 0px;                     /* Square crisp corners (academic feel) */
  --bp-radius-sm: 2px;                  /* Minimal form input radius */
  --bp-shadow: none;                    /* BANNED: zero drop shadows */
  --bp-transition: 120ms ease-out;      /* Under 150ms ease-out on state changes */
}

/* Base Document Reset & Legibility */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: var(--bp-bg-paper);
  color: var(--bp-text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--bp-font-serif);
  font-size: var(--bp-text-base);
  line-height: var(--bp-leading-reading);
  color: var(--bp-text-primary);
  background-color: var(--bp-bg-paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Headings Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--bp-font-serif);
  color: var(--bp-text-primary);
  font-weight: 600;
  line-height: var(--bp-leading-tight);
  text-wrap: balance;
}

h1 { font-size: var(--bp-text-2xl); margin-bottom: var(--bp-space-4); }
h2 { font-size: var(--bp-text-xl); margin-top: var(--bp-space-8); margin-bottom: var(--bp-space-3); }
h3 { font-size: var(--bp-text-lg); margin-top: var(--bp-space-6); margin-bottom: var(--bp-space-2); }
h4 { font-size: var(--bp-text-md); margin-top: var(--bp-space-4); margin-bottom: var(--bp-space-2); }

p {
  margin-bottom: var(--bp-space-4);
  max-width: var(--bp-measure-reading);
}

/* Links in Deep Oxblood */
a {
  color: var(--bp-color-oxblood);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--bp-transition), text-decoration-color var(--bp-transition);
}

a:hover {
  color: var(--bp-color-oxblood-hover);
  text-decoration-thickness: 1.5px;
}

/* Focus state with visible academic outline */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--bp-color-oxblood);
  outline-offset: 2px;
}

/* Small Caps & Tabular Figures Utility */
.small-caps {
  font-family: var(--bp-font-sans);
  font-size: var(--bp-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--bp-text-muted);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Hairline horizontal separator */
hr.hairline {
  border: none;
  border-top: 1px solid var(--bp-border-hairline);
  margin: var(--bp-space-8) 0;
}

hr.hairline-oxblood {
  border: none;
  border-top: 1px solid var(--bp-color-oxblood);
  margin: var(--bp-space-6) 0;
}
