/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ========== DESIGN TOKENS ========== */
:root {
  --bg: #0c0a09;
  --surface: #151311;
  --surface-2: #1c1917;
  --red: #e63227;
  --red-soft: #ff8a80;
  --red-glow: rgba(230, 50, 39, 0.15);
  --text: #f5f0ea;
  --text-muted: #a8a19a;
  --text-dim: #6b6560;
  --border: rgba(168, 161, 154, 0.1);
  --border-hover: rgba(168, 161, 154, 0.2);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-accent: "Source Serif 4", Georgia, serif;

  /* Theme-aware rgba values */
  --header-bg: rgba(12, 10, 9, 0.85);
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --hover-white: rgba(255, 255, 255, 0.04);
  --hover-white-subtle: rgba(255, 255, 255, 0.02);
  --hover-white-faint: rgba(255, 255, 255, 0.03);
  --dot-grid: rgba(168, 161, 154, 0.07);

  /* Legacy aliases for sub-page compatibility */
  --rs-red: var(--red);
  --rs-red-dark: #cc2b21;
  --rs-red-light: var(--red-glow);
  --ink: var(--text);
  --card: var(--surface-2);
  --muted: var(--text-muted);
  --accent: var(--red);
  --accent-light: var(--red-glow);
  --font-heading: var(--font-display);
  --radius: 12px;
  --ring: 0 0 0 4px var(--red-glow);
  color-scheme: dark;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
  --bg: #faf9f7;
  --surface: #f0eeec;
  --surface-2: #e6e3e0;
  --red: #d42b20;
  --red-soft: #b8231a;
  --red-glow: rgba(212, 43, 32, 0.1);
  --text: #1c1917;
  --text-muted: #6b6560;
  --text-dim: #a8a19a;
  --border: rgba(28, 25, 23, 0.1);
  --border-hover: rgba(28, 25, 23, 0.18);
  --header-bg: rgba(250, 249, 247, 0.85);
  --overlay-bg: rgba(0, 0, 0, 0.3);
  --hover-white: rgba(0, 0, 0, 0.04);
  --hover-white-subtle: rgba(0, 0, 0, 0.02);
  --hover-white-faint: rgba(0, 0, 0, 0.03);
  --dot-grid: rgba(28, 25, 23, 0.05);
  --rs-red-dark: #b8231a;
  color-scheme: light;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Dot grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

a { color: var(--red); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--red-soft); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

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

/* ========== LAYOUT ========== */
.wrap {
  width: min(1100px, 90vw);
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.container {
  width: min(1100px, 90vw);
  margin-inline: auto;
  padding: 24px 16px;
  position: relative;
  z-index: 1;
}

section[id] { scroll-margin-top: 80px; }

/* ========== SKIP LINK ========== */
.skip-link {
  position: absolute; left: -999px; top: 4px; z-index: 200;
  background: var(--red); color: #fff; padding: 8px 16px;
  border-radius: 4px; font-size: 0.85rem;
}
.skip-link:focus { left: 8px; }

/* ========== HEADER ========== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}
.site-header.scrolled { border-color: var(--red); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px;
}

.logo-row {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); text-decoration: none;
}
.logo-row:hover { color: var(--text); }
.logo-img { width: 36px; height: 36px; border-radius: 6px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand-short { display: none; }

.nav-right { display: flex; align-items: center; gap: 4px; }
.main-nav { display: flex; gap: 2px; align-items: center; }
.main-nav a {
  color: var(--text-muted); font-size: 0.82rem; font-weight: 500;
  padding: 6px 14px; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  font-family: var(--font-mono); letter-spacing: -0.01em;
}
.main-nav a:hover { color: var(--text); background: var(--hover-white); }

/* Hamburger */
.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px; z-index: 100;
}
.menu-toggle span {
  display: block; width: 22px; height: 1.5px;
  background: var(--text); border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile drawer */
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--overlay-bg); z-index: 92;
  opacity: 0; transition: opacity 0.3s;
}
.mobile-overlay.visible { opacity: 1; }

.mobile-drawer {
  display: none; position: fixed; top: 0; right: -100%;
  width: min(300px, 80vw); height: 100vh;
  background: var(--surface); z-index: 95;
  padding: 80px 28px 28px;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border);
  flex-direction: column; gap: 4px;
}
.mobile-drawer.open { right: 0; }
.mobile-drawer a {
  color: var(--text-muted); font-family: var(--font-mono);
  font-size: 0.95rem; font-weight: 500;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  display: block; transition: color 0.2s;
}
.mobile-drawer a:hover { color: var(--text); }

/* ========== STITCH DIVIDER ========== */
.stitch {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 0; position: relative; z-index: 1;
}
.stitch svg { width: 40px; height: 64px; opacity: 0.5; }

