/* AI Theoria — Main CSS */
:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #1a202c;
  --text-muted: #64748b;
  --border: rgba(99,102,241,0.12);
  --radius: 12px;
  --gap: 2.5em;
  --nav-height: 4.5em;
  --funding-bar-h: 0px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
img { max-width: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.7; color: var(--text); background: var(--bg); overflow-x: hidden; }

/* ── Page Top ─────────────────────────── */
.page-top { padding-top: var(--nav-height); }

/* ── Container ────────────────────────── */
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 0 2em; box-sizing: border-box; }

/* ── Nav ──────────────────────────────── */
.navbar {
  position: fixed !important;
  top: var(--funding-bar-h, 0px) !important;
  left: 0 !important; right: 0 !important;
  width: 100% !important;
  background: #fff !important;
  z-index: 9999 !important;
  border-bottom: 1px solid rgba(99,102,241,0.12) !important;
  height: var(--nav-height);
  display: flex !important;
  align-items: center !important;
}
.nav-container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2.5em;
  width: 100%;
}
.logo {
  display: flex !important;
  align-items: center !important;
  gap: 0.6em;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  color: var(--accent) !important;
  -webkit-text-fill-color: var(--accent) !important;
  background: none !important;
  background-clip: unset !important;
  -webkit-background-clip: unset !important;
}
.logo img { height: 34px; width: auto; display: block; }
.nav-links {
  display: flex !important;
  flex-direction: row !important;
  list-style: none !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
.nav-links li a {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 1em;
  color: var(--text-muted);
  font-size: 0.78em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-links li a:hover,
.nav-links li.active a,
.nav-links li a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* Mobile menu toggle */
.mobile-menu { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.mobile-menu span { display: block; width: 24px; height: 2px; background: var(--text); transition: all 0.3s; }

/* ── Hero ─────────────────────────────── */
.hero {
  background-image: url('../images/hero-main.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgba(10,15,40,0.35);
  background-blend-mode: multiply;
  position: relative;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6em 2em;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 0;
  pointer-events: none;
}
.hero > * { position: relative; z-index: 2; }
.hero-content { max-width: 760px; }
.hero h1 { font-size: 2.8em; font-weight: 800; color: #fff; line-height: 1.15; margin-bottom: 0.6em; }
.hero p { font-size: 1.1em; color: rgba(255,255,255,0.85); margin-bottom: 2em; line-height: 1.7; }
.hero .cta-button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.85em 2.2em;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95em;
  transition: background 0.2s, transform 0.2s;
  letter-spacing: 0.03em;
}
.hero .cta-button:hover { background: var(--accent-dark); transform: translateY(-2px); }

/* ── Sections ─────────────────────────── */
.section-block { padding: 5em 0; }
.section-block.alt { background: var(--surface-alt); }
.section-title { font-size: 2em; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 0.5em; }
.section-subtitle { text-align: center; color: var(--text-muted); font-size: 1em; margin-bottom: 3em; max-width: 600px; margin-left: auto; margin-right: auto; }

/* ── Services Grid ────────────────────── */
.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.service-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2em;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
}
.service-card:hover { box-shadow: 0 8px 32px rgba(99,102,241,0.12); transform: translateY(-3px); }
.service-card .svc-icon { width: 52px; height: 52px; background: rgba(99,102,241,0.08); border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 1.2em; }
.service-card .svc-icon svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 2; }
.service-card h3 { font-size: 1.05em; font-weight: 700; margin-bottom: 0.6em; color: var(--text); }
.service-card p { color: var(--text-muted); font-size: 0.9em; line-height: 1.7; }
.service-features { list-style: none; margin-top: 1em; }
.service-features li { font-size: 0.88em; color: var(--text-muted); padding: 0.25em 0; padding-left: 1.4em; position: relative; }
.service-features li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* ── About / Stats ────────────────────── */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4em; align-items: center; }
.about-grid .about-text h2 { font-size: 1.8em; font-weight: 700; margin-bottom: 0.8em; }
.about-grid .about-text p { color: var(--text-muted); margin-bottom: 1em; }
.about-img-wrap { width: 100%; overflow: hidden; border-radius: var(--radius); }
.about-img-wrap img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 2em; margin-top: 2.5em; }
.stat-item { text-align: center; }
.stat-item .stat-num { font-size: 2.2em; font-weight: 800; color: var(--accent); display: block; }
.stat-item .stat-label { font-size: 0.82em; color: var(--text-muted); }

