/* ===== 1. Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: "Inter", "Roboto", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #0F172A;
  background-color: #FFF8F0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#main-content {
  flex: 1;
  width: 100%;
}

#main-content:focus {
  outline: none;
}

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

input,
button,
textarea,
select {
  font: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

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

:where(a:hover, a:focus-visible) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid #FFD166;
  outline-offset: 2px;
  border-radius: 0;
}

/* ===== 2. Design Tokens ===== */
:root {
  --fire-red: #E63946;
  --fire-red-deep: #A4133C;
  --flame-orange: #F4A261;
  --bright-yellow: #FFD166;
  --space-black: #1D3557;
  --space-black-light: #2A3B54;
  --cream: #FFF8F0;
  --light-gray: #EEF2F7;
  --mid-gray: #94A3B8;
  --text-main: #0F172A;
  --text-on-dark: #FFF8F0;
  --text-muted: #64748B;

  --font-title: Impact, "Anton", "Arial Black", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "Inter", "Roboto", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;

  --container-max: 1240px;
  --container-pad: clamp(16px, 4vw, 40px);

  --border-thin: 1px solid rgba(29, 53, 87, 0.12);
  --shadow-card: 0 4px 24px rgba(29, 53, 87, 0.08);
  --shadow-lift: 0 12px 40px rgba(29, 53, 87, 0.16);

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 3. Typography ===== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-title);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--space-black);
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
}

h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
}

h3 {
  font-size: 1.3rem;
}

h4 {
  font-size: 1.05rem;
}

.mono,
.score-number,
[data-score] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ===== 4. Layout Primitives ===== */
.site-container {
  width: min(var(--container-max), 100% - var(--container-pad) * 2);
  margin-inline: auto;
}

.section {
  padding: 48px 0;
}

.section-head {
  margin-bottom: 32px;
}

.section-title {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  color: var(--space-black);
  position: relative;
  padding-left: 18px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.12em;
  bottom: 0.12em;
  width: 6px;
  background: linear-gradient(to bottom, var(--fire-red), var(--flame-orange));
}

.section-subtitle {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 720px;
}

/* ===== 5. Buttons & Tags ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 26px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background: var(--fire-red);
  border: 2px solid var(--fire-red);
  border-radius: 0;
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.btn:hover {
  background: var(--fire-red-deep);
  border-color: var(--fire-red-deep);
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(230, 57, 70, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--fire-red);
  border: 2px solid var(--fire-red);
}

.btn-outline:hover {
  background: var(--fire-red);
  color: #fff;
}

.btn-light {
  background: var(--bright-yellow);
  border-color: var(--bright-yellow);
  color: var(--space-black);
}

.btn-light:hover {
  background: var(--flame-orange);
  border-color: var(--flame-orange);
  color: var(--space-black);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--light-gray);
  color: var(--space-black);
  border-left: 3px solid var(--mid-gray);
  white-space: nowrap;
}

.tag-hot {
  background: rgba(255, 209, 102, 0.18);
  border-left-color: var(--bright-yellow);
  color: #7a4a00;
}

.tag-live {
  background: rgba(230, 57, 70, 0.1);
  border-left-color: var(--fire-red);
  color: var(--fire-red-deep);
}

.tag-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fire-red);
  animation: live-pulse 1.6s ease-in-out infinite;
}

/* ===== 6. Skip Link ===== */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  padding: 10px 22px;
  background: var(--fire-red);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  transform: translateY(-200%);
  transition: transform var(--transition);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: none;
  text-decoration: none;
}

/* ===== 7. Header ===== */
.site-header {
  position: relative;
  z-index: 80;
  background: var(--cream);
}

/* --- Utility strip --- */
.header-utility {
  background: var(--space-black);
  border-bottom: 1px solid rgba(255, 248, 240, 0.08);
}

.header-utility-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  color: rgba(255, 248, 240, 0.75);
  font-size: 0.78rem;
}

.util-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px 2px 8px;
  background: var(--fire-red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}

.util-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.util-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fire-red);
  flex-shrink: 0;
  animation: live-pulse 1.6s ease-in-out infinite;
}

.util-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px;
  background: rgba(255, 248, 240, 0.07);
  border-left: 2px solid var(--fire-red);
}

.util-score-team {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 248, 240, 0.9);
}

.util-score-num {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--bright-yellow);
}

.util-link {
  margin-left: auto;
  font-weight: 600;
  color: rgba(255, 248, 240, 0.8);
}

