/* =========================================================
   chucinegerenji.qd.je  —  global stylesheet
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --accent: #2F6BFF;      /* 主蓝 */
  --accent-2: #22D3EE;    /* 青 */
  --accent-3: #818CF8;    /* 淡紫蓝 */
  --warm: #FFB86B;        /* 温馨暖点 */

  --bg: #070D1A;
  --bg-soft: #0C1526;
  --surface: rgba(120, 170, 255, 0.055);
  --surface-2: rgba(120, 170, 255, 0.10);
  --border: rgba(120, 170, 255, 0.14);
  --border-strong: rgba(120, 170, 255, 0.26);

  --text: #EAF1FF;
  --text-dim: #9FB0CC;
  --text-faint: #6B7C9C;

  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 1080px;
  --nav-h: 68px;

  --ease: cubic-bezier(.22, .8, .28, 1);
  --fast: .2s var(--ease);
  --slow: .6s var(--ease);

  --shadow: 0 22px 60px -28px rgba(6, 20, 60, .9);
  --glow: 0 0 0 1px rgba(120, 170, 255, .10), 0 18px 42px -24px rgba(47, 107, 255, .55);
}

html[data-theme="light"] {
  --bg: #F2F7FF;
  --bg-soft: #FFFFFF;
  --surface: rgba(47, 107, 255, 0.045);
  --surface-2: rgba(47, 107, 255, 0.085);
  --border: rgba(28, 66, 140, 0.10);
  --border-strong: rgba(28, 66, 140, 0.20);

  --text: #0B1730;
  --text-dim: #4C5F80;
  --text-faint: #8296B4;

  --shadow: 0 22px 55px -30px rgba(28, 66, 140, .40);
  --glow: 0 0 0 1px rgba(47, 107, 255, .10), 0 18px 42px -26px rgba(47, 107, 255, .45);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: .01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--fast), color var(--fast);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }
p { margin: 0; }

::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(100% - 40px, var(--maxw)); margin-inline: auto; }
.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;
}

/* =========================================================
   background mesh
   ========================================================= */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .40;
  will-change: transform;
}
html[data-theme="light"] .blob { opacity: .30; }

.b1 { width: 46vw; height: 46vw; background: var(--accent);   top: -14vw; left: -10vw; animation: drift1 22s var(--ease) infinite alternate; }
.b2 { width: 40vw; height: 40vw; background: var(--accent-2); top: 22vh;  right: -12vw; animation: drift2 26s var(--ease) infinite alternate; }
.b3 { width: 34vw; height: 34vw; background: var(--accent-3); bottom: -12vw; left: 26vw; animation: drift3 30s var(--ease) infinite alternate; }
.b4 { width: 22vw; height: 22vw; background: var(--warm);      top: 46vh;  left: 4vw;    opacity: .22; animation: drift1 34s var(--ease) infinite alternate-reverse; }

@keyframes drift1 { to { transform: translate3d(6vw, 5vh, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-7vw, -6vh, 0) scale(1.08); } }
@keyframes drift3 { to { transform: translate3d(4vw, -5vh, 0) scale(1.15); } }

.grain {
  position: absolute; inset: 0; opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   nav
   ========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 34px);
  transition: background var(--fast), border-color var(--fast), backdrop-filter var(--fast);
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-weight: 700; font-size: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 650; }
.brand-text small { font-size: 10.5px; color: var(--text-faint); letter-spacing: .04em; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--text-dim);
  transition: color var(--fast), background var(--fast);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }

.nav-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: all var(--fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

html[data-theme="dark"]  .i-sun  { display: none; }
html[data-theme="light"] .i-moon { display: none; }

.menu-btn { display: none; }

@media (max-width: 720px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: fixed;
    top: var(--nav-h); left: 12px; right: 12px;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-soft) 94%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    opacity: 0; transform: translateY(-10px); pointer-events: none;
    transition: opacity var(--fast), transform var(--fast);
  }
  .nav-links.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-links a { padding: 12px 14px; font-size: 15px; }
}

/* =========================================================
   hero
   ========================================================= */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding: calc(var(--nav-h) + 40px) 0 100px;
  position: relative;
}

.eyebrow {
  font-size: 11.5px;
  letter-spacing: .22em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(38px, 9vw, 78px);
  line-height: 1.06;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .35em;
}
.hero-title .line1 { font-weight: 350; color: var(--text-dim); }

.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shine 7s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.typing-wrap {
  margin-top: 22px;
  font-size: clamp(17px, 3.4vw, 23px);
  color: var(--text);
  min-height: 1.6em;
  display: flex;
  align-items: center;
  gap: 2px;
}
.caret {
  display: inline-block;
  width: 2px; height: 1.05em;
  background: var(--accent);
  animation: blink 1.05s steps(2, start) infinite;
  border-radius: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-intro {
  margin-top: 22px;
  max-width: 52ch;
  color: var(--text-dim);
  font-size: 16px;
}

.hero-btns { margin-top: 38px; display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast), border-color var(--fast);
}
.btn:active { transform: scale(.97); }

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px -14px color-mix(in srgb, var(--accent) 75%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px color-mix(in srgb, var(--accent) 85%, transparent); }

.btn-ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: var(--surface-2); transform: translateY(-2px); }

