/* ==========================================================================
   KUMA — 复古大红 DESIGN SYSTEM
   base.css : reset · design tokens · typography · utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

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

html:focus-within {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--c-amber);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--c-red);
  color: var(--c-cream-50);
}

/* --------------------------------------------------------------------------
   2. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* ---- 大红 palette ---- */
  --c-red: #e0301e; /* 大红 — primary field */
  --c-red-press: #c41e12; /* pressed / hover */
  --c-red-deep: #8f1108; /* deep shade, shadows */
  --c-red-dark: #4a0a05; /* darkest red, gradients */
  --c-red-glow: #ff4a34; /* highlight, glow */

  --c-cream-50: #fbf3e4; /* paper light */
  --c-cream: #f4e6ce; /* paper */
  --c-cream-200: #e7d2af; /* paper shade */
  --c-cream-300: #d4b98c; /* paper deep */

  --c-amber: #f0a93b; /* retro accent */
  --c-amber-dark: #c97a16;

  --c-teal: #2c6e63; /* the one cool accent */

  --c-ink: #1a100c; /* warm black */
  --c-ink-soft: #3a2a22;
  --c-ink-mute: #6b564a;

  /* ---- semantic ---- */
  --bg: var(--c-cream);
  --fg: var(--c-ink);
  --accent: var(--c-red);

  /* ---- type ---- */
  --f-display: "Anton", "Archivo", "Noto Sans SC", "PingFang SC", sans-serif;
  --f-slab: "Alfa Slab One", "Anton", "Noto Sans SC", serif;
  --f-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-body: "Archivo", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;

  /* fluid type scale */
  --t-hero: clamp(4rem, 19.5vw, 17rem);
  --t-xxl: clamp(2.75rem, 9vw, 8rem);
  --t-xl: clamp(2.25rem, 5.5vw, 4.5rem);
  --t-lg: clamp(1.65rem, 3.2vw, 2.75rem);
  --t-md: clamp(1.25rem, 2vw, 1.75rem);
  --t-body: clamp(0.95rem, 1.05vw, 1.0625rem);
  --t-sm: 0.8125rem;
  --t-xs: 0.6875rem;
  --t-micro: 0.5938rem;

  /* ---- spacing ---- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;
  --s-10: 8rem;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-y: clamp(5rem, 12vh, 11rem);
  --maxw: 1560px;
  --maxw-text: 68ch;

  /* ---- borders & frames ---- */
  --rule: 2px;
  --rule-thick: 4px;
  --frame: 3px solid var(--c-ink);
  --radius: 0px; /* deliberately square — poster stock */
  --radius-pill: 999px;

  /* ---- motion ---- */
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);
  --e-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --e-stamp: cubic-bezier(0.2, 1.4, 0.35, 1);
  --e-linear: linear;
  --d-fast: 0.18s;
  --d-mid: 0.42s;
  --d-slow: 0.8s;
  --d-reveal: 1s;

  /* ---- elevation (hard retro shadows, no blur) ---- */
  --shadow-sm: 4px 4px 0 var(--c-ink);
  --shadow-md: 8px 8px 0 var(--c-ink);
  --shadow-lg: 14px 14px 0 var(--c-ink);
  --shadow-red: 8px 8px 0 var(--c-red-deep);

  /* ---- z-index scale ---- */
  --z-base: 1;
  --z-sticky: 100;
  --z-cursor: 500;
  --z-overlay: 600;
  --z-modal: 700;
  --z-preloader: 900;
}

/* ---- dark sections invert the semantic tokens ---- */
.is-dark {
  --bg: var(--c-ink);
  --fg: var(--c-cream);
  --accent: var(--c-red);
}

/* --------------------------------------------------------------------------
   3. BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.005em;
  overflow-x: hidden;
}

/* ---- display ---- */
.t-display,
.t-xxl,
.t-xl,
.t-lg {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.t-xxl {
  font-size: var(--t-xxl);
}
.t-xl {
  font-size: var(--t-xl);
}
.t-lg {
  font-size: var(--t-lg);
}

/* Chinese display type needs a real CJK face + looser tracking */
.t-cjk {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.02;
}

/* ---- slab accent ---- */
.t-slab {
  font-family: var(--f-slab);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
}

/* ---- mono eyebrow / metadata ---- */
.t-mono {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.4;
}

.t-eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
}

.t-eyebrow::before {
  content: "";
  width: clamp(1.5rem, 4vw, 3.25rem);
  height: var(--rule);
  background: currentColor;
  flex: none;
}

/* wide-tracked utility (the justlouis signature) */
.t-track {
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.t-lede {
  font-size: clamp(1.05rem, 1.6vw, 1.375rem);
  line-height: 1.6;
  font-weight: 400;
}

.t-body p + p {
  margin-top: 1.1em;
}

.t-mute {
  color: var(--c-ink-mute);
}

.is-dark .t-mute {
  color: #b9a08e;
}

/* --------------------------------------------------------------------------
   4. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
  background: var(--bg);
  color: var(--fg);
}

.section--red {
  background: var(--c-red);
  color: var(--c-cream-50);
}

.section--ink {
  background: var(--c-ink);
  color: var(--c-cream);
}

.section--cream {
  background: var(--c-cream);
  color: var(--c-ink);
}

.section--tight {
  padding-block: clamp(3rem, 7vh, 6rem);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: var(--rule-thick) solid currentColor;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}

.section-head__index {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.28em;
  opacity: 0.65;
}

.section-head__title {
  font-family: var(--f-display);
  font-size: var(--t-xxl);
  line-height: 0.85;
  text-transform: uppercase;
}

.stack {
  display: flex;
  flex-direction: column;
}
.stack > * + * {
  margin-top: var(--flow, 1rem);
}

.grid {
  display: grid;
  gap: var(--gap, var(--s-5));
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--s-4);
  z-index: calc(var(--z-preloader) + 10);
  background: var(--c-ink);
  color: var(--c-cream);
  padding: 0.75rem 1.25rem;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: top var(--d-fast) var(--e-out);
}
.skip-link:focus {
  top: var(--s-4);
}

/* --------------------------------------------------------------------------
   5. TEXTURE LAYERS — grain, halftone, misregistration
   -------------------------------------------------------------------------- */
.tex {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* film grain, generated */
.tex--grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.16;
  mix-blend-mode: multiply;
  z-index: 3;
}

.is-dark .tex--grain,
.section--ink .tex--grain,
.section--red .tex--grain {
  mix-blend-mode: overlay;
  opacity: 0.22;
}

/* halftone dots */
.tex--halftone {
  background-image: radial-gradient(
    currentColor 1.15px,
    transparent 1.2px
  );
  background-size: 9px 9px;
  opacity: 0.22;
  z-index: 1;
}

.tex--halftone-lg {
  background-image: radial-gradient(currentColor 2.4px, transparent 2.5px);
  background-size: 16px 16px;
  opacity: 0.14;
  z-index: 1;
}

/* diagonal hatch stripes */
.tex--hatch {
  background-image: repeating-linear-gradient(
    -45deg,
    currentColor 0 1px,
    transparent 1px 9px
  );
  opacity: 0.16;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   6. MOTION PREFERENCES
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* never leave revealed content hidden when motion is off */
  .reveal,
  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}
