/* ============================================
   钟艺-EZ · Personal Portfolio — Base Styles
   ============================================ */

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

:root {
  /* Color System */
  --c-bg-dark: #0a1424;
  --c-bg-darker: #050b16;
  --c-bg-light: #f3f3ef;
  --c-bg-light-2: #e8e8e3;
  --c-ink-dark: #0a1424;
  --c-ink-light: #ffffff;
  --c-ink-muted: rgba(255, 255, 255, 0.55);
  --c-ink-muted-dark: rgba(10, 20, 36, 0.55);
  --c-line: rgba(255, 255, 255, 0.08);
  --c-line-dark: rgba(10, 20, 36, 0.08);
  --c-accent: #1e6cff;
  --c-accent-2: #7affc8;

  /* Typography */
  --f-display: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-body: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono: 'Roboto Mono', ui-monospace, monospace;

  /* Layout */
  --pad-x: clamp(20px, 4vw, 80px);
  --pad-y: clamp(40px, 6vw, 100px);
  --section-gap: 0px;

  /* Container widths — responsive via breakpoint overrides below */
  --max-width: 1400px;       /* default desktop (1440+) */
  --max-width-inner: 1280px; /* inner sub-container */
  --gutter: 24px;            /* default horizontal gap between siblings */

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: auto; /* GSAP controls scroll */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-ink-light);
  background: var(--c-bg-dark);
  overflow-x: hidden;
  min-height: 100vh;
  cursor: none; /* custom cursor */
}

body.is-loading { overflow: hidden; }

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul, ol { list-style: none; }

::selection {
  background: var(--c-accent);
  color: #fff;
}

/* ============================================
   Custom Cursor
   ============================================ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 40px; height: 40px;
  border: 1.5px solid var(--c-ink-light);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: width .35s var(--ease-out), height .35s var(--ease-out),
              background .35s var(--ease-out), border-color .35s var(--ease-out);
  will-change: transform;
}

.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: var(--c-ink-light);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  will-change: transform;
}

.cursor.is-hover { width: 60px; height: 60px; background: rgba(255,255,255,0.1); }
.cursor-dot.is-hover { opacity: 0; }

@media (hover: none), (max-width: 768px) {
  .cursor, .cursor-dot { display: none; }
  body { cursor: auto; }
}

/* ============================================
   Grid Background (faint dot/line grid)
   ============================================ */
.grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--c-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-line) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.6;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
}

[data-theme="light"] .grid-bg {
  background-image:
    linear-gradient(to right, var(--c-line-dark) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-line-dark) 1px, transparent 1px);
}

/* ============================================
   Page System
   ============================================ */
.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: var(--pad-y) var(--pad-x);
  z-index: 1;
  overflow: hidden;
}

.page[data-theme="dark"]  { color: var(--c-ink-light); background: var(--c-bg-dark); }
.page[data-theme="light"] { color: var(--c-ink-dark); background: var(--c-bg-light); }

/* ============================================
   Top Navigation (always-on bar)
   严格按图1：左logo 中2026 右DESIGN
   ============================================ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(20px, 4vw, 60px);
  z-index: 100;
  pointer-events: none;
}

.top-nav > * { pointer-events: auto; }

.nav-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.top-nav::before {
  content: '2026';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #fff;
  opacity: 0.85;
}

.top-nav::after {
  content: 'DESIGN';
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: #fff;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .top-nav::before, .top-nav::after { font-size: 11px; }
}

/* ============================================
   Side Nav (left side) — main navigation
   ============================================ */
.side-nav {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: #ffffff;
  opacity: 0.55;
  transition: opacity .25s var(--ease-soft), transform .25s var(--ease-soft), background .25s var(--ease-soft);
  border-radius: 12px;
}

.side-nav a svg {
  display: block;
  width: 22px;
  height: 22px;
}

.side-nav a:hover {
  opacity: 1;
  transform: translateX(2px);
}

.side-nav a.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.10);
  transform: translateX(4px);
}

@media (max-width: 900px) {
  .side-nav { display: none; }
}

/* ============================================
   右侧 page-indicator 已删除
   ============================================ */

