/* tvprotect.co.uk */
/* everything scattered across Reddit threads and YouTube — gathered, filtered, made useful */

/* this took longer than i'd like to admit */
/* safari strikes again — this fix is load-bearing */
/* resist the urge to add more breakpoints */
/* z-index: 9 because 10 felt arrogant */
/* the spacing scale took three rounds. this is the one */
/* don't let anyone talk you into a CSS framework here */

/* tried a sidebar nav for the tools section. killed it. right call */
/* the diagnostic card grid had six columns at some point. it didn't */
/* calibration page needed its own step counter — not a timeline, a counter */
/* distance calculator: tried sliders, switched to direct input. less cute, more useful */
/* burn-in estimator almost had a traffic-light system. dropped it */
/* footer trust strip was added last and it shows — refactor someday */

/* ============================================================
   reset
   ============================================================ */

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

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

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font: inherit;
}

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

ul, ol {
  list-style: none;
}

/* ============================================================
   tokens
   ============================================================ */

:root {
  /* colours */
  --c-bg:          #0f1117;
  --c-surface:     #181c26;
  --c-border:      #252a38;
  --c-subtle:      #4a5270;
  --c-body:        #c8ccd8;
  --c-heading:     #eef0f6;
  --c-accent:      #2563eb;
  --c-accent-2:    #06b6d4;
  --c-accent-dim:  #1d3a6e;
  --c-danger:      #ef4444;
  --c-warn:        #f59e0b;
  --c-ok:          #22c55e;

  /* typography */
  --font-heading:  'Bricolage Grotesque', sans-serif;
  --font-body:     'Literata', Georgia, serif;
  --font-mono:     'JetBrains Mono', monospace;

  /* scale */
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-md:    1.125rem;
  --text-lg:    1.25rem;
  --text-xl:    1.5rem;
  --text-2xl:   1.875rem;
  --text-3xl:   2.25rem;
  --text-4xl:   3rem;

  /* spacing */
  --sp-1:   0.25rem;
  --sp-2:   0.5rem;
  --sp-3:   0.75rem;
  --sp-4:   1rem;
  --sp-5:   1.25rem;
  --sp-6:   1.5rem;
  --sp-8:   2rem;
  --sp-10:  2.5rem;
  --sp-12:  3rem;
  --sp-16:  4rem;
  --sp-20:  5rem;
  --sp-24:  6rem;

  /* layout */
  --container-max:  1200px;
  --reading-max:    680px;
  --logo-w:         140px;
  --logo-h:         36px;
  --header-h:       64px;

  /* radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-full: 9999px;

  /* shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  /* transitions */
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   400ms ease;

  /* z-index */
  --z-base:    1;
  --z-card:    2;
  --z-sticky:  9;
  --z-header:  50;
  --z-modal:   100;
  --z-toast:   200;
}

/* ============================================================
   base
   ============================================================ */

body {
  background-color: var(--c-bg);
  color: var(--c-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--c-heading);
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
  line-height: 1.75;
  color: var(--c-body);
}

a {
  color: var(--c-accent-2);
  transition: color var(--t-fast);
}

a:hover {
  color: var(--c-heading);
}

strong {
  color: var(--c-heading);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 0.1em 0.4em;
  border-radius: var(--r-sm);
  color: var(--c-accent-2);
}

/* ============================================================
   layout
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

main {
  padding-top: var(--header-h);
  min-height: 70vh;
}

.reading-container {
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.section {
  padding: var(--sp-16) 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent-2);
  display: block;
  margin-bottom: var(--sp-3);
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  color: var(--c-heading);
  margin-bottom: var(--sp-4);
}

.section-intro {
  font-size: var(--text-md);
  color: var(--c-body);
  max-width: 56ch;
  line-height: 1.7;
  margin-bottom: var(--sp-10);
}

.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-12) 0;
}

/* two-column article layout with sidebar */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--sp-12);
  max-width: 980px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.article-body {
  min-width: 0;
}

