/* Howfast.uk v2 — Light theme, speedo-led, production polished */

:root {
  --red: #e40000;
  --red-hover: #b60000;
  --red-muted: #8b0000;
  --ink: #1a1a1a;
  --muted: #4a4a4a;
  --border: #d8d8d8;
  --border-strong: #ccc;
  --bg: #fafafa;
  --card-bg: #fff;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --shadow-strong: 0 4px 18px rgba(0,0,0,.08);
  --max: 900px;
  --space: 1.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 2.25rem;
  --space-xl: 2.75rem;
  --radius: 10px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space);
}

.header-label { font-size: 0.9rem; color: var(--muted); }

/* Header */
.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space);
  border-bottom: 1px solid var(--border);
}
.header-brand { flex: 1; min-width: 0; }
.header-home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  min-height: 44px;
}
.header-home:hover { color: var(--red); }
.header-home:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.wordmark { font-weight: 700; font-size: 1.1rem; }
.logo { display: block; width: 44px; height: 44px; flex-shrink: 0; }
.tagline { font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; }
.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.header-actions select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--card-bg);
}
.header-actions button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.header-actions button:hover:not(:disabled) { background: #f5f5f5; border-color: var(--border-strong); }
.header-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.header-actions select:focus-visible,
.header-actions button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Main */
.main { margin-bottom: var(--space-xl); }

/* Hero */
.hero {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.hero h1 {
  font-size: clamp(1.5rem, 4.5vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.hero-intro {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: var(--space-sm);
  max-width: 36em;
  margin-left: auto;
  margin-right: auto;
}
.status {
  min-height: 1.5em;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

/* Gauge — larger, no gap, visual centrepiece */
.gauge-panel {
  margin-bottom: var(--space);
}
.gauge-wrapper {
  position: relative;
  width: 100%;
  max-width: min(560px, 90vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gauge-svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  overflow: visible;
}
.gauge-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  line-height: 1;
  font-size: 1rem;
}
.gauge-value {
  display: block;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
}
.gauge-unit {
  font-size: 1rem;
  color: var(--muted);
}
.gauge-arc-bg {
  stroke: #eee;
  stroke-width: 24;
  stroke-linecap: round;
  fill: none;
}
.gauge-arc {
  stroke-width: 24;
  stroke-linecap: round;
  fill: none;
  filter: url(#glow);
}
.gauge-arc-prog {
  stroke: var(--red);
  stroke-width: 24;
  stroke-linecap: round;
  fill: none;
  transition: stroke-dashoffset 0.4s ease;
}
.gauge-needle {
  stroke: #333;
  stroke-width: 5;
  stroke-linecap: round;
  transform-origin: 150px 150px;
  transform: rotate(-90deg);
  transition: transform 0.5s cubic-bezier(0.4, 1.2, 0.3, 1);
}
.gauge-pivot { fill: #333; }

/* Hero CTA — compact, visually connected (no dead space below gauge) */
.hero-cta {
  margin-top: 0.5rem;
}
.hero-tip {
  font-size: clamp(0.875rem, 2.2vw, 0.95rem);
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.9rem 2.25rem;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { background: var(--red-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); background: var(--red-muted); }
.btn-primary:disabled { background: #aaa; color: #fff; cursor: not-allowed; }
.btn-primary:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Results */
.results { margin-bottom: var(--space-xl); }
.section-title {
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}
.cards-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-label {
  font-size: clamp(0.8125rem, 2.2vw, 0.9rem);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-value {
  font-size: 1.45rem;
  font-weight: 700;
}
.ghost { opacity: 0.5; }

/* Info tooltip */
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  border: 1px solid var(--muted);
  border-radius: 50%;
  font-size: 0.75em;
  font-weight: 700;
  color: var(--muted);
  cursor: help;
  vertical-align: middle;
}
.info:hover { border-color: var(--ink); color: var(--ink); }
.info::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, 90vw);
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
  margin-bottom: 6px;
}
.info:hover::after { opacity: 1; }
.card-label, .quality-label { position: relative; }

/* Qualities */
.qualities { margin-bottom: var(--space-xl); }
.section-desc { font-size: 0.95rem; color: var(--muted); margin-bottom: var(--space-md); }
.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}
.quality-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.quality-label {
  font-size: clamp(0.8125rem, 2.2vw, 0.9rem);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.verdict { font-weight: 600; font-size: 0.95rem; }

/* Stars */
.stars {
  --val: 0;
  --w: 90px;
  --h: 16px;
  width: var(--w);
  height: var(--h);
  position: relative;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='16' viewBox='0 0 90 16'%3E%3Cg fill='%23ddd'%3E%3Cpath d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3Cuse x='18' href='%23s'/%3E%3Cuse x='36' href='%23s'/%3E%3Cuse x='54' href='%23s'/%3E%3Cuse x='72' href='%23s'/%3E%3C/g%3E%3Cdefs%3E%3Cpath id='s' d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3C/defs%3E%3C/svg%3E") left center/var(--w) var(--h) no-repeat;
}
.stars::after {
  content: '';
  position: absolute;
  inset: 0;
  width: calc((var(--val) / 5) * 100%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='16' viewBox='0 0 90 16'%3E%3Cg fill='%23e40000'%3E%3Cpath d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3Cuse x='18' href='%23s'/%3E%3Cuse x='36' href='%23s'/%3E%3Cuse x='54' href='%23s'/%3E%3Cuse x='72' href='%23s'/%3E%3C/g%3E%3Cdefs%3E%3Cpath id='s' d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3C/defs%3E%3C/svg%3E") left center/var(--w) var(--h) no-repeat;
}
.stars.warn::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='16' viewBox='0 0 90 16'%3E%3Cg fill='%23d97706'%3E%3Cpath d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3Cuse x='18' href='%23s'/%3E%3Cuse x='36' href='%23s'/%3E%3Cuse x='54' href='%23s'/%3E%3Cuse x='72' href='%23s'/%3E%3C/g%3E%3Cdefs%3E%3Cpath id='s' d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3C/defs%3E%3C/svg%3E"); }
.stars.bad::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='16' viewBox='0 0 90 16'%3E%3Cg fill='%23dc2626'%3E%3Cpath d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3Cuse x='18' href='%23s'/%3E%3Cuse x='36' href='%23s'/%3E%3Cuse x='54' href='%23s'/%3E%3Cuse x='72' href='%23s'/%3E%3C/g%3E%3Cdefs%3E%3Cpath id='s' d='M8 1.2l1.8 3.6 4 .6-2.9 2.8.7 4-3.6-1.9-3.6 1.9.7-4-2.9-2.8 4-.6z'/%3E%3C/defs%3E%3C/svg%3E"); }

/* Environment */
.env { margin-bottom: var(--space-xl); }
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem 1.75rem;
}
.env-grid dt { font-size: clamp(0.8125rem, 2.2vw, 0.9rem); font-weight: 600; color: var(--muted); }
.env-grid dd { font-size: 0.95rem; margin-top: 0.2rem; }

/* Action row */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: var(--space-xl);
}
.action-row button {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.action-row button:hover { background: #f0f0f0; border-color: var(--border-strong); }
.action-row button:active { background: #e8e8e8; }
.action-row button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Section text — max-width for readability */
.section-text {
  margin-bottom: var(--space-xl);
  max-width: 65ch;
}
.section-text h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.section-text h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
}
.section-text p, .section-text ul {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}
.section-text ul { padding-left: 1.25rem; }
.section-text a {
  color: var(--red);
  text-decoration: none;
}
.section-text a:hover { text-decoration: underline; }
.section-text a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* What to do next */
.next-steps {
  margin-bottom: var(--space-xl);
  max-width: 65ch;
}
.next-steps h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.next-steps-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.7;
}
.next-steps-list li { margin-bottom: 0.5rem; }
.next-steps-list a {
  color: var(--red);
  text-decoration: none;
}
.next-steps-list a:hover { text-decoration: underline; }
.next-steps-list a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Quick answers — AEO/LLMO friendly */
.quick-answers {
  margin-bottom: var(--space-xl);
}
.quick-answers h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}
.quick-answer {
  margin-bottom: 1rem;
  padding: 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.quick-answer strong { display: block; margin-bottom: 0.35rem; }
.quick-answer p { margin: 0; font-size: 0.95rem; line-height: 1.5; }

/* FAQ */
.faq { margin-bottom: var(--space-xl); }
.faq h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--space-md); }
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.faq summary {
  padding: 1rem 2.5rem 1rem 1.1rem;
  font-weight: 600;
  font-size: clamp(0.9375rem, 2.4vw, 1rem);
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
}
.faq details[open] summary::after { content: '−'; }
.faq summary:hover { background: #fafafa; }
.faq summary:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: var(--radius); }
.faq p { padding: 0 1rem 1rem; margin: 0; font-size: clamp(0.9375rem, 2.4vw, 1rem); line-height: 1.6; }
.faq a { color: var(--red); text-decoration: none; }
.faq a:hover { text-decoration: underline; }

/* Footer */
.footer {
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  color: var(--muted);
  line-height: 1.6;
}
.footer-intro {
  margin-bottom: var(--space-md);
  max-width: 52ch;
}
.footer-support {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.footer-support-heading {
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5rem;
  font-size: clamp(0.9375rem, 2.2vw, 1rem);
}
.footer-support-items,
.footer-legal-links {
  margin: 0;
  font-size: clamp(0.875rem, 2.2vw, 0.95rem);
}
.footer-support a,
.footer-legal-links a {
  color: var(--red);
  text-decoration: none;
}
.footer-support a:hover,
.footer-legal-links a:hover { text-decoration: underline; }
.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md) 2rem;
  margin-bottom: var(--space-lg);
}
.footer-link-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-link-heading {
  font-weight: 600;
  color: var(--ink);
  font-size: clamp(0.8125rem, 2.2vw, 0.9rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.25rem;
}
.footer-links a {
  color: var(--red);
  text-decoration: none;
  font-size: clamp(0.875rem, 2.2vw, 0.95rem);
}
.footer-links a:hover { text-decoration: underline; }
.footer-links a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.footer-legal, .footer-updated { margin: 0; font-size: clamp(0.875rem, 2.2vw, 0.9rem); }
.footer-legal a { color: var(--red); text-decoration: none; }
.footer-legal a:hover { text-decoration: underline; }

.noscript {
  padding: 1rem;
  background: #fee;
  color: #c00;
  text-align: center;
  font-weight: 600;
}

/* Methodology version note */
.method-note {
  font-size: clamp(0.875rem, 2.2vw, 0.9rem);
  color: var(--muted);
  margin-top: 0.75rem;
}

/* Breakpoint-specific gauge sizing, no overlap */
@media (max-width: 320px) {
  .gauge-wrapper { max-width: 272px; }
}
@media (max-width: 375px) {
  .gauge-wrapper { max-width: 90vw; }
}
@media (min-width: 768px) {
  .gauge-wrapper { max-width: 520px; }
}
@media (min-width: 1024px) {
  .gauge-wrapper { max-width: 560px; }
}
@media (min-width: 1280px) {
  .page { max-width: min(900px, 90vw); }
}
@media (max-width: 480px) {
  .page { padding: var(--space-sm); }
  .gauge-value { font-size: 2rem; }
  .cards-results { grid-template-columns: 1fr 1fr; }
  .quality-grid { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-support { padding: var(--space-sm); }
}
