:root {
  --navy: #0b1f3a;
  --navy-light: #13305a;
  --gold: #c9a227;
  --text: #1f2937;
  --muted: #5b6575;
  --bg: #ffffff;
  --bg-alt: #f4f6fa;
  --error: #b42318;
  --radius: 10px;
  --max: 1100px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

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

::selection { background: var(--gold); color: var(--navy); }

.container { width: 90%; max-width: var(--max); margin: 0 auto; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  color: #fff;
  transition: box-shadow 0.2s ease;
}
.site-header.scrolled { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; }
.logo span { color: var(--gold); }
.nav-links { display: flex; gap: 1.75rem; list-style: none; align-items: center; }
.nav-links a:not(.btn) { position: relative; padding: 0.25rem 0; transition: color 0.15s ease; }
.nav-links a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.nav-links a:not(.btn):hover,
.nav-links a.active { color: var(--gold); }
.nav-links a.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 10px;
}
.nav-toggle .bar {
  display: block;
  height: 3px;
  margin: 4px 0;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(201, 162, 39, 0.35); }
.btn-outline:hover { background: rgba(201, 162, 39, 0.12); box-shadow: none; }
.btn-small { padding: 0.45rem 1rem; }
.btn-outline { background: transparent; color: inherit; }

/* Hero */
.hero {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 7rem 0 6rem;
}
.eyebrow { color: var(--gold); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.85rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.15; margin: 1rem 0; max-width: 18ch; }
.lead { font-size: 1.15rem; max-width: 60ch; opacity: 0.9; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* Sections */
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: 2rem; color: var(--navy); margin-bottom: 1.5rem; }
.subhead { color: var(--muted); font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; }

.bullets { list-style: none; }
.bullets li { position: relative; padding-left: 1.4rem; margin-bottom: 0.55rem; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 2px;
}

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.75rem;
  border-top: 4px solid var(--gold);
  box-shadow: 0 4px 16px rgba(11, 31, 58, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(11, 31, 58, 0.14); }
.card h3 { color: var(--navy); margin-bottom: 1rem; }

/* Packages */
.section-intro { color: var(--muted); margin: -0.75rem 0 2rem; max-width: 60ch; }
.package { display: flex; flex-direction: column; }
.package h3 { margin-bottom: 0.25rem; }
.package .bullets { flex: 1; margin-bottom: 1.5rem; }
.package .btn { align-self: flex-start; }
.package-tag {
  align-self: flex-start;
  background: var(--navy);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}
.package-term { color: var(--muted); font-weight: 600; font-size: 0.9rem; margin-bottom: 1rem; }
.package-price { font-weight: 700; color: var(--navy); margin-bottom: 1rem; }

/* Medallion tiers */
.tiers { margin-bottom: 1.5rem; }
.tier-bronze { --tier: #cd7f32; }
.tier-silver { --tier: #c0c6cf; }
.tier-gold { --tier: var(--gold); }
.tier-platinum { --tier: #dfe3e8; }
.tier { border-top-color: var(--tier); }
.tier .package-tag { color: var(--navy); background: var(--tier); }
.on-demand { grid-template-columns: minmax(min(320px, 100%), 540px); }
.package-term a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }

/* Credentials */
.projects { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); margin-bottom: 3rem; }
.projects .bullets { margin-bottom: 1.25rem; }
.credentials-subhead { color: var(--navy); font-size: 1.35rem; margin-bottom: 1.5rem; }

/* Timeline */
.timeline { list-style: none; border-left: 3px solid var(--gold); padding-left: 2rem; }
.timeline > li { position: relative; margin-bottom: 2rem; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: calc(-2rem - 9px);
  top: 0.4rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid var(--gold);
}
.timeline h3 { color: var(--navy); }
.timeline .bullets { margin-top: 0.75rem; }
.company { font-weight: 600; }
.meta { color: var(--muted); font-size: 0.95rem; }

/* Highlights */
.highlights { background: var(--navy-light); color: #fff; padding: 2.5rem 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--gold); }
.stat-label { opacity: 0.85; font-size: 0.95rem; }

/* Skills */
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem; }
.skill-groups h3 { color: var(--navy); margin-bottom: 0.75rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  background: #fff;
  border: 1px solid #d6dce6;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

/* Ask Chris: the nav button, gold with a New badge, on every page */
.nav-links a.nav-ask {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.45rem 0.3rem 0.85rem;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font-weight: 700;
}
.nav-links a.nav-ask::after { display: none; }
.nav-links a.nav-ask:hover,
.nav-links a.nav-ask[aria-current="page"] { background: var(--gold); color: var(--navy); }
.badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--gold);
  color: var(--navy);
}
.nav-ask:hover .badge,
.nav-ask[aria-current="page"] .badge { background: var(--navy); color: var(--gold); }

