/* Site Analyzer block — frontend + editor shared styles */

@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('./fonts/SpaceGrotesk-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 600;
  font-display: swap; src: url('./fonts/Inter-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('./fonts/SpaceMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('./fonts/SpaceMono-Bold.woff2') format('woff2');
}

.iw-site-analyzer {
  --brand:#017cb6; --brand-accent:#e6f4fb; --brand-dark:#026492;
  --ink:#171b23; --ink-soft:#465166; --white:#ffffff; --gray:#98999a;
  --tint:#f5f5f6; --border-light:#ebeced; --border-dark:#cbcbcb; --navy:#1a2332;
  --pass:#1f9d55; --pass-bg:#e8f6ee; --warn:#f97316; --warn-bg:#fdf0e6;
  --fail:#dc2f2a; --fail-bg:#fcebea; --skip:#98999a; --skip-bg:#f1f1f2;

  --font-display:'Space Grotesk', system-ui, sans-serif;
  --font-body:'Inter', system-ui, sans-serif;
  --font-mono:'Space Mono', ui-monospace, monospace;

  font-family: var(--font-body);
  color: var(--ink);
}

/* Form wrapper — styled as a hero so the first-load (form) state matches the
   report's dark gradient look. Breaks out to full viewport width regardless of
   the host theme's content column (alignwide/narrow); the editor neutralizes
   the breakout in editor.css. Hidden once a report has rendered. */

.iw-analyzer-form-wrapper {
  position: relative;
  overflow: hidden;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 4.5rem 2rem;
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(1,124,182,.28), transparent 60%),
    linear-gradient(180deg, var(--navy), var(--ink));
  color: var(--white);
}

.iw-analyzer-form-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 20% 20%, #000, transparent 75%);
          mask-image: radial-gradient(circle at 20% 20%, #000, transparent 75%);
  pointer-events: none;
}

.iw-site-analyzer.is-report .iw-analyzer-form-wrapper {
  display: none;
}

.iw-analyzer-inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.iw-analyzer-heading {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--white);
  margin-bottom: 1rem;
}

.iw-analyzer-intro {
  color: rgba(255,255,255,.72);
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Form */

.iw-analyzer-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  align-items: stretch;
}

.iw-analyzer-honeypot {
  display: none;
}

.iw-analyzer-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.iw-analyzer-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.875rem 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.iw-analyzer-consent__input {
  flex-shrink: 0;
  margin-top: 0.1875rem;
  width: 1rem;
  height: 1rem;
}

.iw-analyzer-consent__text a {
  color: var(--brand);
  text-decoration: underline;
}

/* Consent sits on the dark hero in the form state — lighten it there only
   (the locked-teaser reuses this markup on a white report section). */
.iw-analyzer-form-wrapper .iw-analyzer-consent {
  color: rgba(255,255,255,.72);
}

.iw-analyzer-form-wrapper .iw-analyzer-consent__text a {
  color: var(--brand-accent);
}

.iw-analyzer-input {
  width: 100%;
  padding: 0.875rem 1.125rem;
  border: 1.5px solid var(--border-dark);
  border-radius: 6px;
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.iw-analyzer-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 124, 182, 0.12);
}

.iw-analyzer-input::placeholder {
  color: var(--gray);
}

.iw-analyzer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9375rem 2rem;
  background: var(--brand);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.iw-analyzer-btn:hover {
  background: var(--brand-dark);
}

.iw-analyzer-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Result container — direct child of .iw-site-analyzer (sibling of
   .iw-analyzer-form-wrapper). Breaks out to full viewport width regardless of
   the host theme's content column; the hero/sections inside .iw-report manage
   their own max-widths (1240px centered). The editor neutralizes the breakout
   in editor.css. */

.iw-analyzer-result {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  text-align: left;
}

/* Error state */

.iw-report-error {
  max-width: 680px;
  margin: 2rem auto 0;
  background: var(--fail-bg);
  border: 1.5px solid var(--fail);
  border-radius: 6px;
  padding: 0.875rem 1.125rem;
  color: var(--fail);
  font-size: 0.9375rem;
}

/* Editor preview note */

.iw-analyzer-note {
  margin-top: 1rem;
  color: var(--gray);
  font-size: 0.875rem;
}

/* ============ REPORT ============ */

.iw-site-analyzer .iw-report {
  font-family: var(--font-body);
  color: var(--ink);
}