.article-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-8));
  height: fit-content;
}

/* ============================================================
   header
   ============================================================ */

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(15,17,23,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  z-index: var(--z-header);
  overflow: hidden;
}

#site-header .container {
  height: 100%;
}

.nav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--sp-8);
}

.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-logo img {
  max-width: var(--logo-w);
  max-height: var(--logo-h);
  width: auto;
  height: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: 1;
}

.nav-links a {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-body);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--c-heading);
  background: var(--c-surface);
}

.nav-links a.active {
  color: var(--c-accent-2);
}

.nav-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-cta {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-heading) !important;
  background: var(--c-accent);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--r-full);
  transition: background var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}

.nav-cta:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--c-body);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   fault-entry (unique UI component)
   ============================================================ */

.fault-entry {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-1);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 320px;
}

.fault-categories {
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
}

.fault-cat-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: none;
  border: none;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-body);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.fault-cat-btn:last-child {
  border-bottom: none;
}

.fault-cat-btn:hover {
  background: var(--c-border);
  color: var(--c-heading);
}

.fault-cat-btn.active {
  background: var(--c-accent-dim);
  color: var(--c-heading);
  border-left: 2px solid var(--c-accent);
}

.fault-cat-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--c-accent-2);
}

.fault-results {
  padding: var(--sp-6);
}

.fault-results-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-4);
}

.fault-result-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.fault-result-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.fault-result-item:hover {
  border-color: var(--c-accent);
  background: var(--c-accent-dim);
}

.fault-result-item svg {
  width: 14px;
  height: 14px;
  color: var(--c-accent-2);
  flex-shrink: 0;
}

.fault-result-name {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-heading);
}

.fault-result-desc {
  font-size: var(--text-xs);
  color: var(--c-subtle);
  margin-top: 2px;
}

/* ============================================================
   mobile menu
   ============================================================ */

.mobile-menu {
  display: none;
  flex-direction: column;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-4) var(--sp-6);
  gap: var(--sp-1);
  z-index: calc(var(--z-header) - 1);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--c-body);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
}

.mobile-menu a:hover {
  background: var(--c-border);
  color: var(--c-heading);
}

/* ============================================================
   diagnostic-strip (homepage opening)
   ============================================================ */

.diagnostic-strip {
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-12) 0 var(--sp-10);
}

.diagnostic-strip-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-subtle);
  margin-bottom: var(--sp-6);
}

.diagnostic-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-3);
}

.diagnostic-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-4);
  cursor: pointer;
  transition: border-color var(--t-base), transform var(--t-base), background var(--t-base);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.diagnostic-card:hover {
  border-color: var(--c-accent);
  transform: translateY(-2px);
  background: var(--c-accent-dim);
}

.diagnostic-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-accent-dim);
  border-radius: var(--r-md);
  color: var(--c-accent-2);
}

.diagnostic-card-icon svg {
  width: 18px;
  height: 18px;
}

.diagnostic-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  line-height: 1.3;
}

.diagnostic-card-desc {
  font-size: var(--text-xs);
  color: var(--c-subtle);
  line-height: 1.5;
}

/* ============================================================
   tool-card
   ============================================================ */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  cursor: pointer;
  transition: border-color var(--t-base), transform var(--t-base);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.tool-card:hover {
  border-color: var(--c-accent-2);
  transform: translateY(-2px);
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  background: var(--c-accent-dim);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent-2);
}

.tool-card-icon svg {
  width: 22px;
  height: 22px;
}

.tool-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--c-heading);
}

.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--c-body);
  line-height: 1.6;
  flex: 1;
}

.tool-card-cta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ============================================================
   field-note cards
   ============================================================ */

.field-notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.field-note-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: start;
  gap: var(--sp-6);
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: background var(--t-fast);
}

.field-note-item:last-child {
  border-bottom: none;
}

.field-note-item:hover .field-note-title {
  color: var(--c-accent-2);
}

.field-note-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  padding-top: 3px;
}

