/* ==========================================================================
   Curiosity OS — Base (Newsprint)
   Reset, root rendering, and base element styling.
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  background-color: var(--bg);
  background-image: var(--bg-tint);
  background-repeat: repeat;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.65;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

/* Headlines: high-contrast serif display, tight and heavy. */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--ink);
}

h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); font-weight: 700; }

p,
li,
blockquote,
figcaption,
dd {
  text-wrap: pretty;
}

a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 2px;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

/* Newspaper photography: grayscale by default, a vintage warm on hover. */
img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--ink);
  filter: grayscale(100%) contrast(1.05);
  transition: filter var(--dur) var(--ease);
}
img:hover {
  filter: grayscale(45%) sepia(20%);
}

strong { font-weight: 700; }

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

ul,
ol {
  padding-left: 1.25em;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

summary {
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

/* Crisp newspaper scrollbars.
   WebKit/Blink (Chrome, Safari, Edge): a persistent, layout-occupying bar via
   ::-webkit-scrollbar. We must NOT set the standard `scrollbar-width` here — once
   that is present, Chromium switches to the thin overlay scrollbar (0 width,
   auto-hiding on macOS) and ignores ::-webkit-scrollbar entirely. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
  border-left: 1px solid var(--line);
}
::-webkit-scrollbar-thumb {
  background: var(--ink);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
::-webkit-scrollbar-corner {
  background: var(--bg);
}
/* Firefox has no ::-webkit-scrollbar — give it the standard properties only. */
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--ink) var(--bg);
  }
}

/* Dynamic numbers never cause layout shift (skill). */
.num {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: fixed;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  transform: translateY(-150%);
  transition: transform var(--dur-fast) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Honour the user's wish for stillness. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

