/* Components: header, buttons, cards, terminal, footer, FAQ, pricing. */

@layer components {

/* ---------- Header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--head-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-med) var(--ease-out);
}
.site-head.scrolled { border-bottom-color: var(--border); }

.head-row {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--text);
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; }
.brand .brand-word { color: var(--text); }
.brand .brand-word b { color: var(--accent-ink); font-weight: 700; }

.brand-logo { width: 34px; height: 34px; position: relative; }
.brand-logo img { width: 34px; height: 34px; }
.logo-on-light { display: none; }
.logo-on-dark { display: none; }
[data-theme='light'] .logo-on-light { display: block; }
[data-theme='dark'] .logo-on-dark { display: block; }

.head-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.nav-link:hover, .nav-link[aria-expanded='true'] {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.nav-link.active { color: var(--text); }
.nav-link .caret { transition: transform var(--dur-fast) var(--ease-out); }
.nav-link[aria-expanded='true'] .caret { transform: rotate(180deg); }

/* Features mega menu */
.mega-wrap { position: relative; }
.mega {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px) scale(0.98);
  transform-origin: top center;
  width: min(640px, calc(100vw - 32px));
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-med) var(--ease-spring), visibility 0s linear var(--dur-med);
}
.mega.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  transition-delay: 0s;
}
.mega a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.mega a:hover { background: var(--accent-soft); text-decoration: none; }
.mega a .mi {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--accent-ink);
}
.mega a:hover .mi { background: var(--bg-raised); }
.mega a small { display: block; font-weight: 400; color: var(--text-muted); font-size: var(--fs-2xs); }
.mega .mega-all {
  grid-column: 1 / -1;
  justify-content: center;
  color: var(--accent-ink);
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-top: var(--sp-2);
  padding-top: var(--sp-3);
}

/* Theme toggle: sun and moon slide past each other, token-driven. */
[data-theme='dark'] { --sun-t: translateY(0) rotate(0deg); --sun-o: 1; --moon-t: translateY(26px) rotate(-40deg); --moon-o: 0; }
[data-theme='light'] { --sun-t: translateY(-26px) rotate(40deg); --sun-o: 0; --moon-t: translateY(0) rotate(0deg); --moon-o: 1; }
.theme-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-muted);
  background: var(--surface-2);
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
.theme-btn:hover { color: var(--text); }
.theme-btn svg {
  position: absolute;
  width: 18px;
  height: 18px;
  transition: transform var(--dur-slow) var(--ease-spring), opacity var(--dur-med) var(--ease-out);
}
.theme-btn .tb-sun { transform: var(--sun-t); opacity: var(--sun-o); }
.theme-btn .tb-moon { transform: var(--moon-t); opacity: var(--moon-o); }

/* Mobile menu */
.menu-btn { display: none; }
@media (max-width: 920px) {
  .head-nav .nav-link, .head-nav .btn-ghost { display: none; }
  .head-nav .theme-btn { display: inline-grid; }
  .menu-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text);
  }
  .mobile-menu {
    position: fixed;
    inset: 68px 0 auto 0;
    max-height: calc(100dvh - 68px);
    overflow: auto;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-pop);
    padding: var(--sp-4) clamp(16px, 4vw, 32px) var(--sp-8);
    display: none;
  }
  .mobile-menu.open { display: block; }
  .mobile-menu h4 {
    font-size: var(--fs-2xs);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-faint);
    margin: var(--sp-5) 0 var(--sp-2);
  }
  .mobile-menu a {
    display: block;
    padding: 10px 4px;
    color: var(--text);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
  }
  .mobile-menu a:hover { text-decoration: none; color: var(--accent-ink); }
  .mobile-menu .mm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-6); }
  .mobile-menu .btn { margin-top: var(--sp-5); width: 100%; justify-content: center; }
}
@media (min-width: 921px) {
  .mobile-menu { display: none !important; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-med) var(--ease-out), background-color var(--dur-fast);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.99); }