.field-note-title {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--c-heading);
  transition: color var(--t-fast);
  line-height: 1.35;
}

.field-note-excerpt {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  margin-top: var(--sp-2);
  line-height: 1.6;
}

.field-note-author {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  white-space: nowrap;
  padding-top: 3px;
}

/* ============================================================
   article
   ============================================================ */

.article-header {
  padding: var(--sp-12) 0 var(--sp-8);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-8);
}

.article-category {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent-2);
  display: block;
  margin-bottom: var(--sp-4);
}

.article-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: var(--sp-6);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
}

.article-meta-divider {
  width: 3px;
  height: 3px;
  background: var(--c-subtle);
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.article-hero {
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  margin-bottom: var(--sp-8);
}

.article-content {
  font-size: var(--text-md);
  line-height: 1.8;
}

.article-content h2 {
  font-size: var(--text-xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--c-border);
}

.article-content h3 {
  font-size: var(--text-lg);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
}

.article-content p {
  margin-bottom: var(--sp-5);
}

.article-content ul, .article-content ol {
  margin-bottom: var(--sp-5);
  padding-left: var(--sp-6);
}

.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }

.article-content li {
  margin-bottom: var(--sp-2);
  line-height: 1.7;
}

.article-content blockquote {
  border-left: 3px solid var(--c-accent);
  padding: var(--sp-4) var(--sp-6);
  margin: var(--sp-8) 0;
  background: var(--c-surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.article-content blockquote p {
  font-size: var(--text-md);
  color: var(--c-heading);
  font-style: italic;
  margin: 0;
  line-height: 1.7;
}

/* ============================================================
   sidebar-toc
   ============================================================ */

.sidebar-toc {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.sidebar-toc-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-subtle);
  margin-bottom: var(--sp-4);
  display: block;
}

.sidebar-toc-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.sidebar-toc-list a {
  font-size: var(--text-sm);
  color: var(--c-body);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border-left: 2px solid transparent;
  display: block;
  line-height: 1.4;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.sidebar-toc-list a:hover,
.sidebar-toc-list a.toc-active {
  color: var(--c-accent-2);
  border-left-color: var(--c-accent-2);
  background: var(--c-border);
}

.sidebar-wordcount {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
}

/* ============================================================
   editorial-list (section index pages)
   ============================================================ */

.editorial-list {
  display: flex;
  flex-direction: column;
}

.editorial-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--sp-8);
  padding: var(--sp-6) 0;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
}

.editorial-item:hover .editorial-item-title {
  color: var(--c-accent-2);
}

.editorial-item-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  margin-bottom: var(--sp-2);
}

.editorial-item-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-heading);
  margin-bottom: var(--sp-2);
  transition: color var(--t-fast);
  line-height: 1.3;
}

.editorial-item-excerpt {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  line-height: 1.6;
  max-width: 55ch;
}

.editorial-item-image {
  width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  flex-shrink: 0;
}

/* section hub intro */
.hub-header {
  padding: var(--sp-12) 0 var(--sp-10);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-8);
}

/* ============================================================
   cards (homepage content sections)
   ============================================================ */

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

.content-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--t-base), transform var(--t-base);
}

.content-card:hover {
  border-color: var(--c-accent-2);
  transform: translateY(-2px);
}

.content-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.content-card-body {
  padding: var(--sp-5);
}

.content-card-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-accent-2);
  margin-bottom: var(--sp-2);
}

.content-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-heading);
  line-height: 1.35;
  margin-bottom: var(--sp-2);
}

.content-card-excerpt {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  line-height: 1.6;
}

/* related reading */
.related-reading {
  margin-top: var(--sp-12);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--c-border);
}

.related-reading-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-subtle);
  margin-bottom: var(--sp-6);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.related-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: border-color var(--t-base);
}

.related-card:hover {
  border-color: var(--c-accent-2);
}

.related-card-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-accent-2);
  margin-bottom: var(--sp-2);
}

.related-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  line-height: 1.35;
}

