/* ============================================================================
 * cr-common.css
 *
 * Shared design system for the Correlating Resonance phase pages
 * (gioiaie/sanzognie/corres/pluralitie). The four HTML files load this
 * before their own page-specific <style> block, so any rule defined here
 * may be overridden inline per page.
 *
 * Scope:
 *   1. Design tokens (:root variables)
 *   2. Base reset and body
 *   3. Page header and navigation (top)
 *   4. Phase navigation strip
 *   5. Bottom navigation
 *   6. Workspace container
 *   7. Shared components: callout, error/warning/info/success boxes,
 *      buttons, headings
 *
 * Out of scope (kept inline per page):
 *   - Upload grids and zones (vary materially by phase)
 *   - Results tables, pipeline visualisations, plotting
 *   - Phase-specific colour additions (e.g. --new-concept in Phase 2)
 * ============================================================================ */


/* ── 1. Design tokens ────────────────────────────────────────────────────── */

:root {
  /* Brand alignment (Geoff, 24 Jul): white ground, corporate navy/
     ice-blue in place of the inherited ink/paper/terracotta scheme.
     Each app's own stylesheet carries the same values (cascades over
     this shared fallback) — kept in sync here for anything that
     doesn't define its own. --accent is a darker value from the
     ice-blue hue, not the literal #a9dcef (~1.3:1 on white, fails
     WCAG AA outright) — this stays legible as text. */
  --ink:           #0c1424;
  --ink-mid:       #3d4a5c;
  --ink-light:     #7c838b;
  --paper:         #ffffff;
  --paper-mid:     #eef1f3;
  --paper-dark:    #dde3e7;
  --rule:          #d5dbe0;

  /* Accent (corporate ice-blue) */
  --accent:        #1c7a9c;
  --accent-light:  #4fa8c9;

  /* Status colours */
  --success:        #2a6b4a;
  --success-bg:     #f0f7f3;
  --success-border: #b8d9c8;

  --warning:        #7a5c1a;
  --warning-bg:     #fdf5e0;
  --warning-border: #e8d090;

  /* Typography */
  --font-mono:  'JetBrains Mono', monospace;
  --font-display: 'Spectral', Georgia, serif;
  --font-body:  'Barlow', sans-serif;

  /* Component hooks
     Phases override these in their own <style> block if they vary from the
     default. The phase-tag background alternates ink/accent across the four
     phases; rather than encoding that here, each page sets its own value. */
  --phase-tag-bg: #0c1424;
}


/* ── 2. Base reset and body ──────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:  var(--paper);
  color:       var(--ink);
  font-family: var(--font-body);
  font-size:   15px;
  line-height: 1.6;
  min-height:  100vh;
}


/* ── 3. Page header and navigation (top) ─────────────────────────────────── */

/* Dark bar, deliberately self-contained (hardcoded, not var(--ink)/
   var(--paper)) — same reasoning as the contact modal further down: the
   header needs to look identical and stay dark regardless of whatever
   a given page's own light theme is, matching the logo it carries
   (Geoff, 24 Jul: "make the header dark to match the logo... consistent
   through the apps"). Corporate palette values match ebono_brand/
   tokens.css (navy/black/silver/ice-blue), not each page's terracotta
   --accent. */

header {
  background: linear-gradient(135deg, var(--ink), #05070a);
  border-bottom: 2px solid #16264a;
  padding: 1.5rem 3rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.logo em { font-style: italic; color: #a9dcef; }

/* Brand mark + entity link, shared header (CD input v0.1 Part A/B). */
.cr-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.cr-nav-mark { height: 28px; width: auto; }
.cr-nav-strand-mark { height: 20px; width: auto; }

/* .cr-nav-logo previously had no matching rule — fell back to default
   link styling. Reuses .logo's intended look. */
.cr-nav-logo {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--paper);
}

.cr-nav-logo em { font-style: italic; color: #a9dcef; }

.phase-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #05070a;
  background: #a9dcef;
  padding: 0.25rem 0.65rem;
  border-radius: 2px;
}

.nav-link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fb0c0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover { color: #a9dcef; border-color: #a9dcef; }

/* Some pages use multiple top-right nav links instead of a single one. */
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 1.5rem;
}

.nav-links .nav-link {
  margin-left: 0;
  font-size: 0.65rem;
}


/* ── 4. Phase navigation strip (cr-phases) ───────────────────────────────── */

.cr-phases {
  display: flex;
  align-items: center;
  gap: 0;
}

.cr-phase-link {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border: 1px solid #16264a;
  border-right: none;
  color: #9fb0c0;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.cr-phase-link:first-child { border-radius: 3px 0 0 3px; }

.cr-phase-link:last-child {
  border-right: 1px solid #16264a;
  border-radius: 0 3px 3px 0;
}

.cr-phase-link:hover { background: #16264a; color: var(--paper); }

.cr-phase-link.current {
  background: #a9dcef;
  color: #05070a;
  border-color: #a9dcef;
}

.cr-nav-home {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #9fb0c0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.cr-nav-home:hover { color: #a9dcef; border-color: #a9dcef; }


/* ── 5. Bottom navigation (cr-bottom-nav) ────────────────────────────────── */

.cr-bottom-nav {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
  background: white;
}

.cr-bottom-btn {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-mid);
  padding: 0.5rem 1rem;
  border: 1px solid var(--paper-dark);
  border-radius: 3px;
  transition: all 0.15s;
}

.cr-bottom-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.cr-bottom-btn.ghost {
  opacity: 0.25;
  pointer-events: none;
}


/* ── 6. Workspace container ──────────────────────────────────────────────── */

/* The default container; pages may set a different max-width inline. */
.workspace {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
}


/* ── 7. Shared components ────────────────────────────────────────────────── */

/* Status / error / warning / success boxes -------------------------------- */

.error-box {
  background: #fef2f2;
  border-left: 3px solid #c03030;
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: #5a1010;
  font-family: var(--font-mono);
}

.error-box strong { display: block; margin-bottom: 0.25rem; }

.warning-box {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--warning);
}

.success-box {
  background: var(--success-bg);
  border-left: 3px solid var(--success);
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--success);
}

.info-box {
  background: var(--paper-mid);
  border-left: 3px solid var(--ink-mid);
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: var(--ink-mid);
}

/* Buttons ----------------------------------------------------------------- */

.btn-primary {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.7rem 1.4rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) { background: var(--accent); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  background: white;
  color: var(--ink-mid);
  border: 1px solid var(--paper-dark);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--paper-mid);
  color: var(--ink);
}

/* Section headings -------------------------------------------------------- */

.section-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 0.8rem;
}

