/* ==========================================================================
   Predictive Purpose — Self-Assessment Diagnostic
   Served at tool.neilcatton.com, framed by the live site's nav and footer.

   Section 1 — SITE CHROME: copied from neilcatton-website/index.html
   (palette, base type, nav, dropdown, page header, buttons, footer,
   keyframes, responsive rules) so nav/footer/header render identically
   to the live site.

   Section 2 — TOOL: the diagnostic itself, restyled onto the site's own
   tokens (ink / ink-mid / ink-light / paper / paper-mid / accent /
   accent-mid / rule; Playfair Display for headings, Source Sans 3 for
   body and labels).
   ========================================================================== */

:root {
  --ink:        #1a1714;
  --ink-mid:    #3d3935;
  --ink-light:  #5c5652;
  --paper:      #f5f2ee;
  --paper-mid:  #ede9e3;
  --accent:     #2b4a6f;
  --accent-mid: #3d6494;
  --rule:       #d4cfc9;
  --serif: "Playfair Display", Georgia, serif;
  --sans:  "Source Sans 3", Helvetica, sans-serif;
  --col-pad: clamp(1.5rem, 5vw, 4rem);
  --max-wide: 1080px;
  --nav-height: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  top: -100%; left: 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  z-index: 9999;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.skip-link:focus { top: 1rem; }

/* ── NAV (site) ───────────────────────────────────────────────────────── */

.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--col-pad);
  background: rgba(245,242,238,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.3s ease;
}

.site-nav.scrolled { box-shadow: 0 2px 20px rgba(26,23,20,0.08); }

.nav-wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  animation: fadeInDown 0.5s ease both;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  list-style: none;
}

.nav-links li { animation: fadeInDown 0.5s ease both; }
.nav-links li:nth-child(1) { animation-delay: 0.05s; }
.nav-links li:nth-child(2) { animation-delay: 0.10s; }
.nav-links li:nth-child(3) { animation-delay: 0.15s; }
.nav-links li:nth-child(4) { animation-delay: 0.20s; }
.nav-links li:nth-child(5) { animation-delay: 0.25s; }

.nav-links a {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }
.nav-links a[aria-current="page"] { color: var(--accent); }
.btn-nav { border: 1.5px solid var(--ink); padding: 0.38rem 0.85rem; transition: background 0.2s, color 0.2s; }
.btn-nav::after { display: none !important; }
.btn-nav:hover { background: var(--ink); color: var(--paper) !important; }

.nav-dropdown { position: relative; }
.nav-dropdown > a .caret { font-size: 0.55rem; margin-left: 0.25rem; display: inline-block; transform: translateY(-1px); }
.dropdown-menu {
  position: absolute; top: 100%; left: -1.4rem;
  min-width: 252px; padding: 0.55rem 0;
  background: rgba(245,242,238,0.98);
  border: 1px solid var(--rule); border-top: 2px solid var(--accent);
  box-shadow: 0 14px 30px rgba(26,23,20,0.12);
  list-style: none;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 200;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu li a {
  display: block; padding: 0.48rem 1.4rem;
  font-size: 0.72rem; letter-spacing: 0.08em; white-space: nowrap;
}
.dropdown-menu li a::after { display: none; }
.dropdown-menu li a:hover { background: var(--paper-mid); }
.dropdown-menu li a[aria-current="page"] { color: var(--accent); }

/* ── PAGE HEADER (site) ───────────────────────────────────────────────── */

.page-header { padding-top: 7rem; background: var(--ink); }
.page-header-inner {
  max-width: var(--max-wide); margin: 0 auto;
  padding: 3rem var(--col-pad) 0;
  display: grid; grid-template-columns: 1fr 280px;
  gap: 4rem; align-items: end;
}
.page-header-inner--no-photo { grid-template-columns: 1fr; }
.page-header-text { padding-bottom: 3.5rem; }
.page-label {
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(245,242,238,0.55); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.75rem;
  opacity: 0; animation: fadeInUp 0.6s ease 0.2s forwards;
}
.page-label::before { content: ""; width: 24px; height: 1px; background: var(--accent); flex-shrink: 0; }
.page-title {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 400; line-height: 1.05; letter-spacing: -0.02em;
  color: var(--paper); margin-bottom: 1.5rem;
  opacity: 0; animation: fadeInUp 0.6s ease 0.35s forwards;
}
.page-title em { font-style: italic; color: var(--rule); }
.page-standfirst {
  font-family: var(--sans); font-size: 1.05rem; font-weight: 300; line-height: 1.8;
  color: rgba(245,242,238,0.72); max-width: 560px;
  opacity: 0; animation: fadeInUp 0.6s ease 0.5s forwards;
}

/* ── BUTTONS (site) ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  min-height: 44px;
  min-width: 44px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  border-radius: 0;
}

.btn-primary { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-secondary { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn--small {
  padding: 0.55rem 1.1rem;
  min-height: 36px;
  font-size: 0.68rem;
}

/* ── FOOTER (site) ────────────────────────────────────────────────────── */

.site-footer { background: var(--ink); padding: 2.75rem var(--col-pad); }

.footer-inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-wordmark {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--paper);
  text-decoration: none;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; list-style: none; }

