/* ==========================================================================
   components.css - header, footer, buttons, cards, accordion, scan widget
   ========================================================================== */

/* --- brand logo ------------------------------------------------------------ */
.logo__grad-start {
  stop-color: var(--gradient-logo-start);
}

.logo__grad-end {
  stop-color: var(--gradient-logo-end);
}

.logo__frame {
  fill: none;
  stroke: rgba(var(--rgb-white), 0.25);
  stroke-width: 1;
}

.logo__link {
  fill: none;
  stroke: rgba(var(--rgb-white), 0.55);
  stroke-width: 2;
  stroke-linecap: round;
}

.logo__node {
  fill: var(--color-on-primary);
}

.logo__node--md {
  opacity: 0.85;
}

.logo__node--sm {
  opacity: 0.6;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand__mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: block;
}

.brand__text {
  display: flex;
  flex-direction: column;
  /* the wordmark's descender needs clearance before the tagline starts, so the
     two lines set their own line-height and this gap separates the boxes */
  gap: var(--space-2);
}

.brand__name {
  font-weight: var(--fw-black);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  color: var(--color-header-text);
}

/* shared with the footer lockup - stays on the brand colour */
.brand__accent {
  color: var(--color-primary);
}

.brand__tagline {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-widest);
  color: var(--color-header-text-muted);
}

/* --- site header ----------------------------------------------------------- */
/* Opaque white and stays that way - no backdrop-filter, no scrolled tint.
   Scrolling only deepens the shadow. */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border-invert);
  box-shadow: var(--shadow-header);
  font-family: var(--font-sans);
  transition: box-shadow var(--transition-base);
}

.site-header.is-scrolled {
  box-shadow: var(--shadow-header-scrolled);
}

.site-header__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-nav__link {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--color-header-text);
  transition: color var(--transition-fast);
}

.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  color: var(--color-header-link-active);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-1);
  cursor: pointer;
  padding: 0;
}

.nav-toggle__bar {
  width: 22px;
  height: 2px;
  background: var(--color-header-icon);
  border-radius: var(--radius-xs);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  background: var(--color-header-surface);
  border-top: 1px solid var(--color-border-invert);
  border-bottom: 1px solid var(--color-border-invert);
  font-family: var(--font-sans);
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav__link {
  display: block;
  padding: var(--space-3) var(--gutter);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-header-text);
  border-bottom: 1px solid var(--color-border-invert);
}

/* --- site footer ------------------------------------------------------------ */
.site-footer {
  background: var(--color-footer-bg);
  padding: var(--space-7) var(--gutter) var(--space-5);
  font-family: var(--font-sans);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.footer-brand__name {
  font-weight: var(--fw-black);
  font-size: var(--fs-md);
  color: var(--color-text-invert);
}

.footer-about {
  color: var(--color-text-invert-muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-relaxed);
  max-width: 280px;
}

.footer-heading {
  color: var(--color-text-invert);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
  margin-bottom: var(--space-3);
}

.footer-link {
  display: block;
  color: var(--color-text-invert-muted);
  font-size: var(--fs-xs);
  margin-bottom: var(--space-3);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-primary);
}

.footer-copyright {
  color: var(--color-text-invert-muted);
  font-size: var(--fs-2xs);
}

/* --- buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  background: var(--gradient-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-cta);
}

.btn--light {
  background: var(--color-on-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-button-light);
}

.btn--block {
  display: flex;
  width: 100%;
  box-shadow: var(--shadow-button);
}

.btn--block:disabled {
  cursor: progress;
  transform: none;
}

.btn__arrow {
  font-size: var(--fs-md);
}

/* --- cards ------------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}

.card--interactive {
  transition: transform var(--transition-base), border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.card--interactive:hover {
  transform: translateY(-6px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card-hover);
}

.card--danger {
  border-color: var(--color-border-danger);
}

.card--success {
  border-color: var(--color-border-success);
}

.card--stat {
  background: var(--color-surface-soft);
  padding: var(--space-4);
}

.card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.card__text {
  font-size: var(--fs-xs);
  line-height: 1.65;
  color: var(--color-text-muted);
}

/* --- icon tiles -------------------------------------------------------------- */
.icon-tile {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.icon-tile--lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.icon-tile--soft {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.icon-tile--danger {
  background: var(--color-icon-danger-bg);
}

.icon-tile--success {
  background: var(--color-icon-success-bg);
}

.icon {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--on-primary {
  stroke: var(--color-on-primary);
}

.icon--danger {
  stroke: var(--color-danger);
}

.icon--success {
  stroke: var(--color-success);
}

/* --- stats ------------------------------------------------------------------- */
.stat__value {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  color: var(--color-text);
}

.stat__value--lg {
  font-size: var(--fs-3xl);
  margin-bottom: var(--space-2);
}

.stat__label {
  font-size: var(--fs-2xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.stat__label--lg {
  font-size: var(--fs-xs);
  line-height: var(--lh-base);
  margin-top: 0;
}

/* --- process steps ------------------------------------------------------------ */
.step {
  position: relative;
  text-align: center;
  padding: 0 var(--space-3);
}

.step__num {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-step);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  color: var(--color-primary);
}

/* --- risk tiers ---------------------------------------------------------------- */
.risk {
  --risk-color: var(--color-primary);
}

.risk--low {
  --risk-color: var(--color-success);
}

.risk--medium {
  --risk-color: var(--color-warning);
}

.risk--high {
  --risk-color: var(--color-danger);
}

.risk__range {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  color: var(--risk-color);
}

.risk__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-circle);
  background: var(--risk-color);
}

.risk__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--risk-color);
  margin-bottom: var(--space-3);
}

