/* =============================================================================
 * MY-IA V2 — BASE
 * Minimal reset · paper-grain texture · type defaults · focus / scrollbar
 * ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..700,0..100;1,9..144,300..700,0..100&family=Geist:wght@300..600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ───── Reset ───── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

/* ───── Body ───── */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-fg);
  background-color: var(--color-bg);
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Paper grain — fixed, multiply-blended noise.
   Builds the warm, off-press texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0 0.07  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; }
}

/* All real content renders above the grain layer */
body > * { position: relative; z-index: 2; }

/* ───── Typography defaults ───── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-fg);
}

p { line-height: var(--leading-normal); }

a {
  color: var(--color-accent);
  text-decoration-color: color-mix(in srgb, var(--color-accent) 30%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--duration-fast) var(--ease-out);
}
a:hover { text-decoration-color: var(--color-accent); }

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

/* ───── Form basics ───── */
button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; }

/* ───── Selection ───── */
::selection {
  background-color: var(--color-accent);
  color: var(--color-accent-fg);
}

/* ───── Focus — single shared treatment ───── */
:focus { outline: 0; }
:focus-visible {
  outline: 1.5px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  transition: outline-offset var(--duration-fast) var(--ease-out);
}

/* ───── Scrollbar (webkit) ───── */
::-webkit-scrollbar       { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border: 3px solid var(--color-bg);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-line-strong); }

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

/* ───── HTMX indicator (fade in during request) ───── */
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ───── Utility: visually hidden but accessible ───── */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
