/* ================================================================
   金明浩 — 工程履历
   Full-screen · Purple-tinted everything · Glass morphism
   ================================================================ */

:root {
  /* Fonts */
  --font-sans: -apple-system, "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;

  /* Purple family — everything derives from here */
  --c-accent: #7C5CFC;
  --c-accent-light: #EDE9FE;
  --c-accent-mid: #C4B5FD;
  --c-accent-dark: #5B3FD6;

  /* Tinted neutrals — NOT generic gray, all purple-shifted */
  --c-text: #1E1533;
  --c-text-2: #6B6187;
  --c-text-3: #9E96B3;
  --c-bg: #F6F4FB;
  --c-bg-alt: #EEEAFC;
  --c-white: #FFFFFF;

  /* Borders & lines — purple tinted, semi-transparent */
  --c-line: rgba(124, 92, 252, 0.15);
  --c-line-hover: rgba(124, 92, 252, 0.35);

  /* Shadows — purple tinted, not neutral */
  --shadow-sm: 0 2px 8px rgba(91, 63, 214, 0.06);
  --shadow-md: 0 8px 24px rgba(91, 63, 214, 0.10);
  --shadow-lg: 0 22px 60px rgba(91, 63, 214, 0.14);
  --shadow-glow: 0 0 28px rgba(124, 92, 252, 0.22);

  /* Glass */
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);

  /* Content width */
  --w-content: 1100px;
  --w-narrow: 720px;

  /* Spacing */
  --s-xs: 4px; --s-sm: 8px; --s-md: 16px; --s-lg: 24px;
  --s-xl: 32px; --s-2xl: 48px; --s-3xl: 64px; --s-4xl: 96px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.24s;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* --- Base --- */
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-text);
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(196, 181, 253, 0.35), transparent 40%),
    radial-gradient(ellipse at 85% 5%, rgba(237, 233, 254, 0.50), transparent 35%),
    radial-gradient(ellipse at 50% 80%, rgba(196, 181, 253, 0.18), transparent 45%),
    linear-gradient(180deg, #F8F6FE 0%, var(--c-bg) 50%, #F2EEFA 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.87em; }
::selection { background: var(--c-accent); color: #fff; }

/* --- Container --- */
.inner {
  width: min(var(--w-content), calc(100% - 40px));
  margin: 0 auto;
}

/* --- Full-width page --- */
.page { width: 100%; }

/* --- Glass card mixin (reused everywhere) --- */
.glass-card {
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--glass);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ================================================================
   HEADER — full-width dark with purple atmosphere
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: var(--s-4xl) 0 var(--s-3xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 20%, rgba(124, 92, 252, 0.12), transparent 50%),
    linear-gradient(135deg, #3D2D6B 0%, #4A3A7A 50%, #3D2D6B 100%);
  transition: padding 0.35s var(--ease), background 0.35s var(--ease);
}

.site-header .inner { position: relative; z-index: 1; }

/* Full hero content */
.header-full h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: #fff;
}

.header-full .subtitle {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 10px;
  letter-spacing: 0.5px;
}

.header-full .intro {
  margin-top: 24px;
  font-size: 18px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.80);
  max-width: 560px;
}

/* Compact bar content — name left, meta right */
.header-compact {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 28px;
}

.compact-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.compact-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.50);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Compact state — triggered by JS on scroll */
.site-header.is-compact {
  padding: 14px 0;
  background: rgba(30, 21, 51, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-header.is-compact .header-full { display: none; }
.site-header.is-compact .header-compact { display: flex; }

@media (max-width: 640px) {
  .site-header { padding: var(--s-3xl) 0 var(--s-2xl); }
}

/* ================================================================
   SECTIONS — alternating tinted backgrounds
   ================================================================ */
.section {
  position: relative;
  padding: var(--s-4xl) 0;
}

.section--alt {
  background: linear-gradient(
    180deg,
    rgba(238, 234, 252, 0.45),
    rgba(232, 229, 250, 0.35)
  );
}

.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--c-accent-dark);
}

