:root {
  --text-main: #e2e8f0;
  --text-muted: #9fb1c8;
  --accent: #22d3ee;
  --border: rgba(226, 232, 240, 0.2);
  --works-bg-a: #0b1a3b;
  --works-bg-b: #1f4f8a;
}

@font-face {
  font-family: "JasonFont";
  src: url("./fonts/ZHANKUKUAILETI2016XIUDINGBAN-1.TTF") format("truetype");
  font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "JasonFont", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: #0b1324;
}

body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.section {
  position: relative;
  overflow: hidden;
  background: transparent !important;
}

.section::before {
  display: none;
}

#bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  filter: blur(0);
  transform: scale(1);
  transition: opacity 520ms ease, filter 320ms ease, transform 320ms ease;
}

.bg-layer.works-blur {
  filter: blur(12px);
  transform: scale(1.06);
}

.bg-layer.is-visible {
  opacity: 1;
}

.layer-a {
  opacity: 1;
}

#fullpage {
  position: relative;
  z-index: 2;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3.2vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.7rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 2rem); }
p { line-height: 1.6; }

h1, h2, .welcome-panel p {
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.55);
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 320ms ease, color 320ms ease, border-color 320ms ease, opacity 320ms ease;
}

.btn.primary {
  background: linear-gradient(90deg, #22d3ee, #38bdf8);
  color: #082f49;
  border: none;
  font-weight: 700;
}

.btn.primary:hover {
  background: linear-gradient(90deg, #38dff5, #5ac8ff);
  color: #062a3a;
}

.btn.primary:active {
  background: linear-gradient(90deg, #1aa6cf, #2e9ed6);
  color: #eafaff;
  transform: translateY(1px);
}

/* Platform button themes with fade transitions */
.btn[href*="bilibili.com"] {
  border-color: #20b0e3;
  background: rgba(32, 176, 227, 0.18);
  color: #e4f8ff;
}

.btn[href*="bilibili.com"]:hover {
  background: #20b0e3;
  color: #ffffff;
}

.btn[href*="youtube.com"] {
  border-color: #ff4d4f;
  background: rgba(255, 77, 79, 0.2);
  color: #ffe9ea;
}

.btn[href*="youtube.com"]:hover {
  background: #ff4d4f;
  color: #ffffff;
}

.btn[href*="github.com"] {
  border-color: #8b949e;
  background: rgba(139, 148, 158, 0.2);
  color: #eef2f6;
}

.btn[href*="github.com"]:hover {
  background: #8b949e;
  color: #0f172a;
}

.btn[href*="discord.gg"] {
  border-color: #7289da;
  background: rgba(114, 137, 218, 0.2);
  color: #eef1ff;
}

.btn[href*="discord.gg"]:hover {
  background: #7289da;
  color: #ffffff;
}

.btn[href*="game.jasontv.top"] {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.2);
  color: #e8fff4;
}

.btn[href*="game.jasontv.top"]:hover {
  background: #34d399;
  color: #083344;
}

.btn-narrow {
  min-width: 124px;
  padding: 8px 12px;
}

.welcome-panel {
  background: rgba(0, 0, 0, 0.42);
  border-radius: 18px;
  padding: clamp(24px, 4.2vw, 42px);
  backdrop-filter: blur(2px);
  display: grid;
  gap: 16px;
}

.welcome-panel p {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
}

.btn.primary.hero-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #6a46d9 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn.primary.hero-btn > span {
  position: relative;
  z-index: 2;
  transition: opacity 220ms ease;
}

.btn.primary.hero-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, #a855f7 0%, #ec4899 52%, #facc15 100%);
  opacity: 0;
  transition: opacity 320ms ease;
}

.btn.primary.hero-btn:hover::before,
.btn.primary.hero-btn:focus-visible::before {
  opacity: 1;
}

.hero-btn-coming::after {
  content: attr(data-hover-text);
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  color: #ffffff;
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}

