@import url("brand.css");

/* ============================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--c-primary); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
::selection { background: var(--gold-soft); }

.wrap        { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.wrap-narrow { max-width: var(--maxw-narrow); margin: 0 auto; padding: 0 22px; }
.app-shell   { max-width: var(--maxw-narrow); margin: 0 auto; padding: 0 22px 72px; }
.stack > * + * { margin-top: 16px; }
.center { text-align: center; }

/* ============================================================================
   Top navigation (every page) — carries identity + Quick exit
   ========================================================================== */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--c-surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 -3px 0 var(--c-accent) inset;
}
.topnav-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit; font-weight: 800; letter-spacing: -0.02em;
}
.brand-mark {
  width: 34px; height: 34px; flex: none;
  background: linear-gradient(160deg, var(--c-primary-2), var(--c-primary-dark));
  color: #fff; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.05rem; letter-spacing: -0.05em;
  box-shadow: 0 2px 0 var(--c-accent), var(--shadow-xs);
}
.brand-name { font-size: 1.06rem; }
.brand-name small {
  display: block; font-weight: 600; font-size: 0.66rem; letter-spacing: 0.02em;
  color: var(--c-text-muted); margin-top: -1px;
}
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-links a {
  text-decoration: none; color: var(--c-text-secondary);
  font-size: 0.9rem; font-weight: 600; padding: 7px 11px; border-radius: 8px;
}
.nav-links a:hover { color: var(--c-primary); background: var(--c-surface-2); }
.nav-spacer { flex: 1 1 auto; }

.btn-exit {
  flex: none;
  border: 1px solid var(--c-danger); background: var(--c-danger); color: #fff;
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.01em;
  padding: 8px 15px; border-radius: var(--radius-pill); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-exit:hover { background: var(--c-danger-dark); border-color: var(--c-danger-dark); }
.btn-exit:focus-visible { outline: 3px solid var(--c-danger-soft); outline-offset: 2px; }

.exit-hint {
  text-align: center; font-size: 0.78rem; color: var(--c-text-muted);
  padding: 6px 22px 0;
}
.exit-hint kbd {
  font-family: var(--font-mono); font-size: 0.72rem;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .brand-name small { display: none; }
}

/* ============================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 460px at 78% -8%, rgba(255,255,255,0.10), transparent 60%),
    radial-gradient(900px 500px at 8% 110%, rgba(197,160,70,0.14), transparent 55%),
    linear-gradient(150deg, var(--hero-1) 0%, var(--hero-2) 46%, var(--hero-3) 100%);
  color: var(--on-hero);
  border-bottom: 3px solid var(--c-accent);
}
.hero::before { /* faint star field */
  content: ""; position: absolute; inset: 0; opacity: 0.5; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.4px 1.4px at 32% 68%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1.2px 1.2px at 58% 34%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.6px 1.6px at 76% 76%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.2px 1.2px at 88% 18%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.3px 1.3px at 46% 88%, rgba(255,255,255,0.3), transparent);
}
.hero-inner { position: relative; padding: 62px 22px 68px; max-width: var(--maxw); margin: 0 auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--gold-300);
  border: 1px solid var(--gold-line); border-radius: var(--radius-pill);
  padding: 5px 13px; margin-bottom: 20px;
  background: rgba(0,0,0,0.14);
}
.hero h1 {
  margin: 0; font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 850; letter-spacing: -0.03em;
  max-width: 16ch;
}
.hero .lede {
  margin: 18px 0 0; font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--on-hero-soft);
  max-width: 54ch; line-height: 1.55;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* Two-way motif */
.twoway {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 12px;
  margin-top: 40px; max-width: 640px;
}
.twoway .lane {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius); padding: 16px 16px;
}
.twoway .lane .k { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-300); font-weight: 800; }
.twoway .lane .v { margin-top: 5px; font-weight: 700; color: var(--on-hero); }
.twoway .lane .d { margin-top: 3px; font-size: 0.86rem; color: var(--on-hero-soft); }
.twoway .pipe {
  display: grid; place-items: center; color: var(--gold-300); font-size: 1.5rem; font-weight: 900;
  width: 34px;
}
@media (max-width: 560px) {
  .twoway { grid-template-columns: 1fr; }
  .twoway .pipe { transform: rotate(90deg); height: 24px; }
}

/* ============================================================================
   Buttons
   ========================================================================== */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 0.96rem; font-weight: 700;
  border-radius: var(--radius-sm); padding: 13px 20px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; line-height: 1;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-full { width: 100%; }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--c-primary-2); }