/* ============================================
   Loader
   ============================================ */
.loader {
  position: fixed;
  inset: 0;
  background: var(--c-bg-darker);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s var(--ease-out), visibility .6s var(--ease-out);
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-inner {
  text-align: center;
  color: #fff;
}

.loader-mark {
  font-size: 24px;
  color: var(--c-accent);
  margin-bottom: 16px;
  animation: pulse 1.4s ease-in-out infinite;
}

.loader-text {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--c-ink-muted);
  margin-bottom: 12px;
}

.loader-bar {
  width: 200px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.loader-bar span {
  position: absolute;
  inset: 0;
  background: var(--c-accent);
  transform: translateX(-100%);
  animation: loadBar 1.6s var(--ease-out) infinite;
}

@keyframes loadBar {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0%); }
  100% { transform: translateX(101%); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ============================================
   Typography Helpers
   ============================================ */
.t-line {
  display: block;
  overflow: hidden;
}

.t-line > span {
  display: block;
  transform: translateY(110%);
  will-change: transform;
}

[data-split-text] .t-line > span {
  transform: translateY(0); /* set initial to be revealed by JS */
}

.muted { color: var(--c-ink-muted); }
[data-theme="light"] .muted { color: var(--c-ink-muted-dark); }

/* ============================================
   Scroll hint
   ============================================ */
.scroll-hint {
  position: absolute;
  left: var(--pad-x);
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--c-ink-muted);
  z-index: 5;
}

.scroll-hint .line {
  width: 40px;
  height: 1px;
  background: currentColor;
  position: relative;
  overflow: hidden;
}

.scroll-hint .line::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: var(--c-accent-2);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%   { left: -100%; }
  50%  { left: 0%; }
  100% { left: 101%; }
}

/* ============================================
   Link arrow
   ============================================ */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  position: relative;
  padding-bottom: 4px;
}

.link-arrow::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: currentColor;
  transition: width .35s var(--ease-out);
}

.link-arrow:hover::after { width: 100%; }

/* ============================================
   Buttons
   ============================================ */
.btn-light {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  transition: background .25s var(--ease-soft), border-color .25s var(--ease-soft);
}

.btn-light:hover {
  background: #fff;
  color: var(--c-ink-dark);
}

/* ============================================
   Section Title (generic)
   ============================================ */
.section-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--c-ink-muted);
  margin-bottom: 18px;
}

[data-theme="light"] .section-title { color: var(--c-ink-muted-dark); }

.lead {
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.7;
  color: var(--c-ink-muted);
  margin-bottom: 28px;
}

[data-theme="light"] .lead { color: var(--c-ink-muted-dark); }

/* ============================================
   Utility
   ============================================ */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.7;
}

.is-hidden { display: none !important; }
.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;
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cursor, .cursor-dot { display: none; }
  body { cursor: auto; }
}

/* ============================================
   Responsive Container Width Tokens
   Re-defines --max-width / --max-width-inner / --gutter per breakpoint.
   All sections that opt-in via max-width: var(--max-width) scale together.
   ============================================ */

/* 1600+ : 大屏 — 容器放大, 1440-1920 用 */
@media (min-width: 1600px) {
  :root {
    --max-width: 1600px;
    --max-width-inner: 1440px;
    --gutter: 32px;
  }
}

/* 1280 - 1440 : 主流笔记本 */
@media (max-width: 1440px) {
  :root {
    --max-width: 1280px;
    --max-width-inner: 1200px;
    --gutter: 24px;
  }
}

/* 1024 - 1280 : 小笔记本 / 横屏平板 */
@media (max-width: 1280px) {
  :root {
    --max-width: 1100px;
    --max-width-inner: 1024px;
    --gutter: 20px;
  }
}

/* 768 - 1024 : 平板竖屏 */
@media (max-width: 1024px) {
  :root {
    --max-width: 920px;
    --max-width-inner: 840px;
    --gutter: 16px;
  }
}

/* < 768 : 手机 */
@media (max-width: 768px) {
  :root {
    --max-width: 100%;
    --max-width-inner: 100%;
    --gutter: 12px;
  }
}
