@import url("./fonts.css");

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #111213;
  --bg-soft: #18191a;
  --panel: rgba(237, 237, 237, 0.045);
  --panel-strong: rgba(237, 237, 237, 0.075);
  --line: rgba(237, 237, 237, 0.09);
  --line-strong: rgba(237, 237, 237, 0.15);
  --fg: #ededed;
  --fg-dim: #b5b5b5;
  --fg-mute: #929292;
  --accent: #e28a63;
  --accent-2: #e28a63;
  --accent-rgb: 226, 138, 99;
  --accent-2-rgb: 226, 138, 99;
  --radius: 24px;
  --skill-snap-duration: 560ms;
  --font-display: "Space Grotesk", "Inter", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-body: "Inter", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --maxw: 1160px;
}

* { box-sizing: border-box; }

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

::selection { background: rgba(var(--accent-rgb), 0.32); color: #fff; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: #111213;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  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.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }

.page {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 96px;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  transition: backdrop-filter 0.4s var(--ease-out), background 0.4s var(--ease-out), border-color 0.4s;
}

.topbar.is-stuck {
  background: rgba(8, 8, 11, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
  margin: 0 -24px;
  padding: 14px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 17px;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.9);
}

.brand small {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--fg-dim);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover { color: var(--fg); background: var(--panel); }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background 0.3s;
}

.pill-link:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.1);
}

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: 40px 0 24px;
  text-align: center;
}

/* The avatar sits in its own stacking layer above the message windows. */
.avatar-stage {
  position: relative;
  width: 100%;
  max-width: 880px;
  height: 410px;
  margin: 0 auto 16px;
  isolation: isolate;
  /* Windows and the orbit ring must never widen the page layout. */
  overflow: hidden;
}

.stage-orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  pointer-events: none;
  animation: orbit-spin 48s linear infinite;
}

.stage-orbit::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 72%, rgba(var(--accent-rgb), 0.55) 84%, transparent 90%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  opacity: 0.9;
}

@keyframes orbit-spin { to { transform: rotate(360deg); } }

/* floating macOS-style message windows */
.stage-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.msg-window {
  position: absolute;
  width: 184px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(22, 22, 30, 0.82);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: center;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out), box-shadow 0.4s;
  will-change: transform, opacity;
}

.msg-window.is-in { opacity: 1; }
.msg-window:hover { box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55); }
.msg-window.is-dragging { cursor: grabbing; transition: box-shadow 0.2s; }

.win-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.win-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
  opacity: 0.95;
  transition: filter 0.2s, opacity 0.2s;
}