/* ── Advantages ───────────────────────── */
.advantages-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: var(--gap); }
.advantage-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2em;
  border: 1px solid var(--border);
  display: flex;
  gap: 1em;
  align-items: flex-start;
}
.adv-num { font-size: 1.8em; font-weight: 800; color: rgba(99,102,241,0.2); line-height: 1; flex-shrink: 0; }
.adv-text h4 { font-size: 0.95em; font-weight: 700; margin-bottom: 0.3em; }
.adv-text p { font-size: 0.85em; color: var(--text-muted); line-height: 1.6; }

/* ── Team Cards ───────────────────────── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: var(--gap); }
.team-card { background: var(--surface); border-radius: var(--radius); padding: 2em 1.5em; text-align: center; border: 1px solid var(--border); }
.team-card img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; object-position: 50% 10%; display: block; margin: 0 auto 1.2em; }
.team-card h3 { font-size: 1em; font-weight: 700; margin-bottom: 0.25em; }
.team-card .team-role { font-size: 0.82em; color: var(--accent); font-weight: 600; margin-bottom: 0.8em; }
.team-card .bio { font-size: 0.87em; color: var(--text-muted); line-height: 1.6; }

/* ── Team horizontal variant ──────────── */
.team-card.team-card--h {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 1.8em !important;
  padding: 1.8em 2em !important;
  text-align: left !important;
}
.team-card.team-card--h img { width: 88px !important; height: 88px !important; min-width: 88px !important; margin: 0 !important; border-radius: 50% !important; }
.team-card.team-card--h .team-info { flex: 1; min-width: 0; }
.team-card.team-card--h .bio { max-height: none; overflow: visible; }
@media (max-width: 600px) {
  .team-card.team-card--h { flex-direction: column !important; align-items: center !important; text-align: center !important; }
}

/* ── Blog ─────────────────────────────── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr)); gap: var(--gap); }
.article-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); display: flex; flex-direction: column; }
.article-card .card-thumb { width: 100%; overflow: hidden; }
.article-card .card-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; object-position: center; display: block; }
.article-card .card-body { padding: 1.5em; flex: 1; display: flex; flex-direction: column; }
.article-card .card-tag { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 0.5em; }
.article-card h3 { font-size: 1em; font-weight: 700; margin-bottom: 0.5em; line-height: 1.4; }
.article-card h3 a { color: var(--text); text-decoration: none; }
.article-card h3 a:hover { color: var(--accent); }
.article-card .card-excerpt { font-size: 0.87em; color: var(--text-muted); line-height: 1.6; flex: 1; margin-bottom: 1em; }
.article-card .card-meta { font-size: 0.78em; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 0.8em; }
.article-card.pinned { border-left: 3px solid var(--accent); }
.tag { display: inline-block; font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 0.2em 0.6em; border-radius: 3px; }
.tag.funding { background: var(--accent); color: #fff; }

/* ── Article page ─────────────────────── */
.article-hero-img { width: 100%; overflow: hidden; border-radius: var(--radius); margin-bottom: 2em; }
.article-hero-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.article-content { max-width: 760px; margin: 0 auto; }
.article-content h1 { font-size: 2em; font-weight: 800; margin-bottom: 0.5em; line-height: 1.2; }
.article-content h2 { font-size: 1.3em; font-weight: 700; margin: 2em 0 0.6em; }
.article-content p { margin-bottom: 1.2em; color: var(--text); line-height: 1.8; }
.article-content ul, .article-content ol { margin: 0 0 1.2em 1.5em; }
.article-content li { margin-bottom: 0.4em; color: var(--text); line-height: 1.7; }
.article-back { display: inline-flex; align-items: center; gap: 0.4em; color: var(--accent); text-decoration: none; font-size: 0.88em; font-weight: 600; margin-bottom: 2em; }
.article-back:hover { text-decoration: underline; }
.article-meta { font-size: 0.85em; color: var(--text-muted); margin-bottom: 2em; padding-bottom: 1.5em; border-bottom: 1px solid var(--border); }

