/* ============================================================
   Secret Codes — brand kit theme
   Drop-in replacement for Bootstrap's default look.
   Version: 0.1  —  https://secretcodes.dev
   ============================================================ */

/* 1. Fonts ---------------------------------------------------- */
/* Self-hosted from static/vendor/fonts/. Variable-font woff2 files cover
   the full 400..700 weight axis in a single file per style. Latin subset
   only — add latin-ext or vietnamese later if a respondent needs them.
   Licensed under SIL OFL 1.1; see OFL.txt next to each font. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/fonts/fraunces/fraunces-normal-var.5d2835174326.woff2") format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/fonts/fraunces/fraunces-italic-var.be1b7d1cec18.woff2") format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/fonts/inter/inter-var.65850a373e25.woff2") format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../vendor/fonts/jetbrains-mono/jetbrains-mono-var.570751c5f8b4.woff2") format('woff2');
}

/* 2. Design tokens -------------------------------------------- */
:root {
  /* Ink & paper */
  --sc-ink:        #0E1730;   /* deep navy ink — "battleship night" */
  --sc-ink-soft:   #1B2747;
  --sc-paper:      #F2ECDD;   /* cream paper, like old ciphers */
  --sc-paper-warm: #E8DFC6;
  --sc-rule:       rgba(14, 23, 48, 0.16);

  /* Signal colors — reserved for "found" moments (CTAs, active, success) */
  --sc-signal:     #D84C2F;   /* maritime signal red */
  --sc-gold:       #C79A3A;   /* decoded-message gold */
  --sc-teal:       #2E6E6A;   /* deep water */
  --sc-lilac:      #8A7AB8;   /* synth / softer nod */

  /* Semantic roles */
  --sc-bg:         var(--sc-paper);
  --sc-fg:         var(--sc-ink);
  --sc-muted:      rgba(14, 23, 48, 0.6);
  --sc-accent:     var(--sc-signal);
  --sc-accent-2:   var(--sc-gold);

  /* Type */
  --sc-font-display: 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --sc-font-body:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --sc-font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Bootstrap variable overrides (if you're still on Bootstrap) */
  --bs-body-font-family: var(--sc-font-body);
  --bs-body-bg:          var(--sc-bg);
  --bs-body-color:       var(--sc-fg);
  --bs-primary:          var(--sc-ink);
  --bs-primary-rgb:      14, 23, 48;
  --bs-link-color:       var(--sc-ink);
  --bs-link-hover-color: var(--sc-signal);
  --bs-border-color:     var(--sc-rule);
}

/* Dark mode — add class="sc-dark" to <html> or <body>,
   or it kicks in automatically via prefers-color-scheme below. */
.sc-dark {
  --sc-bg:      var(--sc-ink);
  --sc-fg:      var(--sc-paper);
  --sc-muted:   rgba(242, 236, 221, 0.82);
  --sc-rule:    rgba(242, 236, 221, 0.18);
  --sc-accent:  #F0A06B;   /* warmer on dark */
  --sc-accent-2: #E8C464;

  --bs-secondary-color:   var(--sc-muted);
  --bs-secondary-bg:      var(--sc-ink-soft);
  --bs-tertiary-bg:       var(--sc-ink-soft);
  --bs-emphasis-color:    var(--sc-paper);
}
@media (prefers-color-scheme: dark) {
  :root:not(.sc-light) {
    --sc-bg:      var(--sc-ink);
    --sc-fg:      var(--sc-paper);
    --sc-muted:   rgba(242, 236, 221, 0.82);
    --sc-rule:    rgba(242, 236, 221, 0.18);
    --sc-accent:  #F0A06B;
    --sc-accent-2: #E8C464;

    --bs-secondary-color:   var(--sc-muted);
    --bs-secondary-bg:      var(--sc-ink-soft);
    --bs-tertiary-bg:       var(--sc-ink-soft);
    --bs-emphasis-color:    var(--sc-paper);
  }
}

/* Bootstrap 5.2 sets --bs-card-bg: #fff directly on the .card selector,
   which beats anything we set at :root scope. Override at the same
   selector level so dark mode actually applies to cards. */
.sc-dark .card,
.sc-dark .list-group-item {
  --bs-card-bg:           var(--sc-ink-soft);
  --bs-card-color:        var(--sc-paper);
  --bs-card-border-color: var(--sc-rule);
  --bs-card-cap-bg:       var(--sc-ink-soft);
  --bs-card-cap-color:    var(--sc-paper);
  background-color:       var(--sc-ink-soft);
  color:                  var(--sc-paper);
  border-color:           var(--sc-rule);
}
@media (prefers-color-scheme: dark) {
  :root:not(.sc-light) .card,
  :root:not(.sc-light) .list-group-item {
    --bs-card-bg:           var(--sc-ink-soft);
    --bs-card-color:        var(--sc-paper);
    --bs-card-border-color: var(--sc-rule);
    --bs-card-cap-bg:       var(--sc-ink-soft);
    --bs-card-cap-color:    var(--sc-paper);
    background-color:       var(--sc-ink-soft);
    color:                  var(--sc-paper);
    border-color:           var(--sc-rule);
  }
}

/* 3. Base --------------------------------------------------- */
html, body {
  background: var(--sc-bg);
  color: var(--sc-fg);
  font-family: var(--sc-font-body);
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  transition: background .3s ease, color .3s ease;
}

/* Headings use the display serif */
h1, h2, h3, .sc-display {
  font-family: var(--sc-font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}
h1 { font-size: clamp(40px, 6vw, 72px); line-height: 1.02; }
h2 { font-size: clamp(28px, 3.5vw, 40px); }
h3 { font-size: clamp(22px, 2.5vw, 28px); }

h4, h5, h6 {
  font-family: var(--sc-font-body);
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* Italic accent — use this for the "personal" voice */
.sc-italic,
em.sc-accent,
.sc-display em {
  font-family: var(--sc-font-display);
  font-style: italic;
  color: var(--sc-accent);
  font-weight: 500;
}

/* Mono — for code, labels, coordinates, signals */
code, kbd, samp, pre, .sc-mono {
  font-family: var(--sc-font-mono);
}
.sc-eyebrow,
.sc-label {
  font-family: var(--sc-font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sc-muted);
}

/* Links */
a { color: var(--sc-fg); text-decoration-color: var(--sc-rule); text-underline-offset: 3px; }
a:hover { color: var(--sc-accent); text-decoration-color: currentColor; }

/* 4. Buttons ------------------------------------------------ */
.sc-btn,
.btn-secret {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sc-font-mono);
  font-size: 12px; letter-spacing: 0.06em;
  padding: 10px 16px;
  border-radius: 3px;
  border: 1px solid var(--sc-fg);
  background: var(--sc-fg);
  color: var(--sc-bg);
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s ease, background .2s ease;
}
.sc-btn:hover { transform: translateY(-1px); }
.sc-btn:hover, .sc-btn:focus { color: var(--sc-bg); }

.sc-btn--ghost {
  background: transparent; color: var(--sc-fg);
}
.sc-btn--ghost:hover, .sc-btn--ghost:focus { color: var(--sc-fg); background: transparent; }

.sc-btn--accent {
  background: var(--sc-accent);
  border-color: var(--sc-accent);
  color: var(--sc-paper);
}
.sc-btn--accent:hover, .sc-btn--accent:focus { color: var(--sc-paper); }

/* Bootstrap button remap — derive from --sc-fg/--sc-bg so the
   button auto-flips with light/dark mode and never blends into
   the page background. */
.btn-primary {
  --bs-btn-bg:                 var(--sc-fg);
  --bs-btn-color:              var(--sc-bg);
  --bs-btn-border-color:       var(--sc-fg);
  --bs-btn-hover-bg:           var(--sc-accent);
  --bs-btn-hover-border-color: var(--sc-accent);
  --bs-btn-hover-color:        var(--sc-paper);
  --bs-btn-active-bg:          var(--sc-accent);
  --bs-btn-active-border-color: var(--sc-accent);
  --bs-btn-active-color:       var(--sc-paper);
  --bs-btn-disabled-bg:        var(--sc-fg);
  --bs-btn-disabled-border-color: var(--sc-fg);
  --bs-btn-disabled-color:     var(--sc-bg);
}

/* .btn-outline-light is intentionally NOT in this group: it's only used
   on the dark navbar, where Bootstrap's default (white-on-dark) is correct.
   Overriding it to var(--sc-fg) makes it black-on-black in light mode. */
.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color:              var(--sc-fg);
  --bs-btn-border-color:       var(--sc-fg);
  --bs-btn-bg:                 transparent;
  --bs-btn-hover-bg:           var(--sc-fg);
  --bs-btn-hover-border-color: var(--sc-fg);
  --bs-btn-hover-color:        var(--sc-bg);
  --bs-btn-active-bg:          var(--sc-fg);
  --bs-btn-active-border-color: var(--sc-fg);
  --bs-btn-active-color:       var(--sc-bg);
  --bs-btn-disabled-color:     var(--sc-muted);
  --bs-btn-disabled-border-color: var(--sc-rule);
}

/* Outline-secondary keeps a softer look but still clearly visible:
   muted border, foreground text. */
.btn-outline-secondary {
  --bs-btn-color:        var(--sc-fg);
  --bs-btn-border-color: var(--sc-muted);
}

/* 5. Cards & surfaces --------------------------------------- */
.sc-card {
  border: 1px solid var(--sc-rule);
  border-radius: 6px;
  padding: 24px;
  background: color-mix(in oklab, var(--sc-bg) 98%, var(--sc-fg) 2%);
}

/* Hero / lede / prose patterns */
.sc-hero { --bs-gutter-x: 3rem; }
.sc-hero h1 { line-height: 1.02; }
.sc-lede { max-width: 44ch; font-size: 1.05rem; }
.sc-prose { max-width: 64ch; }
.sc-prose-lead { font-size: 1.05rem; }
.sc-h-tight { line-height: 1.05; }
.sc-h-sub { font-size: 1.5rem; }
.sc-mono-sm { font-size: 0.95em; }

/* Navbar brand wrapping the wordmark */
.sc-brand-link { color: var(--sc-paper); }
.sc-brand-svg  { display: block; }
.sc-opsz-display { font-variation-settings: 'opsz' 144; }

/* Footer block — paper text on ink */
.sc-footer { background: var(--sc-ink); color: var(--sc-paper); }
.sc-footer a { color: var(--sc-paper); }
.sc-footer .sc-mono { letter-spacing: 0.06em; }
.sc-footer__morse {
  max-width: 360px; width: 100%; height: auto;
  display: block; margin-bottom: 14px;
}
.sc-footer__socials {
  list-style: none; padding: 0; margin: 0 0 0.5rem;
  display: flex; flex-wrap: wrap; gap: 1rem;
}
.sc-footer__socials a { font-size: 1.1rem; }
.sc-footer__by { color: rgba(242, 236, 221, 0.6); letter-spacing: 0.06em; }

/* Numbered prefix used inside .sc-eyebrow ("01" Personal infrastructure) */
.sc-num { color: var(--sc-accent); margin-right: 10px; }

/* Card-as-link tile pattern (3-up grid below the hero) */
.sc-tile {
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
  text-decoration: none;
}
.sc-tile:hover, .sc-tile:focus { color: inherit; }
.sc-tile-title { font-size: 1.375rem; margin-bottom: 0; }
.sc-tile-body  { font-size: 0.875rem; margin-bottom: 0; }
.sc-tile .sc-arrow { margin-top: auto; }

/* Accent "open →" indicator */
.sc-arrow {
  font-family: var(--sc-font-mono);
  color: var(--sc-accent);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

/* In-page anchor that clears the fixed-ish navbar */
.sc-anchor { scroll-margin-top: 80px; }

/* Coords strip — signal-flag baseline (COORD · SIGNAL · STATUS · OWNER) */
.sc-coords {
  display: flex; flex-wrap: wrap; gap: 0;
  border-top: 1px solid var(--sc-rule);
  border-bottom: 1px solid var(--sc-rule);
  padding: 14px 0;
  font-family: var(--sc-font-mono);
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--sc-muted);
}
.sc-coords > span { flex: 1 1 50%; min-width: 0; padding: 4px 0; }
.sc-coords b { color: var(--sc-fg); font-weight: 500; margin-right: 8px; }
@media (min-width: 768px) {
  .sc-coords > span { flex: 1; }
}

/* 6. Utilities ---------------------------------------------- */
.sc-muted   { color: var(--sc-muted); }
.sc-accent  { color: var(--sc-accent); }
.sc-rule    { border-color: var(--sc-rule); }
.sc-bg-ink    { background: var(--sc-ink);    color: var(--sc-paper); }
.sc-bg-paper  { background: var(--sc-paper);  color: var(--sc-ink); }
.sc-bg-signal { background: var(--sc-signal); color: var(--sc-paper); }
.sc-bg-teal   { background: var(--sc-teal);   color: var(--sc-paper); }

/* Respondent-view "Edit" affordance — visible only to owner/collaborator */
.respondent-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #6c757d;
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.respondent-edit-link:hover,
.respondent-edit-link:focus {
  color: #534AB7;
  border-color: #cfcae8;
  background: #f4f3fa;
  text-decoration: none;
}

/* Inline SVG icons (replaces Font Awesome kit). Match the in-text */
/* sizing/baseline behaviour FA's <i> + svg-inline--fa CSS used to give. */
.sc-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  overflow: visible;
}