.risk__desc {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  line-height: var(--lh-base);
  margin-bottom: var(--space-3);
}

.risk__points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.risk__point {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}

.risk__point::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: var(--radius-circle);
  background: var(--risk-color);
  margin-top: var(--space-2);
  flex-shrink: 0;
}

/* --- accordion ------------------------------------------------------------------ */
.faq {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  overflow: hidden;
}

.faq__question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: none;
  border: none;
  padding: var(--space-4);
  cursor: pointer;
  text-align: left;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  font-family: var(--font-sans);
}

.faq__icon {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.faq__question[aria-expanded="true"] .faq__icon {
  transform: rotate(45deg);
}

.faq__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.faq__panel.is-open {
  max-height: 320px;
}

.faq__answer {
  margin: 0 var(--space-4) var(--space-4);
  font-size: var(--fs-xs);
  line-height: var(--lh-relaxed);
  color: var(--color-text-muted);
}

/* --- scan widget ------------------------------------------------------------------ */
.scan-panel {
  position: relative;
  z-index: var(--z-content);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-2) var(--space-4) var(--space-4);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-4);
  scroll-margin-top: var(--space-7);
}

.scan-panel__tabs {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.scan-panel__tab {
  display: inline-block;
  padding: var(--space-3) 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  margin-bottom: -1px;
}

.field {
  display: block;
}

.field__label {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.field__select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-surface-strong);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  font-family: var(--font-sans);
  cursor: pointer;
}

.field__select option {
  color: var(--color-bg);
  background: var(--color-on-primary);
}

.scan-panel__submit {
  margin-top: var(--space-4);
}

.result-link {
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  /* the generated link is one long unbreakable token - keep it inside the panel */
  min-width: 0;
  max-width: 100%;
}

.result-link[hidden] {
  display: none;
}

.result-link__value {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--color-primary);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-link__copy {
  flex-shrink: 0;
  background: var(--color-surface-ghost);
  border: none;
  color: var(--color-text);
  font-size: var(--fs-3xs);
  font-weight: var(--fw-bold);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.scan-card {
  position: relative;
  z-index: var(--z-content);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-card-lg);
}

.scan-graph {
  display: block;
  margin-bottom: var(--space-4);
  /* let the node glow and the hub halo spill past the viewBox edge */
  overflow: visible;
}

/* --- edges ------------------------------------------------------------------
   is-done  -> solid
   is-loading -> dashed, marching along the path
   ---------------------------------------------------------------------------- */
.scan-graph__line {
  stroke: var(--color-scan-line-done);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.scan-card.is-done .scan-graph__line {
  stroke: var(--color-scan-line-done);
  stroke-dasharray: none;
  animation: none;
}

.scan-card.is-loading .scan-graph__line {
  stroke: var(--color-scan-line-active);
  stroke-width: 2;
  stroke-dasharray: 6 7;
  animation: dashMove 1s linear infinite;
}

/* --- nodes ------------------------------------------------------------------
   Colour is state-independent - the mix reads the same while scanning and in
   the result. Selectors key off the geometry attributes already in the markup
   so the HTML does not need extra classes.
   ---------------------------------------------------------------------------- */
.scan-graph__node {
  fill: var(--color-scan-node);
}

/* top right - deepest blue */
.scan-graph__node[cx="270"] {
  fill: var(--color-scan-node-deep);
}

/* bottom row - pale, softly lit */
.scan-graph__node[cy="66"] {
  fill: var(--color-scan-node-pale);
  filter: var(--glow-scan-node-pale);
}

/* hub node, top centre - brightest */
.scan-graph__node[r="9"] {
  fill: var(--color-scan-node-bright);
  filter: var(--glow-scan-node-bright);
}

.scan-card.is-loading .scan-graph__node {
  animation: nodePulse 1.4s ease-in-out infinite;
}

.scan-card.is-loading .scan-graph__node--delayed {
  animation-delay: 0.4s;
}

/* the hub keeps full opacity and emits a ring instead of pulsing.
   Must stay after the --delayed rule: equal specificity, source order wins. */
.scan-card.is-loading .scan-graph__node[r="9"] {
  stroke: var(--color-scan-halo);
  animation: nodeHalo 1.8s ease-out infinite;
}

.scan-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.scan-status--pending {
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
}

.scan-status--clear {
  background: var(--gradient-clear);
  border: 1px solid var(--color-border-success-soft);
  animation: fadeUp 0.5s ease;
}

.scan-status__label {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  letter-spacing: var(--ls-wider);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.scan-status__value {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
}

.scan-status--clear .scan-status__value {
  color: var(--color-success);
}

.scan-status__score {
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  color: var(--color-text);
  flex-shrink: 0;
}

.scan-status--clear .scan-status__score {
  color: var(--color-success);
}

.scan-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-text);
  font-size: var(--fs-2xs);
  color: var(--color-text-muted);
}

.scan-check__icon {
  width: 16px;
  flex-shrink: 0;
  color: var(--color-success);
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
}

.scan-card.is-loading .scan-status--clear,
.scan-card.is-done .scan-status--pending {
  display: none;
}

.scan-card.is-loading .scan-check__icon {
  visibility: hidden;
}

/* --- responsive -------------------------------------------------------------------- */
@media (max-width: 860px) {
  .site-nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 640px) {
  .card {
    padding: var(--space-4);
  }

  .faq__question {
    font-size: var(--fs-xs);
    padding: var(--space-3);
  }

  .faq__answer {
    margin: 0 var(--space-3) var(--space-3);
  }

  .faq__panel.is-open {
    max-height: 460px;
  }

  .brand__tagline {
    letter-spacing: var(--ls-wider);
  }
}
