/* ============================================================
   ENBOX COMPONENT LIBRARY
   Reusable components for all product pages.
   Import after tokens.css and base.css
   ============================================================ */

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--content-gutter);
}

.container--narrow {
  max-width: var(--content-narrow);
}

.container--wide {
  max-width: var(--content-wide);
}

.section {
  padding: var(--space-24) 0;
}

.section--sm {
  padding: var(--space-16) 0;
}

.section--lg {
  padding: var(--space-32) 0;
}

.section + .section {
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   NAVIGATION
   Frosted glass sticky nav — Ghostty / Vercel inspired
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--space-3) 0;
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-subtle);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  letter-spacing: var(--tracking-wide);
  text-transform: lowercase;
  text-decoration: none;
}

.nav__logo-mark {
  width: 28px;
  height: 28px;
}

.nav__domain {
  color: var(--text-tertiary);
  font-weight: var(--weight-normal);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}
.nav__link:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

/* ============================================================
   BUTTONS
   Three tiers: primary (filled), secondary (outlined), ghost
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

/* Primary: solid accent fill */
.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--accent-muted);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 24px var(--accent-muted);
}
.btn--primary:active {
  transform: translateY(0);
}

/* Secondary: outlined */
.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn--secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-default);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Ghost: no border, minimal */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-4);
}
.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

/* Size variants */
.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

/* Icon button */
.btn--icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

/* ============================================================
   INSTALL BAR
   curl | bash one-liner — Bun / OpenCode inspired
   ============================================================ */

.install-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-code);
  max-width: 100%;
}

.install-bar__prompt {
  color: var(--accent);
  user-select: none;
}

.install-bar__cmd {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.install-bar__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface-3);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}
.install-bar__copy:hover {
  color: var(--text-primary);
  background: var(--gray-700);
}

/* ============================================================
   CARDS
   Feature cards, protocol cards, product cards
   ============================================================ */

/* Base card */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--duration-base) var(--ease-out);
}
.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

/* Feature card: icon + title + description */
.card--feature {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  color: var(--accent);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

/* Product card (for enbox umbrella page) */
.card--product {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.card--product::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}
.card--product:hover::before {
  opacity: 1;
}

/* Borderless card (Ghostty-style minimal) */
.card--borderless {
  background: transparent;
  border: none;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
}
.card--borderless:hover {
  box-shadow: none;
}

/* Card grid layouts */
.card-grid {
  display: grid;
  gap: var(--space-6);
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 860px) {
  .card-grid--3,
  .card-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .card-grid--2,
  .card-grid--3,
  .card-grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   HERO
   Centered or split hero sections
   ============================================================ */

.hero {
  padding: var(--space-24) 0 var(--space-16);
  text-align: center;
}

.hero__overline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--accent);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin-bottom: var(--space-6);
}

.hero__title {
  max-width: 16ch;
  margin: 0 auto var(--space-6);
}

.hero__subtitle {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-xl));
  color: var(--text-secondary);
  max-width: 52ch;
  margin: 0 auto var(--space-10);
  line-height: var(--leading-snug);
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Split hero (text left, visual right) */
.hero--split {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}
.hero--split .hero__title,
.hero--split .hero__subtitle {
  margin-left: 0;
  margin-right: 0;
}
.hero--split .hero__actions {
  justify-content: flex-start;
}

@media (max-width: 860px) {
  .hero--split {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero--split .hero__actions {
    justify-content: center;
  }
}

/* ============================================================
   CODE BLOCKS
   Terminal-style code display
   ============================================================ */

.code-block {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.code-block__dots {
  display: flex;
  gap: var(--space-2);
}

.code-block__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--gray-700);
}
.code-block__dot--red    { background: #ff5f57; }
.code-block__dot--yellow { background: #febc2e; }
.code-block__dot--green  { background: #28c840; }

.code-block__lang {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-ghost);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.code-block__body {
  padding: var(--space-6);
  overflow-x: auto;
}

.code-block__body pre {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

/* Syntax tokens */
.token-keyword    { color: #c792ea; }
.token-string     { color: #c3e88d; }
.token-comment    { color: var(--gray-600); font-style: italic; }
.token-function   { color: #82aaff; }
.token-number     { color: #f78c6c; }
.token-operator   { color: #89ddff; }
.token-punctuation { color: var(--gray-400); }
.token-type       { color: #ffcb6b; }
.token-flag       { color: var(--accent); }
.token-prompt     { color: var(--accent); user-select: none; }

/* ============================================================
   TRUST / STAT STRIP
   Horizontal metrics row — Bun / Supabase inspired
   ============================================================ */

.stat-strip {
  display: flex;
  justify-content: center;
  gap: var(--space-12);
  padding: var(--space-10) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.stat-strip__item {
  text-align: center;
}

.stat-strip__value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: var(--tracking-tighter);
}

.stat-strip__label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

@media (max-width: 600px) {
  .stat-strip {
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
  }
}

/* ============================================================
   SPLIT SECTION
   50/50 text + code/visual layout
   ============================================================ */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
}

.split--reverse {
  direction: rtl;
}
.split--reverse > * {
  direction: ltr;
}

.split__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .split--reverse {
    direction: ltr;
  }
}

/* ============================================================
   FOOTER
   Minimal, clean — Ghostty / Temporal inspired
   ============================================================ */

.footer {
  padding: var(--space-16) 0;
  border-top: 1px solid var(--border-subtle);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-12);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__tagline {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 28ch;
}

.footer__links {
  display: flex;
  gap: var(--space-12);
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__col-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
.footer__link:hover {
  color: var(--text-primary);
}

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-ghost);
}

@media (max-width: 860px) {
  .footer__inner {
    flex-direction: column;
  }
  .footer__links {
    flex-wrap: wrap;
    gap: var(--space-8);
  }
}

/* ============================================================
   ANIMATIONS
   Scroll reveal + utility animations
   ============================================================ */

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal */
.reveal[data-delay="1"] { transition-delay: 70ms; }
.reveal[data-delay="2"] { transition-delay: 140ms; }
.reveal[data-delay="3"] { transition-delay: 210ms; }
.reveal[data-delay="4"] { transition-delay: 280ms; }
.reveal[data-delay="5"] { transition-delay: 350ms; }

/* Pulse glow */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-muted); }
  50%      { box-shadow: 0 0 24px 4px var(--accent-muted); }
}

.pulse-glow {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .pulse-glow {
    animation: none;
  }
}

/* ============================================================
   BADGE / TAG
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid var(--accent-subtle);
}

.badge--neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

/* ============================================================
   DIVIDER
   ============================================================ */

.divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  border: none;
}

.divider--accent {
  background: var(--accent-gradient);
  height: 2px;
}
