/* ===================================================
   AI ToolKit Hub — Shared Styles
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Sora:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Color tokens */
  --bg-deep: #120c1e;
  --bg-surface: #1b1330;
  --bg-surface-alt: #221a3a;
  --border-soft: #2e2350;
  --purple-deep: #6d28d9;
  --purple-mid: #7c3aed;
  --purple-light: #c4b5fd;
  --amber: #f0b429;
  --amber-soft: #f7d38d;
  --text-primary: #f4f0ff;
  --text-muted: #a998c9;
  --text-faint: #6f5f96;

  /* Type */
  --font-display: 'Fraunces', serif;
  --font-body: 'Sora', sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Layout */
  --max-width: 1120px;
  --radius-sm: 6px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

h1, h2, h3 { overflow-wrap: break-word; word-break: break-word; }

@media (max-width: 480px) {
  .container { padding: 0 18px; }
}

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

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em 0;
  letter-spacing: -0.01em;
}

p { color: var(--text-muted); max-width: 66ch; }

/* Focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

.value-grid .reveal:nth-child(1) { transition-delay: 0s; }
.value-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.value-grid .reveal:nth-child(3) { transition-delay: 0.2s; }
.value-grid .reveal:nth-child(4) { transition-delay: 0.3s; }
.value-grid .reveal:nth-child(5) { transition-delay: 0.4s; }
.value-grid .reveal:nth-child(6) { transition-delay: 0.5s; }
.value-grid .reveal:nth-child(7) { transition-delay: 0.6s; }
.value-grid .reveal:nth-child(8) { transition-delay: 0.7s; }
.value-grid .reveal:nth-child(9) { transition-delay: 0.8s; }

.article-grid .reveal:not(.revealed):nth-child(3n+1) { transition-delay: 0s; }
.article-grid .reveal:not(.revealed):nth-child(3n+2) { transition-delay: 0.08s; }
.article-grid .reveal:not(.revealed):nth-child(3n+3) { transition-delay: 0.16s; }

/* ---------- Header / Nav ---------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 12, 30, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: background 0.35s ease, border-color 0.35s ease, padding 0.35s ease;
}

header.site-header.is-scrolled {
  background: rgba(18, 12, 30, 0.92);
  border-bottom: 1px solid var(--border-soft);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  transition: padding 0.35s ease;
}

header.site-header.is-scrolled .nav-row {
  padding: 12px 0;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

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

nav.main-nav ul {
  list-style: none;
  display: flex;
  gap: 32px;
  margin: 0;
  padding: 0;
}

nav.main-nav a {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  color: var(--text-primary);
  border-bottom-color: var(--amber);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  nav.main-nav {
    display: none;
    width: 100%;
  }
  nav.main-nav.open { display: block; }
  nav.main-nav ul {
    flex-direction: column;
    gap: 4px;
    padding-bottom: 16px;
  }
  .nav-row { flex-wrap: wrap; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, box-shadow 0.25s ease;
}

.btn-primary {
  background: var(--amber);
  color: #1a1206;
}
.btn-primary:hover {
  background: var(--amber-soft);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px -8px rgba(240, 180, 41, 0.5);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-outline {
  background: transparent;
  border-color: var(--border-soft);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--purple-light);
  transform: translateY(-2px);
}
.btn-outline:active { transform: translateY(0); }

/* ---------- Hero (home) ---------- */
.hero {
  padding: 72px 0 88px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -180px;
  right: -160px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.35) 0%, rgba(124, 58, 237, 0) 70%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  position: relative;
  perspective: 1100px;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-grid > * { position: relative; z-index: 1; }

.eyebrow-tag {
  display: inline-block;
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.6rem, 5.6vw, 4.4rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.hero p.lede {
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  will-change: transform;
  box-shadow: 0 30px 60px -20px rgba(109, 40, 217, 0.45);
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
}

/* ---------- Section framing ---------- */
section { padding: 96px 0; }

.section-alt { background: var(--bg-surface); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }

.section-head { max-width: 640px; margin-bottom: 48px; }

.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); letter-spacing: -0.02em; }