.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent-from), var(--accent-to));
  box-shadow: 0 6px 20px -8px rgba(240, 138, 18, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 26px -8px rgba(240, 138, 18, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

.btn-ghost {
  color: var(--text);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-dark {
  color: #E4EAF1;
  background: #1D2530;
  box-shadow: inset 0 0 0 1px #3B4856;
}
.btn-dark:hover { background: #26303D; }

.btn-lg { padding: 15px 28px; font-size: var(--fs-md); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--sp-6);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}
.card.lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); }

/* Soft amber aura instead of colored borders. */
.card.aura::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(420px 200px at 50% -40px, var(--accent-aura), transparent 72%);
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: none;
}
.card.aura:hover::before { opacity: 1; }

.card h3 a { color: inherit; }
.card h3 a:hover { text-decoration: none; color: var(--accent-ink); }

.card-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: var(--sp-4);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* ---------- Terminal / code ---------- */
.term {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  text-align: left;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--code-border);
}
.term-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2E3947;
}
.term-bar i:nth-child(1) { background: #E4584B; }
.term-bar i:nth-child(2) { background: #E0A72E; }
.term-bar i:nth-child(3) { background: #37B36B; }
.term-bar span {
  margin-left: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--code-dim);
}
.term-body {
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.75;
  color: var(--code-text);
  overflow-x: auto;
}
/* Long one-liners (the install command) wrap instead of clipping. */
.term-body > div { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-body .t-prompt { color: var(--code-green); }
.term-body .t-cmd { color: var(--code-text); }
.term-body .t-dim { color: var(--code-dim); }
.term-body .t-amber { color: var(--code-accent); }
.term-body .t-ok { color: var(--code-green); }
.term-caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--code-accent);
  animation: caret-blink 1.1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* Copyable one-liner: the command scrolls, the copy button stays pinned. */
.cmdline {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--code-text);
  min-width: 0;
}
.cmdline .t-prompt { color: var(--code-green); flex: none; }
.cmdline .cmd {
  flex: 1;
  min-width: 0;
  text-align: left;
  /* Wrap instead of scrolling: a scrollbar inside the pill looks broken and
     hides part of the command. The container is sized to fit one line on
     desktop; narrow screens get a clean two-line wrap. */
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.copy-btn {
  flex: none;
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--code-dim);
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
.copy-btn:hover { color: var(--code-text); background: rgba(255, 255, 255, 0.06); }
.copy-btn.copied { color: var(--code-green); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}
.chip.amber { background: var(--accent-soft); color: var(--accent-ink); }
.chip.green { background: rgba(16, 185, 129, 0.12); color: var(--success-ink); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip .dot.pulse { animation: dot-pulse 2s var(--ease-out) infinite; }
@keyframes dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin-inline: auto; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--sp-3);
  overflow: hidden;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-md);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  margin-left: auto;
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--accent-ink);
  transition: transform var(--dur-med) var(--ease-spring);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p {
  padding: 0 var(--sp-6) var(--sp-5);
  color: var(--text-muted);
}

/* ---------- CTA band ---------- */
.cta-band {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--steel-hi), var(--steel-lo));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: clamp(36px, 5vw, 72px);
  text-align: center;
}
.cta-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(640px 300px at 50% 115%, var(--accent-aura), transparent 70%);
  pointer-events: none;
}
.cta-band > * { position: relative; }
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: center;
  margin-top: var(--sp-6);
}

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: var(--sp-24);
}
.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
}
.foot-brand p { color: var(--text-muted); font-size: var(--fs-sm); max-width: 30ch; }
.foot-col h4 {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin-bottom: var(--sp-4);
}
.foot-col a {
  display: block;
  padding: 5px 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.foot-col a:hover { color: var(--text); text-decoration: none; }
.foot-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-12);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--fs-xs);
}
.foot-base .spacer { margin-left: auto; }
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

}