.btn-onhero { background: #fff; color: var(--c-primary-dark); box-shadow: var(--shadow); }
.btn-onhero:hover { background: var(--gold-300); color: var(--hero-1); }
.btn-ghost-hero { background: rgba(255,255,255,0.08); color: var(--on-hero); border-color: rgba(255,255,255,0.28); }
.btn-ghost-hero:hover { background: rgba(255,255,255,0.16); }
.btn-secondary { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-border-strong); }
.btn-secondary:hover { border-color: var(--c-primary-line); color: var(--c-primary); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn + .btn { margin-top: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ============================================================================
   Sections & general layout
   ========================================================================== */
.section { padding: 56px 0; }
.section.tint { background: var(--c-bg-2); }
.section-head { max-width: 62ch; margin: 0 auto 34px; text-align: center; }
.section-head .kicker {
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--c-accent);
}
.section-head h2 { margin: 8px 0 0; font-size: clamp(1.6rem, 3.6vw, 2.15rem); font-weight: 800; }
.section-head p { margin: 12px 0 0; color: var(--c-text-secondary); font-size: 1.05rem; }

/* Doors */
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.door {
  display: flex; flex-direction: column; text-align: left; text-decoration: none; color: inherit;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow);
  transition: transform .13s ease, box-shadow .13s ease, border-color .13s ease;
}
.door:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--c-primary-line); }
.door .door-ic {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.5rem; margin-bottom: 14px;
  background: var(--c-primary-soft); border: 1px solid var(--c-primary-line);
}
.door .door-title { display: flex; align-items: center; gap: 10px; font-size: 1.22rem; font-weight: 800; }
.door p { margin: 8px 0 0; color: var(--c-text-secondary); font-size: 0.96rem; }
.door .door-go { margin-top: 16px; font-weight: 800; color: var(--c-primary); font-size: 0.92rem; }
.door.primary { border-color: var(--c-primary-line); background: linear-gradient(180deg, var(--c-primary-soft), var(--c-surface) 62%); }
.door.responder .door-ic { background: var(--gold-soft); border-color: var(--gold-line); }
@media (max-width: 640px) { .doors { grid-template-columns: 1fr; } }

/* Feature grid */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-xs);
}
.feature .fic {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 1.3rem;
  background: var(--c-surface-2); border: 1px solid var(--c-border); margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 1.08rem; font-weight: 750; }
.feature p { margin: 0; color: var(--c-text-secondary); font-size: 0.92rem; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.step {
  position: relative; background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 24px 22px 22px; box-shadow: var(--shadow-xs);
}
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-primary); color: #fff; font-weight: 800; margin-bottom: 12px;
  box-shadow: 0 2px 0 var(--c-accent);
}
.step h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 750; }
.step p { margin: 0; color: var(--c-text-secondary); font-size: 0.92rem; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

/* Commitments / boundary lines */
.commit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.commit {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
  padding: 16px 18px; box-shadow: var(--shadow-xs);
}
.commit .cmark { color: var(--c-success); font-weight: 900; flex: none; margin-top: 1px; }
.commit .cx { color: var(--c-danger); }
.commit b { display: block; margin-bottom: 2px; }
.commit span { color: var(--c-text-secondary); font-size: 0.9rem; }
@media (max-width: 640px) { .commit-grid { grid-template-columns: 1fr; } }

/* Trust strip */
.trust {
  display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; align-items: center;
  color: var(--c-text-secondary); font-size: 0.9rem; font-weight: 600;
}
.trust .pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-pill);
  padding: 8px 15px; box-shadow: var(--shadow-xs);
}
.trust .pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-success); }

/* CTA band */
.cta-band {
  background:
    radial-gradient(700px 300px at 82% 120%, rgba(197,160,70,0.16), transparent 60%),
    linear-gradient(150deg, var(--hero-2), var(--hero-3));
  color: var(--on-hero); border-radius: var(--radius-lg);
  padding: 40px; text-align: center; border: 1px solid rgba(255,255,255,0.10);
}
.cta-band h2 { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2rem); }
.cta-band p { margin: 12px auto 0; max-width: 52ch; color: var(--on-hero-soft); }

/* ============================================================================
   Cards / forms  (used by report + console)
   ========================================================================== */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 24px; margin: 16px 0; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 1.25rem; }
.card.emphasis { border-color: var(--c-primary-line); background: linear-gradient(180deg, var(--c-primary-soft), var(--c-surface) 55%); }
.subhead { margin: 0 0 8px; font-size: 1.08rem; font-weight: 750; }
.lede { margin: 0 0 14px; color: var(--c-text-secondary); font-size: 0.95rem; }
.step-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--c-primary); background: var(--c-primary-soft);
  border: 1px solid var(--c-primary-line); padding: 4px 11px; border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

/* Page header inside app-shell */
.page-head { padding: 30px 0 6px; }
.page-head .kicker {
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; color: var(--c-accent);
}
.page-head h1 { margin: 6px 0 6px; font-size: clamp(1.6rem, 4vw, 2.1rem); }
.page-head p { margin: 0; color: var(--c-text-secondary); font-size: 1.02rem; max-width: 60ch; }

/* "What is this" contextual explainer */
.explainer {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary); border-radius: var(--radius);
  padding: 16px 18px; margin: 18px 0; box-shadow: var(--shadow-xs);
}
.explainer .ei { font-size: 1.3rem; flex: none; line-height: 1.2; }
.explainer h3 { margin: 0 0 4px; font-size: 0.98rem; }
.explainer p { margin: 0; color: var(--c-text-secondary); font-size: 0.9rem; }
.explainer a { font-weight: 700; }