/* ── CTA Band ──────────────────────────── */
.cta-band { background: var(--accent); padding: 5em 2em; text-align: center; }
#main .cta-band h2, .cta-band h2 { color: #fff !important; font-size: 1.8em; margin-bottom: 0.5em; }
#main .cta-band p, .cta-band p { color: rgba(255,255,255,0.85) !important; margin-bottom: 1.5em; }
.cta-band .cta-button { background: #fff; color: var(--accent); }
.cta-band .cta-button:hover { background: rgba(255,255,255,0.9); }

/* ── Testimonials ──────────────────────── */
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: var(--gap); }
.testimonial-card { background: var(--surface); border-radius: var(--radius); padding: 2em; border: 1px solid var(--border); }
.testimonial-card blockquote { font-size: 0.93em; color: var(--text-muted); line-height: 1.7; font-style: italic; margin-bottom: 1.5em; }
.testimonial-card cite { display: flex; align-items: center; gap: 0.8em; font-style: normal; }
.testimonial-card cite .author-init { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.82em; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.testimonial-card cite .author-name { font-weight: 600; font-size: 0.88em; }
.testimonial-card cite .author-title { font-size: 0.78em; color: var(--text-muted); }

/* ── Contact ───────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4em; align-items: start; }
.contact-info h2 { font-size: 1.6em; font-weight: 700; margin-bottom: 1em; }
.contact-info p { color: var(--text-muted); margin-bottom: 1.5em; }
.contact-detail { display: flex; gap: 0.8em; align-items: flex-start; margin-bottom: 1em; }
.contact-detail svg { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 2; flex-shrink: 0; margin-top: 2px; }
.contact-detail span { font-size: 0.9em; color: var(--text-muted); }
.contact-form { background: var(--surface); border-radius: var(--radius); padding: 2.5em; border: 1px solid var(--border); }
.form-field { margin-bottom: 1.2em; }
.form-field label { display: block; font-size: 0.85em; font-weight: 600; margin-bottom: 0.4em; }
.form-field input, .form-field textarea, .form-field select { width: 100%; padding: 0.75em 1em; border: 1px solid rgba(99,102,241,0.2); border-radius: 6px; font-family: inherit; font-size: 0.9em; color: var(--text); background: var(--bg); transition: border-color 0.2s; }
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); }
.form-field textarea { min-height: 120px; resize: vertical; }
.btn-primary { display: inline-block; background: var(--accent); color: #fff; border: none; padding: 0.85em 2em; border-radius: 6px; font-size: 0.95em; font-weight: 600; cursor: pointer; transition: background 0.2s; width: 100%; text-align: center; }
.btn-primary:hover { background: var(--accent-dark); }

/* ── Footer ────────────────────────────── */
#footer { background: #1e293b; border-top: 1px solid rgba(255,255,255,0.06); padding: 4em 2em 2em; width: 100%; }
#footer .inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3em; max-width: 1400px; margin: 0 auto; padding: 0 4em; align-items: start; box-sizing: border-box; }
#footer h2 { color: #fff; font-size: 0.95em; font-weight: 600; margin: 0 0 1em; letter-spacing: 0.05em; text-transform: uppercase; }
#footer p { color: rgba(255,255,255,0.55); font-size: 0.88em; line-height: 1.7; margin: 0; }
.footer-nav { list-style: none; margin: 0; padding: 0; }
.footer-nav li { margin-bottom: 0.5em; }
.footer-nav a { color: rgba(255,255,255,0.55); text-decoration: none; font-size: 0.88em; transition: color 0.2s; }
.footer-nav a:hover { color: #fff; }
#footer .copyright { color: rgba(255,255,255,0.35); font-size: 0.8em; text-align: center; margin: 2.5em auto 0; padding-top: 1.5em; border-top: 1px solid rgba(255,255,255,0.08); max-width: 1100px; }

/* ── Cookie Banner ─────────────────────── */
#cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #1e293b;
  color: #e8eaf0;
  padding: 1.2em 2em;
  border-top: 1px solid rgba(99,102,241,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  z-index: 10003;
  flex-wrap: wrap;
}
#cookie-banner p { margin: 0; font-size: 0.88em; color: rgba(255,255,255,0.75); }
#cookie-banner a { color: var(--accent); }
#cookie-banner button { border: none; padding: 0.45em 1.2em; border-radius: 6px; cursor: pointer; font-size: 0.85em; }
#cookie-accept { background: var(--accent); color: #fff; }
#cookie-decline { background: transparent; color: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.2) !important; }

/* ── Legal pages ───────────────────────── */
.legal-content { max-width: 800px; margin: 0 auto; padding: 3em 2em; }
.legal-content h1 { font-size: 2em; font-weight: 800; margin-bottom: 0.5em; }
.legal-content h2 { font-size: 1.2em; font-weight: 700; margin: 2em 0 0.6em; }
.legal-content p { margin-bottom: 1em; color: var(--text-muted); line-height: 1.8; }
.legal-content ul { margin: 0 0 1em 1.5em; }
.legal-content ul li { margin-bottom: 0.4em; color: var(--text-muted); line-height: 1.7; }
.legal-meta { font-size: 0.82em; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 1.5em; margin-bottom: 2em; }

/* ── Page Hero (non-home) ──────────────── */
.page-hero { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); padding: 5em 2em; text-align: center; position: relative; }
.page-hero h1 { color: #fff; font-size: 2.2em; font-weight: 800; margin-bottom: 0.4em; }
.page-hero p { color: rgba(255,255,255,0.85); font-size: 1em; max-width: 560px; margin: 0 auto; }

/* ── Platform page ────────────────────── */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: var(--gap); }
.platform-card { background: var(--surface); border-radius: var(--radius); padding: 2em; border: 1px solid var(--border); }
.platform-card h3 { font-size: 1em; font-weight: 700; margin-bottom: 0.6em; }
.platform-card p { font-size: 0.88em; color: var(--text-muted); }

/* ── Spotlight / Story Section ─────────── */
.spotlight-section { display: grid; grid-template-columns: 3fr 2fr; gap: 4em; align-items: start; max-width: 1100px; margin: 0 auto; padding: 4em 2em; }
.story-img { width: 100%; overflow: hidden; border-radius: var(--radius); }
.story-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: center; display: block; border-radius: var(--radius); }
.story-text h2 { font-size: 1.8em; font-weight: 700; margin-bottom: 0.8em; }
.story-text p { color: var(--text-muted); margin-bottom: 1em; }

