:root {
  /* Dark (default) — AI Tech */
  --bg: #08080a;
  --bg-elevated: #0e0e12;
  --bg-card: rgba(255, 255, 255, 0.025);
  --ink: #e8e8ec;
  --ink-dim: #9090a0;
  --ink-muted: #5a5a6a;
  --accent: #9b8ec7;
  --accent-dim: #7a6ea5;
  --accent-glow: rgba(155, 142, 199, 0.15);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(155, 142, 199, 0.3);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  --radius: 14px;
  --font-display: "Fraunces", "Songti SC", "Noto Serif SC", serif;
  --font-body: "Source Sans 3", "PingFang SC", "Noto Sans SC", sans-serif;
  --max: 1120px;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.72);
  --ink: #1a1a1a;
  --ink-dim: #4a4a4a;
  --ink-muted: #888888;
  --accent: #7a6ea5;
  --accent-dim: #5d5280;
  --accent-glow: rgba(122, 110, 165, 0.10);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(122, 110, 165, 0.3);
  --shadow: 0 18px 50px rgba(23, 50, 77, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Tech grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(0, 212, 170, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 170, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 70%);
}

[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(0, 143, 107, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 143, 107, 0.04) 1px, transparent 1px);
}

/* Theme toggle in nav */
.theme-toggle-nav {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.25s ease;
  margin-left: 0.5rem;
}

.theme-toggle-nav:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  background: var(--bg-card);
}

.theme-toggle-nav:active {
  transform: scale(0.92);
}

/* Smooth transitions for theme switch */
*,
*::before,
*::after {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.25s ease, box-shadow 0.35s ease;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.wrap {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(20px) saturate(1.2);
  background: rgba(8, 8, 10, 0.7);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}

.brand {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--ink);
  text-transform: uppercase;
}

.brand::before {
  content: '// ';
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: 4rem 0 3rem;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-body);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 7vw, 5.5rem);
  line-height: 1.05;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.hero h1 span {
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
}

.tagline {
  margin: 1.5rem 0 2rem;
  max-width: 34rem;
  color: var(--ink-dim);
  font-size: 1.15rem;
  line-height: 1.65;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 8px;
  padding: 0.8rem 1.3rem;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  cursor: pointer;
  letter-spacing: 0.02em;
}

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

.btn-primary {
  background: var(--accent);
  color: #08080a;
  font-weight: 700;
}

.btn-primary:hover {
  background: #00e8c0;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-dim);
}

.btn-ghost:hover {
  border-color: var(--border-hover);
  color: var(--ink);
  background: var(--bg-card);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1.2;
  font-weight: 650;
}

.stat span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* Portrait */
.portrait-wrap {
  position: relative;
  justify-self: end;
  width: min(100%, 360px);
}

.portrait {
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  background: linear-gradient(145deg, #12121a, #0a0a10);
  border: 1px solid var(--border);
  position: relative;
}

.portrait::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--accent), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.4;
  pointer-events: none;
}

.portrait svg,
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-pill {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: rgba(8, 8, 10, 0.9);
  color: var(--ink-dim);
  font-size: 0.75rem;
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  font-family: var(--font-body);
  letter-spacing: 0.03em;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.scroll-hint {
  display: flex;
  justify-content: center;
  padding-bottom: 2rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.scroll-hint span {
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* Sections */
section {
  padding: 5rem 0;
}

.section-title {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.section-lead {
  margin: 0 0 2.5rem;
  color: var(--ink-muted);
  max-width: 36rem;
  font-size: 1.05rem;
}

/* Claims */
.claims {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.claim {
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.claim::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.claim:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.claim:hover::before {
  opacity: 0.5;
}

.claim h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.claim p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Work Grid */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}

.work-card {
  display: block;
  text-decoration: none;
  padding: 1.8rem 1.8rem 1.6rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.3s ease;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.work-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.work-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
}

.work-card:hover::before {
  opacity: 1;
}

.work-card .dim {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-body);
  opacity: 0.8;
}

.work-card h3 {
  margin: 0.8rem 0 0.5rem;
  font-family: var(--font-body);
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.work-card p {
  margin: 0 0 1.2rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.work-card .meta {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 3rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.site-footer .footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-footer a {
  color: var(--ink-dim);
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Case pages */
.case-hero {
  padding: 4rem 0 2rem;
}

.case-hero .back {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s ease;
}

.case-hero .back:hover {
  color: var(--ink);
}

.case-hero h1 {
  margin: 0.5rem 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  max-width: 20ch;
  color: var(--ink);
}

.case-hero .proposition {
  font-size: 1.15rem;
  color: var(--ink-dim);
  max-width: 42rem;
  margin: 0;
  line-height: 1.6;
}

.case-body {
  display: grid;
  gap: 3rem;
  padding-bottom: 5rem;
}

.case-body h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--ink);
}

.case-body p,
.case-body li {
  color: var(--ink-dim);
  line-height: 1.7;
}

.case-body ul {
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
}

.case-body li {
  margin-bottom: 0.5rem;
}

.layer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

.layer {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  background: var(--bg-card);
  transition: border-color 0.3s ease;
}

.layer:hover {
  border-color: var(--border-hover);
}

.layer strong {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.95rem;
}

.layer span {
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.result-box {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.2rem;
  margin-top: 1rem;
}

.result-box p {
  margin: 0.3rem 0;
  color: var(--ink-dim);
}

.result-box strong {
  color: var(--accent);
  font-weight: 600;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.stagger > *:nth-child(1) { transition-delay: 0.06s; }
.stagger > *:nth-child(2) { transition-delay: 0.14s; }
.stagger > *:nth-child(3) { transition-delay: 0.22s; }
.stagger > *:nth-child(4) { transition-delay: 0.30s; }

/* Demo components */
.demo-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.demo-tab {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.demo-tab:hover {
  color: var(--ink-dim);
}

.demo-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.demo-panel {
  display: none;
}

.demo-panel.active {
  display: block;
}

.carousel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.carousel-slide {
  display: none;
  padding: 2rem;
}

.carousel-slide.active {
  display: block;
}

.carousel-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.carousel-dot.active {
  background: var(--accent);
}

.mockup-phone {
  max-width: 320px;
  margin: 0 auto;
  border-radius: 32px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.mockup-screen {
  border-radius: 24px;
  background: var(--bg);
  min-height: 400px;
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.mockup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mockup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.mockup-title {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-left: auto;
}

/* Responsive */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 2.5rem;
    padding-top: 2.5rem;
  }

  .portrait-wrap {
    justify-self: start;
    width: min(100%, 280px);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  .claims,
  .work-grid,
  .layer-grid {
    grid-template-columns: 1fr;
  }

  .demo-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-hint span { animation: none; }
}

/* Light theme specific overrides */
[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(122, 110, 165, 0.06), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(100, 90, 140, 0.04), transparent 50%),
    linear-gradient(180deg, #f5f5f7 0%, var(--bg) 40%, #eef0f2 100%);
}

[data-theme="light"] .site-header {
  background: rgba(245, 245, 247, 0.78);
}

[data-theme="light"] .work-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(240, 242, 245, 0.65));
}

[data-theme="light"] .claim {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 50px rgba(23, 50, 77, 0.06);
}

[data-theme="light"] .portrait {
  background: linear-gradient(145deg, #e8e8ec, #f0f0f4 55%, #e0e0e6);
}

[data-theme="light"] .theme-toggle-nav {
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .btn-primary {
  color: #ffffff;
}
