/* ============================================================
   Calibarr — industrial phosphor-terminal (carbon + acid lime)
   ============================================================ */
:root {
  --carbon: #0a0c0a;
  --carbon-2: #0f120f;
  --panel: #14181499;
  --panel-solid: #141814;
  --line: #262b26;
  --line-2: #333a33;
  --lime: #a3e635;
  --lime-bright: #b6f24d;
  --lime-dim: #79b80f;
  --fg: #d3d6cf;
  --fg-dim: #9aa096;
  --fg-mute: #6b716a;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --maxw: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--fg);
  background-color: var(--carbon);
  /* faint lime aurora over a hairline engineering grid */
  background-image:
    radial-gradient(1100px 620px at 50% -12%, rgba(163, 230, 53, 0.08), transparent 60%),
    linear-gradient(rgba(210, 255, 170, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 255, 170, 0.02) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
  background-position: center top;
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--lime); color: var(--carbon); }

/* grain overlay for texture */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
strong { color: var(--fg); font-weight: 600; }
em { color: var(--lime-bright); font-style: italic; }

/* ── Wordmark (matches the app's phosphor terminal wordmark) ── */
.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--lime-bright);
  text-shadow: 0 0 16px rgba(163, 230, 53, 0.45);
  font-size: 0.95rem;
}
.wordmark::after {
  content: "▌"; margin-left: 0.1em; color: var(--lime);
  animation: caret 1.1s steps(1) infinite;
}
.wordmark.small { font-size: 0.85rem; }
@keyframes caret { 50% { opacity: 0; } }

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  max-width: var(--maxw); margin: 0 auto; padding: 0.9rem 1.5rem;
  backdrop-filter: blur(10px);
}
.nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent);
}
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; font-family: var(--mono); font-size: 0.8rem; }
.nav-links a { color: var(--fg-dim); transition: color 0.18s; }
.nav-links a:hover { color: var(--lime-bright); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-weight: 600; font-size: 0.9rem;
  padding: 0.8rem 1.4rem; border-radius: 8px;
  background: var(--lime); color: var(--carbon);
  border: 1px solid var(--lime);
  box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.15), 0 0 30px -8px rgba(163, 230, 53, 0.55);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { background: var(--lime-bright); transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.3), 0 8px 40px -8px rgba(163, 230, 53, 0.7); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-2); box-shadow: none; }
.btn-ghost:hover { background: rgba(163, 230, 53, 0.06); border-color: var(--lime-dim); color: var(--lime-bright); }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.8rem; }

/* ── Shared section scaffolding ── */
main { position: relative; z-index: 2; }
.section, .band, .hero { max-width: var(--maxw); margin: 0 auto; padding: 5.5rem 1.5rem; }
.band { max-width: none; background:
    linear-gradient(180deg, transparent, rgba(163, 230, 53, 0.02), transparent),
    var(--carbon-2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.band > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }

.eyebrow {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--lime-dim); margin: 0 0 1rem;
}
.band-head { max-width: 760px; margin-bottom: 2.6rem; }
.band-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.12; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.band-head .sub { color: var(--fg-dim); font-size: 1.05rem; margin: 1rem 0 0; max-width: 680px; }
.hl { color: var(--lime-bright); text-shadow: 0 0 24px rgba(163, 230, 53, 0.35); }

/* ── Hero ── */
.hero { padding-top: 4rem; padding-bottom: 4rem; }
.hero .eyebrow { color: var(--lime-dim); }
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1.02; letter-spacing: -0.03em;
  font-weight: 700; margin: 0 0 1.4rem; max-width: 15ch;
}
.lede { font-size: 1.2rem; color: var(--fg-dim); max-width: 60ch; margin: 0 0 2rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 3rem; }

.hero-stats {
  list-style: none; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; margin: 2.5rem 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line);
}
.hero-stats li { background: var(--carbon-2); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.2rem; }
.hero-stats b { font-family: var(--mono); color: var(--lime-bright); font-size: 0.92rem; }
.hero-stats span { color: var(--fg-mute); font-size: 0.82rem; }

