@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Primitive palette — Apple-inspired */
  --brand-50: #e8f2ff;
  --brand-100: #cfe5ff;
  --brand-200: #9fcbff;
  --brand-300: #66abff;
  --brand-400: #2e8dff;
  --brand-500: #007aff;
  --brand-600: #0064d6;
  --brand-700: #004fad;
  --brand-800: #003b82;
  --brand-900: #00275a;

  --background-50: #ffffff;
  --background-100: #f7f7fa;
  --background-200: #f2f2f7;
  --background-300: #e5e5ea;
  --background-400: #d1d1d6;
  --background-500: #aeaeb2;
  --background-600: #8e8e93;
  --background-700: #3a3a3c;
  --background-800: #1c1c1e;
  --background-900: #000000;

  --text-50: #f5f5f7;
  --text-100: #e3e3e8;
  --text-200: #c7c7cc;
  --text-300: #aeaeb2;
  --text-400: #8e8e93;
  --text-500: #6e6e73;
  --text-600: #48484a;
  --text-700: #3c3c43;
  --text-800: #1d1d1f;
  --text-900: #000000;

  --state-success: #34c759;
  --state-error: #ff3b30;

  /* Semantic roles — light */
  --background: var(--background-50);
  --foreground: var(--text-800);
  --card: var(--background-50);
  --card-foreground: var(--text-800);
  --primary: var(--brand-500);
  --primary-foreground: var(--background-50);
  --secondary: var(--background-200);
  --secondary-foreground: var(--text-800);
  --muted: var(--background-200);
  --muted-foreground: var(--text-500);
  --accent: var(--background-100);
  --accent-foreground: var(--text-800);
  --destructive: var(--state-error);
  --success: var(--state-success);
  --border: var(--background-300);
  --input: var(--background-400);
  --ring: var(--brand-500);
  --icon: var(--text-800);
  --icon-muted: var(--text-400);

  /* Typography */
  --font-sans: "DM Sans", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radius & spacing */
  --radius: 1.2rem;
  --spacing: 0.24rem;

  /* Shadows */
  --shadow-2xs: 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1px 3px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 24px -8px rgba(0, 0, 0, 0.08), 0 4px 8px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 16px 40px -10px rgba(0, 0, 0, 0.10), 0 8px 16px -8px rgba(0, 0, 0, 0.06);
}

.dark {
  --background: var(--background-900);
  --foreground: var(--text-50);
  --card: var(--background-800);
  --card-foreground: var(--text-50);
  --primary: var(--brand-400);
  --primary-foreground: var(--background-900);
  --secondary: var(--background-800);
  --secondary-foreground: var(--text-50);
  --muted: var(--background-800);
  --muted-foreground: var(--text-400);
  --accent: var(--background-700);
  --accent-foreground: var(--text-50);
  --border: var(--background-700);
  --input: var(--background-700);
  --ring: var(--brand-400);
  --icon: var(--text-50);
  --icon-muted: var(--text-400);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.36), 0 1px 3px -1px rgba(0, 0, 0, 0.36);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.44), 0 2px 4px -2px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 8px 24px -8px rgba(0, 0, 0, 0.50), 0 4px 8px -4px rgba(0, 0, 0, 0.40);
  --shadow-xl: 0 16px 40px -10px rgba(0, 0, 0, 0.55), 0 8px 16px -8px rgba(0, 0, 0, 0.44);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, p { margin: 0; }

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

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

button { font-family: inherit; }

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Sections */
.section { padding: 120px 0; }
.section-sm { padding: 80px 0; }
.section-header { margin-bottom: 48px; }

.text-center { text-align: center; }

/* Typography */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 12px;
}

.display-xl {
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.display-lg {
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.0;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.display-md {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.headline {
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.body-lg {
  font-size: 18px;
  line-height: 1.65;
  color: var(--muted-foreground);
}

.body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted-foreground);
}

.caption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: color-mix(in srgb, var(--background) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s ease;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 14px;
  color: var(--foreground);
  transition: background-color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--secondary);
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease;
}

.icon-btn:hover { background: var(--secondary); }

.mobile-menu-btn { display: none; }

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-top: 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.78) 100%);
  z-index: -1;
}

