/* ENOKQA — McBride BCR Portal · red / white / blue design system
   Type: IBM Plex Sans (UI/body), IBM Plex Mono (code, numbers). Self-hosted, see assets/fonts. */
:root {
  --navy: #0B2A5B;
  --navy-2: #12356F;
  --blue: #1F4FBF;
  --blue-dark: #183E96;
  --blue-tint: #E9EFFB;
  --red: #C8102E;
  --red-dark: #A00D25;
  --red-tint: #FCEBEE;
  --white: #FFFFFF;
  --bg-soft: #F4F7FC;
  --border: #D3DCEB;
  --border-strong: #AEBBD3;
  --text: #14213D;
  --text-muted: #46536B;
  --focus: #1F4FBF;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 42, 91, .06), 0 4px 14px rgba(11, 42, 91, .06);
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --maxw: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, pre, kbd, .mono { font-family: var(--font-mono); }
code {
  font-size: .9em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05em .35em;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; color: var(--navy); margin: 0; }

.skip-link {
  position: absolute; left: -9999px; top: .5rem;
  background: var(--navy); color: var(--white); padding: .5rem .9rem; border-radius: 6px; z-index: 1000;
}
.skip-link:focus { left: .5rem; color: var(--white); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- A2A status strip ---------- */
.a2a-status {
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .02em;
}
.a2a-status .inner {
  max-width: var(--maxw); margin: 0 auto; padding: .4rem 1.25rem;
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
}
.a2a-status a { color: var(--white); text-decoration: underline; text-decoration-color: rgba(255,255,255,.55); overflow-wrap: anywhere; }
.a2a-status a:hover { color: #DCE6FA; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #6FA0FF; box-shadow: 0 0 0 3px rgba(111, 160, 255, .25);
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 900;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(11, 42, 91, .04);
}
.site-header::after { /* red / white / blue rule */
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--navy) 0 33.3%, var(--white) 33.3% 66.6%, var(--red) 66.6% 100%);
  border-top: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.logo {
  font-weight: 700; font-size: 1.15rem; letter-spacing: .14em; color: var(--navy);
}
.badge {
  display: inline-block;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  color: var(--red-dark); background: var(--red-tint);
  border: 1px solid #F1C2CA; border-radius: 999px; padding: .12rem .55rem; white-space: nowrap;
}
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.site-nav a {
  display: inline-block; padding: .45rem .7rem; border-radius: 6px;
  color: var(--navy); font-weight: 500; font-size: .92rem; text-decoration: none;
}
.site-nav a:hover { background: var(--blue-tint); color: var(--blue-dark); }
.site-nav a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -2px 0 var(--red); border-radius: 6px 6px 0 0; }
.lock { font-size: .75em; margin-left: .2rem; color: var(--text-muted); }

.auth-status { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-muted); min-height: 2rem; }
.auth-status .auth-email { font-family: var(--font-mono); font-size: .78rem; color: var(--navy); overflow-wrap: anywhere; }
.auth-status .auth-dot { width: 8px; height: 8px; border-radius: 50%; background: #1E7B4E; flex: none; }
.btn-small { padding: .35rem .7rem !important; font-size: .82rem !important; min-height: 0 !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .65rem 1.1rem;
  font-family: var(--font-sans); font-size: .95rem; font-weight: 600; line-height: 1.2;
  color: var(--white); background: var(--blue);
  border: 1px solid var(--blue); border-radius: 8px;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); box-shadow: 0 4px 12px rgba(31, 79, 191, .25); }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--blue-tint); color: var(--navy); border-color: var(--blue); box-shadow: none; }
.btn-accent { background: var(--red); border-color: var(--red); }
.btn-accent:hover { background: var(--red-dark); border-color: var(--red-dark); box-shadow: 0 4px 12px rgba(200, 16, 46, .25); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }

/* ---------- Layout ---------- */
main { flex: 1; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 2.75rem 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title {
  font-size: 1.35rem; font-weight: 600; color: var(--navy); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .6rem;
}
.section-title::before { content: ""; width: 6px; height: 1.1em; background: var(--red); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(31, 79, 191, .10), transparent 60%),
    linear-gradient(180deg, var(--white), var(--bg-soft));
  border-bottom: 1px solid var(--border);
}
.hero .container { padding-top: 3.5rem; padding-bottom: 3rem; }
.eyebrow { font-family: var(--font-mono); font-size: .8rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--red-dark); margin: 0 0 .75rem; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4rem); font-weight: 700; letter-spacing: .08em; color: var(--navy); margin-bottom: 1rem; }
.tagline { font-size: clamp(1.05rem, 2.4vw, 1.25rem); color: var(--text); max-width: 46ch; margin: 0 0 1.75rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Link cards ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.link-card {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  padding: 1.1rem 1.15rem 1.15rem; background: var(--white);
  border: 1px solid var(--border); border-top: 3px solid var(--blue); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.link-card:nth-child(3n+2) { border-top-color: var(--red); }
.link-card:nth-child(3n+3) { border-top-color: var(--navy); }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(11, 42, 91, .12); }
.link-card h3 { font-size: 1.02rem; font-weight: 600; color: var(--navy); }
.link-card a.primary { font-weight: 500; color: var(--blue); text-decoration: none; overflow-wrap: anywhere; }
.link-card a.primary::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); } /* whole card clickable */
.link-card a.primary:hover { text-decoration: underline; }
.link-card a.primary:focus-visible { outline: none; }
.link-card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.link-card .also { position: relative; z-index: 1; margin: .2rem 0 0; font-size: .85rem; color: var(--text-muted); }
.ext { font-size: .8em; }