/* ── Terminal card ── */
.terminal {
  position: relative; background: #0b0e0b; border: 1px solid var(--line-2);
  border-radius: 12px; overflow: hidden; max-width: 720px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(163, 230, 53, 0.04);
}
.terminal-bar {
  display: flex; align-items: center; gap: 0.45rem; padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line); background: #0e120e;
}
.terminal-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #2a2f2a; }
.terminal-bar .dot:first-child { background: #3a4a1a; }
.terminal-title { font-family: var(--mono); font-size: 0.74rem; color: var(--fg-mute); margin-left: 0.5rem; letter-spacing: 0.05em; }
.terminal-body { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; }
.terminal-body code { font-family: var(--mono); font-size: 0.84rem; line-height: 1.7; color: var(--fg); white-space: pre; }
.c-mute { color: var(--fg-mute); } .c-lime { color: var(--lime-bright); } .c-str { color: #d5f7a3; } .c-key { color: #8fd41f; }
.copy {
  position: absolute; top: 0.5rem; right: 0.6rem;
  font-family: var(--mono); font-size: 0.72rem; color: var(--fg-dim);
  background: rgba(20, 24, 20, 0.9); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 0.28rem 0.6rem; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.copy:hover { color: var(--lime-bright); border-color: var(--lime-dim); }
.copy.ok { color: var(--lime-bright); border-color: var(--lime-dim); }

/* ── AI companion grid ── */
.companion-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.ccard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.4rem; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; backdrop-filter: blur(4px);
}
.ccard:hover { border-color: var(--lime-dim); transform: translateY(-3px); box-shadow: 0 20px 50px -30px rgba(163, 230, 53, 0.5); }
.ccard-tag { font-family: var(--mono); font-size: 0.8rem; font-weight: 600; color: var(--lime-bright); margin-bottom: 0.6rem; letter-spacing: 0.02em; }
.ccard p { margin: 0; color: var(--fg-dim); font-size: 0.95rem; }
.ccard p b { color: var(--fg); }
.hero-ccard { grid-column: span 2; background:
    linear-gradient(135deg, rgba(163, 230, 53, 0.07), transparent 60%), var(--panel-solid);
  border-color: var(--line-2); }
.hero-ccard .ccard-tag { font-size: 1.05rem; }
.hero-ccard p { font-size: 1.05rem; color: var(--fg); }
.privacy-ccard { border-style: dashed; border-color: var(--lime-dim); background: rgba(163, 230, 53, 0.04); }

/* ── Core feature grid ── */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card { background: var(--carbon-2); padding: 1.6rem 1.4rem; transition: background 0.2s; position: relative; }
.card::before { content: ""; position: absolute; left: 0; top: 0; width: 0; height: 2px; background: var(--lime); transition: width 0.3s; }
.card:hover { background: #12160f; } .card:hover::before { width: 100%; }
.card h3 { font-size: 1rem; margin: 0 0 0.5rem; color: var(--fg); font-weight: 600; }
.card p { margin: 0; font-size: 0.9rem; color: var(--fg-dim); }

/* ── Comparison table ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.cmp { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; }
.cmp th, .cmp td { padding: 0.85rem 1rem; text-align: center; border-bottom: 1px solid var(--line); }
.cmp thead th { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; color: var(--fg-dim); background: var(--carbon-2); position: sticky; top: 0; }
.cmp thead th.us { color: var(--carbon); background: var(--lime); border-radius: 8px 8px 0 0; }
.cmp td.feat, .cmp th.feat { text-align: left; color: var(--fg); font-weight: 500; }
.cmp td.feat span { display: block; font-size: 0.76rem; color: var(--fg-mute); font-weight: 400; margin-top: 0.15rem; }
.cmp td.us { background: rgba(163, 230, 53, 0.07); font-family: var(--mono); font-weight: 600; color: var(--fg); }
.cmp .y { color: var(--lime-bright); font-weight: 700; }
.cmp td.us.y { color: var(--lime-bright); }
.cmp .p { color: var(--fg-dim); }
.cmp .n { color: var(--fg-mute); }
.cmp tbody tr:last-child td { border-bottom: none; }
.cmp tbody tr:hover td { background: rgba(163, 230, 53, 0.03); }
.cmp tbody tr:hover td.us { background: rgba(163, 230, 53, 0.11); }
.cmp-legend { font-size: 0.8rem; color: var(--fg-mute); margin: 1rem 0 0; font-family: var(--mono); }
.cmp-legend .y { color: var(--lime); } .cmp-legend .p { color: var(--fg-dim); } .cmp-legend .n { color: var(--fg-mute); }

/* ── Screenshots ── */
.shots .band-head { margin-bottom: 2rem; }
.shot { margin: 0 0 1.4rem; }
.shot img { width: 100%; display: block; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9); }
.shot figcaption { font-family: var(--mono); font-size: 0.76rem; color: var(--fg-mute); margin-top: 0.7rem; letter-spacing: 0.03em; }
.shot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }

/* ── Self-host pills ── */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pill {
  font-family: var(--mono); font-size: 0.8rem; color: var(--fg-dim);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.45rem 0.95rem;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.pill:hover { color: var(--lime-bright); border-color: var(--lime-dim); background: rgba(163, 230, 53, 0.05); }

/* ── Quick start ── */
.start-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.2rem; align-items: start; }
.start-copy p { display: flex; gap: 0.75rem; margin: 0 0 1.1rem; color: var(--fg-dim); }
.start-copy .step { font-family: var(--mono); color: var(--lime-dim); font-weight: 700; flex-shrink: 0; }
.start-copy code, .card code, .start-copy b { font-family: var(--mono); }
.start-copy code { color: var(--lime-bright); background: rgba(163, 230, 53, 0.08); padding: 0.05rem 0.4rem; border-radius: 4px; font-size: 0.86em; }
.start-copy b { color: var(--fg); }

/* ── Deep-dive page ── */
.nav-links a.active { color: var(--lime-bright); }
.page-hero { padding-top: 3.5rem; padding-bottom: 2.5rem; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.toc { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 2rem; }
.toc a {
  font-family: var(--mono); font-size: 0.8rem; color: var(--fg-dim);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.4rem 0.9rem;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.toc a:hover { color: var(--lime-bright); border-color: var(--lime-dim); background: rgba(163, 230, 53, 0.05); }
#library, #ai, #readers, #metadata, #deliver, #automate, #ops { scroll-margin-top: 72px; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--line); background: var(--carbon-2); position: relative; z-index: 2; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 2.4rem 1.5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.foot-note { color: var(--fg-mute); font-size: 0.85rem; margin: 0; flex: 1 1 320px; }
.foot-links { display: flex; gap: 1.3rem; font-family: var(--mono); font-size: 0.82rem; }
.foot-links a { color: var(--fg-dim); } .foot-links a:hover { color: var(--lime-bright); }
.disclaimer { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem 2rem; color: var(--fg-mute); font-size: 0.74rem; }

/* ── Reveal animations (only when JS is on; otherwise everything is visible) ── */
.js .reveal, .js .card, .js .ccard, .js .shot, .js .pill { opacity: 0; transform: translateY(18px); }
.js .reveal { transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: calc(var(--d, 0) * 90ms); }
.js .card, .js .ccard, .js .shot, .js .pill { transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.in, .card.in, .ccard.in, .shot.in, .pill.in { opacity: 1 !important; transform: none !important; }
/* hero reveals fire on load even before the observer attaches */
.js .hero .reveal { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--d, 0) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* stagger cards/pills within their row */
.companion-grid .ccard:nth-child(2) { transition-delay: 0.06s; }
.companion-grid .ccard:nth-child(3) { transition-delay: 0.12s; }
.companion-grid .ccard:nth-child(4) { transition-delay: 0.06s; }
.companion-grid .ccard:nth-child(5) { transition-delay: 0.12s; }
.companion-grid .ccard:nth-child(6) { transition-delay: 0.18s; }
.pill:nth-child(2) { transition-delay: 0.05s; } .pill:nth-child(3) { transition-delay: 0.1s; }
.pill:nth-child(4) { transition-delay: 0.15s; } .pill:nth-child(5) { transition-delay: 0.2s; } .pill:nth-child(6) { transition-delay: 0.25s; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .companion-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-ccard { grid-column: span 2; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .start-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .section, .band, .hero { padding: 3.5rem 1.2rem; }
  .nav-links { display: none; }
  .companion-grid, .grid, .shot-pair, .hero-stats { grid-template-columns: 1fr; }
  .hero-ccard { grid-column: span 1; }
  .hero-stats { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal, .card, .ccard, .shot, .pill { opacity: 1; transform: none; }
}
