/* ==========================================================================
   base.css — tokens, reset, typography, shared components
   范心悦 · Portfolio 2026
   All brand values live in :root. Change here, not in components.
   ========================================================================== */

:root {
  /* ---- surface ---- */
  --bg: #08090b;
  --bg-2: #0c0e11;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: #101216;
  --surface-3: #15171b;

  /* ---- lines ---- */
  --line: rgba(237, 235, 230, 0.1);
  --line-strong: rgba(237, 235, 230, 0.2);
  --line-faint: rgba(237, 235, 230, 0.055);

  /* ---- ink ---- */
  --ink: #edebe6;
  --ink-2: #a6a6a2;
  --ink-3: #6b6d70;
  --ink-4: #45474b;

  /* ---- accent ---- */
  --accent: #c8553d;
  --accent-bright: #e2604a;
  --accent-soft: rgba(200, 85, 61, 0.14);
  --jade: #7fa394;

  /* ---- type ---- */
  --font-display: "Noto Serif SC", "Songti SC", "SimSun", "Source Han Serif SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular", "Menlo", monospace;

  --fs-cover: clamp(3.4rem, 11vw, 11rem);
  --fs-h1: clamp(2.35rem, 6.1vw, 5.2rem);
  --fs-h2: clamp(1.85rem, 3.5vw, 3.1rem);
  --fs-h3: clamp(1.2rem, 1.7vw, 1.6rem);
  --fs-lead: clamp(1rem, 1.15vw, 1.12rem);
  --fs-body: clamp(0.92rem, 0.95vw, 0.98rem);
  --fs-small: 0.82rem;
  --fs-label: 0.68rem;

  /* ---- layout ---- */
  --maxw: 1560px;
  --pad: clamp(20px, 4.6vw, 72px);
  --gap: clamp(16px, 1.6vw, 24px);
  --section-y: clamp(78px, 9.4vw, 152px);
  --nav-h: 76px;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 250ms;
  --t-med: 620ms;
  --t-slow: 960ms;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 300;
  line-height: 1.9;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection {
  background: var(--accent);
  color: #0a0a0b;
}

/* thin dark scrollbar (desktop) */
@media (pointer: fine) {
  html {
    scrollbar-width: thin;
    scrollbar-color: #2a2c30 var(--bg);
  }
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--bg);
  }
  ::-webkit-scrollbar-thumb {
    background: #26282c;
    border: 3px solid var(--bg);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #3a3d42;
  }
}

/* ==========================================================================
   Type utilities
   ========================================================================== */

.display {
  font-family: var(--font-display);
  font-weight: 200;
  letter-spacing: 0.01em;
  line-height: 1.02;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.4;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.4;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
  flex: none;
}

.eyebrow--bare::before {
  display: none;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

/* ==========================================================================
   Layout utilities
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-block: var(--section-y);
  position: relative;
}

.section--edge {
  padding-inline: 0;
}

.rule {
  height: 1px;
  width: 100%;
  background: var(--line);
  border: 0;
  margin: 0;
}

.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: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: translateY(-200%);
  transition: transform var(--t-fast) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* film grain — fixed, static, no network cost */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  animation: grain-shift 1.4s steps(2) infinite;
}

@keyframes grain-shift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-1.2%, 0.8%, 0);
  }
  100% {
    transform: translate3d(0.6%, -0.6%, 0);
  }
}

/* ==========================================================================
   Focus
   ========================================================================== */

:focus-visible {
  outline: 1px solid var(--accent-bright);
  outline-offset: 3px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border: 1px solid var(--btn-line);
  color: var(--btn-ink);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  background: transparent;
  overflow: hidden;
  isolation: isolate;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  cursor: pointer;
}

.btn > span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--t-fast) var(--ease);
}

.btn:hover {
  color: var(--bg);
  border-color: var(--ink);
}

.btn:hover::before {
  transform: scaleY(1);
}

.btn--solid {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn--solid::before {
  background: var(--accent);
  transform: scaleY(0);
}

.btn--solid:hover {
  color: #fff;
  border-color: var(--accent);
}

.btn--sm {
  padding: 11px 18px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.btn--plain {
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.btn--plain::before {
  display: none;
}

.btn--plain:hover {
  color: var(--accent-bright);
  text-decoration-color: var(--accent-bright);
}

/* arrow glyph inside buttons/links */
.arr {
  display: inline-block;
  transition: transform var(--t-fast) var(--ease);
}

a:hover > .arr,
.btn:hover .arr,
button:hover .arr {
  transform: translate(3px, -3px);
}

/* ==========================================================================
   Status dot
   ========================================================================== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 0 rgba(127, 163, 148, 0.5);
  animation: pulse 3.2s var(--ease) infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(127, 163, 148, 0.42);
  }
  55% {
    box-shadow: 0 0 0 5px rgba(127, 163, 148, 0);
  }
}

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

html.is-booting [data-reveal] {
  transition: none;
}

/* ==========================================================================
   Marquee
   ========================================================================== */

.marquee {
  position: relative;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: var(--bg-2);
  padding-block: 18px;
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 42s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__group {
  display: flex;
  align-items: center;
  gap: 0;
  flex: none;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  padding-inline: 28px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.marquee__item::after {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--accent);
  opacity: 0.66;
  transform: rotate(45deg);
}

@keyframes marquee {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@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;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .grain {
    animation: none;
  }
}