.win-dot:hover { filter: brightness(1.25); }
.win-dot.close { background: #ff5f57; }
.win-dot.minimize { background: #febb2e; }
.win-dot.maximize { background: #28c840; }

.win-title {
  flex: 1;
  min-width: 0;
  margin-left: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(244, 244, 246, 0.42);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-body {
  padding: 9px 10px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(244, 244, 246, 0.9);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.win-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 8px;
  font-size: 10.5px;
  color: rgba(244, 244, 246, 0.36);
}

.win-like {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 2px 4px;
  border-radius: 6px;
  font-size: 11px;
  color: inherit;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.win-like:hover { color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }
.win-like.is-liked { color: var(--accent); }
.win-like svg { width: 11px; height: 11px; fill: currentColor; }

/* A closed window refills its slot, so the ring never leaves a hole. */
.msg-window.is-zoomed {
  z-index: 60;
  width: 226px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(var(--accent-rgb), 0.4);
}

.msg-window.is-zoomed .win-body {
  -webkit-line-clamp: 7;
  font-size: 13px;
}

.stage-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, 130px);
  font-size: 12.5px;
  color: var(--fg-mute);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* the avatar layer is always the topmost element of the stage */
.avatar-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* The portrait itself stays interactive (it is the site's focal point). */
.avatar-layer .hero-ring,
.avatar-layer .status-badge { pointer-events: auto; }

.hero-ring {
  position: relative;
  width: 188px;
  height: 188px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.hero-ring::before,
.hero-ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), #22d3ee, var(--accent));
  opacity: 0.75;
  filter: blur(14px);
  z-index: -1;
  animation: spin 14s linear infinite;
}

.hero-ring::after {
  inset: -3px;
  filter: blur(2px);
  opacity: 0.9;
  animation-direction: reverse;
  animation-duration: 26s;
}

.avatar {
  width: 188px;
  height: 188px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-soft);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
}

@keyframes spin { to { transform: rotate(360deg); } }

.status-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(12, 12, 16, 0.92);
  backdrop-filter: blur(10px);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  white-space: nowrap;
  z-index: 2;
}

.status-badge .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.hero-name {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-name .grad {
  color: var(--fg);
  background: none;
  animation: none;
}

@keyframes shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-en {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

.bio-window {
  width: min(100%, 680px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(237, 237, 237, 0.12);
  border-radius: 14px;
  background: rgba(24, 25, 26, 0.62);
  -webkit-backdrop-filter: blur(14px) saturate(108%);
  backdrop-filter: blur(14px) saturate(108%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.bio-window-bar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(237, 237, 237, 0.08);
  background: rgba(237, 237, 237, 0.025);
}

.bio-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #66696b;
}

.bio-dot-close { background: #ff5f57; }
.bio-dot-minimize { background: #febb2e; }
.bio-dot-maximize { background: #28c840; }

.hero-bio {
  max-width: 100%;
  min-height: 112px;
  max-height: 156px;
  margin: 0;
  padding: 18px 20px 20px;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.72;
  color: var(--fg-dim);
  text-align: left;
  white-space: pre-line;
  scrollbar-width: thin;
  scrollbar-color: rgba(237, 237, 237, 0.2) transparent;
}

.bio-text { white-space: pre-line; }

.type-caret {
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--fg-dim);
  animation: caret-blink 1.05s steps(2, start) infinite;
}

@keyframes caret-blink { to { visibility: hidden; } }

@media (max-width: 720px) {
  .bio-window { width: 100%; border-radius: 12px; }
  .bio-window-bar { height: 32px; }
  .hero-bio { min-height: 104px; max-height: 140px; padding: 14px 16px 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .type-caret { animation: none; opacity: 1; }
}

/* free-form profile info list (location / email / links) */
.hero-info {
  margin: 26px auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 9px;
  max-width: 760px;
}

.info-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  color: var(--fg-dim);
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background 0.3s, color 0.3s;
}

.info-item[href]:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--fg);
}

.info-item .info-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  font-size: 12px;
  color: var(--accent);
  flex: 0 0 auto;
}

.info-item .info-icon svg { width: 13px; height: 13px; fill: currentColor; }
.info-item .info-value { color: var(--fg); }
.info-item .info-label { color: var(--fg-mute); font-size: 12px; }

/* ----------------------------------------------------------------- marquee */
.marquee {
  margin: 44px -24px 0;
  padding: 16px 0;
  border-block: 1px solid var(--line);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: marquee 26s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 40px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-mute);
  white-space: nowrap;
}

.marquee-item::after {
  content: "◆";
  font-size: 8px;
  color: var(--accent);
  opacity: 0.7;
}

@keyframes marquee { to { transform: translateX(-50%); } }

/* ----------------------------------------------------------------- section */
.section { padding: 92px 0 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
}

.section-title {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section-sub { margin: 0; color: var(--fg-dim); font-size: 15px; max-width: 460px; }

/* ----------------------------------------------------------- flip carousel */
.ring-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 0;
}

/* Reusable 3D orbit carousel: the stage is a snap window, the track is a
   perspective plane, and each skill face is positioned relative to its centre. */
.scroll-scene {
  position: relative;
  width: 100%;
  height: 520px;
  outline: none;
  touch-action: pan-y;
  overflow: hidden;
  perspective: var(--carousel-perspective, 1200px);
  perspective-origin: 50% 48%;
  isolation: isolate;
}

.orbit-stage {
  position: absolute;
  inset: 0;
  perspective: var(--carousel-perspective, 1200px);
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  overflow: visible;
}

.orbit-track {
  position: absolute;
  top: 50%;
  height: 1px;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.scroll-scene.is-dragging .orbit-track { transition: none !important; }

.ring-card {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid rgba(237, 237, 237, 0.12);
  border-radius: 22px;
  background: rgba(34, 36, 38, 0.54);
  -webkit-backdrop-filter: blur(16px) saturate(108%);
  backdrop-filter: blur(16px) saturate(108%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  opacity: 0.3;
  pointer-events: none;

  transition:
    transform var(--skill-snap-duration) cubic-bezier(0.22, 0.72, 0.22, 1),
    opacity 380ms ease,
    border-color 360ms ease,
    background-color 360ms ease,
    box-shadow 460ms ease;
  will-change: transform, opacity;
  pointer-events: auto;
}

.ring-card.is-front {
  border-color: rgba(237, 237, 237, 0.23);
  background: rgba(34, 36, 38, 0.62);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  opacity: 1;
  filter: none;
}

.ring-card[data-skill-index]:not(.is-front) { cursor: pointer; }

.ring-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(237, 237, 237, 0.045);
  pointer-events: none;
}

/* --- card content -------------------------------------------------------- */
/* One coloured mark per card: a bare line icon. No tinted tile, no ring —
   the glyph itself carries the accent, everything else stays graphite. */
.skill-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: rgb(var(--card-accent));
  margin: 2px 0 14px -1px;
  flex: 0 0 auto;
}

.skill-icon svg { width: 26px; height: 26px; display: block; }
.skill-icon .icon-text { font-size: 20px; line-height: 1; }

/* The category line is a quiet label, not a second coloured headline. */
.skill-subtitle {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-mute);
  margin-bottom: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-title {
  margin: 0 0 9px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 0 0 auto;
}

.skill-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--fg-dim);
  flex: 1 1 auto;
  min-height: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-progress {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.progress-bar {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--level, 0%);
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 1.1s var(--ease-out);
}

.ring-card.is-in .progress-fill { transform: scaleX(1); }

.progress-value {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* Tags size themselves: a fixed max-height used to slice the bottom off
   every pill, because the pill is taller than one line of card text. */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  flex: 0 0 auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.03);
}

.carousel-controls {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

.carousel-dots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }

.dot-btn {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: rgba(237, 237, 237, 0.28);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.24s ease, transform 0.24s ease;
}

.dot-btn.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

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

.work-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.014));
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--ease-out), border-color 0.4s, box-shadow 0.5s;
  color: inherit;
}

