/* CivLaunch web MVP. One accent color; tiers are communicated by text and a
   filled-segment indicator, never by color alone. */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0f1ee;
  --text: #16191d;
  --muted: #59616b;
  --border: #dfe1dd;
  --accent: #0b5f63;
  --accent-strong: #084a4d;
  --accent-soft: #e3f0ef;
  --focus: #2f6fdf;
  --warn-bg: #fbf4e6;
  --warn-text: #6b4a0e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 25, 30, 0.05), 0 4px 16px rgba(20, 25, 30, 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111416;
    --surface: #181c1f;
    --surface-2: #20262a;
    --text: #e9ecee;
    --muted: #9aa4ad;
    --border: #2c3338;
    --accent: #5fb8b3;
    --accent-strong: #86cdc8;
    --accent-soft: #1d3434;
    --focus: #7aa7ff;
    --warn-bg: #2d2615;
    --warn-text: #ebcf94;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Long unbroken titles (e.g. "Communications/Navigation/Radar") must wrap on narrow phones. */
h1, h2, h3, p, li, .specialty-option span { overflow-wrap: anywhere; }
.specialty-option span { min-width: 0; }

/* Component display rules (e.g. inline-flex buttons) must not override the hidden attribute. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.container { max-width: 780px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -48px;
  background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm);
  z-index: 10;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.header-note { color: var(--muted); font-size: 0.875rem; }

/* Intro */
.intro { padding: 40px 0 24px; }
.intro h1 { font-size: clamp(1.6rem, 4.2vw, 2.25rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; max-width: 22ch; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 60ch; }

.notice { background: var(--warn-bg); color: var(--warn-text); padding: 12px 16px; border-radius: var(--radius-sm); }

/* Finder panel */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px 24px;
}
.step { border: 0; margin: 0; padding: 20px 0; min-width: 0; }
.step + .step { border-top: 1px solid var(--border); }
.step legend, .step-label {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; font-size: 1.05rem; margin: 0 0 12px; padding: 0;
}
.step-number {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 0.85rem; font-weight: 700;
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }

/* Branch choices: radio buttons styled as pills */
.branch-options { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-option { position: relative; }
.branch-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.branch-option span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-weight: 550; cursor: pointer;
}
.branch-option input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.branch-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.branch-option:hover span { border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .branch-option input:checked + span { color: #0c1415; } }

/* Specialty search */
input[type="search"] {
  width: 100%; font: inherit; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input[type="search"]:disabled { background: var(--surface-2); color: var(--muted); }
.specialty-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: 320px; overflow-y: auto; border-radius: var(--radius-sm); }
.specialty-list:not(:empty) { border: 1px solid var(--border); }
.specialty-list li + li { border-top: 1px solid var(--border); }
.specialty-option {
  width: 100%; display: flex; gap: 12px; align-items: baseline; text-align: left;
  padding: 10px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer;
}
.specialty-option:hover { background: var(--surface-2); }
.specialty-option[aria-pressed="true"] { background: var(--accent-soft); }
.specialty-code { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 5.5ch; color: var(--accent-strong); }

/* Selected specialty */
.specialty-card { background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px; }
.specialty-meta { margin: 0; color: var(--muted); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.02em; }
.specialty-card h3 { margin: 2px 0 8px; font-size: 1.15rem; }
.specialty-description { margin: 0 0 12px; color: var(--muted); font-size: 0.95rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.chips li {
  padding: 3px 10px; border-radius: 999px; font-size: 0.85rem;
  background: var(--surface); border: 1px solid var(--border);
}

/* Buttons */
.button-primary, .button-secondary, .button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; border-radius: var(--radius-sm); padding: 11px 20px; cursor: pointer; text-decoration: none;
}
.button-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.button-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.button-secondary:hover { border-color: var(--accent); }
.button-link { background: var(--accent); color: #fff; border: 1px solid var(--accent); padding: 9px 16px; }
.button-link:hover { background: var(--accent-strong); }
@media (prefers-color-scheme: dark) { .button-primary, .button-link { color: #0c1415; } }

/* Results */
.results { padding: 32px 0 16px; }
.results h2 { font-size: 1.35rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.results h2:focus { outline: none; }
.empty-state {
  margin: 16px 0; padding: 20px; background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state p { margin: 0 0 16px; max-width: 52ch; }
.results-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 12px; }

.job-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.job-card:focus-within { border-color: var(--accent); }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.job-card h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.job-org { margin: 2px 0 0; color: var(--muted); }
.job-org strong { color: var(--text); font-weight: 600; }
.job-summary { margin: 12px 0 0; font-size: 0.95rem; }

.tier { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 650; white-space: nowrap; }
.tier-bars { display: inline-flex; gap: 3px; }
.tier-bars span { width: 6px; height: 14px; border-radius: 2px; background: var(--border); }
.tier-bars span.on { background: var(--accent); }

.why { margin-top: 14px; padding: 12px 14px; background: var(--accent-soft); border-radius: var(--radius-sm); }
.why-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-strong); margin: 0 0 4px; }
.why p { margin: 0; }
.why .chips { margin-top: 10px; }
.why .chips li { background: var(--surface); }
.more-skills, .more-summary { display: none; }
.overlap { color: var(--muted); font-size: 0.875rem; margin-top: 6px !important; }

.flags { margin: 12px 0 0; padding: 0; list-style: none; font-size: 0.875rem; color: var(--warn-text); }
.flags li { display: flex; gap: 6px; }
.flags li::before { content: "!"; font-weight: 800; }

.job-actions { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-actions .source { color: var(--muted); font-size: 0.8rem; }

/* Footer */
.site-footer { margin-top: 32px; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.site-footer p { margin: 0 0 6px; max-width: 70ch; }

/* Phones: full-width actions, compact cards, nothing narrower than a thumb. */
@media (max-width: 560px) {
  .intro { padding: 24px 0 16px; }
  .panel { padding: 4px 16px; }
  .header-note { display: none; }
  .job-card { padding: 16px; }
  .why { padding: 10px 12px; }
  .why .chips { gap: 4px; margin-top: 8px; }
  .chips li { font-size: 0.8rem; padding: 2px 8px; }
  .job-summary:not(.expanded) {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  }
  .more-summary {
    display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 -10px; padding: 0 2px;
    background: none; border: 0; font: inherit; font-size: 0.875rem; font-weight: 650;
    color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  }
  .why .chips:not(.expanded) li.extra { display: none; }
  /* Tags and the "+N more" button share one wrapping row. */
  .shared-skills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
  .shared-skills .chips { display: contents; }
  .more-skills {
    display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; padding: 0 4px;
    background: none; border: 0; font: inherit; font-size: 0.875rem; font-weight: 650;
    color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  }
  .button-primary, .button-secondary, .job-actions .button-link { width: 100%; }
  .job-actions { gap: 8px; }
  .job-actions .source { width: 100%; text-align: center; }
  .results { padding-top: 24px; }
}

@media (prefers-reduced-motion: no-preference) {
  .button-primary, .button-secondary, .button-link, .specialty-option, .branch-option span { transition: background-color 120ms ease, border-color 120ms ease; }
}