.hero-btn-coming:hover > span,
.hero-btn-coming:focus-visible > span {
  opacity: 0;
}

.hero-btn-coming:hover::after,
.hero-btn-coming:focus-visible::after {
  opacity: 1;
}

.btn.primary.hero-btn:active {
  background: #4c2ea8 !important;
  color: #e5ddff !important;
}

.btn.primary.hero-btn:active::before {
  opacity: 0.35;
}

.content-center {
  min-height: calc(var(--app-vh, 1vh) * 100);
  display: grid;
  place-content: center;
  text-align: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.welcome-actions {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.split-layout {
  width: min(1100px, 92%);
  min-height: calc(var(--app-vh, 1vh) * 100);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.left-column {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 20px;
  justify-items: center;
}

.avatar-placeholder {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.right-column {
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 16px;
  padding: clamp(18px, 3vw, 32px);
  display: grid;
  gap: 14px;
}

.btn.primary.profile-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #3b82f6 !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn.primary.profile-btn > span {
  position: relative;
  z-index: 2;
}

.btn.primary.profile-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, #ffa5a6 0%, #a5e0ff 100%);
  opacity: 0;
  transition: opacity 320ms ease;
}

.btn.primary.profile-btn:hover::before,
.btn.primary.profile-btn:focus-visible::before {
  opacity: 1;
}

.btn.primary.profile-btn:hover,
.btn.primary.profile-btn:focus-visible {
  color: #0f172a !important;
}

.btn.primary.profile-btn:active {
  background: #2563eb !important;
  color: #dbeafe !important;
}

.btn.primary.profile-btn:active::before {
  opacity: 0.35;
}

.works-shell,
.contact-shell {
  width: min(1160px, 94%);
  height: calc(var(--app-vh, 1vh) * 100);
  margin: 0 auto;
  padding: 18px 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}

.works-section .works-shell {
  padding-top: clamp(38px, 6vh, 64px);
}

.work-category {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  position: absolute;
  inset: 18px 0 56px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.works-section .work-category {
  inset: clamp(44px, 8vh, 86px) 0 56px 0;
}

.work-category.is-active {
  opacity: 1;
  pointer-events: auto;
}

.contact-shell {
  position: relative;
  overflow: hidden;
  display: block;
  padding: clamp(12px, 2.4vw, 28px);
}

.contact-fit {
  --contact-scale: 1;
  width: min(1120px, calc(100% - clamp(24px, 4.8vw, 56px)));
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(var(--contact-scale));
  transition: transform 220ms ease;
  will-change: transform;
}
.slide-head {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
}

.slide-head h2 {
  width: 100%;
  text-align: center;
}

.right-column h2 {
  text-align: center;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-content: center;
}

.contact-card {
  border: 1px solid rgba(226, 232, 240, 0.25);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.34);
  padding: 18px;
  display: grid;
  gap: 10px;
  transition: background-color 320ms ease, border-color 320ms ease, color 320ms ease, opacity 320ms ease;
}

.contact-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

.contact-btn:hover {
  border-color: var(--contact-accent);
  background: var(--contact-accent);
  color: #fff;
}

.tier3-panel {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.tier3-item {
  min-width: 100%;
  height: 100%;
  position: relative;
  flex: 0 0 100%;
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s ease;
}

.item-layout {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: center;
}

.item-left {
  display: grid;
  align-content: center;
  border-radius: 14px;
  overflow: hidden;
}

.work-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  max-height: min(46vh, 420px);
  object-fit: contain;
  margin-inline: auto;
}

.icon-placeholder {
  min-height: 180px;
  border: 1px solid rgba(226, 232, 240, 0.24);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.12);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.item-right {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 0;
}

.stack {
  color: var(--accent);
  font-weight: 600;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dot-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transform: translateY(-20px);
}

.dot-tab {
  width: 11px;
  height: 11px;
  min-width: 11px;
  min-height: 11px;
  padding: 0;
  line-height: 0;
  appearance: none;
  border-radius: 50%;
  border: none;
  background: var(--control-dot, rgba(226, 232, 240, 0.4));
  cursor: pointer;
  transition: background-color 320ms ease, border-color 320ms ease, opacity 320ms ease;
  flex: 0 0 11px;
  aspect-ratio: 1 / 1;
}

.dot-tab.is-active {
  background: var(--control-active, #22d3ee);
}

.carousel-nav {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  line-height: 0;
  appearance: none;
  border-radius: 50%;
  border: none;
  background: var(--control-bg, rgba(30, 41, 59, 0.55));
  color: var(--control-fg, #dff6ff);
  cursor: pointer;
  transition: background-color 320ms ease, color 320ms ease, border-color 320ms ease, opacity 320ms ease;
}

.carousel-nav:hover {
  background: var(--control-active, #22d3ee);
  color: #ffffff;
}

.category-switch {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 10px;
}

.category-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: color-mix(in srgb, var(--control-bg, #334155) 70%, transparent);
  padding: 2px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 320ms ease, border-color 320ms ease, opacity 320ms ease;
  position: relative;
}

.category-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: brightness(0) saturate(100%) invert(100%);
  opacity: 0.95;
  transition: opacity 320ms ease;
}

.category-btn:hover img {
  filter: brightness(0) saturate(100%) invert(65%) sepia(80%) saturate(1548%) hue-rotate(156deg) brightness(94%) contrast(92%);
  opacity: 1;
}

.category-btn.is-active {
  box-shadow: none;
  background: color-mix(in srgb, var(--control-active, #22d3ee) 32%, transparent);
}

.category-btn.is-active img {
  filter: brightness(0) saturate(100%) invert(63%) sepia(98%) saturate(1570%) hue-rotate(157deg) brightness(98%) contrast(95%);
  opacity: 1;
}

.contact-github .contact-icon {
  filter: brightness(0) saturate(100%) invert(100%);
}

#fp-nav ul li a span {
  background: var(--fp-nav-color, var(--accent));
  transition: background-color 320ms ease, opacity 320ms ease;
}
.fp-watermark { display: none !important; }

/* Global rule: portrait = 上下排版, landscape = 左右排版 */
@media (orientation: portrait) {
  .split-layout { grid-template-columns: 1fr; padding: 64px 0; }
  .left-column { grid-auto-flow: column; }
  .item-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 10px;
  }
  .item-left {
    align-content: start;
  }
  .work-image {
    max-height: min(30vh, 220px);
    border-radius: 14px !important;
  }
  .item-right {
    align-content: start;
    overflow: auto;
    max-height: min(42vh, 320px);
    padding-right: 4px;
  }
  .works-section .item-right {
    justify-items: center;
    text-align: center;
  }
  .works-section .btn-row {
    justify-content: center;
  }
  .works-shell, .contact-shell { width: 95%; }
  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .contact-card {
    padding: 10px;
    gap: 6px;
  }
  .contact-card h3 {
    font-size: clamp(0.88rem, 2.8vw, 1rem);
  }
  .contact-card p {
    font-size: clamp(0.76rem, 2.4vw, 0.9rem);
    line-height: 1.35;
  }
  .contact-icon {
    width: 30px;
    height: 30px;
  }
  .contact-btn {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 0.8rem;
  }
}

@media (orientation: landscape) {
  .split-layout { grid-template-columns: 1fr 1fr; padding: 0; }
  .left-column { grid-auto-flow: column; }
  .item-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    gap: 22px;
  }
  .item-right {
    overflow: visible;
    max-height: none;
    padding-right: 0;
    align-content: center;
  }
  .works-section .item-right {
    justify-items: start;
    text-align: left;
  }
  .works-section .btn-row {
    justify-content: flex-start;
  }
}
