/* Punk Rock AI — design tokens, typography, texture
   Reusable across every page and widget. No widget-specific layout here.
   --------------------------------------------------------------------- */

:root {
  /* palette */
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --fg: #f2f2f2;
  --fg-soft: #cfcfcf;
  --muted: #9a9a9a;
  --accent: #e11d2e;
  --accent-ink: #ffffff;
  --paper: #f4ede0;
  --paper-ink: #111111;
  --border: #2a2a2a;
  --border-strong: #3f3f3f;
  --rule: #5a0a13;

  /* type — JetBrains Mono + Newsreader (brutalist serif). Self-hosted
     woff2 files live in site/public/fonts/; system stack is the fallback
     so the site still renders if the woff2s 404. */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "SFMono-Regular",
    Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-display: "Newsreader", "Times New Roman", "Hoefler Text", Georgia,
    ui-serif, serif;
  --font-body: var(--font-mono);

  /* type scale */
  --fs-xs: 0.78rem;
  --fs-sm: 0.88rem;
  --fs-md: 1rem;
  --fs-lg: 1.18rem;
  --fs-xl: clamp(1.4rem, 2.8vw, 1.85rem);
  --fs-2xl: clamp(2rem, 5.5vw, 3.25rem);
  --fs-3xl: clamp(3rem, 9vw, 6rem);

  /* spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6rem;

  /* layout */
  --max-w: 72rem;
  --max-w-narrow: 42rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* motion */
  --ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Self-hosted faces. System stack in --font-mono / --font-display is the
   fallback if any woff2 fails to load. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/public/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/public/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/public/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/public/fonts/Newsreader-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/public/fonts/Newsreader-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* type primitives */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0 0 var(--space-3);
}

h1 {
  font-size: var(--fs-3xl);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

h2 {
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--fs-xl);
}

p {
  margin: 0 0 var(--space-3);
  max-width: 60ch;
}

a {
  color: var(--fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 120ms var(--ease-snap);
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

strong {
  color: var(--fg);
}

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

/* ------------------------------------------------------------------
   PRIMITIVES — reusable across widgets
   ------------------------------------------------------------------ */

.kicker {
  display: inline-block;
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 var(--space-2);
}

.kicker--accent {
  color: var(--accent);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.pull {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.15;
  border-left: 3px solid var(--accent);
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  margin: var(--space-4) 0;
  max-width: 50ch;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
}

.panel--paper {
  background: var(--paper);
  color: var(--paper-ink);
  border-color: var(--paper-ink);
}

.btn {
  font: inherit;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: var(--fs-sm);
  padding: 0.6rem 1rem;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: background 120ms var(--ease-snap),
    color 120ms var(--ease-snap), border-color 120ms var(--ease-snap),
    transform 120ms var(--ease-snap);
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--fg);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.tag {
  display: inline-block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid var(--border-strong);
  padding: 0.15rem 0.5rem;
  color: var(--muted);
}

.tag--accent {
  border-color: var(--accent);
  color: var(--accent);
}

textarea,
input[type="text"],
input[type="email"] {
  width: 100%;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  padding: var(--space-2) var(--space-3);
  background: #0d0d0d;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 0;
}

textarea:focus,
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.5;
}

hr.rule {
  border: 0;
  height: 3px;
  background: var(--accent);
  margin: var(--space-5) 0;
}

/* ------------------------------------------------------------------
   TEXTURE — xerox grain + halftone overlays. Apply via class or
   ::before/::after on a positioned parent. Both are pure CSS so they
   ship at zero byte cost and render offline.
   ------------------------------------------------------------------ */

.grain {
  position: relative;
  isolation: isolate;
}

.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.grain--strong::after {
  opacity: 0.32;
}

.halftone {
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.08) 1px,
    transparent 1.5px
  );
  background-size: 6px 6px;
}

.halftone--paper {
  background-color: var(--paper);
  background-image: radial-gradient(
    circle,
    rgba(17, 17, 17, 0.22) 1px,
    transparent 1.5px
  );
  background-size: 7px 7px;
  color: var(--paper-ink);
}

.halftone--accent {
  background-image: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 35%, transparent) 1px,
    transparent 1.5px
  );
  background-size: 8px 8px;
}

/* ribbon of repeating-linear scanlines, like the companion-site header */
.scanlines {
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
}

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