/* =============================================================================
   INSIGHT EDITORIAL DARK — Base Styles & Typography
   Ohio School Insight
   =============================================================================
   Global resets, font loading, root typography, scrollbar theming, and
   foundational element styling. Import after tokens.css.
   ============================================================================= */


/* -----------------------------------------------------------------------------
   @font-face — Self-hosted fallback hints
   Google Fonts handles actual loading via <link> in HTML. These declarations
   provide display:swap behavior guidance and system fallback chains.
   ----------------------------------------------------------------------------- */

/* Public Sans — UI & data typography */
/* Load via: https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap */

/* Newsreader — Editorial serif for district names, pull quotes */
/* Load via: https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,500;1,400;1,500;1,600&display=swap */


/* -----------------------------------------------------------------------------
   Universal Box-Sizing Reset
   ----------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  /* Prevent iOS tap highlight bleeding onto custom interactive elements */
  -webkit-tap-highlight-color: transparent;
}


/* -----------------------------------------------------------------------------
   Document Root
   ----------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  /* Prevent layout shift from scrollbar appearing/disappearing */
  overflow-y: scroll;
  /* Base font size — 1rem = 16px */
  font-size: 16px;
  /* Prevent text inflation on mobile */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}


/* -----------------------------------------------------------------------------
   Body — Foundation
   ----------------------------------------------------------------------------- */

body,
html {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--background);
  color: var(--on-surface);

  /* UI font stack with full fallback chain */
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);

  /* Crisp rendering for dark backgrounds */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smoothing: antialiased;  /* future-proofing */

  /* Prevent content flash before fonts load — dark bg is already correct color */
  min-height: 100vh;
  min-height: 100dvh;

  /* Prevent horizontal overflow from animation artifacts */
  overflow-x: hidden;
}


/* -----------------------------------------------------------------------------
   Custom Scrollbar — Webkit
   Thin, dark-themed scrollbar consistent with the surface hierarchy.
   ----------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface-container-highest);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
  /* Subtle transparency so track shows through at edges */
  opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-fixed);
}

::-webkit-scrollbar-corner {
  background: var(--surface-container-highest);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--surface-container-highest);
}


/* -----------------------------------------------------------------------------
   Selection
   ----------------------------------------------------------------------------- */

::selection {
  background: var(--primary);
  color: var(--on-primary);
  /* Prevent text-shadow from interfering with selection clarity */
  text-shadow: none;
}

::-moz-selection {
  background: var(--primary);
  color: var(--on-primary);
  text-shadow: none;
}


/* -----------------------------------------------------------------------------
   Typography — Headings
   ----------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--on-surface);
  /* Prevent long words from breaking layout */
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-3xl);
  letter-spacing: -0.015em;
}

h3 {
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--text-xl);
  letter-spacing: -0.005em;
}

h5 {
  font-size: var(--text-lg);
  letter-spacing: 0;
}

h6 {
  font-size: var(--text-md);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--on-surface-variant);
}


/* -----------------------------------------------------------------------------
   Typography — Body
   ----------------------------------------------------------------------------- */

p {
  margin: 0;
  line-height: var(--leading-relaxed);
  color: var(--on-surface);
}

/* Vertical rhythm when paragraphs follow other text elements */
p + p {
  margin-top: var(--space-4);
}

/* Lead paragraph — used for article intros and section summaries */
.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--on-surface-variant);
  font-weight: 400;
}

/* Caption / helper text */
.caption,
figcaption {
  font-size: var(--text-xs);
  color: var(--on-surface-variant);
  letter-spacing: var(--tracking-wide);
  line-height: var(--leading-normal);
}

/* Overline — label above a heading */
.overline {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--primary);
  display: block;
  margin-bottom: var(--space-2);
}

/* Editorial serif — pull quotes, district names, article excerpts */
.serif {
  font-family: var(--font-editorial);
  font-style: italic;
}


/* -----------------------------------------------------------------------------
   Typography — Lists
   ----------------------------------------------------------------------------- */

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Restore list styling when semantic context requires it */
.prose ul {
  list-style: disc;
  padding-left: var(--space-6);
}

.prose ol {
  list-style: decimal;
  padding-left: var(--space-6);
}

.prose li {
  margin-bottom: var(--space-2);
  color: var(--on-surface);
  line-height: var(--leading-relaxed);
}


/* -----------------------------------------------------------------------------
   Links
   ----------------------------------------------------------------------------- */

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-editorial),
              opacity var(--duration-fast) var(--ease-editorial);
}

a:hover {
  color: var(--primary-fixed);
}

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Visited state — slightly dimmed, still in brand palette */
a:visited {
  color: var(--on-primary-container);
}

/* Inline prose links get an underline */
.prose a {
  text-decoration: underline;
  text-decoration-color: rgba(60, 221, 199, 0.4);
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-color: var(--primary);
}


/* -----------------------------------------------------------------------------
   Images & Media
   ----------------------------------------------------------------------------- */

img,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  /* Prevent layout shift while images load */
  object-fit: cover;
}

figure {
  margin: 0;
}


/* -----------------------------------------------------------------------------
   Forms — Base
   (Component-level form styling in components.css; this is just the reset)
   ----------------------------------------------------------------------------- */

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
  line-height: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--on-surface-variant);
  margin-bottom: var(--space-2);
}

textarea {
  resize: vertical;
}


/* -----------------------------------------------------------------------------
   Tables — Base
   (Data table component styles in components.css)
   ----------------------------------------------------------------------------- */

table {
  border-collapse: collapse;
  border-spacing: 0;
}


/* -----------------------------------------------------------------------------
   Code & Pre
   ----------------------------------------------------------------------------- */

code,
kbd,
samp,
pre {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.875em;
}

code {
  background: var(--surface-container-high);
  color: var(--primary);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--surface-container-low);
  color: var(--on-surface);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
}


/* -----------------------------------------------------------------------------
   Horizontal Rule
   ----------------------------------------------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--outline-variant);
  margin: var(--space-8) 0;
  opacity: 0.4;
}


/* -----------------------------------------------------------------------------
   Blockquote
   ----------------------------------------------------------------------------- */

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 3px solid var(--primary);
  background: var(--surface-container-low);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote p {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--on-surface);
  line-height: var(--leading-relaxed);
}

blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--on-surface-variant);
}


/* -----------------------------------------------------------------------------
   Focus Visible — Global
   Accessible focus ring that doesn't conflict with mouse interaction.
   ----------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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


/* -----------------------------------------------------------------------------
   Utility — Screen reader only
   ----------------------------------------------------------------------------- */

.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;
}

/* Reveal to screen readers on focus (for skip links) */
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}


/* -----------------------------------------------------------------------------
   Utility — Truncation
   ----------------------------------------------------------------------------- */

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* Print styles have been moved to css/print.css — see that file. */
