/**
 * CAI.com — Marketing pages (home, about, faq, blog)
 * Shared layout, nav drawer, and content sections.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

html, body {
  min-height: 100%;
  font-family: "Inter", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  background: #000;
  color: #fff;
  overflow-x: hidden;
}

body[data-page="main"],
body[data-page="about"],
body[data-page="faq"],
body[data-page="blog"],
body[data-page="developers"] {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(99,102,241,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(168,85,247,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 20%, rgba(59,130,246,0.10) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Top bar ─── */
.mkt-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.mkt-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-family: "Anta", "Noto Sans TC", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mkt-topbar-brand img {
  width: 1.75rem;
  height: auto;
  filter: brightness(0) invert(1);
}

.mkt-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mkt-topbar-nav {
  display: none;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.84rem;
}

.mkt-topbar-nav a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 0.15s ease;
}

.mkt-topbar-nav a:hover,
.mkt-topbar-nav a[aria-current="page"] {
  color: #c4b5fd;
}

.mkt-topbar-nav a[aria-current="page"] {
  font-weight: 600;
}

.mkt-menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.55rem;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.mkt-menu-btn span {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: currentColor;
  margin: 0 auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mkt-menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mkt-menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mkt-menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 768px) {
  .mkt-menu-btn {
    display: none;
  }

  .mkt-topbar-nav {
    display: flex;
  }
}

/* ─── Mobile drawer ─── */
.mkt-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.mkt-nav-open .mkt-drawer-backdrop {
  display: block;
  opacity: 1;
}

.mkt-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(18rem, 88vw);
  z-index: 100;
  background: rgba(12, 8, 24, 0.98);
  border-left: 1px solid rgba(139, 92, 246, 0.35);
  padding: 1.25rem 1rem 1.5rem;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

body.mkt-nav-open .mkt-drawer {
  transform: translateX(0);
}

.mkt-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mkt-drawer-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.mkt-drawer-close {
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.4rem;
}

.mkt-drawer-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mkt-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mkt-drawer-nav a {
  display: block;
  padding: 0.72rem 0.85rem;
  border-radius: 0.55rem;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.mkt-drawer-nav a:hover,
.mkt-drawer-nav a[aria-current="page"] {
  background: rgba(139, 92, 246, 0.18);
  color: #ede9fe;
}

.mkt-drawer-nav a[aria-current="page"] {
  font-weight: 600;
}

.mkt-drawer-cta {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mkt-drawer-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.62rem 1rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
}

.mkt-drawer-cta .mkt-btn-primary {
  color: #fafafa;
  border: 1px solid rgba(167, 139, 250, 0.5);
  background: rgba(17, 10, 30, 0.82);
}

.mkt-drawer-cta .mkt-btn-secondary {
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

body.mkt-nav-open {
  overflow: hidden;
}

/* ─── Page shell ─── */
.mkt-page {
  position: relative;
  z-index: 1;
  width: min(100%, 46rem);
  margin: 0 auto;
  padding: 5.25rem 1rem 3rem;
}

.mkt-page--wide {
  width: min(100%, 52rem);
}

.mkt-page h1 {
  font-family: "Anta", "Noto Sans TC", system-ui, sans-serif;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  color: #fff;
  text-wrap: balance;
}

.mkt-lead {
  font-size: 1.02rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 1.75rem;
}

.mkt-section {
  margin-bottom: 1.75rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 0.85rem;
  background: rgba(15, 10, 30, 0.5);
}

.mkt-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
  color: #e9d5ff;
}

.mkt-section p,
.mkt-section li {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.84);
}

.mkt-section p {
  margin-bottom: 0.65rem;
}

.mkt-section p:last-child {
  margin-bottom: 0;
}

.mkt-section ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}

.mkt-section li {
  margin-bottom: 0.4rem;
}

.mkt-section a,
.mkt-lead a,
.mkt-page a {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.mkt-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.88rem;
}

.mkt-link-row a {
  color: #c4b5fd;
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 181, 253, 0.35);
}

.mkt-link-row a:hover {
  color: #ede9fe;
  border-bottom-color: rgba(237, 233, 254, 0.7);
}

/* FAQ */
.mkt-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mkt-faq-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.85rem 1rem;
}

.mkt-faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  list-style: none;
}

.mkt-faq-item summary::-webkit-details-marker {
  display: none;
}

.mkt-faq-item p {
  margin-top: 0.65rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

/* Blog index */
.mkt-blog-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mkt-blog-card {
  display: block;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 0.85rem;
  background: rgba(15, 10, 30, 0.5);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mkt-blog-card:hover {
  border-color: rgba(196, 181, 253, 0.55);
  background: rgba(20, 12, 38, 0.65);
}

.mkt-blog-card time {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.4rem;
}

.mkt-blog-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e9d5ff;
  margin-bottom: 0.45rem;
}

.mkt-blog-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
}

/* Blog article */
.mkt-article-meta {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 1.5rem;
}

.mkt-article-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e9d5ff;
  margin: 1.75rem 0 0.65rem;
}

.mkt-article-body p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.84);
  margin-bottom: 0.85rem;
}

.mkt-article-body ul {
  padding-left: 1.2rem;
  margin-bottom: 0.85rem;
}

.mkt-article-body li {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.84);
  margin-bottom: 0.35rem;
}

.mkt-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 0.05em;
  line-height: 1.6;
}

.mkt-footer a {
  color: rgba(255, 255, 255, 0.38);
  text-decoration: none;
}

.mkt-footer a:hover {
  color: rgba(167, 139, 250, 0.95);
  text-decoration: underline;
}

/* Developers page */
.mkt-page--dev {
  max-width: 44rem;
}

.mkt-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  padding: 1rem 1.1rem;
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.mkt-card p {
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.65rem;
}

.mkt-card p:last-child {
  margin-bottom: 0;
}

.mkt-card ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.mkt-card li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.35rem;
}

.mkt-card--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: rgba(255, 237, 213, 0.92);
}

.mkt-card--warn p,
.mkt-card--warn strong {
  color: inherit;
}

.mkt-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  color: #ddd6fe;
}

.mkt-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.75rem 0.85rem;
  overflow-x: auto;
  color: rgba(255, 255, 255, 0.82);
  margin: 0.5rem 0 0;
  line-height: 1.45;
  white-space: pre;
}

.mkt-qs-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.35rem;
}

.mkt-qs-meta {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
}

.mkt-card-link {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.85rem;
}

.mkt-lang {
  flex-shrink: 0;
}

.mkt-lang .cai-lang-select {
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

/* Home explore links */
.mkt-explore {
  width: min(100%, 40rem);
  margin: 2rem auto 0;
  text-align: center;
}

.mkt-explore-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.85rem;
}

.mkt-explore-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0.85rem;
}

.mkt-explore-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(15, 10, 30, 0.45);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mkt-explore-links a:hover {
  border-color: rgba(196, 181, 253, 0.65);
  background: rgba(20, 12, 38, 0.65);
  color: #ede9fe;
}

@media (prefers-reduced-motion: reduce) {
  .mkt-drawer,
  .mkt-drawer-backdrop {
    transition: none;
  }
}