.section-desc {
  font-size: 16px;
  color: var(--c-text-2);
  max-width: 620px;
  line-height: 1.65;
  margin-top: 8px;
  margin-bottom: var(--s-xl);
}

/* Section heading (label + h2 combo) */
.section-heading {
  margin-bottom: var(--s-xl);
}

.section-heading h2 {
  margin-top: 10px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: var(--c-text);
}

/* ================================================================
   CAPABILITIES — glass cards in grid
   ================================================================ */
.cap-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 900px) {
  .cap-list { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 540px) {
  .cap-list { grid-template-columns: 1fr; gap: 12px; }
}

.cap-item {
  padding: 22px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.cap-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-line-hover);
}

.cap-item h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 6px;
}

.cap-item p {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.55;
}

/* ================================================================
   PROJECT CARDS — glass cards, 2-col grid
   ================================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

@media (max-width: 700px) {
  .project-grid { grid-template-columns: 1fr; }
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

a.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-line-hover);
}

a.project-card:active { transform: translateY(-1px); }

.project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.project-head h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  transition: color var(--dur) var(--ease);
}

a.project-card:hover .project-head h3 {
  color: var(--c-accent);
  text-shadow: 0 0 18px rgba(124, 92, 252, 0.25);
}

.status {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-accent-dark);
  background: var(--c-accent-light);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-card > p {
  font-size: 13.5px;
  color: var(--c-text-2);
  line-height: 1.6;
  flex: 1;
}

.metrics {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.metrics span {
  font-size: 11px;
  color: var(--c-text-2);
  padding: 4px 10px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  letter-spacing: 0.2px;
  font-weight: 500;
  transition: all var(--dur) var(--ease);
}

a.project-card:hover .metrics span {
  border-color: var(--c-line-hover);
  background: var(--c-accent-light);
  color: var(--c-accent-dark);
}

/* --- NIO Placeholder --- */
.project-card.placeholder {
  opacity: 0.5;
  cursor: default;
  border-style: dashed;
}

.coming {
  font-size: 11px;
  color: var(--c-text-3);
  margin-top: 8px;
  font-style: italic;
}

/* ================================================================
   TAGS — pill shaped, glass style
   ================================================================ */
.tags { display: flex; flex-wrap: wrap; gap: 10px; }

.tag {
  font-size: 13px;
  color: var(--c-text-2);
  padding: 6px 14px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}

.tag:hover {
  color: var(--c-accent-dark);
  background: var(--c-accent-light);
  border-color: var(--c-line-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ================================================================
   BOUNDARIES — 2-col with dash prefix
   ================================================================ */
.boundary-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 40px;
}

@media (max-width: 640px) {
  .boundary-list { grid-template-columns: 1fr; }
}

.boundary-item {
  font-size: 14px;
  color: var(--c-text-3);
  padding: 6px 0 6px 18px;
  line-height: 1.6;
  position: relative;
}

.boundary-item::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--c-accent-mid);
}

/* ================================================================
   FOOTER — dark, matching header family
   ================================================================ */
.site-footer {
  background:
    radial-gradient(ellipse at 30% 0%, rgba(124, 92, 252, 0.12), transparent 50%),
    linear-gradient(135deg, #1E1533, #2A1F45);
  color: rgba(255, 255, 255, 0.50);
  padding: var(--s-2xl) 0;
  font-size: 14px;
  line-height: 1.75;
}

/* ================================================================
   CASE STUDY PAGES
   ================================================================ */
.case-page-body {
  max-width: var(--w-narrow);
  margin: 0 auto;
  padding: var(--s-2xl) var(--s-xl) var(--s-4xl);
}

@media (max-width: 640px) {
  .case-page-body { padding: var(--s-xl) 20px var(--s-3xl); }
}

/* --- Back Nav --- */
.back { margin-bottom: var(--s-xl); }

.back a {
  font-size: 13px;
  color: var(--c-accent);
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--dur) var(--ease);
}