.section-intro {
  font-size: 0.9rem;
  color: var(--ink-mid);
  margin-bottom: 1.2rem;
  max-width: 60ch;
}
/* Removed here (D1Win, brand alignment pass): .nav-body/.nav-eyebrow/
   .nav-title/.nav-subtitle/.nav-description — styled a headline block
   that edu_header.html no longer injects (see that file's changelog
   note). Confirmed dead: no other file referenced these classes. */

/* ── Contact FAB/modal (CD input v0.1 Part A item 6) ─────────────────────
   Deliberately self-contained dark surface, using its own hardcoded
   values rather than each page's --ink/--paper tokens — it needs to
   look identical whether opened from the dark landing hero or a light
   paper-themed app page, as one consistent brand-facing popover.
   Colours match ebono_au_site's component 1:1 (see ebono_brand/tokens.css
   for the canonical values this was copied from). */

.contact-fab {
  position: fixed;
  right: clamp(16px, 4vw, 40px);
  bottom: clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  border: 1px solid #16264a;
  background: linear-gradient(135deg, var(--ink), #05070a);
  color: #c7ccd1;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 30px -10px rgba(0,0,0,0.7);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  z-index: 40;
}

.contact-fab:hover, .contact-fab:focus-visible {
  border-color: #a9dcef;
  transform: translateY(-2px);
  box-shadow: 0 10px 34px -8px rgba(169,220,239,0.25);
}

.contact-fab svg { width: 18px; height: 18px; flex-shrink: 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,5,8,0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 50;
}

.modal-overlay.is-open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 460px;
  background: var(--ink);
  border: 1px solid #16264a;
  border-radius: 4px;
  padding: 2rem;
  transform: translateY(12px);
  transition: transform 0.35s ease;
}

.modal-overlay.is-open .modal { transform: translateY(0); }

.modal h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.4rem;
  margin: 0 0 0.4rem;
  color: var(--paper);
}

.modal p.modal-sub { margin: 0 0 1.4rem; font-size: 0.85rem; color: var(--ink-light); }

.modal label {
  display: block;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin: 1rem 0 0.35rem;
}

.modal input, .modal textarea {
  width: 100%;
  background: #05070a;
  border: 1px solid #16264a;
  border-radius: 2px;
  color: var(--paper);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  padding: 0.65rem 0.75rem;
  resize: vertical;
}