.work-card:hover {
  transform: translateY(-6px);
  border-color: rgba(var(--work-accent), 0.55);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.5);
}

.work-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #101017;
}

.work-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out), filter 0.5s;
}

.work-card:hover .work-cover img { transform: scale(1.05); }

.work-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 10, 14, 0.85));
}

.work-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 9px; flex: 1; }

.work-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(var(--work-accent), 0.95);
  font-weight: 600;
}

.work-meta .work-date { color: var(--fg-mute); letter-spacing: 0.04em; font-weight: 500; }
.work-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-mute); }

.work-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.work-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }

.work-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--fg-mute);
  transition: color 0.3s, gap 0.3s;
}

.work-card:hover .work-open { color: rgb(var(--work-accent)); gap: 10px; }

.work-empty { margin-top: 4px; }

/* -------------------------------------------------------------- work detail */
.detail-page {
  min-height: 100vh;
  padding-bottom: 90px;
}

.detail-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 26px 0 30px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 13px;
  color: var(--fg-dim);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.detail-back:hover { color: var(--fg); border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.1); }

.detail-hero-img {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #101017;
  margin-bottom: 30px;
}

.detail-hero-img img { width: 100%; display: block; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.detail-summary { margin: 0 0 26px; font-size: 17px; color: var(--fg-dim); line-height: 1.7; }

.detail-desc {
  font-size: 15.5px;
  line-height: 1.85;
  color: rgba(244, 244, 246, 0.84);
  white-space: pre-line;
}

.detail-actions { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), #ff8a6b 48%, var(--accent-2));
  color: #150708;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.25s var(--ease-out), box-shadow 0.3s;
}