/* ============ LOADING STATE ============ */

.iw-report-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 240px;
  padding: 3rem 2rem;
  color: var(--white);
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(1,124,182,.28), transparent 60%),
    linear-gradient(180deg, var(--navy), var(--ink));
  font-family: var(--font-display);
}

.iw-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: var(--brand-accent);
  animation: iw-spin .8s linear infinite;
  flex-shrink: 0;
}

@keyframes iw-spin {
  to { transform: rotate(360deg); }
}

/* ============ HERO / SCORECARD ============ */

.iw-hero {
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(1,124,182,.28), transparent 60%),
    linear-gradient(180deg,var(--navy),var(--ink));
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.iw-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 20% 20%,#000,transparent 75%);
          mask-image: radial-gradient(circle at 20% 20%,#000,transparent 75%);
  pointer-events: none;
}

.iw-hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4.5rem 2rem 4rem;
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3.5rem;
  align-items: center;
}

.iw-eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.iw-eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--brand);
}

.iw-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem,4.2vw,3.3rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin-bottom: 1.3rem;
}

.iw-hero h1 .iw-hl {
  color: var(--brand-accent);
}

.iw-hero p.iw-lede {
  color: rgba(255,255,255,.72);
  font-size: 1.05rem;
  max-width: 36ch;
  margin-bottom: 1.8rem;
}

.iw-scan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}

.iw-chip {
  font-family: var(--font-mono);
  font-size: .78rem;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  padding: .4rem .75rem;
  border-radius: 7px;
  color: rgba(255,255,255,.88);
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.iw-chip svg {
  width: 13px;
  height: 13px;
  opacity: .7;
}

.iw-chip .iw-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pass);
  box-shadow: 0 0 0 3px rgba(31,157,85,.25);
}

/* dials */

.iw-dials {
  display: flex;
  gap: 1.4rem;
  justify-content: flex-end;
}

.iw-dial-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 1.6rem 1.4rem 1.4rem;
  text-align: center;
  flex: 1;
  max-width: 200px;
  backdrop-filter: blur(2px);
}

.iw-dial-label {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 1rem;
}

.iw-ring-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 0 auto;
}

.iw-ring-wrap svg {
  transform: rotate(-90deg);
}

.iw-ring-track {
  fill: none;
  stroke: rgba(255,255,255,.1);
  stroke-width: 9;
}

.iw-ring-prog {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1);
}

.iw-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.iw-grade {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
}

.iw-score {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: rgba(255,255,255,.6);
  margin-top: .25rem;
}

/* Speed dial pending placeholder */

.iw-dial-card.is-pending .iw-grade--pending {
  color: rgba(255,255,255,.5);
}

.iw-dial-card.is-pending .iw-ring-wrap svg {
  transform: rotate(-90deg);
}

/* ============ SECTIONS ============ */

.iw-section {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.iw-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}

.iw-section-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: -.01em;
}

.iw-section-head .iw-note {
  color: var(--ink-soft);
  font-size: .92rem;
}

/* priority list */

.iw-priority {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.iw-pri-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem;
  align-items: start;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--border-light);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  transition: box-shadow .2s,transform .2s;
}

.iw-pri-item:hover {
  box-shadow: 0 8px 28px rgba(23,27,35,.07);
  transform: translateY(-2px);
}

.iw-pri-item.is-fail { border-left-color: var(--fail); }
.iw-pri-item.is-warn { border-left-color: var(--warn); }
.iw-pri-item.is-pass { border-left-color: var(--pass); }
.iw-pri-item.is-skip { border-left-color: var(--skip); }

.iw-pri-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .85rem;
  color: var(--gray);
  padding-top: .15rem;
}

.iw-pri-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  margin-bottom: .25rem;
}

.iw-pri-body p {
  color: var(--ink-soft);
  font-size: .95rem;
}

.iw-pri-tag {
  font-family: var(--font-mono);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .32rem .6rem;
  border-radius: 6px;
  white-space: nowrap;
}

.iw-pri-tag.is-fail { background: var(--fail-bg); color: var(--fail); }
.iw-pri-tag.is-warn { background: var(--warn-bg); color: var(--warn); }
.iw-pri-tag.is-pass { background: var(--pass-bg); color: var(--pass); }
.iw-pri-tag.is-skip { background: var(--skip-bg); color: var(--skip); }

/* ============ BREAKDOWN GRID ============ */

