/* =============================================================================
 * site.css — shared styles for the Merlin bridge site (all pages)
 * Tokens mirror the console-modern system in apps/web/app/globals.css.
 * ============================================================================= */

:root {
  --bg: #fafafa; --panel: #ffffff; --panel-2: #f1f1f1;
  --border: #e2e2e2; --border-strong: #cfcfcf;
  --text: #111111; --muted: #666666;
  --ink: #111111; --ink-contrast: #ffffff;
  --grid-dot: rgba(0, 0, 0, 0.055);
  --glass: rgba(255, 255, 255, 0.72); --glass-edge: rgba(255, 255, 255, 0.65);
  --glass-heavy: rgba(255, 255, 255, 0.94);
  --terminal-bg: #0d0d0d; --terminal-text: #e8e8e8; --terminal-border: #262626;
  --green: #3f9142;
  --shadow: 0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --panel: #141414; --panel-2: #1a1a1a;
  --border: #262626; --border-strong: #3a3a3a;
  --text: #ededed; --muted: #9b9b9b;
  --ink: #ededed; --ink-contrast: #0a0a0a;
  --grid-dot: rgba(255, 255, 255, 0.05);
  --glass: rgba(20, 20, 20, 0.7); --glass-edge: rgba(255, 255, 255, 0.06);
  --glass-heavy: rgba(16, 16, 16, 0.94);
  --green: #34d399;
  --shadow: 0 2px 8px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0a0a; --panel: #141414; --panel-2: #1a1a1a;
    --border: #262626; --border-strong: #3a3a3a;
    --text: #ededed; --muted: #9b9b9b;
    --ink: #ededed; --ink-contrast: #0a0a0a;
    --grid-dot: rgba(255, 255, 255, 0.05);
    --glass: rgba(20, 20, 20, 0.7); --glass-edge: rgba(255, 255, 255, 0.06);
    --glass-heavy: rgba(16, 16, 16, 0.94);
    --green: #34d399;
    --shadow: 0 2px 8px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  overflow-x: hidden; /* nothing may widen the page past the viewport */
  overflow-x: clip;   /* (preferred where supported — iOS 16+; hidden is the fallback) */
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--mono); letter-spacing: -0.02em; font-weight: 600; }
a { color: inherit; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.header-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.logo { height: 30px; width: auto; display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-light { display: none; }
  :root:not([data-theme]) .logo-dark { display: block; }
}
/* Primary nav. Desktop: one row pushed right — text links | divider | product
   buttons. Mobile (≤700px): links collapse into a hamburger dropdown that
   slides out under the glass header (see nav.js for the toggle behavior). */
.header-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.nav-link {
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  padding: 4px 2px; border-radius: 4px;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.nav-link[aria-current="page"] {
  color: var(--text); text-decoration: underline;
  text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.nav-sep { width: 1px; height: 20px; background: var(--border-strong); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }

/* Hamburger: pure CSS via the #nav-check checkbox — works with zero JS.
   nav.js only ADDS niceties (close on outside tap / Escape, current-page
   underline); the menu itself must never depend on it. */
.nav-check {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 38px; padding: 9px 10px;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--panel-2); border-color: var(--border); }
.nav-check:focus-visible ~ .nav-toggle { outline: 2px solid var(--ink); outline-offset: 1px; }
.nav-toggle span {
  display: block; height: 2px; width: 100%; border-radius: 2px;
  background: var(--text);
  transition: transform .2s ease, opacity .15s ease;
}
.nav-check:checked ~ .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-check:checked ~ .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-check:checked ~ .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  .brand { margin-left: 10px; }             /* nudge the logo off the screen edge */
  #theme-toggle { margin-left: auto; }      /* logo ... toggle, hamburger */
  .header-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 20px 18px; margin-left: 0;
    max-height: calc(100vh - 70px); overflow-y: auto;
    background: var(--glass-heavy);   /* near-opaque: content under the open menu was too visible */
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .nav-check:checked ~ .header-nav { display: flex; animation: nav-drop .18s ease; }
  .header-nav .nav-link { font-size: 15px; padding: 11px 4px; }
  .header-nav .nav-sep { width: 100%; height: 1px; background: var(--border); margin: 8px 0 12px; }
  .header-nav .btn-sm { padding: 11px 13px; font-size: 13.5px; }
  .header-nav .btn-outline { margin-bottom: 8px; }
}
@keyframes nav-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 6px; cursor: pointer;
  text-decoration: none; border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--ink); color: var(--ink-contrast); }