.footer-links a {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245,242,238,0.5);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--paper); }

.footer-copy {
  font-size: 0.75rem;
  color: rgba(245,242,238,0.55);
  width: 100%;
}

/* ── KEYFRAMES (site) ─────────────────────────────────────────────────── */

@keyframes fadeInDown {
  from { opacity:0; transform:translateY(-10px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(14px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── SITE RESPONSIVE ──────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .nav-links { gap: 1.25rem; }
  .page-header-inner { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .nav-links { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}


/* ==========================================================================
   TOOL — the diagnostic itself
   ========================================================================== */

.tool-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--col-pad) 4rem;
}

.tool-wrap h2, .tool-wrap h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.6em;
  line-height: 1.2;
}

.tool-wrap h2 { font-size: 1.7rem; }

.results-subheading {
  font-size: 1.25rem;
  margin-top: 1.6em;
}

.tool-wrap p {
  margin: 0 0 1em;
}

.body-text {
  font-family: var(--sans);
}

.label-text {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  display: block;
}

/* ── Sticky progress bar ── */

.sticky-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 2px 10px rgba(26, 23, 20, 0.2);
}

.sticky-bar__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.6rem var(--col-pad);
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow-x: auto;
}

.sticky-chips {
  display: flex;
  gap: 0.4rem;
  flex: 1 1 auto;
  overflow-x: auto;
}

.sticky-chip {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(245, 242, 238, 0.08);
  border: 1px solid rgba(245, 242, 238, 0.18);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  color: var(--paper);
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}

.sticky-chip:hover,
.sticky-chip:focus-visible {
  background: rgba(61, 100, 148, 0.35);
}

.sticky-chip__num {
  opacity: 0.7;
  font-weight: 400;
}

.sticky-chip__val {
  color: var(--paper);
  font-weight: 700;
}

.sticky-total {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--sans);
  white-space: nowrap;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(245, 242, 238, 0.2);
}

.sticky-total__label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.sticky-total__value {
  color: var(--paper);
  font-weight: 700;
  font-size: 0.95rem;
}

/* ── Panels ── */

.panel {
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  padding: 1.75rem 1.75rem;
  margin-top: 1.75rem;
}

.intro-panel {
  margin-top: 2.25rem;
}

.callout {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1rem;
  font-style: italic;
  color: var(--ink-mid);
}

.privacy-note {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-light);
  margin-bottom: 0;
}

/* ── Scoring key table ── */

.key-table {
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  width: 100%;
  max-width: 420px;
}

.key-table__caption {
  margin: 1.25rem 0 0.5rem;
}

.key-table th,
.key-table td {
  text-align: left;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

.key-table th {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
}

.key-table__score {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--accent);
  width: 2.5rem;
}

/* ── Front matter ── */

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field input {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Dimensions ── */

.dimension__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.dimension__head h2 {
  font-size: 1.5rem;
  margin: 0;
}

.dimension__subtotal {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-light);
  white-space: nowrap;
}

.dimension__subtotal-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

.statements {
  list-style: none;
  margin: 0;
  padding: 0;
}