/* ============================================================
   tools pages
   ============================================================ */

.tool-interface {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  margin-bottom: var(--sp-8);
}

.tool-input-group {
  margin-bottom: var(--sp-6);
}

.tool-label {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-heading);
  margin-bottom: var(--sp-2);
}

.tool-label-hint {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  font-weight: 400;
  margin-left: var(--sp-2);
}

.tool-input {
  width: 100%;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-heading);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  transition: border-color var(--t-fast);
  appearance: none;
}

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

.tool-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5270' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
  cursor: pointer;
}

.tool-btn {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-heading);
  background: var(--c-accent);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-8);
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}

.tool-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.tool-result {
  display: none;
  background: var(--c-bg);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-top: var(--sp-6);
}

.tool-result.visible {
  display: block;
}

.tool-result-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  color: var(--c-accent-2);
  font-weight: 700;
  margin-bottom: var(--sp-3);
}

.tool-result-label {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--c-heading);
  margin-bottom: var(--sp-3);
}

.tool-result-explanation {
  font-size: var(--text-sm);
  color: var(--c-body);
  line-height: 1.7;
}

.tool-result-list {
  margin-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.tool-result-item {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--c-body);
  padding: var(--sp-3);
  background: var(--c-surface);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
}

.tool-result-item-label {
  font-family: var(--font-mono);
  color: var(--c-accent-2);
  font-size: var(--text-xs);
  white-space: nowrap;
  min-width: 80px;
}

/* risk indicator */
.risk-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--sp-4);
}

.risk-low    { background: rgba(34,197,94,0.15); color: var(--c-ok); border: 1px solid var(--c-ok); }
.risk-moderate { background: rgba(245,158,11,0.15); color: var(--c-warn); border: 1px solid var(--c-warn); }
.risk-elevated { background: rgba(239,68,68,0.15); color: var(--c-danger); border: 1px solid var(--c-danger); }

/* wizard */
.wizard-progress {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-8);
}

.wizard-step-dot {
  height: 4px;
  flex: 1;
  background: var(--c-border);
  border-radius: var(--r-full);
  transition: background var(--t-base);
}

.wizard-step-dot.done { background: var(--c-accent-2); }
.wizard-step-dot.active { background: var(--c-accent); }

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--c-border);
}

.wizard-btn-secondary {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-body);
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-5);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.wizard-btn-secondary:hover {
  border-color: var(--c-body);
  color: var(--c-heading);
}

/* step counter */
.step-counter {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.step-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-accent-2);
  background: var(--c-accent-dim);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-sm);
  padding: 2px 8px;
}

.step-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-heading);
}

/* ============================================================
   breadcrumb
   ============================================================ */

.breadcrumb {
  padding: var(--sp-5) 0 0;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.breadcrumb li+li::before {
  content: "›";
  color: var(--c-subtle);
  font-size: var(--text-sm);
}

.breadcrumb a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  transition: color var(--t-fast);
}

.breadcrumb a:hover {
  color: var(--c-body);
}

.breadcrumb li:last-child span {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-body);
}

/* ============================================================
   page header (inner pages)
   ============================================================ */

.page-header {
  padding: var(--sp-12) 0 var(--sp-10);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--sp-10);
}

.page-header .section-label {
  margin-bottom: var(--sp-3);
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: var(--sp-4);
}

.page-header p {
  font-size: var(--text-md);
  color: var(--c-body);
  max-width: 55ch;
  line-height: 1.7;
}

/* ============================================================
   newsletter
   ============================================================ */

.newsletter-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-10) var(--sp-12);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-10);
  align-items: center;
}

.newsletter-form {
  display: flex;
  gap: var(--sp-3);
}

.newsletter-input {
  flex: 1;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-heading);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: border-color var(--t-fast);
}

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

.newsletter-btn {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  background: var(--c-accent);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-6);
  cursor: pointer;
  transition: background var(--t-fast);
  white-space: nowrap;
}

.newsletter-btn:hover {
  background: #1d4ed8;
}