/* Browse-text view — read-only overview of all open-text responses.
   Each card is a contained box; editing happens in triage, not here. */
.text-responses-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid #E8E6DC;
  font-size: 13px;
  flex-wrap: wrap;
}
.text-responses-strip .crumb { color: #8A8983; }
.text-responses-strip .crumb-current {
  color: #1F1E1B;
  font-weight: 500;
}
.text-responses-strip-sep { color: #8A8983; }
.text-responses-summary {
  margin-left: auto;
  font-size: 12px;
  color: #5C5B57;
}
.text-responses-empty {
  padding: 24px;
  background: #F5F4ED;
  border-radius: 6px;
  text-align: center;
}

/* Section per question — sits inside a soft frame to visually group its cards. */
.text-responses-section {
  margin: 28px 0;
  padding: 14px 10px 6px;
  background: #FAF8F1;
  border: 1px solid #E8E6DC;
  border-radius: 10px;
}
.text-responses-question {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #E8E6DC;
  flex-wrap: wrap;
}
.text-responses-question-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.text-responses-q-num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #8A8983;
  flex-shrink: 0;
}
.text-responses-q-text {
  font-family: Fraunces, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  color: #1F1E1B;
}
.text-responses-question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.text-responses-q-count {
  font-size: 12px;
  color: #8A8983;
}
.text-responses-untriaged {
  color: #b06b00;
  font-weight: 500;
}
.text-responses-q-empty {
  font-size: 13px;
  color: #8A8983;
  padding: 4px 0 14px;
  margin: 0;
}

/* Card per response — a single contained box, generous whitespace, calm. */
.text-responses-card {
  background: #fff;
  border: 1px solid #E8E6DC;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(14, 23, 48, 0.04);
  scroll-margin-top: 16px;
  overflow: hidden;
}
.text-responses-card:last-child { margin-bottom: 4px; }
.text-responses-card-body { padding: 12px 14px 10px; }
.text-responses-card .response-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  color: #8A8983;
  flex-wrap: wrap;
}
.text-responses-card .meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #F0EFE7;
  color: #5C5B57;
}
.text-responses-callout {
  font-family: Fraunces, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
  color: #1F1E1B;
  padding: 0 0 0 10px;
  border-left: 3px solid #534AB7;
  margin-bottom: 10px;
}
.text-responses-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.text-responses-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 12px;
  background: #EEEDFE;
  color: #3C3489;
  font-size: 12px;
  font-weight: 500;
}
.text-responses-tag-empty {
  background: transparent;
  color: #B7B6AF;
  font-style: italic;
  border: 1px dashed #DAD8CD;
  font-weight: 400;
}
.text-responses-triage-cta { white-space: nowrap; }

/* Question-scope banner — surfaces on Browse-text and Triage when a
   ?question=<id> filter is active. */
.triage-scope-banner {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #EEEDFE;
  border-left: 3px solid #534AB7;
  border-radius: 6px;
  flex-wrap: wrap;
}
.triage-scope-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #534AB7;
}
.triage-scope-q {
  font-family: Fraunces, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 15px;
  font-weight: 500;
  color: #3C3489;
  flex: 1;
  min-width: 0;
}
.triage-scope-unscope {
  font-size: 12px;
  color: #534AB7;
  text-decoration: none;
  white-space: nowrap;
}
.triage-scope-unscope:hover { text-decoration: underline; }