/* Ask Chris: example questions (buttons on /ask, links on the home page) */
.ask-starters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.ask-starters[hidden] { display: none; } /* the display above would otherwise keep them on screen once the chat starts */
.ask-starter {
  display: inline-block;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  color: var(--navy);
  background: var(--bg-alt);
  border: 1px solid #d6dce6;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.ask-starter:hover { border-color: var(--gold); }

/* Ask Chris: the home-page teaser */
.ask-teaser { max-width: 760px; display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.ask-teaser .ask-starters { margin: 0; }

/* Ask Chris: the /ask page. The page scrolls, not a box inside it; the question box stays at the bottom. */
.ask-hero { padding: 4rem 0 3rem; }
.ask-chat { padding-top: 2.5rem; }
.ask { max-width: 760px; }
.ask-log { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 1rem; }
.ask-log:empty { display: none; }
.msg {
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 92%;
  scroll-margin-top: 80px; /* below the sticky header when a question is brought to the top */
}
.msg-user { align-self: flex-end; background: var(--navy); color: #fff; }
.msg-bot { align-self: flex-start; background: var(--bg-alt); color: var(--text); border-left: 3px solid var(--gold); }
.msg-bot a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }
.ask-form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--bg);
  border-top: 1px solid #e3e8ef;
  padding: 0.25rem 0 1rem;
}
.ask-status { min-height: 1.6em; margin: 0.25rem 0; color: var(--muted); font-size: 0.9rem; }
.ask-error { color: var(--error); font-weight: 600; }
.ask-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.ask-row textarea {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.7rem 0.9rem;
  border: 1px solid #c3cbd8;
  border-radius: var(--radius);
  resize: vertical;
}
.ask-row textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.ask-actions { display: flex; gap: 0.5rem; }
.ask-actions .btn { font: inherit; font-weight: 700; cursor: pointer; }
.ask-actions .btn:disabled { opacity: 0.6; cursor: wait; transform: none; box-shadow: none; }
.ask-note { color: var(--muted); font-size: 0.85rem; margin: 0.5rem 0 3rem; }
.ask-note a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }
@media (max-width: 560px) {
  .ask-row { flex-direction: column; align-items: stretch; }
}
/* "Want Chris to follow up?" (chat.js builds it after the second answer) */
.ask-lead { margin: 0.5rem 0 1.25rem; padding: 1.1rem 1.25rem; background: var(--bg-alt); border: 1px solid #e3e8ef; border-top: 3px solid var(--gold); border-radius: var(--radius); }
.ask-lead[hidden] { display: none; }
.ask-lead h2 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.ask-lead > p { margin: 0 0 0.75rem; color: var(--muted); }
.ask-lead-form { display: grid; gap: 0.75rem; }
.ask-lead-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; font-weight: 600; color: var(--text); min-width: 0; }
.ask-lead-field input, .ask-lead-field textarea {
  font: inherit; font-weight: 400; padding: 0.55rem 0.75rem; border: 1px solid #c3cbd8; border-radius: 6px; background: #fff; width: 100%; min-width: 0;
}
.ask-lead-field input:focus, .ask-lead-field textarea:focus, .ask-lead-check input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.ask-lead-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0.75rem; }
.ask-lead-check { display: flex; gap: 0.5rem; align-items: center; font-size: 0.95rem; }
.ask-lead-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--navy); }
/* The bots-only field: off screen, never seen or tabbed to by people. */
.ask-lead-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ask-lead-consent { margin: 0; color: var(--muted); font-size: 0.85rem; }
.ask-lead-consent a, .privacy a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }
.ask-lead .ask-status { margin: 0; }
.ask-lead-done { margin: 0; font-weight: 600; }