/* ── Responsive ────────────────────────── */
@media (max-width: 980px) {
  .nav-links { display: none !important; }
  .mobile-menu { display: flex; }
  .nav-links.open { display: flex !important; flex-direction: column; position: absolute; top: var(--nav-height); left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 1em 0; z-index: 9998; }
  .nav-links.open li a { height: auto; padding: 0.75em 2em; }
}
@media (max-width: 768px) {
  .about-grid, .contact-grid, .spotlight-section { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(3,1fr); }
  #footer .inner { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2em; }
  .section-title { font-size: 1.6em; }
}
@media (max-width: 480px) {
  #footer .inner { grid-template-columns: 1fr; padding: 0 1em; }
  .stats-row { grid-template-columns: 1fr; }
}

/* === Card Grid Equal Height Fix === */
.features-grid,
.services-grid,
.cards-grid,
.solutions-grid,
.advantages-grid {
  align-items: start;
}

.card-custom,
.service-card,
.solution-card,
.advantage-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-custom p,
.service-card p,
.solution-card p,
.advantage-card p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* === Card Equal Height (stretch to tallest card) === */
.features-grid,
.services-grid,
.cards-grid,
.solutions-grid,
.advantages-grid,
.platform-grid,
[class*="-grid"] {
  align-items: stretch;
}

.card-custom,
.service-card,
.solution-card,
.advantage-card,
.feature-card,
.platform-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  box-sizing: border-box;
}

.card-custom h3,
.card-custom h4,
.service-card h3,
.solution-card h3 {
  flex-shrink: 0;
}

.card-custom p:last-of-type,
.service-card p:last-of-type,
.solution-card p:last-of-type {
  flex: 1;
}

/* === Odd-count card grid: last card centered === */
.features-grid > .card-custom:last-child:nth-child(odd),
.services-grid > .card-custom:last-child:nth-child(odd),
.cards-grid > .card-custom:last-child:nth-child(odd),
.solutions-grid > .card-custom:last-child:nth-child(odd),
.advantages-grid > .card-custom:last-child:nth-child(odd),
.features-grid > *:last-child:nth-child(odd),
.services-grid > *:last-child:nth-child(odd),
[class*="-grid"] > .card-custom:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: calc(50% - 1rem);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}