.modal input:focus, .modal textarea:focus { outline: none; border-color: #a9dcef; }

.modal-actions {
  margin-top: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-submit {
  background: linear-gradient(135deg, #a9dcef, #c7ccd1);
  color: #05070a;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px -6px rgba(169,220,239,0.4); }

.modal-close {
  background: none;
  border: none;
  color: var(--ink-light);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.modal-close:hover { color: #c7ccd1; }

.modal-status { margin-top: 1rem; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 0.75rem; min-height: 1em; }
.modal-status[data-state="ok"]  { color: #9fe6b0; }
.modal-status[data-state="err"] { color: #ff9d8a; }

@media (prefers-reduced-motion: reduce) {
  .contact-fab, .modal, .modal-overlay { transition: none; }
}

/* ── Registration gate and collection notice (CD v0.1, 23 Aug) ─────────────
   Presentation only. The strings are CD's and are placed verbatim in
   apps/corres/index.html and edu_header.html; nothing here alters them. */
.cr-gate {
  border: 1px solid var(--rule);
  background: var(--paper-mid);
  padding: 1.75rem 2rem;
  margin: 1.5rem 0 2rem;
  max-width: 46rem;
}
.cr-gate-title { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); margin: 0 0 0.75rem; }
.cr-gate-body  { color: var(--ink-mid); margin: 0 0 0.75rem; }
.cr-gate-action {
  display: inline-block; margin: 0.5rem 0 0.75rem;
  background: var(--accent); color: var(--paper);
  padding: 0.65rem 1.5rem; text-decoration: none; font-weight: 600;
}
.cr-gate-action:hover { background: var(--ink); }
.cr-gate-sub { font-size: 0.85rem; color: var(--ink-light); margin: 0; }
.modal-collection-notice {
  font-size: 0.8rem; line-height: 1.5; color: var(--ink-light);
  margin: 0.25rem 0 1rem; padding-top: 0.75rem; border-top: 1px solid var(--rule);
}

/* ── Site footer on the app pages ─────────────────────────────────────────
   The landing page's footer is styled in edu_hero.css against the dark
   ground. The app pages are light and never load that file, so the same
   entity block needs its own rules here. Links and text are identical; only
   the colours differ. */
.edu-footer {
  margin-top: 4rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--rule);
}
.edu-footer .footer-entity {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem;
  justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.04em; color: var(--ink-light);
}
.edu-footer .footer-entity a { color: var(--ink-light); text-decoration: none; border-bottom: 1px solid transparent; }
.edu-footer .footer-entity a:hover { color: var(--accent); border-color: var(--accent); }
.edu-footer .footer-legal-links { display: flex; gap: 1.25rem; }

/* ── Front page prose sections (CD corres_beta_copy v0.1) ────────────────
   These sit BELOW the hero, on edu_common's light ground — edu_common.css
   loads after edu_hero.css and sets body to --paper. They were first styled
   with the hero's dark-theme tokens, which rendered every heading #ffffff on
   #ffffff: present in the markup, invisible on the page. Light tokens here. */
.fp-section {
  padding: 0 4rem;
  max-width: 62rem;
  margin: 0 auto 3.5rem;
}
.fp-section:first-of-type { margin-top: 4rem; }
.fp-heading {
  font-family: var(--ebono-font-display); font-weight: 400;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: var(--ink); margin: 0 0 1rem; line-height: 1.15;
}
.fp-body {
  font-family: var(--ebono-font-body); font-weight: 400;
  font-size: 1.05rem; line-height: 1.7;
  color: var(--ink-mid); max-width: 42rem; margin: 0 0 1rem;
}
.fp-body strong { color: var(--ink); font-weight: 600; }
.fp-fields {
  font-family: var(--ebono-font-mono); font-size: 0.72rem;
  letter-spacing: 0.06em; color: var(--ink-light);
  padding-top: 0.75rem; border-top: 1px solid var(--rule);
}

/* The hero was built full-viewport, with a 1fr row for a footer strip that
   this page no longer carries. With CD's shorter copy that row became a
   screen-height void below the call to action. Size to content instead. */
/* The hero was authored full-viewport with a 1fr grid row for a footer strip
   this page no longer carries, so it filled the screen and left a black void
   under the call to action. Sized to its content: the band is now only as deep
   as the heading, standfirst and button need. */
section.hero {
  min-height: 0;
  height: auto;
  display: block;
}
section.hero .hero-body {
  padding: 3.5rem 4rem 3.25rem;
  max-width: 62rem;
  margin: 0 auto;
}
section.hero .hero-title { margin-bottom: 0.5rem; }
section.hero .hero-description { margin-bottom: 1.75rem; max-width: 42rem; }

@media (max-width: 900px) {
  .fp-section { padding-left: 2rem; padding-right: 2rem; }
  .hero-body  { padding: 3.5rem 2rem 3rem; }
}

/* Paired band and feedback form (CD root copy v0.2) */
.fp-paired { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.fp-form { max-width: 34rem; margin: 1.5rem 0 1rem; display: flex; flex-direction: column; }
.fp-form label { font-family: var(--ebono-font-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-light); margin: 0.9rem 0 0.3rem; }
.fp-optional { text-transform: none; letter-spacing: 0; font-style: italic; }
.fp-form input, .fp-form textarea {
  font-family: var(--ebono-font-body); font-size: 0.95rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 2px; }
.fp-form input:focus, .fp-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.fp-submit { align-self: flex-start; margin-top: 1.25rem; border: none; cursor: pointer; }
.fp-status { font-size: 0.85rem; color: var(--ink-mid); margin: 0.75rem 0 0; min-height: 1.2em; }
@media (max-width: 900px) { .fp-paired { grid-template-columns: 1fr; gap: 0; } }

/* The floating Contact widget sat over the footer links (CD root copy v0.2).
   Reserve space for it at the foot of the page so it cannot cover them. */
.edu-footer, footer { padding-bottom: 5.5rem; }
