/* ================================================================
   AI Architect — Design System (Apple-inspired, light)
   ================================================================ */

/* ================================================================
   1. TOKENS
   ================================================================ */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --bg-dark: #1d1d1f;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --green: #28a745;
  --orange: #f59e0b;
  --purple: #a855f7;
  --pink: #ec4899;
  --cyan: #06b6d4;
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.16);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 8px 32px rgba(0,0,0,0.1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', monospace;
  --section-pad: 120px;
}

/* ================================================================
   2. RESET & BASE
   ================================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ================================================================
   2b. SKIP LINK (a11y)
   ================================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 300;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
  color: #fff;
}

/* ================================================================
   3. HEADER / NAV
   ================================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(251,251,253,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.header.scrolled {
  background: rgba(251,251,253,0.92);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo span { color: var(--accent); }

.nav { display: flex; gap: 32px; align-items: center; }
.nav a {
  position: relative;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.nav a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  z-index: 110;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ================================================================
   4. HERO
   ================================================================ */
.hero-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero {
  max-width: 900px;
  text-align: center;
  padding: 0 32px;
}

h1 {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 24px;
  color: var(--text);
}
.subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 48px;
  line-height: 1.6;
}

.scroll-hint {
  margin-top: 48px;
  animation: scrollBounce 2s ease-in-out infinite;
}
.scroll-hint svg {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  opacity: 0.5;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ================================================================
   5. BUTTONS (Apple-style pill)
   ================================================================ */
.cta-group { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 980px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: all 0.2s var(--ease-smooth);
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  color: var(--accent);
}
.btn-secondary:hover {
  color: var(--accent-hover);
}
.btn-full { width: 100%; text-align: center; }

.btn-submit {
  width: 100%;
  padding: 12px;
  border-radius: 980px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-submit:hover:not(:disabled) { background: var(--accent-hover); }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================================================================
   6. SECTIONS
   ================================================================ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--section-pad) 32px;
}
.section-alt {
  background: var(--bg-alt);
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 64px;
  font-size: 1.1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ================================================================
   7. SCROLL REVEAL ANIMATIONS
   ================================================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

.stagger { transition-delay: calc(var(--stagger, 0) * 100ms); }

/* Scale-on-scroll: controlled via JS --scroll-progress */
.scale-on-scroll {
  transform: scale(calc(0.85 + var(--scroll-progress, 0) * 0.15));
  will-change: transform;
}

/* ================================================================
   8. CARDS
   ================================================================ */
.card {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* ================================================================
   9. INSTALL / CODE BLOCKS
   ================================================================ */
.install {
  margin: 48px auto;
  max-width: 700px;
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 16px 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #86efac;
  text-align: left;
  overflow-x: auto;
  position: relative;
}
.install .prompt { color: #a1a1a6; }
.install .cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: #86efac;
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
}
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.08);
  color: #a1a1a6;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s;
  z-index: 3;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.copy-btn.copied { background: var(--green); color: #fff; border-color: var(--green); }

code {
  background: rgba(0,113,227,0.06);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent);
}
pre {
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #86efac;
  overflow-x: auto;
  margin: 16px 0 24px;
  line-height: 1.6;
  position: relative;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
pre .comment, .code-block .comment { color: #a1a1a6; }
pre .key { color: #60a5fa; }
pre .value { color: #86efac; }
pre .prompt, .code-block .prompt { color: #a1a1a6; }

.code-block {
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 16px 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #86efac;
  margin: 16px 0;
  overflow-x: auto;
  position: relative;
}

/* ================================================================
   10. TABLES
   ================================================================ */
.comparison-table, .validation-table, .how-table, .types-table {
  width: 100%;
  border-collapse: collapse;
}
.comparison-table th, .comparison-table td,
.validation-table th, .validation-table td,
.how-table th, .how-table td,
.types-table th, .types-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.comparison-table th, .validation-table th, .how-table th, .types-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.comparison-table td:first-child, .validation-table td:first-child,
.how-table td:first-child, .types-table td:first-child {
  font-weight: 600;
}
.comparison-table td:nth-child(2), .validation-table td:nth-child(2),
.types-table td:nth-child(2) {
  color: var(--text-secondary);
}
.validation-table td:nth-child(3), .comparison-table .col-spec {
  color: var(--green);
}
.comparison-table tr:hover td,
.validation-table tr:hover td,
.how-table tr:hover td,
.types-table tr:hover td {
  background: rgba(0,113,227,0.03);
}
.how-table td:nth-child(2) {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.how-table td:nth-child(3) { color: var(--text-secondary); }
.research-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 0.85rem;
}

.comparison-table-wrap, .types-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

/* ================================================================
   11. STATS
   ================================================================ */
.stat-row {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  margin: 32px 0;
}
.stat-item { text-align: center; }
.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  display: block;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.stats-row {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 40px;
}
.stat { text-align: center; }
.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.stat-label-sm {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ================================================================
   12. FAQ ACCORDION
   ================================================================ */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.faq-question {
  width: 100%;
  text-align: left;
  padding: 20px 0;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
}
.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 300;
  transition: transform 0.3s var(--ease-out);
  flex-shrink: 0;
  margin-left: 16px;
}
.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out);
}
.faq-answer-inner {
  padding: 0 0 20px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}
.faq-answer-inner p { margin-bottom: 12px; }
.faq-answer-inner p:last-child { margin-bottom: 0; }
.faq-answer-inner ul, .faq-answer-inner ol {
  margin: 8px 0 16px 24px;
}
.faq-answer-inner li { margin-bottom: 4px; }

/* ================================================================
   13. READING PROGRESS BAR
   ================================================================ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 200;
  width: 0%;
  transition: width 0.1s;
}

/* ================================================================
   14. FOOTER
   ================================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 80px;
}
.footer-links {
  margin-bottom: 8px;
  line-height: 2;
}
.footer-links a {
  color: var(--text-secondary);
  margin: 0 4px;
  font-size: 0.85rem;
}
.footer-links a:hover { color: var(--text); }

/* ================================================================
   15. TERMINAL / VIDEO
   ================================================================ */
.terminal-output {
  background: var(--bg-dark);
  border-radius: 16px;
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto 32px;
}
.terminal-header {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #444;
}
.terminal-dot:first-child { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #28c940; }
.terminal-body {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  overflow-x: auto;
  color: #a1a1a6;
  margin: 0;
}
.t-prompt { color: #a1a1a6; }
.t-cmd { color: #f5f5f7; }
.t-stage { color: #60a5fa; }
.t-pass { color: #86efac; font-weight: 700; }
.t-time { color: #a1a1a6; }
.t-dots { color: #3a3a3c; }
.t-summary { color: #f5f5f7; font-weight: 600; }
.t-comment { color: #a1a1a6; }

.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: #86efac;
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}

.video-wrap {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.video-wrap video {
  width: 100%;
  display: block;
}

/* ================================================================
   16. CONTACT FORM
   ================================================================ */
.contact-box {
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea { min-height: 120px; resize: vertical; }
.ht-field { position: absolute; left: -9999px; }
.pow-progress {
  text-align: center;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.contact-status { text-align: center; margin-top: 16px; font-size: 0.85rem; }
.contact-status.success { color: var(--green); }
.contact-status.error { color: #ef4444; }
.contact-checklist {
  margin-top: 24px;
  padding: 16px 24px;
  background: var(--bg-alt);
  border-radius: 10px;
  list-style: none;
}
.contact-checklist li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.contact-checklist li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ================================================================
   17. CTA SECTIONS
   ================================================================ */
.cta-section {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  margin: 48px 0;
  box-shadow: var(--shadow-card);
}
.cta-section h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  margin-top: 0;
}
.cta-section p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.cta-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  margin: 48px 0;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.cta-card h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  margin-top: 0;
}
.cta-card p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 24px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ================================================================
   18. BADGE (minimal)
   ================================================================ */
.badge {
  display: inline-block;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ================================================================
   19. SHARED: GRID & ARTICLE (deduplicated from per-page CSS)
   ================================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ================================================================
   20. RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  /* Mobile hamburger nav */
  .nav-toggle { display: flex; }
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg);
    flex-direction: column;
    padding: 80px 32px 32px;
    gap: 24px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 105;
  }
  .nav.nav-open {
    transform: translateX(0);
  }
  .nav a {
    font-size: 1rem;
  }
  .nav a.active::after { display: none; }
}

@media (max-width: 640px) {
  :root { --section-pad: 64px; }
  h1 { font-size: 2.2rem; }
  .hero-wrapper { min-height: auto; padding: 80px 0; }
  .header { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-row, .stat-row { gap: 24px; }
  .cta-group { flex-direction: column; align-items: center; }
  .section-title { font-size: 1.8rem; }
}

@media (min-width: 1440px) {
  .section { max-width: 1320px; }
}

/* ================================================================
   21. PAGE CONTENT LAYER
   ================================================================ */
.page-content { position: relative; z-index: 1; }

/* Section divider — subtle */
.section-divider {
  height: 1px;
  background: var(--border);
  max-width: 200px;
  margin: 0 auto;
}

/* Nav overlay backdrop */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 104;
}
.nav-overlay.active {
  display: block;
}
