/* CTM Style Lab — shared base
   Five personal-site skins, one person. Each skin overrides the tokens below. */

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

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

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--bg, #07070a);
  color: var(--fg, #f4f1ea);
  font-family: var(--font-sans, system-ui, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent, #8b7cff);
  color: var(--bg, #07070a);
}

:focus-visible {
  outline: 2px solid var(--accent, #8b7cff);
  outline-offset: 4px;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--fg, #fff);
  color: var(--bg, #000);
  font-size: 12px;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip:focus {
  transform: none;
}

/* ---------- shared navigation ---------- */

.site-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 52px);
  color: var(--fg, #fff);
  pointer-events: none;
}

.site-nav a {
  pointer-events: auto;
}

.nav-back,
.nav-brand,
.style-links a {
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.nav-back:hover,
.nav-brand:hover,
.style-links a:hover,
.style-links a[aria-current='page'] {
  opacity: 1;
}

.nav-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  letter-spacing: 0.08em;
}

.nav-brand span {
  opacity: 0.55;
}

.style-links {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
}

.style-links a[aria-current='page'] {
  color: var(--accent, #fff);
}

/* ---------- shared 3D stage ---------- */

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scene canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

.scene-fallback {
  display: none;
  position: absolute;
  inset: 0;
}

.no-webgl .scene canvas {
  display: none;
}

.no-webgl .scene-fallback {
  display: block;
}

/* ---------- reveal ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- helpers ---------- */

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

.mono {
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
}

@media (max-width: 760px) {
  .site-nav {
    padding: 14px 16px;
  }

  .nav-brand {
    display: none;
  }

  .style-links {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 70;
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--line, rgba(255, 255, 255, 0.16));
    border-radius: 999px;
    background: var(--nav-bg, rgba(8, 8, 12, 0.72));
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .style-links a {
    font-size: 9px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  body {
    padding-bottom: 76px;
  }
}

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

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
