/* [SEJP-V3-T008] StudyEnvsJP v3 Warm Ivory & Deep Midnight Design Tokens */
@view-transition {
  navigation: auto;
}

:root,
html[data-theme="light"] {
  --bg-canvas: #f4efe6;
  --bg-page: var(--bg-canvas);
  --bg-surface: #fcfaf5;
  --bg-elevated: #f1eadc;
  --bg-surface-alt: var(--bg-elevated);
  --bg-hover: #e6dece;
  --card-highlight: rgba(255, 255, 255, 0.85);
  --border-subtle: #e2d9c8;
  --border-strong: #c8bda6;

  --text-primary: #1f242d;
  --text-secondary: #535b69;
  --text-muted: #707887;
  --text-on-accent: #faf7f0;

  --accent-primary: #0f766e;
  --accent-primary-hover: #0d5e58;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-rgb: 15, 118, 110;
  --accent-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  --accent-glow: 0 8px 22px rgba(15, 118, 110, 0.24);

  --accent-jp: #be123c;
  --accent-en: #1d4ed8;
  --accent-general: #047857;

  --status-success: #15803d;
  --status-success-bg: rgba(21, 128, 61, 0.12);
  --status-warning: #b45309;
  --status-warning-bg: rgba(180, 83, 9, 0.14);
  --status-danger: #b91c1c;
  --status-danger-bg: rgba(185, 28, 28, 0.12);
  --status-info: #0369a1;
  --status-info-bg: rgba(3, 105, 161, 0.12);

  --shadow-sm: 0 1px 2px rgba(45, 36, 20, 0.05), 0 2px 6px rgba(45, 36, 20, 0.04);
  --shadow-md: 0 6px 16px rgba(45, 36, 20, 0.08), 0 12px 28px rgba(45, 36, 20, 0.05);
  --shadow-lg: 0 14px 32px rgba(45, 36, 20, 0.12), 0 24px 48px rgba(45, 36, 20, 0.08);

  --canvas-bg: #faf7f0;
  --canvas-text: #1f242d;
  --canvas-line: #0f766e;

  --heat-0: #e7e0d2;
  --heat-1: #99f6e4;
  --heat-2: #2dd4bf;
  --heat-3: #0d9488;
  --heat-4: #115e59;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --space-card: 20px;
  --font-scale: 1;
  --font-sans: "Be Vietnam Pro", "Noto Sans JP", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;

  /* [SEJP-V9-T006] Global Layering / Z-Index Scale */
  --z-sidebar: 1020;
  --z-topbar: 1025;
  --z-fab-support: 1030;
  --z-drawer: 1040;
  --z-modal-backdrop: 1050;
  --z-modal: 1060;
  --z-toast: 1080;
}

html[data-theme="dark"] {
  --bg-canvas: #0d1117;
  --bg-page: var(--bg-canvas);
  --bg-surface: #151b26;
  --bg-elevated: #1e2738;
  --bg-surface-alt: var(--bg-elevated);
  --bg-hover: #273248;
  --card-highlight: rgba(255, 255, 255, 0.06);
  --border-subtle: #283449;
  --border-strong: #3d4d6b;

  --text-primary: #eaf0f8;
  --text-secondary: #b4c0d3;
  --text-muted: #8896ad;
  --text-on-accent: #ffffff;

  --accent-primary: #14b8a6;
  --accent-primary-hover: #0d9488;
  --accent-soft: rgba(20, 184, 166, 0.17);
  --accent-rgb: 20, 184, 166;
  --accent-gradient: linear-gradient(135deg, #0d9488 0%, #2dd4bf 100%);
  --accent-glow: 0 8px 24px rgba(20, 184, 166, 0.28);

  --accent-jp: #fb7185;
  --accent-en: #60a5fa;
  --accent-general: #34d399;

  --status-success: #4ade80;
  --status-success-bg: rgba(74, 222, 128, 0.14);
  --status-warning: #fbbf24;
  --status-warning-bg: rgba(251, 191, 36, 0.14);
  --status-danger: #f87171;
  --status-danger-bg: rgba(248, 113, 113, 0.14);
  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.14);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.48), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.68), 0 8px 20px rgba(0, 0, 0, 0.42);

  --canvas-bg: #151b26;
  --canvas-text: #eaf0f8;
  --canvas-line: #14b8a6;

  --heat-0: #1e2738;
  --heat-1: #115e59;
  --heat-2: #0d9488;
  --heat-3: #14b8a6;
  --heat-4: #5eead4;
}

/* 4 Configurable Accent Palettes */
html[data-theme="light"][data-accent="indigo"] {
  --accent-primary: #4338ca;
  --accent-primary-hover: #3730a3;
  --accent-soft: rgba(67, 56, 202, 0.12);
  --accent-rgb: 67, 56, 202;
  --accent-gradient: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  --accent-glow: 0 8px 22px rgba(67, 56, 202, 0.24);
}
html[data-theme="dark"][data-accent="indigo"] {
  --accent-primary: #818cf8;
  --accent-primary-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --accent-rgb: 129, 140, 248;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
  --accent-glow: 0 8px 24px rgba(129, 140, 248, 0.3);
}

html[data-theme="light"][data-accent="amber"] {
  --accent-primary: #b45309;
  --accent-primary-hover: #92400e;
  --accent-soft: rgba(180, 83, 9, 0.14);
  --accent-rgb: 180, 83, 9;
  --accent-gradient: linear-gradient(135deg, #b45309 0%, #f59e0b 100%);
  --accent-glow: 0 8px 22px rgba(180, 83, 9, 0.24);
}
html[data-theme="dark"][data-accent="amber"] {
  --accent-primary: #f59e0b;
  --accent-primary-hover: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.18);
  --accent-rgb: 245, 158, 11;
  --accent-gradient: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
  --accent-glow: 0 8px 24px rgba(245, 158, 11, 0.28);
}

html[data-theme="light"][data-accent="crimson"] {
  --accent-primary: #be123c;
  --accent-primary-hover: #9f1239;
  --accent-soft: rgba(190, 18, 60, 0.12);
  --accent-rgb: 190, 18, 60;
  --accent-gradient: linear-gradient(135deg, #be123c 0%, #f43f5e 100%);
  --accent-glow: 0 8px 22px rgba(190, 18, 60, 0.24);
}
html[data-theme="dark"][data-accent="crimson"] {
  --accent-primary: #fb7185;
  --accent-primary-hover: #f43f5e;
  --accent-soft: rgba(251, 113, 133, 0.18);
  --accent-rgb: 251, 113, 133;
  --accent-gradient: linear-gradient(135deg, #e11d48 0%, #fb7185 100%);
  --accent-glow: 0 8px 24px rgba(251, 113, 133, 0.28);
}

/* Ergonomic Density, Tabular Telemetry & Reduced Motion */
html {
  font-size: calc(16px * var(--font-scale, 1));
}

html[data-density="compact"] {
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --space-card: 14px;
}

html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.reading-prose {
  line-height: 1.85;
  max-width: 68ch;
}

code,
pre,
.font-monospace {
  font-family: var(--font-mono);
}
