/* ==========================================================================
   Chisenoa — base
   Design tokens, reset, typography and layout primitives.
   The palette is sampled from the Mindlabor key art (Boltz, Pight, Lovux…).
   ========================================================================== */

:root {
  /* Type */
  --font-display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --step--1: clamp(0.8rem, 0.78rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.06rem + 0.3vw, 1.3rem);
  --step-2: clamp(1.35rem, 1.22rem + 0.6vw, 1.7rem);
  --step-3: clamp(1.9rem, 1.6rem + 1.5vw, 2.8rem);
  --step-4: clamp(2.5rem, 1.8rem + 3.4vw, 4.6rem);

  /* Space */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-s: 0.75rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: clamp(4rem, 2.8rem + 5vw, 7rem);

  /* Shape */
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-pill: 999px;
  --border: 2.5px;
  --lift: 5px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Mindlabor palette (same in both themes) */
  --lilac: #d6b4fb;
  --purple: #6a4fa6;
  --blue: #33708c;
  --teal: #124e50;
  --peach: #f4a56a;
  --cream: #fbf2d6;
  --coral: #f0665c;
  --mint: #8edc98;
  --sun: #f7d56a;
  --ink: #15121b;
  --paper: #fffcf5;

  /* Theme: paper (light) */
  --bg: #f3eee4;
  --surface: #fffcf5;
  --surface-2: #f5efe4;
  --text: #15121b;
  --text-2: #463f4f;
  --text-3: #635c6d;
  --line: #15121b;
  --shadow: #15121b;
  --link: #5b3fa0;
  --accent: #d6b4fb;
  --on-accent: #15121b;
  --tile: #222222;
  --header-bg: rgb(243 238 228 / 0.9);
  --skeleton: #e7dfd2;
  color-scheme: light;
}

/* Theme: ink (dark) — follows the OS unless the visitor picked a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1823;
    --surface: #282231;
    --surface-2: #2f2939;
    --text: #f6f1e9;
    --text-2: #d0c7d9;
    --text-3: #aaa0b5;
    --line: #07060a;
    --shadow: #07060a;
    --link: #cfb0fb;
    --accent: #c8a3f7;
    --on-accent: #15121b;
    --tile: #222222;
    --header-bg: rgb(27 24 35 / 0.9);
    --skeleton: #332c3e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1823;
  --surface: #282231;
  --surface-2: #2f2939;
  --text: #f6f1e9;
  --text-2: #d0c7d9;
  --text-3: #aaa0b5;
  --line: #07060a;
  --shadow: #07060a;
  --link: #cfb0fb;
  --accent: #c8a3f7;
  --on-accent: #15121b;
  --tile: #222222;
  --header-bg: rgb(27 24 35 / 0.9);
  --skeleton: #332c3e;
  color-scheme: dark;
}

/* ---------- Reset ---------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

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

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

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

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.text-link {
  color: var(--link);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  transition: text-decoration-color 0.2s;
}

.text-link:hover {
  text-decoration-color: var(--link);
}

.mono {
  font-family: var(--font-mono);
}

/* ---------- Layout ---------- */

.container {
  width: min(100% - clamp(2rem, 6vw, 4rem), 1140px);
  margin-inline: auto;
}

.section {
  padding-block: var(--space-3xl);
}

.section + .section {
  padding-top: 0;
}

.section-head {
  display: grid;
  gap: var(--space-s);
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
  max-width: 44rem;
}

.section-head--split {
  max-width: none;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--space-m) var(--space-xl);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.kicker::before {
  content: "";
  width: 1.75rem;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
}

.section-title {
  font-size: var(--step-3);
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 60ch;
}

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

.skip-link {
  position: fixed;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  border: var(--border) solid var(--line);
  border-radius: var(--radius-s);
}

.skip-link:focus {
  top: 1rem;
}

/* Scroll reveal — main.js adds .reveal-ready, so content never hides without it */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 640px) {
  :root {
    --border: 2px;
    --lift: 4px;
  }

  .section-head--split {
    grid-template-columns: 1fr;
  }
}