.btn-solid:hover { opacity: .92; box-shadow: var(--shadow); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--ink); }
.btn-outline:hover { background: var(--panel); box-shadow: var(--shadow); }
.btn-ghost {
  background: transparent; color: var(--text); border-color: transparent;
  padding: 8px 10px; font-size: 15px; border-radius: 6px;
}
.btn-ghost:hover { background: var(--panel-2); border-color: var(--border); }

/* ---------- Hero (home) ---------- */
.hero { padding: 84px 0 40px; text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 5px 14px; margin-bottom: 26px; background: var(--panel);
}
.hero .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.hero h1 { font-size: clamp(30px, 5.4vw, 52px); margin: 0 0 16px; }
.hero p.sub { font-size: clamp(16px, 2.4vw, 19px); color: var(--muted); max-width: 620px; margin: 0 auto 30px; }
.hero .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.welcome {
  display: none; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin: 26px auto 0; max-width: 560px;
  font-size: 14.5px;
  border: 1px solid var(--border); border-left: 2px solid var(--ink);
  border-radius: 10px; padding: 12px 16px;
  background: var(--panel); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.welcome.show { display: flex; }
.welcome a { font-family: var(--mono); font-weight: 600; }

/* ---------- Product cards (home) ---------- */
.products { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 30px 0 20px; }
@media (max-width: 760px) { .products { grid-template-columns: 1fr; } }
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 26px; text-decoration: none;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg); }
.card .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card h2 { font-size: 21px; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.card .go { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.card .go::after { content: " ->"; }
.card:hover .go::after { content: " -->"; }

/* ---------- Terminal flourish (home) ---------- */
.term {
  max-width: 640px; margin: 34px auto 0;
  background: var(--terminal-bg); color: var(--terminal-text);
  border: 1px solid var(--terminal-border); border-radius: 8px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  text-align: left; padding: 16px 18px; overflow-x: auto;
  box-shadow: var(--shadow-lg);
}
.term .c { color: #6a6a6a; }
.term .g { color: #34d399; }
.term .cursor { display: inline-block; width: 8px; height: 15px; background: var(--terminal-text); vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Legal / content pages ---------- */
.page { max-width: 780px; margin: 0 auto; padding: 60px 20px 20px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 6px 12px; margin-bottom: 22px;
  transition: color .15s, border-color .15s, background .15s;
}
.back-btn:hover { color: var(--text); border-color: var(--ink); background: var(--panel); }
.page > h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 6px; }
.page .updated { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-bottom: 34px; }
.legal-section {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
  padding: 22px 24px; margin-bottom: 16px;
}
.legal-section h2 { font-size: 17px; margin: 0 0 10px; }
.legal-section p, .legal-section li { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.legal-section p:last-child { margin-bottom: 0; }
.legal-section ul { margin: 0 0 10px; padding-left: 1.3em; }
.legal-section strong { color: var(--text); }
.legal-section a { color: var(--text); }
.legal-callout { border-left: 2px solid var(--ink); }

/* ---------- Contact page ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
  padding: 22px 24px;
}
.contact-card h2 { font-size: 16px; margin: 0 0 8px; }
.contact-card p { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; }
.contact-card .mono { font-family: var(--mono); font-size: 14px; }

/* ---------- Pricing page ---------- */
.pricing-head { text-align: center; padding: 40px 0 8px; }
.pricing-head h1 { font-size: clamp(26px, 4.4vw, 40px); margin: 0 0 10px; }
.pricing-head p { color: var(--muted); max-width: 560px; margin: 0 auto; }
.cycle-toggle {
  display: inline-flex; align-items: center; gap: 10px; margin: 22px auto 8px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.cycle-toggle button {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  background: none; border: 1px solid var(--border-strong); color: var(--muted);
}
.cycle-toggle button.active { border-color: var(--ink); color: var(--text); background: var(--panel); }
.beta-strip {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  max-width: 720px; margin: 18px auto 0; padding: 10px 16px; font-size: 14px;
  border: 1px solid var(--border); border-left: 2px solid var(--ink); border-radius: 10px;
  background: var(--panel); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.beta-strip a { font-family: var(--mono); font-weight: 600; }

.product-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 26px 0 8px; }
@media (max-width: 860px) { .product-cols { grid-template-columns: 1fr; } }
.product-col > .col-head { text-align: center; margin-bottom: 14px; }
.product-col .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.product-col h2 { font-size: 20px; margin: 4px 0 2px; }
.product-col .col-sub { font-size: 13.5px; color: var(--muted); }

.tier {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 12px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.tier.popular { border-color: var(--ink); }
.tier .tier-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tier h3 { font-size: 15px; margin: 0; }
.tier .price { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.tier .price .per { font-size: 12px; color: var(--muted); font-weight: 400; }
.tier .badge-pop {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--ink); border-radius: 999px; padding: 2px 8px; margin-left: 8px;
}
.tier ul { margin: 10px 0 0; padding: 0; list-style: none; }
.tier li { font-size: 13.5px; color: var(--muted); padding: 2px 0; }
.tier li::before { content: "✓ "; color: var(--green); }

.bundle-ribbon {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin: 22px 0 8px; padding: 18px 22px; text-align: center;
  background: var(--terminal-bg); color: var(--terminal-text);
  border: 1px solid var(--terminal-border); border-radius: 10px;
  font-family: var(--mono); font-size: 14px;
  box-shadow: var(--shadow-lg);
}
.bundle-ribbon .g { color: #34d399; }

.beta-form {
  max-width: 560px; margin: 34px auto 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.beta-form h2 { font-size: 17px; margin: 0 0 4px; }
.beta-form p { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }
.beta-form label { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.beta-form input, .beta-form textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 9px 12px; box-sizing: border-box;
}
.beta-form input:focus, .beta-form textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.beta-form .form-actions { margin-top: 16px; }
.beta-form .form-msg { font-size: 13.5px; margin-top: 10px; }
.beta-form .form-msg.ok { color: var(--green); }
.beta-form .form-msg.err { color: #dc2626; }

/* ---------- Product pages (/builder, /organizations) & About ---------- */
.hero.compact { padding: 64px 0 34px; }
.hero .trust { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.section-head { text-align: center; padding: 34px 0 22px; }
.section-head h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 8px; }
.section-head p { color: var(--muted); max-width: 560px; margin: 0 auto; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 22px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.feature .ico { font-size: 24px; line-height: 1; }
.feature h3 { font-size: 15px; margin: 10px 0 6px; }
.feature p { font-size: 13.5px; color: var(--muted); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 880px; margin: 0 auto; text-align: center; }
@media (max-width: 700px) { .steps { grid-template-columns: 1fr; max-width: 420px; } }
.step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  border: 1px solid var(--ink); background: var(--panel);
  margin-bottom: 12px;
}
.step h3 { font-size: 15.5px; margin: 0 0 6px; }
.step p { font-size: 13.5px; color: var(--muted); margin: 0; }

.cta-band { text-align: center; padding: 46px 0 10px; }
.cta-band h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 8px; }
.cta-band p { color: var(--muted); max-width: 520px; margin: 0 auto 22px; }

.crosslink {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  max-width: 720px; margin: 40px auto 0; padding: 12px 18px; font-size: 14px;
  border: 1px solid var(--border); border-left: 2px solid var(--ink); border-radius: 10px;
  background: var(--panel); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.crosslink a { font-family: var(--mono); font-weight: 600; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 0 30px; }
.notfound .code { font-family: var(--mono); font-size: clamp(64px, 14vw, 120px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; margin: 0; }
.notfound h1 { font-size: clamp(20px, 3.4vw, 28px); margin: 14px 0 10px; }
.notfound p { color: var(--muted); max-width: 480px; margin: 0 auto 26px; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); margin-top: 70px; padding: 28px 0 40px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-row .fam { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.foot-row .fam span { white-space: nowrap; }
.foot-links { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 13.5px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 700px) {
  .foot-row { justify-content: center; text-align: center; }
  .foot-links { justify-content: center; }
}