.scroll-hint {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 38px;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  display: grid;
  justify-items: center;
  padding-top: 7px;
}
.scroll-hint span {
  width: 3px; height: 7px;
  border-radius: 2px;
  background: var(--text-dim);
  animation: wheel 1.7s var(--ease) infinite;
}
@keyframes wheel { 0% { opacity: 0; transform: translateY(0);} 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

@media (max-width: 600px) { .scroll-hint { display: none; } .hero { padding-bottom: 70px; } }

/* =========================================================
   stats
   ========================================================= */
.stats { width: min(100% - 40px, var(--maxw)); margin: 0 auto 40px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: var(--bg-soft);
  padding: 24px 18px;
  text-align: center;
}
.stat b {
  display: block;
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 700;
  letter-spacing: -.03em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { font-size: 13px; color: var(--text-faint); }

/* =========================================================
   sections
   ========================================================= */
.section {
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding: clamp(70px, 12vh, 130px) 0;
}

.sec-head { margin-bottom: 44px; }
.sec-head h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(26px, 5vw, 38px);
}
.sec-head .idx {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.sec-sub { margin-top: 12px; color: var(--text-faint); font-size: 15px; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.35fr .95fr;
  gap: 26px;
  align-items: start;
}
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }

.about-copy p { color: var(--text-dim); margin-bottom: 18px; font-size: 16.5px; }
.about-copy p:last-child { margin-bottom: 0; }

.about-card { text-align: center; }
.about-initial {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 22px;
  font-size: 32px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent) 80%, transparent);
}
.about-card h3 { font-size: 16px; font-weight: 600; color: var(--text-dim); margin-bottom: 20px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tag-list li {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
}

/* ---------- works ---------- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 18px;
}

.work {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: transform var(--slow), border-color var(--fast), background var(--fast);
}
.work::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(340px 160px at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  opacity: 0; transition: opacity var(--fast);
  pointer-events: none;
}
.work:hover { transform: translateY(-5px); border-color: var(--border-strong); background: var(--surface-2); }
.work:hover::after { opacity: 1; }

.work-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  font-size: 20px;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.work h3 { font-size: 18px; }
.work p { color: var(--text-dim); font-size: 14.5px; flex: 1; }
.work-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.work-tags span {
  font-size: 11px; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-faint);
}
.work-arrow {
  position: absolute; top: 22px; right: 22px;
  color: var(--text-faint);
  transition: transform var(--fast), color var(--fast);
}
.work:hover .work-arrow { transform: translate(3px, -3px); color: var(--accent); }
.work-arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- contact ---------- */
.contact-wrap { display: flex; flex-direction: column; gap: 26px; }

.mail-big {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(19px, 4.6vw, 34px);
  font-weight: 600;
  letter-spacing: -.02em;
  width: fit-content;
  max-width: 100%;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  transition: border-color var(--fast), color var(--fast);
  word-break: break-all;
}
.mail-big:hover { border-color: var(--accent); color: var(--accent); }
.mail-big svg { width: 26px; height: 26px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--fast); }
.mail-big:hover svg { transform: translateX(5px); }

.link-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link-row a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: all var(--fast);
}
.link-row a:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }

/* =========================================================
   footer
   ========================================================= */
.footer {
  border-top: 1px solid var(--border);
  padding: 30px 20px 44px;
  margin-top: 40px;
}
.foot-inner {
  width: min(100%, var(--maxw));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-faint);
}
.foot-inner a:hover { color: var(--text); }
.dot { opacity: .45; }

/* =========================================================
   to-top
   ========================================================= */
.to-top {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(14px);
  color: var(--text-dim);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: all var(--fast);
  z-index: 90;
}
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================
   reveal —— 默认可见；只有 JS 正常时才启用入场动画
   ========================================================= */
.reveal { opacity: 1; transform: none; }

html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
html.js .reveal.in { opacity: 1; transform: none; }

/* =========================================================
   toast
   ========================================================= */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: all var(--fast);
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   tools page
   ========================================================= */
.page-head {
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding: calc(var(--nav-h) + 56px) 0 34px;
}
.page-head h1 { font-size: clamp(30px, 7vw, 50px); }
.page-head p { margin-top: 14px; color: var(--text-dim); max-width: 56ch; }

.tool-grid {
  width: min(100% - 40px, var(--maxw));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding-bottom: 60px;
}

.tool { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.tool h3 { font-size: 16px; display: flex; align-items: center; gap: 9px; }
.tool h3 em { font-style: normal; font-size: 15px; }
.tool .hint { font-size: 12.5px; color: var(--text-faint); }

.field {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  transition: border-color var(--fast);
}
.field:focus { outline: none; border-color: var(--accent); }
textarea.field { min-height: 96px; line-height: 1.6; }

.tool-row { display: flex; flex-wrap: wrap; gap: 9px; }

.mini {
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 550;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  transition: all var(--fast);
}
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.mini.primary:hover { transform: translateY(-1px); color: #fff; }

.out {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  word-break: break-all;
  min-height: 44px;
  white-space: pre-wrap;
}
.out.ok { border-style: solid; border-color: color-mix(in srgb, #22c55e 45%, transparent); color: var(--text); }
.out.err { border-style: solid; border-color: color-mix(in srgb, #ef4444 55%, transparent); color: #fca5a5; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  transition: all var(--fast);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on { color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); border-color: transparent; }

/* range */
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------- notfound ---------- */
.nf {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: 40px 24px;
}
.nf h1 { font-size: clamp(70px, 22vw, 160px); letter-spacing: -.05em; background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nf p { color: var(--text-dim); max-width: 40ch; }