label { display: block; margin: 16px 0 6px; font-size: 0.86rem; font-weight: 700; color: var(--c-text); }
label .hint { font-weight: 500; color: var(--c-text-muted); }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 0.98rem; color: var(--c-text);
  background: var(--c-surface-2); border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm); padding: 12px 13px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-primary); background: var(--c-surface); box-shadow: var(--ring);
}
.mono { font-family: var(--font-mono); }
.hint { margin: 6px 0 0; font-size: 0.83rem; color: var(--c-text-muted); }
.hint-key {
  margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--c-primary-line);
  background: var(--c-primary-soft); border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--c-text-secondary);
}
.status-line {
  margin-top: 14px; padding: 13px 15px;
  background: var(--c-success-soft); border: 1px solid var(--c-success-line);
  border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--c-success);
}
.demo-note {
  margin: 18px 0 0; padding: 12px 15px;
  background: var(--c-warn-bg); border: 1px solid var(--c-warn-line);
  border-radius: var(--radius-sm); font-size: 0.85rem; color: var(--c-warn-text);
}
.demo-note b { color: var(--c-warn-text); }

/* ============================================================================
   Message thread  (report + console)
   ========================================================================== */
.thread { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.thread:empty { display: none; }
.bubble {
  max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: 0.94rem;
  box-shadow: var(--shadow-xs); white-space: pre-wrap; word-break: break-word;
}
.bubble .meta { display: block; font-size: 0.72rem; opacity: 0.75; margin-bottom: 3px; }
.bubble.them { align-self: flex-start; background: var(--c-surface-2); border: 1px solid var(--c-border); border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--c-primary); color: #fff; border-bottom-right-radius: 5px; }
.bubble.me .meta { opacity: 0.85; }
.empty-state { margin: 16px 0 0; color: var(--c-text-muted); font-size: 0.92rem; font-style: italic; }

/* Queue / case rows */
.queue-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface-2); margin-top: 8px;
}
.queue-row .who { font-weight: 700; }
.tag {
  font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--c-primary-soft); color: var(--c-primary); border: 1px solid var(--c-primary-line);
}
.tag.urgent { background: var(--c-warn-bg); color: var(--c-warn-text); border-color: var(--c-warn-line); }
.tag.emergency { background: var(--c-danger-soft); color: var(--c-danger); border-color: var(--c-danger); }

/* Status grid */
.status-grid { display: grid; gap: 10px; margin-top: 4px; }
.status-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface-2);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--c-success); box-shadow: 0 0 0 3px var(--c-success-soft); }
.dot.warn { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.dot.bad { background: var(--c-danger); box-shadow: 0 0 0 3px var(--c-danger-soft); }
.status-item .k { font-weight: 700; }
.status-item .v { margin-left: auto; color: var(--c-text-secondary); font-size: 0.9rem; }

.case-detail { margin-top: 12px; }
.case-detail .row { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--c-border); font-size: 0.92rem; }
.case-detail .row .k { width: 140px; color: var(--c-text-muted); flex: none; font-weight: 600; }

/* ============================================================================
   Footer (every page)
   ========================================================================== */
.site-footer {
  background: var(--c-bg-2); border-top: 1px solid var(--c-border);
  color: var(--c-text-secondary); margin-top: 8px;
}
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 40px 22px 48px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid h4 { margin: 0 0 10px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-muted); }
.footer-grid a { display: block; color: var(--c-text-secondary); text-decoration: none; font-size: 0.92rem; padding: 4px 0; }
.footer-grid a:hover { color: var(--c-primary); }
.footer-about p { margin: 10px 0 0; font-size: 0.92rem; max-width: 40ch; }
.footer-legal {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 22px 40px;
  border-top: 1px solid var(--c-border); display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 0.82rem; color: var(--c-text-muted); align-items: center;
}
.footer-legal .flagchip {
  width: 22px; height: 14px; border-radius: 2px; border: 1px solid var(--c-border);
  background: url("/static/flag.svg") center/cover no-repeat; flex: none;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }

/* Quiet inline link row (used on sub-pages) */
.quiet-links {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--c-border); font-size: 0.9rem;
}
.quiet-links a { text-decoration: none; color: var(--c-text-secondary); }
.quiet-links a:hover { color: var(--c-primary); text-decoration: underline; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 20px 0 2px;
  font-size: 0.9rem; text-decoration: none; color: var(--c-text-secondary);
}
.back-link:hover { color: var(--c-primary); }

/* ============================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--c-primary-dark); color: #fff; padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 0.92rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 90vw; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }

/* Gold utilities (kept from prior overlay) */
.text-gold { color: var(--gold); }
.chip-gold {
  display: inline-flex; align-items: center; gap: .35em;
  border: 1px solid var(--gold); color: var(--gold);
  border-radius: var(--radius-pill); padding: .125rem .55rem; font-size: .75rem; line-height: 1.4;
}

@media (max-width: 560px) {
  .app-shell { padding: 0 16px 60px; }
  .hero-inner { padding: 46px 18px 52px; }
  .section { padding: 44px 0; }
  .cta-band { padding: 30px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