.back a:hover {
  color: var(--c-accent-dark);
  text-shadow: 0 0 14px rgba(124, 92, 252, 0.3);
}

/* --- Case Header --- */
.case-header {
  margin-bottom: var(--s-2xl);
  padding-bottom: var(--s-lg);
  border-bottom: 1px solid var(--c-line);
}

.case-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.25;
}

.case-header .status { margin-top: 10px; }

.case-header .lead {
  margin-top: 14px;
  font-size: 16px;
  color: var(--c-text-2);
  line-height: 1.7;
}

/* --- Case Content --- */
.case h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-top: 44px;
  margin-bottom: 14px;
  color: var(--c-text);
}

.case h3 {
  font-size: 15px;
  font-weight: 700;
  margin-top: 30px;
  margin-bottom: 10px;
  color: var(--c-text);
}

.case p {
  margin-bottom: 12px;
  color: var(--c-text-2);
}

.case ul, .case ol {
  margin-left: 20px;
  margin-bottom: 14px;
}

.case li {
  margin-bottom: 5px;
  line-height: 1.65;
  color: var(--c-text-2);
}

.case li strong { color: var(--c-text); }

.case pre {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--c-line);
  padding: 18px 20px;
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 16px 0 20px;
  backdrop-filter: blur(8px);
}

.case table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14px;
}

.case th, .case td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-line);
  text-align: left;
  line-height: 1.5;
}

.case th {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(237, 233, 254, 0.5);
  color: var(--c-accent-dark);
}

.case td { color: var(--c-text-2); }

.case blockquote {
  margin: 16px 0 20px;
  padding: 16px 20px;
  background: rgba(237, 233, 254, 0.55);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--c-text);
  backdrop-filter: blur(8px);
}

.case blockquote p { margin-bottom: 0; }

.case hr {
  border: none;
  height: 1px;
  background: var(--c-line);
  margin: 44px 0;
}

/* Collapsible */
.case details {
  margin: 20px 0;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: all var(--dur) var(--ease);
}

.case details:hover { border-color: var(--c-line-hover); box-shadow: var(--shadow-sm); }

.case details summary {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-2);
  cursor: pointer;
  user-select: none;
  transition: color var(--dur) var(--ease);
}

.case details summary:hover { color: var(--c-accent); }
.case details[open] summary { border-bottom: 1px solid var(--c-line); }
.case details > :not(summary) { padding: 0 18px; }
.case details > p:first-of-type { margin-top: 16px; }
.case details > :last-child { margin-bottom: 16px; }

/* ================================================================
   SCROLL REVEAL
   ================================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -14px, 0); }
}

/* ================================================================
   FOCUS & ACCESSIBILITY
   ================================================================ */
a:focus-visible,
button:focus-visible,
details summary:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

a:focus:not(:focus-visible) { outline: none; }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  body { background: #fff; font-size: 12px; }
  body { background: #fff; }
  .site-header { padding: var(--s-xl) 0; }
  .site-header { background: #fff; }
  .site-header h1 { font-size: 24px; color: var(--c-text); }
  .site-header .subtitle { color: var(--c-text-3); }
  .site-header .intro { color: var(--c-text-2); }
  .section { padding: var(--s-lg) 0; }
  .section--alt { background: none; }
  .site-footer { background: #fff; color: var(--c-text-3); border-top: 1px solid var(--c-line); padding: var(--s-md) 0; }
  .back { display: none; }
  a.project-card, a.project-card:hover { box-shadow: none; transform: none; backdrop-filter: none; }
  .project-grid { grid-template-columns: 1fr; }
  .cap-list { grid-template-columns: repeat(2, 1fr); }
  .project-card, .cap-item { break-inside: avoid; backdrop-filter: none; }
  .case h2 { break-after: avoid; }
  .placeholder { opacity: 1; }
  .coming { display: none; }
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