.newsletter-note {
  font-size: var(--text-xs);
  color: var(--c-subtle);
  margin-top: var(--sp-3);
}

.newsletter-confirm {
  display: none;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--c-ok);
  margin-top: var(--sp-4);
}

/* ============================================================
   faq
   ============================================================ */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  background: var(--c-surface);
  border: none;
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast);
}

.faq-question:hover {
  background: var(--c-border);
}

.faq-question-text {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-heading);
}

.faq-question svg {
  width: 16px;
  height: 16px;
  color: var(--c-subtle);
  flex-shrink: 0;
  transition: transform var(--t-base);
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 var(--sp-6) var(--sp-5);
  background: var(--c-surface);
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-answer p {
  font-size: var(--text-base);
  color: var(--c-body);
  line-height: 1.75;
}

/* ============================================================
   contact
   ============================================================ */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-heading);
}

.form-input,
.form-textarea,
.form-select {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-heading);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: border-color var(--t-fast);
  width: 100%;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--c-accent);
}

.form-textarea {
  resize: vertical;
  min-height: 140px;
}

.form-btn {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-heading);
  background: var(--c-accent);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-8);
  cursor: pointer;
  transition: background var(--t-fast);
  align-self: flex-start;
}

.form-btn:hover {
  background: #1d4ed8;
}

/* ============================================================
   services
   ============================================================ */

.service-entry {
  padding: var(--sp-8) 0;
  border-bottom: 1px solid var(--c-border);
}

.service-entry:last-of-type {
  border-bottom: none;
}

.service-label-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-accent-2);
  background: var(--c-accent-dim);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-full);
  padding: 2px 10px;
  margin-bottom: var(--sp-3);
}

.service-name {
  font-size: var(--text-xl);
  margin-bottom: var(--sp-2);
}

.service-audience {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  margin-bottom: var(--sp-4);
}

.service-desc {
  font-size: var(--text-base);
  line-height: 1.75;
  margin-bottom: var(--sp-5);
  max-width: 65ch;
}

.service-includes {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.service-includes li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--c-body);
}

.service-includes li::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  background: var(--c-accent-2);
  border-radius: var(--r-full);
  margin-top: 8px;
  flex-shrink: 0;
}

.service-note {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  font-style: italic;
  padding: var(--sp-4);
  background: var(--c-surface);
  border-radius: var(--r-md);
  border-left: 3px solid var(--c-border);
}

/* ============================================================
   legal pages
   ============================================================ */

.legal-content {
  font-size: var(--text-base);
  line-height: 1.8;
  max-width: var(--reading-max);
}

.legal-content h2 {
  font-size: var(--text-xl);
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--c-border);
}

.legal-content h3 {
  font-size: var(--text-lg);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
}

.legal-content p {
  margin-bottom: var(--sp-4);
}

.legal-content ul {
  list-style: disc;
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-4);
}

.legal-content li {
  margin-bottom: var(--sp-2);
}

.legal-update {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
  margin-top: var(--sp-4);
}

/* ============================================================
   about
   ============================================================ */

.contributor-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}

.contributor-name {
  font-size: var(--text-xl);
  margin-bottom: var(--sp-1);
}

.contributor-role {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-accent-2);
  margin-bottom: var(--sp-4);
}

.contributor-bio {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--c-body);
  margin-bottom: var(--sp-3);
}

.contributor-covers {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-subtle);
}

/* ============================================================
   resources
   ============================================================ */

.resource-category {
  margin-bottom: var(--sp-10);
}

.resource-category-title {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--c-border);
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.resource-item {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  padding: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast);
}

.resource-item:hover {
  border-color: var(--c-accent-2);
}

.resource-item svg {
  color: var(--c-accent-2);
  flex-shrink: 0;
  margin-top: 2px;
}

.resource-item-name {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  margin-bottom: var(--sp-1);
}

.resource-item-desc {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  line-height: 1.6;
}

/* ============================================================
   footer
   ============================================================ */

footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-20);
}