/* ---------- Console teaser / notices ---------- */
.notice {
  display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--navy);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.notice p { margin: 0 0 .75rem; color: var(--text-muted); }
.notice-error { border-left-color: var(--red); background: var(--red-tint); }
.notice-error p, .notice-error strong { color: #5E0716; }

/* ---------- Console workspace ---------- */
.workspace {
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: 0;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); min-height: 560px; height: 74vh;
}
.panel { display: flex; flex-direction: column; gap: .75rem; padding: 1rem; overflow-y: auto; background: var(--white); }
.panel-left { border-right: 1px solid var(--border); }
.panel-right { border-left: 1px solid var(--border); }
.panel-header {
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--navy);
  border-bottom: 1px solid var(--border); padding-bottom: .45rem; margin: .25rem 0 0;
}
.panel .btn { width: 100%; justify-content: flex-start; }
.mono-list { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); line-height: 1.75; }
.mono-list li::before { content: "▸ "; color: var(--red); }
.viewport-container { display: grid; grid-template-rows: 1fr 1fr; gap: 1px; background: var(--border); min-width: 0; }
#map-viewport { width: 100%; height: 100%; min-height: 240px; background: var(--blue-tint); position: relative; z-index: 0; }
#fits-viewport { width: 100%; height: 100%; min-height: 240px; background: var(--bg-soft); display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; overflow: auto; }
.fits-dropzone {
  width: calc(100% - 1.5rem); height: calc(100% - 1.5rem); margin: .75rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  border: 2px dashed var(--border-strong); border-radius: 8px; color: var(--text-muted);
  font-size: .9rem; text-align: center; padding: 1rem;
}
.fits-dropzone .btn { width: auto; }
.fits-dropzone.dragover { border-color: var(--blue); background: var(--blue-tint); color: var(--navy); }
#fits-meta { width: 100%; max-height: 50%; overflow-y: auto; font-size: .72rem; display: none; }
#fits-meta pre { margin: 0; padding: .6rem .75rem; color: var(--text); white-space: pre-wrap; word-break: break-all; }
#fits-canvas-wrap { width: 100%; display: none; justify-content: center; align-items: center; padding: .5rem; }
#fits-canvas { max-width: 100%; max-height: 100%; image-rendering: pixelated; border: 1px solid var(--border); }
.console-box {
  flex: 1; min-height: 220px; overflow-y: auto;
  background: #F7F9FD; border: 1px solid var(--border); border-radius: 8px;
  padding: .75rem; font-family: var(--font-mono); font-size: .76rem; color: var(--text);
}
.log-entry { margin-bottom: .45rem; line-height: 1.45; }
.log-time { color: var(--text-muted); }
.log-vector { color: var(--blue-dark); word-break: break-all; }
.leaflet-container { font-family: var(--font-sans); }

/* ---------- FAQ ---------- */
.page-head { background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.page-head .container { padding-top: 2.25rem; padding-bottom: 2rem; }
.page-head h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; margin-bottom: .5rem; }
.page-head p { margin: 0; color: var(--text-muted); max-width: 60ch; }
.faq-layout { max-width: 860px; margin: 0 auto; padding: 2rem 1.25rem 3rem; display: flex; flex-direction: column; gap: 1.5rem; }
.faq-list { margin: 0; }
.faq-item { padding: 1.15rem 0; border-bottom: 1px solid var(--border); }
.faq-item:first-child { padding-top: 0; }
.faq-q { font-size: 1.12rem; font-weight: 600; color: var(--navy); margin: 0 0 .4rem; }
.faq-a { margin: 0; color: var(--text); }
.faq-a a { color: var(--blue); text-decoration: underline; }

/* ---------- Login ---------- */
.login-card {
  max-width: 460px; margin: 3rem auto; padding: 2rem 1.75rem; background: var(--white);
  border: 1px solid var(--border); border-top: 4px solid var(--red); border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.login-card p { color: var(--text-muted); }
.gsi-button {
  display: inline-flex; align-items: center; gap: .75rem; min-height: 44px; padding: .55rem 1rem;
  background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; border-radius: 4px;
  font-family: var(--font-sans); font-weight: 500; font-size: .95rem; text-decoration: none; cursor: pointer;
}
.gsi-button:hover { background: #F7F8F8; color: #1F1F1F; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.gsi-button svg { width: 18px; height: 18px; }
#gsi-container { min-height: 44px; }
.fine-print { font-size: .85rem; color: var(--text-muted); margin-top: 1.25rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #DCE4F2; margin-top: auto; }
.site-footer .container { padding-top: 1.5rem; padding-bottom: 1.5rem; font-size: .88rem; line-height: 1.9; }
.site-footer a { color: var(--white); text-decoration: underline; text-decoration-color: rgba(255,255,255,.5); }
.site-footer a:hover { color: #DCE6FA; }
.site-footer .mono { color: var(--white); }
.footer-rule { height: 3px; background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .panel-left { border-right: 0; border-bottom: 1px solid var(--border); }
  .panel-right { border-left: 0; border-top: 1px solid var(--border); }
  #map-viewport, #fits-viewport { height: 320px; }
}
@media (max-width: 720px) {
  .header-inner { padding: .6rem 1rem; gap: .5rem .75rem; }
  .site-nav { margin-left: 0; width: 100%; order: 3; }
  .site-nav ul { gap: 0; }
  .site-nav a { padding: .5rem .6rem; font-size: .9rem; }
  .auth-status { margin-left: auto; }
  .hero .container { padding-top: 2.25rem; padding-bottom: 2.25rem; }
  .cta-row .btn { flex: 1 1 100%; }
  .section { padding: 2rem 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