.iw-breakdown {
  background: var(--tint);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.iw-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 1rem;
}

.iw-check {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  transition: border-color .2s,box-shadow .2s;
}

.iw-check:hover {
  border-color: var(--border-dark);
  box-shadow: 0 6px 20px rgba(23,27,35,.05);
}

.iw-status {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .1rem;
}

.iw-status svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

.iw-status.is-pass { background: var(--pass-bg); color: var(--pass); }
.iw-status.is-warn { background: var(--warn-bg); color: var(--warn); }
.iw-status.is-fail { background: var(--fail-bg); color: var(--fail); }
.iw-status.is-skip { background: var(--skip-bg); color: var(--skip); }

.iw-check-body h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.iw-check-body p {
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.5;
}

.iw-pill {
  font-family: var(--font-mono);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .18rem .45rem;
  border-radius: 5px;
}

.iw-pill.is-pass { background: var(--pass-bg); color: var(--pass); }
.iw-pill.is-warn { background: var(--warn-bg); color: var(--warn); }
.iw-pill.is-fail { background: var(--fail-bg); color: var(--fail); }
.iw-pill.is-skip { background: var(--skip-bg); color: var(--skip); }

/* Locked grid teaser: dim the preview rows behind the unlock form */

.iw-grid--locked {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  opacity: .85;
}

.iw-check--preview {
  filter: saturate(.9);
}

/* Locked report teaser */

.iw-locked-teaser {
  margin: 0 0 1.5rem;
  padding-top: 1.25rem;
}

.iw-locked-teaser__text {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 0.875rem;
}

.iw-unlock-form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ============ CTA ============ */

.iw-cta {
  background:
    radial-gradient(700px 300px at 85% 120%, rgba(1,124,182,.35), transparent 60%),
    linear-gradient(120deg,var(--ink),var(--navy));
  color: var(--white);
}

.iw-cta-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 3.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.iw-cta-text {
  max-width: 46ch;
}

.iw-cta-text .iw-eyebrow {
  margin-bottom: .8rem;
}

.iw-cta-text h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: -.01em;
  margin-bottom: .5rem;
  color: var(--white);
}

.iw-cta-text p {
  color: rgba(255,255,255,.72);
}

.iw-cta-actions {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: flex-start;
}

.iw-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: .95rem 1.7rem;
  border-radius: 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  transition: transform .15s,background .15s,box-shadow .15s;
}

.iw-btn-primary {
  background: var(--brand);
  color: var(--white) !important;
  box-shadow: 0 6px 20px rgba(1,124,182,.4);
}

.iw-btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
}

.iw-btn-primary .iw-arrow {
  transition: transform .15s;
}

.iw-btn-primary:hover .iw-arrow {
  transform: translateX(4px);
}

.iw-site-analyzer .iw-report a:focus-visible,
.iw-site-analyzer .iw-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Tier 3 (product checks) loading note */

.iw-report-note {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
  color: var(--ink-soft);
  font-size: .9rem;
}

/* ============ RESPONSIVE ============ */

@media (min-width: 560px) {
  .iw-analyzer-fields {
    flex-direction: row;
  }

  .iw-analyzer-fields .iw-analyzer-input:first-child {
    flex: 2;
  }

  .iw-analyzer-fields .iw-analyzer-input:last-child {
    flex: 3;
  }

  .iw-unlock-form {
    flex-direction: row;
  }

  .iw-unlock-input {
    flex: 1;
  }
}

@media (max-width: 900px) {
  .iw-hero-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .iw-dials {
    justify-content: flex-start;
  }

  .iw-grid,
  .iw-grid--locked {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .iw-hero-inner {
    padding: 3rem 1.25rem;
  }

  .iw-section {
    padding: 3rem 1.25rem;
  }

  .iw-cta-inner {
    padding: 3rem 1.25rem;
  }

  .iw-dials {
    flex-direction: column;
  }

  .iw-dial-card {
    max-width: none;
  }

  .iw-pri-item {
    grid-template-columns: auto 1fr;
    gap: .9rem;
  }

  .iw-pri-tag {
    grid-column: 2;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .iw-spinner {
    animation: none;
    border-top-color: var(--brand);
  }

  .iw-site-analyzer .iw-report * {
    transition: none !important;
    animation: none !important;
  }

  .iw-ring-prog {
    transition: none !important;
  }
}
