/* ==========================================================================
   K.DEV Solo Full-Stack Portfolio — Design System
   Pure static CSS with Dark (default) & Light theme support
   ========================================================================== */

:root {
  --bg: #090c12;
  --paper: #0f141e;
  --surface: #141b26;
  --surface-hover: #1a2332;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --subtle: #64748b;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --brand: #38bdf8;
  --brand-soft: rgba(56, 189, 248, 0.12);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --header-bg: rgba(9, 12, 18, 0.82);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --max-w: 1280px;
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --paper: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --ink: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.22);
  --brand: #0284c7;
  --brand-soft: rgba(2, 132, 199, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --header-bg: rgba(248, 250, 252, 0.86);
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 40px;
  }
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 0.95rem;
  color: var(--ink);
}

.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 28px;
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.mobile-menu-btn {
  display: inline-flex;
}

@media (min-width: 900px) {
  .mobile-menu-btn {
    display: none;
  }
}

.mobile-drawer {
  display: none;
  border-top: 1px solid var(--line);
  padding: 16px 20px 24px;
  background: var(--bg);
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer a {
  display: block;
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mobile-drawer a:last-child {
  border-bottom: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--brand);
  color: #06121e;
  font-weight: 600;
}

.btn-accent:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
}

/* Badges & Typography Helpers */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.status-pill.live {
  border-color: rgba(16, 185, 129, 0.35);
  background: var(--emerald-soft);
  color: var(--emerald);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.dot.pulse {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.section-title {
  margin: 8px 0 0;
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section-desc {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 620px;
  font-size: 0.95rem;
}

/* Hero Section */
.hero {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: 1.35fr 0.95fr;
    gap: 48px;
  }
}

.hero-title {
  margin: 14px 0 18px;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-title span {
  color: var(--brand);
}

.hero-subtitle {
  margin: 0 0 26px;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.metric-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.metric-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  display: block;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}

.stack-row strong {
  color: var(--ink);
}

.stack-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Services Grid */
.cards-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .cards-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cards-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .cards-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.service-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.service-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.service-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.service-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Works Portfolio Grid (matching zhiqingit.cn editorial card style) */
.works-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

@media (min-width: 640px) {
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .works-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.work-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.22s ease, transform 0.22s ease;
}

.work-card:hover {
  border-color: var(--brand);
  transform: translateY(-3px);
}

.work-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-num {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.work-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.work-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.work-cat {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.work-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.work-desc {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--muted);
  flex: 1;
}

/* Process Steps */
.process-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

.process-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
}

.process-step {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand);
  margin-bottom: 10px;
}

.process-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.process-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Contact CTA Banner */
.cta-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}

@media (min-width: 820px) {
  .cta-box {
    grid-template-columns: 1.3fr 0.7fr;
    padding: 40px;
  }
}

.qr-inline-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
}

.qr-inline-card img {
  width: 176px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.qr-caption {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Filter Bar (for /works/) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--brand-soft);
}

/* Case Detail Page */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.breadcrumb a:hover {
  color: var(--brand);
}

.detail-hero {
  padding: 40px 0 36px;
  border-bottom: 1px solid var(--line);
}

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

@media (min-width: 900px) {
  .detail-grid {
    grid-template-columns: 1.4fr 0.8fr;
  }
}

.prose-block {
  margin-bottom: 28px;
}

.prose-block h2 {
  font-size: 1.2rem;
  margin: 0 0 10px;
}

.prose-block p,
.prose-block li {
  color: var(--muted);
  font-size: 0.94rem;
}

.prose-block ul {
  padding-left: 18px;
  margin: 8px 0 0;
}

.prose-block li {
  margin-bottom: 6px;
}

.spec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  position: sticky;
  top: 88px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.spec-row:last-of-type {
  border-bottom: none;
}

.spec-row span:first-child {
  color: var(--muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 15, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid;
  place-items: center;
}

.modal-qr {
  width: 240px;
  margin: 16px auto 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

/* Footer */
.site-footer {
  padding: 32px 0 42px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
  }
}

.footer-muted {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.footer-link {
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--ink);
}

/* Theme Icon Visibility */
html:not([data-theme="light"]) .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

