/* ===== Design tokens ===== */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  --content-default: 1120px;
  --content-narrow: 720px;

  --font-display: 'Fraunces', 'Noto Serif JP', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-jp: 'Noto Serif JP', 'Fraunces', serif;
}

/* ===== Color: indigo + sumi + vermilion (light) ===== */
:root,
[data-theme='light'] {
  --color-bg: #f4f1ea;
  --color-surface: #faf7f0;
  --color-surface-2: #fdfbf6;
  --color-surface-offset: #ece7da;
  --color-surface-dark: #1a2240;
  --color-border: #d8d1bf;
  --color-divider: #e3ddca;

  --color-text: #1d1a14;
  --color-text-muted: #6a6555;
  --color-text-faint: #a89f87;
  --color-text-inverse: #faf7f0;

  --color-primary: #1a2240; /* sumi indigo */
  --color-primary-hover: #0f1530;
  --color-primary-soft: #d9dde8;

  --color-accent: #c8423a; /* hanko vermilion */
  --color-accent-hover: #a8312a;
  --color-accent-soft: #f3d7d4;

  --color-success: #4a7c3a;
  --color-warning: #b07b1a;
  --color-error: #a8312a;

  --shadow-sm: 0 1px 2px rgba(26, 34, 64, 0.08);
  --shadow-md: 0 6px 18px rgba(26, 34, 64, 0.1);
  --shadow-lg: 0 18px 42px rgba(26, 34, 64, 0.14);
}

[data-theme='dark'] {
  --color-bg: #11131c;
  --color-surface: #181b27;
  --color-surface-2: #1f2230;
  --color-surface-offset: #232636;
  --color-surface-dark: #0a0c14;
  --color-border: #2f3346;
  --color-divider: #262a3a;

  --color-text: #ecead8;
  --color-text-muted: #9c9788;
  --color-text-faint: #5f5b50;
  --color-text-inverse: #11131c;

  --color-primary: #c9d1ec;
  --color-primary-hover: #e3e8f7;
  --color-primary-soft: #2c3149;

  --color-accent: #e26a5e;
  --color-accent-hover: #f08376;
  --color-accent-soft: #45221f;

  --color-success: #7fb56b;
  --color-warning: #d4a14a;
  --color-error: #e26a5e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.6);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* subtle paper texture via SVG noise */
  background-image: radial-gradient(
    circle at 20% 0%,
    color-mix(in oklab, var(--color-primary) 6%, transparent),
    transparent 50%
  );
}

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

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

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  line-height: 1.15;
  color: var(--color-text);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--color-primary) 35%, transparent);
}

a:hover {
  text-decoration-color: var(--color-primary);
}

::selection {
  background: color-mix(in oklab, var(--color-accent) 35%, transparent);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a,
button,
[role='button'],
input,
textarea,
select {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

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

.container {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: clamp(var(--space-4), 4vw, var(--space-10));
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