.detail-link:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(var(--accent-rgb), 0.3); }

.detail-missing { padding: 80px 0; text-align: center; color: var(--fg-mute); }

/* -------------------------------------------------------------- guestbook */
/* One form, two layouts: a two-column grid on wide screens and a single
   column on phones. Quiet surface, one primary action. */
.guestbook-form {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.form-card {
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
}

.gb-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.form-card p.hint { margin: 0 0 20px; font-size: 13px; color: var(--fg-mute); }

.gb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.gb-wide { grid-column: 1 / -1; }

.field { margin: 0; }

.field label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-dim);
}

.field-note { font-size: 12px; font-weight: 400; color: var(--fg-mute); }

.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--fg-mute); }

.field input:hover,
.field textarea:hover { border-color: var(--line-strong); }

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.field textarea {
  min-height: 120px;
  line-height: 1.6;
  resize: vertical;
}

.gb-meta { display: flex; justify-content: flex-end; margin-top: 6px; }
.gb-counter { font-size: 11.5px; color: var(--fg-mute); font-variant-numeric: tabular-nums; }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.gb-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

/* The one warm note: a solid accent, dark text, no gradient or lift. */
.btn-primary {
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #16130f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

.form-note { margin: 0; font-size: 12px; color: var(--fg-mute); }

.form-status {
  margin-top: 12px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  display: none;
}

.form-status.is-error { display: block; background: rgba(255, 90, 67, 0.1); color: #ffb3a5; border: 1px solid rgba(255, 90, 67, 0.28); }
.form-status.is-ok { display: block; background: rgba(74, 222, 128, 0.08); color: #8ff0b6; border: 1px solid rgba(74, 222, 128, 0.24); }

@media (max-width: 720px) {
  .form-card { padding: 20px; }
  .gb-grid { grid-template-columns: 1fr; gap: 14px; }
  .gb-actions { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .gb-actions .btn-primary { width: 100%; }
  .form-note { text-align: center; }
}

/* ------------------------------------------------------------------- tip */
/* The tip form keeps the same quiet card as the guestbook: presets are
   selectable amounts, custom amount sits below, one primary action. */
.pay-card { max-width: 720px; margin: 0 auto; }

.pay-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.pay-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.pay-preset:hover { border-color: var(--line-strong); background: var(--panel); }

.pay-preset.is-active {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.06);
}

.pay-preset-name { font-size: 12.5px; color: var(--fg-mute); }

.pay-preset-amount {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.pay-preset-note { font-size: 11.5px; color: var(--fg-mute); }

.pay-custom { margin-top: 20px; }

.pay-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-dim);
}

.pay-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.pay-amount:focus-within {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.pay-amount span { color: var(--fg-mute); font-size: 15px; }

.pay-amount input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  outline: none;
}

.pay-amount input::-webkit-outer-spin-button,
.pay-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pay-amount input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.pay-amount input::placeholder { color: var(--fg-mute); font-size: 16px; }

.pay-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.pay-name {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.pay-name:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.pay-card .form-note { margin-top: 14px; }
.pay-card .form-status { margin-top: 12px; }

/* Recent tips under the form: a quiet ledger, not a leaderboard. */
.pay-records {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
}

.pay-records-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.pay-records-head h3 { margin: 0; font-size: 14px; font-weight: 500; color: var(--fg); }
.pay-records-count { font-size: 12px; color: var(--fg-mute); font-variant-numeric: tabular-nums; }

.pay-record-list { list-style: none; margin: 0; padding: 0; }

.pay-record {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pay-record:last-child { border-bottom: 0; padding-bottom: 0; }

.pay-record-name { font-size: 13.5px; color: var(--fg); }

.pay-record-meta {
  font-size: 12px;
  color: var(--fg-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pay-record-amount {
  font-family: var(--font-display);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

@media (max-width: 720px) {
  .pay-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pay-preset { padding: 12px; }
  .pay-preset-amount { font-size: 20px; }
  .pay-actions { flex-direction: column; align-items: stretch; }
  .pay-actions .btn-primary { width: 100%; }
  .pay-records { padding: 16px; }
  .pay-record { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .pay-record-meta { grid-column: 1 / -1; grid-row: 2; }
  .pay-record-amount { grid-row: 1; grid-column: 2; }
}

/* ----------------------------------------------------------------- footer */
.footer {
  margin-top: 96px;
  padding: 34px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--fg-mute);
}

.footer-stats { display: flex; gap: 22px; }

.stat { display: inline-flex; align-items: baseline; gap: 7px; }
.stat b { font-family: var(--font-display); font-size: 15px; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- reveal */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------- skeleton */
.skeleton { animation: shimmer 1.6s linear infinite; background-size: 200% 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .ring-card { padding: 18px 16px 15px; }
  .skill-icon { width: 22px; height: 22px; margin: 0 0 12px -1px; }
  .skill-icon svg { width: 22px; height: 22px; }
  .skill-title { font-size: 17px; margin-bottom: 7px; -webkit-line-clamp: 2; }
  .skill-subtitle { font-size: 11.5px; margin-bottom: 6px; }
  .skill-desc { font-size: 12px; line-height: 1.58; -webkit-line-clamp: 4; }
  .skill-progress { padding-top: 11px; }
  .skill-tags { margin-top: 10px; gap: 5px; }
  .tag { font-size: 11px; padding: 3px 8px; }
  .scroll-scene { height: 460px; }
}

@media (max-width: 720px) {
  .work-grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-shell { padding: 0 18px; }
  .work-title { font-size: 18px; }
  .page { padding: 0 18px 72px; }
  .topbar { padding: 14px 0; }
  .topbar.is-stuck { margin: 0 -18px; padding: 12px 18px; }
  .nav-links { display: none; }
  .hero { padding: 18px 0 12px; }
  .hero-ring, .avatar { width: 132px; height: 132px; }
  /* Mobile: the stage is narrow, so windows shrink and tuck into the two top
     corners and the lower-left, leaving the portrait unobstructed. */
  .avatar-stage { height: 420px; margin-bottom: 8px; }
  .stage-orbit { width: 288px; height: 288px; margin: -144px 0 0 -144px; }
  .msg-window { width: min(42%, 132px); border-radius: 10px; }
  .win-body { font-size: 11px; padding: 8px 9px 9px; -webkit-line-clamp: 2; }
  .win-bar { padding: 5px 7px; gap: 4px; }
  .win-dot { width: 8px; height: 8px; }
  .win-title { font-size: 9px; }
  .win-foot { font-size: 10px; padding: 0 10px 8px; }
  .info-item { font-size: 12.5px; padding: 6px 12px; }
  .section { padding: 66px 0 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .scroll-scene { height: 420px; width: calc(100% + 36px); margin-inline: -18px; }
  .marquee { margin: 34px -18px 0; }
  .footer { flex-direction: column; align-items: flex-start; }
  .footer-stats { flex-wrap: wrap; gap: 14px; }
  .carousel-controls { flex-direction: row; }
  .carousel-dots { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .progress-fill { transform: scaleX(1); }
}