.util-link:hover {
  color: var(--flame-orange);
  text-decoration: none;
}

/* --- Masthead --- */
.header-masthead {
  position: relative;
  padding: 26px 0 28px;
  overflow: hidden;
  border-bottom: 3px solid var(--space-black);
  background: var(--cream);
}

.header-masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(29, 53, 87, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29, 53, 87, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.header-masthead::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(230, 57, 70, 0.05) 0%, transparent 25%, transparent 75%, rgba(244, 162, 97, 0.08) 100%);
  pointer-events: none;
}

.masthead-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.masthead-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--mid-gray);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
  text-decoration: none;
}

.brand-mark:hover {
  text-decoration: none;
}

.brand-mark-icon {
  width: 38px;
  height: 46px;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(230, 57, 70, 0.35));
}

.brand-mark-text {
  font-family: var(--font-title);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--space-black);
  line-height: 1;
  white-space: nowrap;
}

.brand-mark-accent {
  color: var(--fire-red);
}

.masthead-sub {
  margin-top: 10px;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--space-black-light);
}

.masthead-sub::before {
  content: "◤";
  color: var(--fire-red);
  font-size: 0.7rem;
  transform: translateY(1px);
}

.masthead-sub::after {
  content: "◢";
  color: var(--fire-red);
  font-size: 0.7rem;
  transform: translateY(1px);
}

.masthead-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-title);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--mid-gray);
  z-index: 1;
  display: none;
}

.masthead-left {
  left: 24px;
}

.masthead-right {
  right: 24px;
}

/* --- Navigation --- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--space-black);
  border-top: 4px solid var(--fire-red);
  box-shadow: 0 4px 16px rgba(29, 53, 87, 0.18);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  position: relative;
}

.nav-toggle {
  display: none;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: block;
  padding: 12px 22px;
  font-size: 0.93rem;
  font-weight: 700;
  color: rgba(255, 248, 240, 0.82);
  border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 248, 240, 0.06);
}

.nav-link[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--flame-orange);
}

/* --- Header progress --- */
.header-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 400;
  background: linear-gradient(to right, var(--fire-red), var(--flame-orange), var(--bright-yellow));
  transform-origin: 0 0;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

/* ===== 8. Footer ===== */
.site-footer {
  background: var(--space-black);
  color: var(--text-on-dark);
  margin-top: auto;
  overflow: hidden;
}

.footer-fire {
  height: 4px;
  background: linear-gradient(90deg, var(--fire-red-deep), var(--fire-red) 25%, var(--flame-orange) 55%, var(--bright-yellow) 100%);
}

.footer-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 52px 0 40px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-decoration: none;
}

.footer-logo:hover {
  color: var(--flame-orange);
  text-decoration: none;
}

.footer-logo-icon {
  width: 26px;
  height: 32px;
  flex-shrink: 0;
}

.footer-desc {
  margin-top: 16px;
  font-size: 0.88rem;
  color: rgba(255, 248, 240, 0.6);
  max-width: 400px;
  line-height: 1.8;
}

.footer-trust {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--fire-red);
  background: rgba(255, 248, 240, 0.05);
  font-size: 0.78rem;
  color: rgba(255, 248, 240, 0.5);
  line-height: 1.7;
  max-width: 420px;
}

.footer-heading {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--flame-orange);
  margin-bottom: 18px;
  padding-bottom: 10px;
  position: relative;
}

.footer-heading::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 26px;
  height: 2px;
  background: var(--fire-red);
}

.footer-list a {
  color: rgba(255, 248, 240, 0.7);
  font-size: 0.88rem;
  transition: color var(--transition), padding-left var(--transition);
}

.footer-list a:hover {
  color: var(--bright-yellow);
  padding-left: 4px;
  text-decoration: none;
}

.footer-list li {
  margin-bottom: 10px;
  color: rgba(255, 248, 240, 0.7);
  font-size: 0.86rem;
  line-height: 1.7;
}

.footer-contact-col .footer-list li {
  padding-left: 20px;
  position: relative;
}

.footer-contact-col .footer-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--fire-red);
  font-weight: 700;
  font-size: 1em;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 248, 240, 0.08);
  padding: 16px 0;
}

.footer-bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 0.8rem;
  color: rgba(255, 248, 240, 0.4);
}

.footer-icp {
  color: rgba(255, 248, 240, 0.55);
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.footer-slogan {
  color: var(--flame-orange);
  font-weight: 600;
}

/* ===== 9. Shared Components ===== */

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--mid-gray);
  padding: 16px 0;
}