/* /privacy */
.privacy { max-width: 760px; padding-top: 2.5rem; padding-bottom: 3rem; }
.privacy h2 { font-size: 1.3rem; margin: 2rem 0 0.5rem; }
.privacy h2:first-child { margin-top: 0; }
.privacy ul { padding-left: 1.25rem; }
.privacy li { margin: 0.25rem 0; }

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

/* Contact */
.contact { background: var(--navy); color: #fff; text-align: center; }
.contact h2 { color: #fff; }
.contact .lead { margin: 0 auto; }
.contact .hero-actions { justify-content: center; }

/* Footer */
.site-footer { background: #07152a; color: #aab4c3; text-align: center; padding: 1.5rem 0; font-size: 0.9rem; }
.site-footer p + p { margin-top: 0.6rem; }
.privacy-note { font-size: 0.8rem; }
.footer-call a { color: #fff; font-weight: 700; text-decoration: underline; text-decoration-color: var(--gold); }
.privacy-note a { color: #fff; text-decoration: underline; text-decoration-color: var(--gold); }

/* Share (track.js): the footer's on every page, and one under the /ask conversation */
.share-btn { font: inherit; font-weight: 700; cursor: pointer; }
.site-footer .share-btn { color: #fff; }
.share-status:not(:empty) { margin-left: 0.5rem; overflow-wrap: anywhere; }
.ask-share { color: var(--muted); font-size: 0.9rem; margin: 0.75rem 0 0; }
.ask-share .share-btn { color: var(--navy); margin-left: 0.25rem; }

/* Scroll reveal (class added by script.js, so content stays visible without JS) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* 404 */
.not-found { min-height: calc(100vh - 64px - 60px); display: flex; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Responsive */
/* The full nav (logo, 7 links and the Ask Chris button) needs about 960px; below 1041px it becomes the menu button.
   tests/render.test.mjs checks the width just above this. */
@media (max-width: 1040px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--navy);
    padding: 1.5rem 0;
  }
  .nav-links.open { display: flex; }
  .two-col { grid-template-columns: 1fr; gap: 1rem; }
  .hero { padding: 5rem 0 4rem; }
}

/* /admin: Chris's private lead report (admin.js). Wide tables scroll inside their box, never the page. */
.admin { padding: 6rem 0 4rem; }
.admin h1 { color: var(--navy); margin-bottom: 0.5rem; }
.admin-section { margin-top: 2.5rem; }
.admin-section h2 { color: var(--navy); font-size: 1.4rem; margin-bottom: 0.5rem; }
.admin-section h3 { color: var(--navy); font-size: 1rem; margin: 1.25rem 0 0.5rem; }
/* /admin's messages ("Saved", errors): pinned to the top of the screen, so a Save at the bottom of the page shows its answer. */
#admin-status { position: sticky; top: 0.5rem; z-index: 20; width: fit-content; max-width: 100%; margin: 0.5rem 0; padding: 0.4rem 0.9rem;
  background: var(--bg); border: 1px solid #e3e8ef; border-left: 3px solid var(--gold); border-radius: 6px; box-shadow: 0 2px 8px rgba(11, 31, 58, 0.12); }
#admin-status:empty { display: none; }
/* /admin Leads (1.3.0) */
.lead-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.75rem; }
.lead-tabs .btn { font: inherit; font-size: 0.85rem; cursor: pointer; }
.lead-tab-current { pointer-events: none; }
.lead-overdue { color: var(--error); }
.lead-detail { margin-top: 1rem; padding: 1rem 1.25rem; border: 1px solid #e3e8ef; border-left: 3px solid var(--gold); border-radius: var(--radius); background: var(--bg-alt); overflow-wrap: anywhere; }
.lead-detail[hidden] { display: none; }
.lead-detail h3 { margin: 0 0 0.25rem; }
.lead-detail h4 { margin: 1.25rem 0 0.4rem; font-size: 0.95rem; }
.lead-detail a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); }
.lead-msg { white-space: pre-wrap; margin: 0.4rem 0; padding: 0.5rem 0.75rem; background: var(--bg); border-radius: 6px; }
.lead-notes { padding-left: 1.25rem; margin: 0 0 0.5rem; }
.lead-detail textarea { font: inherit; width: 100%; padding: 0.4rem 0.5rem; border: 1px solid #c9ced6; border-radius: 6px; }
.lead-detail > label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }

.admin-form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; margin-top: 0.5rem; }
.admin-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.admin-form textarea { font: inherit; font-weight: 400; color: var(--text); padding: 0.4rem 0.5rem; border: 1px solid #c9ced6; border-radius: 6px; max-width: 100%; }
.admin-form input, .admin-form select { font: inherit; font-weight: 400; color: var(--text); padding: 0.4rem 0.5rem; border: 1px solid #c9ced6; border-radius: 6px; max-width: 100%; }
.admin .btn { font: inherit; font-weight: 700; cursor: pointer; }
.table-wrap { overflow-x: auto; }
.admin table { border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.admin th, .admin td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #e3e6ea; text-align: left; white-space: nowrap; }
.admin th { color: var(--muted); font-weight: 600; }
.admin-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 0 1.5rem; }
.admin-sources > div { overflow-x: auto; }
.share-tree { margin: 0.25rem 0 0 1.25rem; font-size: 0.85rem; }
.admin-link { margin-top: 0.75rem; overflow-wrap: anywhere; }

/* The printable invoice (/admin/invoice/<id>, made by the Worker). Print or save as PDF from the browser. */
.invoice-page { background: #fff; padding: 1.5rem; }
.invoice { max-width: 760px; margin: 0 auto; color: var(--text); overflow-wrap: anywhere; }
.invoice h1 { font-size: 1.6rem; margin: 0 0 0.25rem; color: var(--navy); }
.invoice h2 { font-size: 1.1rem; margin: 1.5rem 0 0.4rem; color: var(--navy); }
.invoice p { margin: 0 0 1rem; }
.invoice-items { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.invoice-items th { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 2px solid var(--navy); }
.invoice-items td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #e3e8ef; vertical-align: top; }
.invoice-items .num { text-align: right; white-space: nowrap; }
.invoice-items tfoot td { font-weight: 700; border-bottom: 0; }
.invoice-tools { max-width: 760px; margin: 0 auto 1rem; font-size: 0.9rem; color: var(--muted); }
.invoice-tools a { color: var(--navy); }
.invoice-line { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.5rem; align-items: end; margin: 0.5rem 0; }
.invoice-line label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); min-width: 0; }
.invoice-line input { font: inherit; font-weight: 400; padding: 0.4rem 0.5rem; border: 1px solid #c9ced6; border-radius: 6px; width: 100%; min-width: 0; }
@media (max-width: 560px) { .invoice-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .invoice-line label:first-child { grid-column: 1 / -1; } }
.invoice-total { font-weight: 700; margin: 0.5rem 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.row-actions .btn { white-space: nowrap; }
@media print {
  .no-print { display: none; }
  .invoice-page { padding: 0; }
  .invoice { max-width: none; }
}