.hero .container { position: relative; z-index: 1; color: #fff; }
.hero .eyebrow { color: rgba(255,255,255,0.75); }
.hero .display-xl { margin: 24px 0; }
.hero .body-lg {
  color: rgba(255,255,255,0.82);
  max-width: 560px;
  margin-bottom: 40px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--secondary); }

.btn-lg { height: 56px; padding: 0 32px; font-size: 16px; }

/* Cards */
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.project-card .media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--accent);
}

.project-card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.project-card:hover .media img { transform: scale(1.04); }

.project-card .content { padding: 24px; }
.project-card .eyebrow { margin-bottom: 8px; }
.project-card .title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.project-card .desc {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.55;
}
.project-card .arrow {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Cover gradients for generated-free cards */
.cover-gradient {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
}

.cover-iot {
  background:
    radial-gradient(circle at 20% 20%, rgba(0,122,255,0.18) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(52,199,89,0.16) 0%, transparent 45%),
    linear-gradient(135deg, var(--background-100), var(--background-200));
}

.cover-brand {
  background:
    radial-gradient(circle at 30% 70%, rgba(175,82,222,0.14) 0%, transparent 45%),
    radial-gradient(circle at 70% 30%, rgba(255,149,0,0.14) 0%, transparent 45%),
    linear-gradient(135deg, var(--background-100), var(--background-200));
}

.cover-mark {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  font-size: 28px;
}

/* Filters */
.filter-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.filter-btn {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* Metrics */
.metric {
  padding: 32px;
  border-radius: var(--radius);
  background: var(--accent);
  border: 1px solid var(--border);
  text-align: center;
}

.metric-value {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 14px;
  color: var(--muted-foreground);
}

/* Value cards */
.value-card {
  padding: 32px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.value-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.value-card h3 { font-size: 20px; margin-bottom: 12px; }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 36px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--background);
  border: 2px solid var(--primary);
}

.timeline-title { font-weight: 600; margin-bottom: 4px; }
.timeline-meta {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

/* Tool stack */
.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-tag {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-size: 13px;
  font-weight: 500;
}

/* Logos */
.logo-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: center;
}

.logo-item {
  height: 40px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
}

/* Forms */
.form { display: grid; gap: 20px; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label { font-size: 14px; font-weight: 500; }

.field-group input,
.field-group textarea,
.field-group select {
  min-height: 48px;
  padding: 0 16px;
  border-radius: calc(var(--radius) * 0.55);
  border: 1px solid var(--input);
  background: var(--background);
  color: var(--foreground);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-group textarea {
  min-height: 140px;
  padding: 16px;
  resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Project single */
.project-hero {
  padding-top: 48px;
  padding-bottom: 64px;
}

.project-hero img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
}

.project-body { max-width: 760px; margin: 0 auto; }
.project-body h3 {
  font-size: 22px;
  margin: 48px 0 16px;
  letter-spacing: -0.02em;
}
.project-body p {
  margin-bottom: 16px;
  color: var(--muted-foreground);
}
.project-body ul {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--muted-foreground);
}
.project-body li { margin-bottom: 8px; }

.quote {
  padding: 24px 28px;
  border-left: 3px solid var(--primary);
  background: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 32px 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--foreground);
}

/* Footer */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.socials { display: flex; gap: 12px; }

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  transition: background-color 0.18s ease;
}
.social-link:hover { background: var(--secondary); }

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

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Responsive */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .section { padding: 88px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 24px;
    gap: 4px;
  }
  .nav.open { display: flex; }
  .nav-link { height: 44px; }
  .mobile-menu-btn { display: inline-flex; }
  .hero .display-xl { font-size: clamp(40px, 11vw, 64px); }
  .hero .body-lg { font-size: 16px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