/* ========== HERO ========== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 100px 0 80px;
}
.hero-glow {
  position: absolute; top: 50%; left: 50%;
  width: 600px; height: 600px;
  transform: translate(-50%, -55%);
  background: radial-gradient(ellipse, var(--red-glow) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero-inner { position: relative; z-index: 1; max-width: 800px; }

.hero-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--red); background: var(--red-glow);
  border: 1px solid rgba(230, 50, 39, 0.25);
  padding: 6px 16px; border-radius: 100px;
  margin-bottom: 32px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 6vw + 0.5rem, 5.5rem);
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 28px;
}
.hero h1 .highlight {
  background: linear-gradient(135deg, var(--red), #ff6b5a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 40px;
}

.hero-cta {
  display: flex; gap: 14px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 56px;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.88rem; font-weight: 600;
  padding: 14px 30px; border-radius: 8px; border: none;
  cursor: pointer; transition: all 0.25s; text-align: center;
}
.btn-primary {
  background: var(--red); color: #fff;
}
.btn-primary:hover {
  background: #cc2b21; color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(230, 50, 39, 0.3);
}
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-hover);
}
.btn-outline:hover {
  border-color: var(--text-muted); color: var(--text);
  background: var(--hover-white-faint);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-hover);
}
.btn-ghost:hover {
  border-color: var(--text-muted); color: var(--text);
  background: var(--hover-white-faint);
}

/* ========== HERO STATS ========== */
.hero-stats {
  display: flex; justify-content: center; gap: 48px;
}
.hero-stat { text-align: center; }
.hero-stat-number {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ========== HIRE SECTION ========== */
.hire-section {
  padding: 80px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.hire-inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 64px; align-items: center;
}
.hire-left h2 {
  font-family: var(--font-display);
  font-weight: 700; font-size: clamp(1.8rem, 3vw, 2.8rem);
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hire-left p {
  color: var(--text-muted);
  font-size: 1.02rem; line-height: 1.75;
}
.hire-right {
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px;
  background: var(--hover-white-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.hire-right .btn { width: 100%; }
.hire-right p {
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--text-dim);
  text-align: center;
}

/* ========== PROJECTS ========== */
.projects-section { padding: 80px 0 96px; }

.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 48px; gap: 24px;
}
.section-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red); margin-bottom: 8px;
}
.section-header h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.03em;
}
.section-header p {
  color: var(--text-dim); font-size: 0.9rem;
  font-family: var(--font-mono);
}

.project-list { display: flex; flex-direction: column; }

.project-row {
  display: grid;
  grid-template-columns: 48px 1fr 2fr auto;
  gap: 24px;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}
.project-row::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--red);
  transform: scaleY(0); transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}
.project-row:hover::before { transform: scaleY(1); }
.project-row:hover {
  background: var(--hover-white-subtle);
  border-color: var(--border-hover);
}

.project-num {
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-dim);
}

.project-name-col {
  display: flex; align-items: center; gap: 14px;
}
.project-logo-sm {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.project-logo-sm img { width: 22px; height: 22px; object-fit: contain; }
.project-logo-sm picture { display: contents; }
.project-logo-sm picture img { width: 22px; height: 22px; object-fit: contain; }
.project-logo-sm .emoji-logo { font-size: 1rem; line-height: 1; }

.project-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 0.95rem;
  color: var(--text);
  transition: color 0.2s;
}
.project-row:hover .project-title { color: var(--red-soft); }

.project-desc-col {
  font-size: 0.85rem; color: var(--text-dim);
  line-height: 1.5;
}

.project-arrow-col {
  font-family: var(--font-mono);
  font-size: 0.85rem; color: var(--text-dim);
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  transform: translateX(-4px);
}
.project-row:hover .project-arrow-col {
  opacity: 1; transform: translateX(0);
}

/* ========== CAPABILITIES ========== */
.capabilities-section {
  padding: 80px 0 88px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.capabilities-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border-radius: 12px; overflow: hidden;
  margin-top: 48px;
}
.capability-card {
  background: var(--surface);
  padding: 36px 28px;
  transition: background 0.2s;
}
.capability-card:hover { background: var(--surface-2); }
.capability-card h3 {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.05rem;
  margin-bottom: 10px;
}
.capability-num {
  font-family: var(--font-mono);
  font-size: 0.65rem; font-weight: 500;
  color: var(--red); letter-spacing: 0.1em;
  margin-bottom: 20px;
  display: block;
}
.capability-card p {
  font-size: 0.85rem; color: var(--text-dim);
  line-height: 1.6;
}
.capabilities-link {
  margin-top: 32px; font-size: 0.88rem;
  font-family: var(--font-mono);
}

/* ========== FAQ ========== */
.faq-section { padding: 80px 0 96px; }
.faq-list { max-width: 680px; margin-top: 48px; }

