/* ── Cursor trail (WebGL, full viewport) ──────────────────────────── */
.cursor-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ── Brand tokens ─────────────────────────────────────────────────── */
:root {
  --brand:              #9B6FC4;
  --brand-soft:         rgba(155, 111, 196, 0.12);
  --brand-glow:         rgba(155, 111, 196, 0.06);
  --brand-border:       rgba(155, 111, 196, 0.22);
  --brand-border-hover: rgba(155, 111, 196, 0.50);
  --brand-soft-hover:   rgba(155, 111, 196, 0.18);
  --font-display:       'Source Serif 4', Georgia, serif;
  --font-body:          'Source Sans 3', 'Inter', -apple-system, sans-serif;
}
[data-theme="dark"] {
  --surface:   #22182e; /* Ube 950 */
  --surface-1: #191919;
  --surface-2: #222222;
  --surface-3: #2a2a2a;
  --surface-4: #313131;
  --border:    #1F1F1F;
  --ink-ghost: #8A8A8A;
  --ink-mute:  #999999;
}
[data-theme="light"] {
  --surface:   #f5f0f8; /* Ube 50 */
  --surface-1: #FFFFFF;
  --surface-2: #F1F1F3;
  --surface-3: #EAEAEE;
  --surface-4: #E2E2E8;
  --border:    #E2E2E8;
}

/* ── Mima nav override ────────────────────────────────────────────── */
.nav-mark .svg-icon { color: var(--ink); }

/* ── Hero background mark ─────────────────────────────────────────── */
.hero-bg-mark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(80vw, 700px);
  opacity: 0.032;
  pointer-events: none;
  color: var(--glyph-color);
}

/* ── Hero overrides ────────────────────────────────────────────────── */

/* ── Chapters ────────────────────────────────────────────────────── */
.chapter { padding: 6rem 0; }
.chapter-header { margin-bottom: 3.5rem; }
.chapter-num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-ghost);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chapter-num::before {
  content: '';
  display: block;
  width: 1.5rem;
  height: 1px;
  background: currentColor;
}
.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.chapter-title em { font-style: italic; color: var(--ink-soft); }

/* ── Body copy ────────────────────────────────────────────────────── */
.body-copy {
  font-size: 1.0625rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 720px;
}
.body-copy + .body-copy { margin-top: 1.5rem; }
.body-copy strong { font-weight: 500; color: var(--ink); }
.pull-quote {
  border-left: 2px solid var(--brand);
  padding: 0.25rem 0 0.25rem 1.75rem;
  margin: 2.5rem 0;
}
.pull-quote p {
  font-family: var(--font-display);
  font-size: 1.4375rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.45;
  letter-spacing: -0.01em;
}

/* ── Figma placeholder ────────────────────────────────────────────── */
.figma-placeholder {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
}
.figma-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  min-height: 360px;
}
.figma-placeholder-icon { opacity: 0.22; color: var(--ink-mute); }
.figma-placeholder-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-ghost);
  text-align: center;
}
.figma-placeholder-desc {
  font-size: 0.8125rem;
  color: var(--ink-ghost);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}
/* ── Grids ───────────────────────────────────────────────────────── */
.two-up   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.three-up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Icon showcase ────────────────────────────────────────────────── */
.icon-showcase {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
}
.icon-showcase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.icon-showcase-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-ghost);
}
.icon-showcase-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--ink-ghost);
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 1px;
  background: var(--border);
}
.icon-cell {
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
  cursor: default;
}
.icon-cell:hover {
  background: var(--surface-3);
  color: var(--brand);
}

/* ── UI mockup card ───────────────────────────────────────────────── */
.mockup-card {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 1rem;
  overflow: hidden;
}
.mockup-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}
.mockup-bar-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
}
.mockup-bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink-mute);
}
.mockup-bar-title {
  font-size: 0.875rem;
  font-weight: 500;
}
.mockup-feed { padding: 0.5rem; display: flex; flex-direction: column; gap: 1px; }
.mockup-post {
  background: var(--surface-1);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.mockup-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mockup-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  flex-shrink: 0;
}
.mockup-post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  margin-left: 0.625rem;
}
.mockup-post-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink);
}
.mockup-post-time {
  font-size: 0.6875rem;
  color: var(--ink-ghost);
}
.mockup-post-body {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.mockup-post-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: var(--ink-ghost);
}
.mockup-action {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  cursor: default;
}
.mockup-bar-brand { color: var(--brand); }

/* ── Palette swatches ─────────────────────────────────────────────── */
.palette-row {
  display: flex;
  gap: 3px;
  border-radius: 0.75rem;
  overflow: hidden;
}
.swatch {
  height: 56px;
  flex: 1;
  position: relative;
  cursor: default;
  transition: flex 0.3s var(--ease-out);
}
.swatch:hover { flex: 2; }
.swatch-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.25rem 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(0,0,0,0.5);
  color: white;
}
.swatch:hover .swatch-label { opacity: 1; }

/* ── Process list ────────────────────────────────────────────────── */
.process-list { list-style: none; }
.process-item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.process-item:first-child { border-top: 1px solid var(--border); }
.process-num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ink-ghost);
  padding-top: 0.2rem;
}
.process-text { font-size: 0.9375rem; color: var(--ink-soft); line-height: 1.6; }
.process-text strong { color: var(--ink); font-weight: 500; display: block; margin-bottom: 0.25rem; }

/* ── Code block ──────────────────────────────────────────────────── */
.code-note {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 0.75rem;
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-top: 2rem;
}
.code-note .value { color: var(--brand); }

/* ── Divider ─────────────────────────────────────────────────────── */
.divider-mark {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 3rem 0;
}
.divider-mark::before,
.divider-mark::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-mark-icon { opacity: 0.18; flex-shrink: 0; color: var(--glyph-color); }

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
  padding: 4rem 0 5rem;
  margin-top: 4rem;
}
.footer-mark { opacity: 0.25; color: var(--glyph-color); margin-bottom: 1rem; }

/* ── Brand transition (for palette switcher) ─────────────────────── */
.nav-badge,
.hero-overline,
.pull-quote,
.metric-value sup,
.chapter-num::before,
.btn-brand,
.figma-placeholder-icon,
.mockup-bar-brand { transition: color 0.35s ease, background 0.35s ease, border-color 0.35s ease; }

/* ── Palette switcher ─────────────────────────────────────────────── */
.palette-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.palette-switcher-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-ghost);
  white-space: nowrap;
}
.palette-switcher-chips {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.ps-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--ink-mute);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.ps-chip:hover { border-color: var(--border-soft); color: var(--ink); }
.ps-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
}
.ps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ps-badge {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .two-up { grid-template-columns: 1fr; }
  .three-up { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  nav { padding: 1rem 1.25rem; }
  .wrap, .wrap-wide { padding: 0 1.25rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}