.statement {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.statement:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.statement__text {
  margin: 0 0 0.8rem;
  font-size: 1.02rem;
}

.statement__controls {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.score-buttons {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.score-btn {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0;
  border: 1.5px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.score-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.score-btn:active {
  transform: translateY(1px);
}

.score-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.note-field {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.note-input {
  font-family: var(--sans);
  font-style: italic;
  font-size: 0.92rem;
  padding: 0.45rem 0.6rem;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
}

.note-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.note-input::placeholder {
  color: var(--ink-light);
  opacity: 0.6;
  font-style: italic;
}

/* ── Results ── */

.results-panel {
  border-top: 4px solid var(--accent);
}

.completion-note__text {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-mid);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 0.7rem 1rem;
}

.completion-note__text--done {
  color: var(--ink);
  border-left: 3px solid var(--accent);
}

.results-frontmatter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1.5rem;
  margin: 1.25rem 0 0.5rem;
}

.results-frontmatter__item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.95rem;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 1rem 0 1.75rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 11rem 1fr 4.5rem;
  align-items: center;
  gap: 0.75rem;
}

.bar-row__label {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-light);
}

.bar-row__track {
  background: rgba(26, 23, 20, 0.08);
  border-radius: 999px;
  height: 0.85rem;
  overflow: hidden;
  display: block;
}

.bar-row__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-mid) 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.bar-row__value {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink);
  text-align: right;
}

.total-band {
  background: var(--ink);
  color: var(--paper);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.total-band__total {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--paper);
  margin-bottom: 0.5em;
}

.total-band__total .label-text {
  display: inline;
  color: rgba(245, 242, 238, 0.7);
}

.total-band__text {
  font-family: var(--sans);
  font-size: 1.02rem;
  margin: 0;
}

.lowest-dim {
  border: 1px solid var(--accent);
  padding: 1rem 1.5rem;
  margin-bottom: 0.5rem;
  background: rgba(43, 74, 111, 0.06);
}

.lowest-dim__text {
  margin: 0;
  font-size: 1.02rem;
}

.reading-guidance p {
  font-size: 1rem;
}

.noted-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.noted-list li {
  border-left: 3px solid var(--ink-light);
  padding-left: 1rem;
}

.noted-list__statement {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.noted-list__score {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--accent);
}

.noted-list__note {
  margin: 0;
  font-style: italic;
  color: var(--ink-mid);
  font-size: 0.92rem;
}

.general-notes {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.general-notes textarea {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

.general-notes textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* ── Print sheet (hidden on screen) ── */

.print-sheet {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-sheet,
  .print-sheet * {
    visibility: visible;
  }

  .print-sheet {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--paper);
    color: var(--ink);
    padding: 0;
    font-family: var(--sans);
  }

  .print-sheet h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.9rem;
    margin-bottom: 0.2em;
  }

  .print-sheet h2 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.3rem;
    margin-top: 1.4em;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.2em;
  }

  .print-incomplete {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--ink-light);
  }

  .print-frontmatter,
  .print-bars {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
  }

  .print-frontmatter th,
  .print-frontmatter td {
    text-align: left;
    padding: 0.3rem 0.5rem 0.3rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.92rem;
  }

  .print-frontmatter th {
    font-family: var(--sans);
    font-weight: 600;
    width: 40%;
  }

  .print-bars td {
    padding: 0.3rem 0.5rem;
    vertical-align: middle;
    font-size: 0.85rem;
  }

  .print-bar__label {
    font-family: var(--sans);
    font-weight: 600;
    width: 30%;
  }

  .print-bar__track {
    width: 45%;
    background: rgba(26, 23, 20, 0.1);
    border-radius: 999px;
    height: 0.6rem;
  }

  .print-bar__fill {
    display: block;
    height: 0.6rem;
    background: var(--accent);
    border-radius: 999px;
  }

  .print-bar__value {
    font-family: var(--sans);
    font-weight: 600;
    text-align: right;
    width: 25%;
  }

  .print-total {
    font-size: 1.05rem;
  }

  .print-lowest {
    border-left: 3px solid var(--accent);
    padding-left: 0.8rem;
  }

  .print-noted-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
  }

  .print-noted-list li {
    border-left: 2px solid var(--ink-light);
    padding-left: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    break-inside: avoid;
  }

  .print-general-notes {
    white-space: pre-wrap;
  }

  @page {
    margin: 1.6cm;
  }
}

/* ── Tool responsive ── */

@media (max-width: 640px) {
  .panel {
    padding: 1.35rem 1.25rem;
  }

  .field-grid,
  .results-frontmatter {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 6.5rem 1fr 3.5rem;
  }

  .statement__controls {
    gap: 1rem;
  }

  .sticky-total {
    padding-left: 0.5rem;
  }

  .sticky-bar__inner {
    flex-wrap: wrap;
    padding: 0.55rem 1rem;
  }

  .sticky-chips {
    order: 1;
    flex: 1 1 100%;
    width: 100%;
  }

  .sticky-total {
    order: 2;
    border-left: none;
    padding-left: 0;
  }

  .btn--small {
    order: 3;
    margin-left: auto;
  }
}
