/* ============================================================================
   ComicsPRO — BASE ELEMENT DEFAULTS
   Source: design system tokens/base.css. The upper section is that file's
   source text with two additions inline ([hidden], scroll behaviour and
   scroll-margin); the lower section is mockup-only (media defaults, measure,
   skip link, screen-reader utility, reduced motion).
   ============================================================================ */

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

/* [hidden] must beat any display rule a component sets. Without this, a
   `display:flex` component ignores the attribute entirely. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

/* Anchor targets clear the whole sticky header, not just the masthead. */
:target, [id] { scroll-margin-top: calc(var(--header-h) + var(--utility-h) + var(--space-4)); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-body);
  background-color: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display headings — Oswald, all-caps (Style Guide) */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  color: var(--text-heading);
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); font-weight: 500; }
h3 { font-size: var(--fs-h3); font-weight: 500; }

/* Sub-heads use the body face bold (readable, not condensed) */
h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--text-heading);
  margin: 0 0 var(--space-3);
}
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 var(--space-4); text-wrap: pretty; }

a {
  color: var(--text-link);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: color var(--dur) var(--ease-out);
}
a:hover { color: var(--text-link-hover); }

strong, b { font-weight: var(--fw-bold); }

small { font-size: var(--fs-caption); }

/* Titling accent utility (Oswald caps) */
.cp-pop {
  font-family: var(--font-pop);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

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


/* ==== Mockup-only base ==================================================== */

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

ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; }
li { margin-bottom: var(--space-2); }

button { font: inherit; color: inherit; }

hr {
  border: 0;
  border-top: var(--stroke) solid var(--border-ink);
  margin: var(--space-7) 0;
}

/* Body copy holds a readable measure wherever it runs long. */
.cp-measure { max-width: 68ch; }

/* Skip link — visible only on keyboard focus. */
.cp-skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 200;
  background: var(--cp-cyan);
  color: var(--cp-ink);
  font-weight: var(--fw-bold);
  padding: var(--space-3) var(--space-5);
  border: var(--stroke) solid var(--border-ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pop-sm);
  text-decoration: none;
  transition: top var(--dur) var(--ease-out);
}
.cp-skip:focus { top: var(--space-4); color: var(--cp-ink); }

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

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