/* ============================================================
   pages.renfei.dev — landing (light, motion-led)
   Paper-white stock, ink type, one vermilion accent.
   The idea: a scratch address for whatever is on localhost.
   ============================================================ */

:root {
  --bg:      oklch(97.4% 0.006 85);
  --s1:      oklch(99.6% 0.003 85);
  --s2:      oklch(94.6% 0.008 85);
  --line:    oklch(88.5% 0.010 80);
  --line-2:  oklch(92.5% 0.007 80);

  --ink:     oklch(22%   0.018 60);
  --ink-2:   oklch(35%   0.014 60);
  --ink-3:   oklch(45%   0.012 60);

  --brand:      oklch(52% 0.180 45);
  --brand-deep: oklch(43% 0.150 42);
  --ok:         oklch(48% 0.130 150);

  --sans: 'Instrument Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --disp: 'Space Grotesk', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gut: clamp(20px, 4vw, 56px);
  --maxw: 1280px;
  --rh: 8px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
code, pre, kbd { font-family: var(--mono); }
dl, ol, ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: 3px; border-radius: 2px; }
.mono { font-family: var(--mono); font-variant-ligatures: none; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }

.skip { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--s2); color: var(--ink); padding: 12px 16px; }
.skip:focus { left: 12px; top: 12px; }

/* ---------- texture layers ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  opacity: .030; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.mesh {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(58,44,32,.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(58,44,32,.055) 1px, transparent 1px);
  background-size: 76px 76px;
  animation: drift 46s linear infinite;
  -webkit-mask-image: radial-gradient(ellipse 100% 68% at 50% -10%, #000 20%, transparent 80%);
          mask-image: radial-gradient(ellipse 100% 68% at 50% -10%, #000 20%, transparent 80%);
}
@keyframes drift { to { background-position: 76px 76px; } }

.spot {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(440px circle at var(--mx, 50%) var(--my, 24%), rgba(255,138,38,.14), transparent 68%);
  opacity: 0; transition: opacity .6s var(--ease);
}
.spot.is-on { opacity: 1; }

/* ============================================================
   nav
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid transparent;
  transition: background .4s var(--ease), border-color .4s var(--ease);
  animation: fadeDown .8s var(--ease) both;
}
.nav.is-stuck {
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  border-bottom-color: var(--line-2);
}
@supports not (background: color-mix(in oklab, red, blue)) {
  .nav.is-stuck { background: rgba(250,248,245,.9); }
}
.nav__in { display: flex; align-items: center; gap: 24px; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 11px; height: 11px; flex: none; background: var(--brand);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: spinMark 14s linear infinite;
}
@keyframes spinMark { to { transform: rotate(360deg); } }
.brand__name { font-family: var(--disp); font-weight: 700; letter-spacing: -.01em; font-size: 1.0625rem; }
.brand__dim { color: var(--ink-3); font-weight: 500; }

.status { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.status__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px color-mix(in oklab, var(--ok) 16%, transparent); }
  50%      { opacity: .4; box-shadow: 0 0 0 6px color-mix(in oklab, var(--ok) 5%, transparent); }
}
.status__text { transition: opacity .3s var(--ease); }
.status__text.is-swap { opacity: 0; }

/* ============================================================
   hero
   ============================================================ */
.hero {
  padding-top: clamp(56px, 12vh, 140px);
  padding-bottom: clamp(48px, 8vh, 96px);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: .75rem; letter-spacing: .12em;
  color: var(--ink-3);
  animation: fadeUp .8s var(--ease) both; animation-delay: var(--d, 0s);
}
.eyebrow__sq { width: 6px; height: 6px; background: var(--brand); flex: none; }