/* ---------- Feature / value grid ---------- */
.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.value-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 28px;
  background: var(--bg-surface);
}

.value-card .icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.18);
  color: var(--purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.value-card h3 { font-size: 1.1rem; color: var(--text-primary); }
.value-card p { margin: 0; font-size: 0.95rem; }

@media (max-width: 860px) {
  .value-grid { grid-template-columns: 1fr; }
}

/* ---------- Flip-to-reveal fact cards ---------- */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.fact-card {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 280px;
  perspective: 1200px;
  border-radius: var(--radius-md);
}

.fact-card:focus-visible .fact-card-inner {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.fact-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
  transform-style: preserve-3d;
}

.fact-card[aria-expanded="true"] .fact-card-inner {
  transform: rotateY(180deg);
}

.fact-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.fact-front {
  background: var(--bg-surface);
}

.fact-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(240, 180, 41, 0.16);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-family: var(--font-mono);
}

.fact-question {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--text-primary);
  text-align: left;
}

.fact-hint {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.fact-back {
  background: var(--bg-surface-alt);
  transform: rotateY(180deg);
  justify-content: center;
  overflow-y: auto;
}

.fact-back p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
  text-align: left;
}

@media (max-width: 860px) {
  .value-grid { grid-template-columns: 1fr; }
  .fact-grid { grid-template-columns: 1fr; }
  .fact-card { height: 260px; }
}

@media (max-width: 420px) {
  .fact-card { height: 240px; }
}

/* ---------- AI Tool Matcher quiz ---------- */
.tool-quiz {
  max-width: 640px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 40px;
}

.quiz-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.quiz-progress-dot {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-soft);
  transition: background 0.3s ease;
}

.quiz-progress-dot.is-active {
  background: var(--amber);
}

.quiz-step {
  animation: quizFadeIn 0.35s ease;
}

@keyframes quizFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 0 0 20px;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quiz-option {
  all: unset;
  display: block;
  box-sizing: border-box;
  cursor: pointer;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.quiz-option:hover {
  border-color: var(--purple-mid);
  background: rgba(124, 58, 237, 0.14);
  transform: translateY(-1px);
}

.quiz-option:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.quiz-result-label {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 0 0 20px;
}

.quiz-result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-result-item {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.quiz-result-item:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
}

.quiz-retake {
  all: unset;
  cursor: pointer;
  color: var(--purple-light);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--purple-light);
  padding-bottom: 1px;
}

@media (max-width: 640px) {
  .tool-quiz { padding: 28px 22px; }
  .quiz-options { grid-template-columns: 1fr; }
}

/* ---------- Article grid (Explore page) ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  perspective: 1000px;
}

.article-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
}

.article-card.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  will-change: transform;
}

.article-card.tilt-card:hover {
  box-shadow: 0 26px 50px -18px rgba(109, 40, 217, 0.5);
  border-color: var(--purple-mid);
}

.article-card .thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg-surface-alt);
}

.article-card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}

.article-card .card-body {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-card .tag {
  font-size: 0.78rem;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-card .tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.article-card h3 {
  font-size: 1.08rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.article-card p {
  font-size: 0.92rem;
  margin: 0 0 16px 0;
}

.article-card .read-link {
  margin-top: auto;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--purple-light);
  border-bottom: 1px solid var(--purple-light);
  align-self: flex-start;
}

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

/* ---------- Article page (full-bleed video hero) ---------- */
.article-hero-video {
  position: relative;
  min-height: 64vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--bg-deep);
}

.article-hero-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.article-hero-video .article-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(18, 12, 30, 0.5) 0%,
    rgba(18, 12, 30, 0.6) 55%,
    var(--bg-deep) 100%
  );
}

.article-hero-content {
  position: relative;
  z-index: 2;
  padding: 140px 0 56px;
  width: 100%;
}