.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none;
  padding: 22px 0; cursor: pointer; text-align: left;
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 500;
  color: var(--text); gap: 16px;
  transition: color 0.2s;
}
.faq-question:hover { color: var(--red-soft); }

.faq-chevron {
  width: 20px; height: 20px; flex-shrink: 0;
  position: relative;
}
.faq-chevron::before {
  content: "";
  position: absolute; top: 6px; left: 3px;
  width: 10px; height: 10px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 0.3s;
}
.faq-item.open .faq-chevron::before {
  transform: rotate(-135deg);
  top: 9px;
}

.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-answer-inner {
  padding: 0 0 22px;
  font-size: 0.92rem; color: var(--text-muted);
  line-height: 1.75;
}

/* ========== CONTACT ========== */
.contact-section {
  padding: 80px 0 96px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.contact-grid {
  display: grid; grid-template-columns: 1fr 1.1fr;
  gap: 64px; align-items: start;
}
.contact-left h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.03em; margin-bottom: 16px;
}
.contact-left > p {
  color: var(--text-muted); font-size: 1rem;
  line-height: 1.75; margin-bottom: 36px;
}

.contact-methods { display: flex; flex-direction: column; gap: 20px; }
.contact-method {
  display: flex; align-items: center; gap: 14px;
}
.contact-method-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--red-glow);
  border: 1px solid rgba(230, 50, 39, 0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.95rem; color: var(--red);
}
.contact-method-info strong {
  display: block; font-size: 0.78rem; font-weight: 600;
  font-family: var(--font-mono); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-dim);
}
.contact-method-info a,
.contact-method-info span {
  font-size: 0.92rem; color: var(--text-muted);
}

.contact-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 32px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 6px;
}
.form-group label .req { color: var(--red); }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  color: var(--text); font-family: var(--font-body);
  font-size: 0.92rem; transition: border-color 0.2s;
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}
.form-group select option { background: var(--surface-2); color: var(--text); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-submit { width: 100%; font-size: 0.92rem; }

.form-message {
  margin-top: 14px; padding: 12px 16px;
  border-radius: 8px; font-size: 0.88rem;
}
.form-message.success {
  background: rgba(76, 175, 80, 0.1);
  color: #81c784; border: 1px solid rgba(76, 175, 80, 0.2);
}
.form-message.error {
  background: rgba(230, 50, 39, 0.1);
  color: var(--red-soft); border: 1px solid rgba(230, 50, 39, 0.2);
}

/* Hide honeypot */
input[name="website"] {
  position: absolute;
  left: -9999px;
}

/* ========== FOOTER ========== */
.site-footer {
  padding: 28px 0; text-align: center;
  border-top: 1px solid var(--border);
}
.site-footer small {
  font-family: var(--font-mono);
  color: var(--text-dim); font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* ========== UTILITY CLASSES (sub-page compat) ========== */
.section {
  margin: 64px auto;
  padding: 32px 0;
}
.section h2 {
  text-align: center;
  margin: 0 0 16px;
  color: var(--text);
  font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem);
}
.lead {
  text-align: center;
  color: var(--text-muted);
  margin: 0 auto 40px;
  max-width: 600px;
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; padding: 5px 8px;
  color: var(--text-muted); transition: color 0.2s, background 0.2s, border-color 0.2s;
  margin-left: 6px;
}
.theme-toggle:hover {
  color: var(--text); background: var(--hover-white);
  border-color: var(--border-hover);
}
.theme-toggle svg { width: 16px; height: 16px; display: block; }

.mobile-drawer .theme-toggle {
  margin: 16px 0 0; padding: 12px 0;
  border: none; border-top: 1px solid var(--border); border-radius: 0;
  width: 100%; justify-content: flex-start; gap: 10px;
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500;
  margin-left: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .project-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 18px 20px;
  }
  .project-num { display: none; }
  .project-desc-col { display: none; }
  .project-arrow-col { display: none; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .mobile-drawer { display: flex; }
  .main-nav { display: none; }
  .brand-full { display: none; }
  .brand-short { display: inline; }

  .hero { min-height: auto; padding: 110px 0 64px; }
  .hero h1 { font-size: clamp(2.2rem, 8vw, 3.2rem); }
  .hero-glow { width: 350px; height: 350px; }
  .hero-stats { gap: 32px; }
  .hero-stat-number { font-size: 1.6rem; }

  .hire-inner { grid-template-columns: 1fr; gap: 32px; }

  .capabilities-grid { grid-template-columns: 1fr 1fr; }

  .contact-grid { grid-template-columns: 1fr; gap: 36px; }
  .form-row { grid-template-columns: 1fr; }

  .section-header { flex-direction: column; align-items: flex-start; }

  .stitch svg { height: 40px; }

  .container { padding: 16px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .hero-stats { flex-direction: column; gap: 20px; }

  .capabilities-grid { grid-template-columns: 1fr; }

  .contact-form { padding: 24px 18px; }
}