.hero__title {
  font-family: var(--disp);
  font-weight: 600;
  font-size: clamp(3rem, 12vw, 9.5rem);
  line-height: .96;
  letter-spacing: -.045em;
  margin-top: calc(var(--rh) * 3);
}
.hero__title .mono { font-size: .84em; letter-spacing: -.03em; }
.hero__title .line {
  display: block;
  animation: reveal 1.05s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes reveal {
  from { clip-path: inset(0 100% -25% 0); opacity: 0; filter: blur(14px); transform: translateY(.16em); }
  to   { clip-path: inset(0 -25% -25% 0); opacity: 1; filter: blur(0);    transform: none; }
}

.hl { position: relative; color: var(--brand); }
.hl::after {
  content: ""; position: absolute; left: 0; right: .04em; bottom: .06em; height: .055em;
  background: currentColor; opacity: .55;
  transform: scaleX(0); transform-origin: left;
  animation: underline .7s var(--ease) .95s both;
}
@keyframes underline { to { transform: scaleX(1); } }

.hero__sub {
  max-width: 40ch;
  margin-top: calc(var(--rh) * 4);
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--ink-2);
  animation: fadeUp .8s var(--ease) both; animation-delay: var(--d, 0s);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.readout {
  display: flex; flex-wrap: wrap; gap: clamp(20px, 4vw, 56px);
  margin-top: calc(var(--rh) * 8);
  padding-top: calc(var(--rh) * 3);
  border-top: 1px solid var(--line-2);
  animation: fadeUp .8s var(--ease) both; animation-delay: var(--d, 0s);
}
.readout__i { display: grid; gap: 4px; }
.readout__i dt { font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.readout__i dd { font-size: .8125rem; color: var(--ink); }
.dot-live {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ok); margin-right: 6px; vertical-align: 1px;
  animation: pulse 2.6s var(--ease) infinite;
}

/* ============================================================
   swap: localhost -> shareable url
   ============================================================ */
.swap {
  padding-block: clamp(44px, 8vh, 88px);
  border-top: 1px solid var(--line-2);
}
.swap__row {
  display: flex; align-items: baseline; gap: clamp(12px, 2vw, 24px);
  overflow: hidden;
}
.swap__v {
  font-size: clamp(.9rem, 3.3vw, 2.4rem);
  font-weight: 500; letter-spacing: -.025em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
}
.swap__ar {
  font-size: clamp(1rem, 2.6vw, 1.9rem);
  color: var(--brand);
  animation: nudge 3.6s var(--ease) infinite;
}
@keyframes nudge {
  0%, 72%, 100% { transform: translateX(0); opacity: .9; }
  82%           { transform: translateX(6px); opacity: 1; }
}
.swap__cap {
  margin-top: calc(var(--rh) * 2);
  font-size: .75rem; letter-spacing: .06em; color: var(--ink-3);
}

/* keyword marquee */
.marquee {
  margin-top: clamp(28px, 5vh, 56px);
  overflow: hidden;
  border-block: 1px solid var(--line-2);
  padding-block: 13px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.marquee__track {
  display: flex; align-items: center; gap: 14px;
  width: max-content;
  font-family: var(--mono); font-size: .8125rem;
  color: var(--ink-3); white-space: nowrap;
  animation: slide 40s linear infinite;
}
.marquee__track i { font-style: normal; color: var(--brand); opacity: .55; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }

/* ============================================================
   routes stage
   ============================================================ */
.routes { padding-block: clamp(32px, 5vh, 64px); }

.routes__head {
  display: flex; align-items: baseline; gap: 14px;
  font-size: .75rem; letter-spacing: .1em;
}
.routes__k { color: var(--brand-deep); }
.routes__v { color: var(--ink-3); }
.routes__note {
  margin-top: 6px;
  font-size: .8125rem; color: var(--ink-3); max-width: 42ch;
}

.stage {
  margin-top: calc(var(--rh) * 3);
  width: 100%;
  overflow: hidden;
  transform: translate3d(0, calc(var(--sy, 0) * -0.06px), 0);
  will-change: transform;
}
.net { width: 100%; height: auto; display: block; overflow: visible; }

.wire {
  stroke: url(#wireGrad);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw 1.15s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.node {
  fill: var(--brand);
  transform-box: fill-box; transform-origin: center;
  animation: pop .55s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.label {
  font-family: var(--mono); font-size: 13px;
  fill: var(--ink-3);
  transform-box: fill-box;
  animation: slideIn .7s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.pulse {
  fill: var(--brand);
  filter: drop-shadow(0 0 7px rgba(255,138,38,.55));
  opacity: 0;
}

/* ============================================================
   elsewhere: blog / home / mail
   ============================================================ */
.elsewhere {
  padding-block: clamp(56px, 10vh, 128px);
  border-top: 1px solid var(--line-2);
}
.elsewhere__t {
  font-family: var(--disp); font-weight: 500;
  font-size: clamp(1.25rem, 2.6vw, 1.875rem);
  letter-spacing: -.025em;
  margin-bottom: calc(var(--rh) * 3);
}
.links__i { border-top: 1px solid var(--line-2); }
.links__i:last-child { border-bottom: 1px solid var(--line-2); }
.links__i a {
  display: flex; align-items: baseline; gap: 12px;
  padding-block: 16px;
}
.links__k { font-size: .9375rem; color: var(--ink); transition: color .3s var(--ease); }
.links__leader { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-5px); transition: border-color .3s var(--ease); }
.links__v { font-size: .8125rem; color: var(--ink-3); transition: color .3s var(--ease); }
.links__ar {
  font-size: .875rem; color: var(--brand);
  opacity: 0; transform: translateX(-6px);
  transition: opacity .3s var(--ease), transform .35s var(--ease);
}
.links__i a:hover .links__k { color: var(--brand-deep); }
.links__i a:hover .links__leader { border-color: var(--brand); }
.links__i a:hover .links__v { color: var(--ink-2); }
.links__i a:hover .links__ar { opacity: 1; transform: none; }

/* ============================================================
   footer
   ============================================================ */
.foot { border-top: 1px solid var(--line-2); padding-block: calc(var(--rh) * 4); }
.foot__in { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot__host { font-size: .8125rem; color: var(--ink-2); }
.foot__copy { font-size: .75rem; color: var(--ink-3); }

/* ============================================================
   reveal on scroll
   ============================================================ */
.js [data-reveal] { opacity: 0; transform: translateY(16px); }
[data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 860px) {
  .routes__head { display: none; }
}
@media (max-width: 640px) {
  .hero__title { font-size: clamp(2.6rem, 15vw, 5rem); }
  .readout { gap: 18px 32px; }
  .label { font-size: 16px; }
  .links__v { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
  .wire { stroke-dashoffset: 0; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .pulse { display: none; }
}