.article-hero-content .tag {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.85rem;
}

.article-hero-content h1 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  margin-top: 14px;
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 14px;
}

.article-hero-content p.lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 52ch;
  margin-top: 16px;
}

@media (max-width: 700px) {
  .article-hero-video { min-height: 52vh; }
  .article-hero-content { padding: 110px 0 40px; }
}

.article-cover {
  margin: 40px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.article-body {
  max-width: 72ch;
}

.article-body h2 {
  font-size: 1.4rem;
  margin-top: 2em;
  color: var(--text-primary);
}

.article-body p { margin: 0 0 1.2em 0; }

.article-body h3 {
  font-size: 1.12rem;
  margin: 1.6em 0 0.6em;
  color: var(--purple-light);
  font-family: var(--font-body);
  font-weight: 600;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.2em 0;
  padding-left: 1.4em;
  color: var(--text-primary);
}

.article-body ul li,
.article-body ol li {
  margin-bottom: 0.55em;
  line-height: 1.6;
}

.article-body ul li::marker { color: var(--amber); }
.article-body ol li::marker { color: var(--amber); font-weight: 700; }

.article-body .table-wrap {
  overflow-x: auto;
  margin: 0 0 1.6em 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 480px;
}

.article-body thead th {
  background: var(--bg-surface-alt);
  color: var(--amber-soft);
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.article-body tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-muted);
  vertical-align: top;
}

.article-body tbody tr:last-child td { border-bottom: none; }
.article-body tbody tr:hover td { background: rgba(124,58,237,0.06); color: var(--text-primary); }

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-soft);
}
.back-link:hover { color: var(--text-primary); }

/* ---------- Technical frame (article content wrapper) ---------- */
.tech-frame {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 40px 0 56px;
  background:
    linear-gradient(var(--bg-deep), var(--bg-deep)) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(124,58,237,0.05) 40px);
}

.tech-frame-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-surface-alt);
}

.tech-frame-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tech-frame-bar .dot.purple { background: var(--purple-mid); }
.tech-frame-bar .dot.amber { background: var(--amber); }
.tech-frame-bar .dot.lilac { background: var(--purple-light); }

.tech-frame-bar .label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-left: 6px;
  letter-spacing: 0.02em;
}

.tech-frame-body {
  padding: 36px 40px 44px;
}

@media (max-width: 640px) {
  .tech-frame-body { padding: 24px 20px 32px; }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.contact-info .item { margin-bottom: 24px; }
.contact-info .label {
  font-size: 0.8rem;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 4px;
}
.contact-info .value { color: var(--text-primary); font-size: 1.02rem; }

form.contact-form { display: flex; flex-direction: column; gap: 16px; }

.hidden-field { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

.form-status {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin: 0;
}
.form-status.is-success {
  background: rgba(45, 232, 122, 0.12);
  color: #6ee7a8;
  border: 1px solid rgba(45, 232, 122, 0.3);
}
.form-status.is-error {
  background: rgba(232, 90, 74, 0.12);
  color: #f2a598;
  border: 1px solid rgba(232, 90, 74, 0.3);
}

form.contact-form label {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

form.contact-form input,
form.contact-form textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

form.contact-form input:focus,
form.contact-form textarea:focus {
  outline: none;
  border-color: var(--purple-mid);
}

@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; }
}

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

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

.footer-row .brand { font-size: 1.1rem; }

.footer-links { display: flex; gap: 24px; list-style: none; padding: 0; margin: 0; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--text-primary); }

.footer-note { color: var(--text-faint); font-size: 0.82rem; margin-top: 20px; }

/* ---------- Secondary page video banners ---------- */
.page-video-banner {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  margin: 8px 0 40px;
  box-shadow: 0 24px 48px -20px rgba(109, 38, 217, 0.4);
}

.page-video-banner video {
  width: 100%;
  display: block;
  max-height: 380px;
  object-fit: cover;
}