.breadcrumb a {
  color: var(--fire-red);
}

.breadcrumb a:hover {
  color: var(--fire-red-deep);
}

.breadcrumb-sep {
  color: var(--mid-gray);
  opacity: 0.6;
  font-family: var(--font-mono);
}

/* Page hero */
.page-hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 44px;
  background: var(--space-black);
  color: var(--text-on-dark);
}

.page-hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 220px;
  height: 220px;
  background: linear-gradient(135deg, transparent 46%, rgba(230, 57, 70, 0.28) 46%, rgba(230, 57, 70, 0.28) 54%, transparent 54%);
  transform: rotate(18deg);
  pointer-events: none;
}

.page-hero-title {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  color: #fff;
}

.page-hero-desc {
  margin-top: 10px;
  max-width: 640px;
  color: rgba(255, 248, 240, 0.7);
  font-size: 0.98rem;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--border-thin);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

/* Image frame */
.img-frame {
  position: relative;
  overflow: hidden;
  background: var(--light-gray);
}

.img-frame::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

.img-frame > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-frame.is-square::before {
  padding-top: 100%;
}

.img-frame.is-portrait::before {
  padding-top: 125%;
}

/* Vertical note */
.vert-note {
  writing-mode: vertical-rl;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: var(--mid-gray);
  text-transform: uppercase;
  font-weight: 700;
}

/* Skill tree */
.skill-tree {
  display: flex;
  flex-direction: column;
}

.skill-node {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--border-thin);
  border-left: 4px solid var(--fire-red);
  color: var(--text-main);
  transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.skill-node:hover {
  background: var(--space-black);
  color: var(--text-on-dark);
  transform: translateX(6px);
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

.skill-node-index {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--fire-red);
}

.skill-node:hover .skill-node-index {
  color: var(--bright-yellow);
}

.skill-node-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
}

.skill-node-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: auto;
}

.skill-node:hover .skill-node-desc {
  color: rgba(255, 248, 240, 0.55);
}

.skill-branch {
  width: 2px;
  height: 24px;
  margin-left: 29px;
  background: linear-gradient(to bottom, var(--fire-red), var(--flame-orange));
}

/* Tabs */
.tab-group {
  margin-bottom: 28px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 3px solid var(--space-black);
}

.tab-btn {
  position: relative;
  padding: 11px 24px;
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--space-black-light);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
}

.tab-btn:hover {
  color: var(--fire-red);
}

.tab-btn.is-active {
  color: var(--fire-red);
}

.tab-btn.is-active::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--fire-red);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--fire-red);
  outline-offset: -2px;
}

.tab-panel[hidden] {
  display: none;
}

.tab-panel.is-active {
  animation: fade-slide-in 240ms ease-out;
}

/* ===== 10. Responsive ===== */
@media (max-width: 639px) {
  .util-score {
    display: none;
  }

  .util-link {
    font-size: 0.72rem;
  }

  .masthead-sub::before,
  .masthead-sub::after {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--text-on-dark);
    font-weight: 700;
    font-size: 0.88rem;
  }

  .nav-toggle-bars {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
  }

  .nav-toggle-bar {
    width: 22px;
    height: 3px;
    background: var(--flame-orange);
    transition: transform var(--transition), opacity var(--transition);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-inner {
    justify-content: space-between;
    min-height: 48px;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--space-black);
    border-top: 2px solid var(--fire-red);
    box-shadow: 0 20px 40px rgba(29, 53, 87, 0.45);
  }

  .site-nav[data-open] .nav-menu {
    display: flex;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    padding: 14px 26px;
    border-bottom: 1px solid rgba(255, 248, 240, 0.06);
    border-left: 3px solid transparent;
    border-radius: 0;
  }

  .nav-link[aria-current="page"] {
    border-left-color: var(--fire-red);
    border-bottom-color: transparent;
    background: rgba(230, 57, 70, 0.12);
  }

  .footer-main {
    padding: 40px 0 28px;
  }

  .section {
    padding: 32px 0;
  }

  .page-hero {
    padding: 40px 0 32px;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
  }

  .util-score {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .masthead-side {
    display: block;
  }

  .footer-main {
    grid-template-columns: 2fr 1fr 1fr 1.4fr;
    gap: 44px;
  }
}

/* ===== 11. Accessibility & Motion ===== */
@keyframes live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.55);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(230, 57, 70, 0);
  }
}

@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