.footer-inner {
  padding: var(--sp-12) 0 var(--sp-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp-12);
  margin-bottom: var(--sp-10);
}

.footer-brand .nav-logo img {
  max-width: calc(var(--logo-w) * 0.9);
  max-height: calc(var(--logo-h) * 0.9);
  width: auto;
  height: auto;
  display: block;
}

.footer-tagline {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  line-height: 1.6;
  margin-top: var(--sp-4);
  max-width: 28ch;
}

.footer-col-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  margin-bottom: var(--sp-4);
}

.footer-col-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.footer-col-links a {
  font-size: var(--text-sm);
  color: var(--c-subtle);
  transition: color var(--t-fast);
}

.footer-col-links a:hover {
  color: var(--c-body);
}

.footer-bottom {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--c-subtle);
}

.footer-legal-links {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.footer-legal-links a {
  font-size: var(--text-xs);
  color: var(--c-subtle);
  transition: color var(--t-fast);
}

.footer-legal-links a:hover {
  color: var(--c-body);
}

/* ============================================================
   cookie
   ============================================================ */

#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  z-index: var(--z-toast);
  transform: translateY(100%);
  transition: transform var(--t-slow);
}

#cookie-banner.visible {
  transform: translateY(0);
}

.cookie-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.cookie-text {
  font-size: var(--text-sm);
  color: var(--c-body);
  line-height: 1.6;
}

.cookie-text a {
  color: var(--c-accent-2);
}

.cookie-actions {
  display: flex;
  gap: var(--sp-3);
  flex-shrink: 0;
}

#cookie-decline {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-subtle);
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-5);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}

#cookie-decline:hover {
  color: var(--c-body);
  border-color: var(--c-body);
}

#cookie-accept {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-heading);
  background: var(--c-accent);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-5);
  cursor: pointer;
  transition: background var(--t-fast);
}

#cookie-accept:hover {
  background: #1d4ed8;
}

/* ============================================================
   back to top
   ============================================================ */

#back-to-top {
  position: fixed;
  bottom: var(--sp-8);
  right: var(--sp-8);
  width: 44px;
  height: 44px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-sticky);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t-base), transform var(--t-base), border-color var(--t-fast);
  color: var(--c-body);
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover {
  border-color: var(--c-accent-2);
  color: var(--c-accent-2);
}

#back-to-top svg {
  width: 18px;
  height: 18px;
}

/* ============================================================
   reading progress
   ============================================================ */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--c-accent);
  width: 0%;
  z-index: calc(var(--z-header) + 1);
  transition: width 100ms linear;
}

/* ============================================================
   animations
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slow), transform var(--t-slow);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   responsive
   ============================================================ */

/* hide CTA at mid viewports */
@media (max-width: 1100px) {
  .nav-actions {
    display: none;
  }
}

/* mobile: hide nav links, show hamburger */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
    margin-left: auto;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-sidebar {
    display: none;
  }

  .diagnostic-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .diagnostic-cards .diagnostic-card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    margin: 0 auto;
    width: 100%;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .newsletter-section {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
    padding: var(--sp-8);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-8);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .fault-entry {
    grid-template-columns: 1fr;
  }

  .fault-categories {
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    flex-direction: row;
    flex-wrap: wrap;
  }

  .fault-cat-btn {
    border-bottom: none;
    border-right: 1px solid var(--c-border);
  }

  .field-note-item {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }

  .field-note-author {
    display: none;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 var(--sp-4);
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }

  .diagnostic-cards {
    grid-template-columns: 1fr;
  }

  .diagnostic-cards .diagnostic-card:last-child {
    grid-column: auto;
    max-width: 100%;
    margin: 0;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .editorial-item {
    grid-template-columns: 1fr;
  }

  .editorial-item-image {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-interface {
    padding: var(--sp-5);
  }

  .section {
    padding: var(--sp-10) 0;
  }

  #back-to-top {
    bottom: var(--sp-5);
    right: var(--sp-5);
  }
}
