/* ============================================================
   Infyze Technologies — Site Checkup tool
   Loaded alongside styles.css. Reuses the brand tokens defined
   there (orange accent, charcoal ink, Bricolage + Lexend).
   ============================================================ */

:root {
  --score-good: #12833f;   /* 90+  green  */
  --score-good-soft: #eafaf0;
  --score-warn: #d9560a;   /* 50-89 brand orange, AA on white */
  --score-warn-soft: #fff1e6;
  --score-bad: #c23434;    /* <50  red    */
  --score-bad-soft: #fdecec;
}

/* visually hidden but available to screen readers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- tool hero ---------- */
.checkup-hero {
  position: relative; overflow: hidden;
  padding: clamp(2rem, 4vw, 3.25rem) 0 clamp(2.5rem, 5vw, 4rem);
  background: linear-gradient(180deg, var(--orange-soft), #fff 80%);
}
.checkup-hero .breadcrumb { margin-bottom: 1.75rem; }
.checkup-hero-inner { position: relative; z-index: 1; max-width: 720px; }
.checkup-hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.35rem); font-weight: 800;
  letter-spacing: -.03em; margin-bottom: 1rem;
}
.checkup-hero .lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--ink-2); max-width: 52ch; margin: 0 0 2rem; }

/* URL entry form */
.checkup-form { position: relative; z-index: 1; }
.url-row {
  display: flex; gap: .75rem; background: #fff; padding: .55rem;
  border: 1.5px solid var(--line); border-radius: 999px;
  box-shadow: 0 24px 50px -34px rgba(25,28,34,.5); max-width: 640px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.url-row:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(242,106,17,.14), 0 24px 50px -34px rgba(25,28,34,.5); }
.url-row input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: 1.02rem; color: var(--ink); padding: .55rem 0 .55rem 1.1rem;
}
.url-row input::placeholder { color: var(--ink-3); }
.url-row .btn { flex-shrink: 0; }
.checkup-fineprint { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 0; font-size: .85rem; color: var(--ink-3); }
.checkup-fineprint svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--score-good); }
.url-error { color: var(--score-bad); font-size: .9rem; font-weight: 500; margin: .85rem 0 0; min-height: 1em; }

/* ---------- results area ---------- */
.checkup-results { padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(3rem, 6vw, 5rem); }
.checkup-results[hidden] { display: none; }

/* strategy toggle (mobile / desktop) */
.strategy-toggle {
  display: inline-flex; gap: .25rem; background: var(--bg-3); border: 1px solid var(--line);
  padding: .3rem; border-radius: 999px; margin-bottom: 2rem;
}
.strategy-toggle button {
  display: inline-flex; align-items: center; gap: .45rem; border: 0; background: transparent;
  font: inherit; font-size: .92rem; font-weight: 600; color: var(--ink-3);
  padding: .55rem 1.1rem; border-radius: 999px; transition: background .2s var(--ease), color .2s var(--ease);
}
.strategy-toggle button svg { width: 16px; height: 16px; }
.strategy-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* headline: overall grade + verdict */
.result-headline {
  display: grid; grid-template-columns: auto 1fr; gap: clamp(1.5rem, 4vw, 2.75rem); align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.5rem); margin-bottom: 1.5rem;
}
.grade-badge {
  width: clamp(96px, 22vw, 128px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; line-height: 1;
  font-size: clamp(3rem, 9vw, 4.25rem); position: relative;
}
.grade-badge span { position: relative; }
.grade-badge small { display: block; font-size: .8rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .8; margin-top: .35rem; }
.result-headline h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin-bottom: .5rem; }
.result-verdict { margin: 0; color: var(--ink-2); font-size: 1.02rem; max-width: 52ch; }
.tested-url { display: inline-flex; align-items: center; gap: .4rem; margin-top: .9rem; font-size: .88rem; color: var(--ink-3); word-break: break-all; }
.tested-url svg { width: 14px; height: 14px; flex-shrink: 0; }

/* four category rings */
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.score-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem 1.5rem; text-align: center;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.score-card:hover { transform: translateY(-4px); box-shadow: 0 24px 44px -30px rgba(25,28,34,.32); border-color: transparent; }
.ring { width: 108px; height: 108px; margin: 0 auto 1rem; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .ring-track { stroke: var(--line-2); }
.ring .ring-value { stroke: var(--orange); transition: stroke-dashoffset 1s var(--ease), stroke .3s var(--ease); }
.ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.85rem; color: var(--ink);
}
.score-card h3 { font-size: 1.02rem; margin-bottom: .2rem; }
.score-card p { margin: 0; font-size: .82rem; color: var(--ink-3); }

/* score color states (shared by rings + grade badge + metric chips) */
.is-good { --sc: var(--score-good); --sc-soft: var(--score-good-soft); }
.is-warn { --sc: var(--score-warn); --sc-soft: var(--score-warn-soft); }
.is-bad  { --sc: var(--score-bad);  --sc-soft: var(--score-bad-soft); }
.ring.is-good .ring-value, .ring.is-warn .ring-value, .ring.is-bad .ring-value { stroke: var(--sc); }
.grade-badge.is-good, .grade-badge.is-warn, .grade-badge.is-bad { background: var(--sc-soft); color: var(--sc); }

/* Core Web Vitals */
.metrics-block, .opps-block {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.25rem); margin-bottom: 1.5rem;
}
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.block-head h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.data-badge {
  font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: .3rem .7rem; border-radius: 999px; background: var(--bg-3); color: var(--ink-3); white-space: nowrap;
}
.data-badge.is-field { background: var(--score-good-soft); color: var(--score-good); }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.metric {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.15rem 1.25rem;
  border-left: 4px solid var(--sc, var(--line));
}
.metric small { display: block; font-size: .82rem; color: var(--ink-3); margin-bottom: .35rem; }
.metric .metric-val { font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; color: var(--ink); line-height: 1.1; }
.metric .metric-tag { display: inline-block; margin-top: .5rem; font-size: .74rem; font-weight: 600; color: var(--sc); }

/* opportunities */
.opps-list { display: flex; flex-direction: column; }
.opp {
  display: flex; align-items: flex-start; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--line-2);
}
.opp:first-child { border-top: 0; }
.opp-icon { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--sc-soft, var(--orange-soft)); color: var(--sc, var(--orange-deep)); }
.opp-icon svg { width: 18px; height: 18px; }
.opp-text { flex: 1; min-width: 0; }
.opp-text strong { display: block; color: var(--ink); font-size: 1rem; font-family: var(--font-display); font-weight: 600; margin-bottom: .15rem; }
.opp-text span { font-size: .9rem; color: var(--ink-2); }
.opp-save { flex-shrink: 0; font-size: .85rem; font-weight: 600; color: var(--score-warn); white-space: nowrap; }
.opps-allclear { display: flex; align-items: center; gap: .75rem; color: var(--score-good); font-weight: 500; }
.opps-allclear svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- lead capture (value-first, appears with results) ---------- */
.checkup-lead {
  position: relative; overflow: hidden; background: var(--charcoal);
  border-radius: var(--radius-lg); padding: clamp(1.75rem, 4vw, 3rem);
}
.checkup-lead::before {
  content: ""; position: absolute; top: -40%; right: -8%; width: 40vw; max-width: 520px; aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(242,106,17,.26), transparent 70%); pointer-events: none;
}
.checkup-lead-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
.checkup-lead .eyebrow { color: #ffb27a; }
.checkup-lead .eyebrow-mark { background: var(--orange); }
.checkup-lead h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 1rem; }
.checkup-lead > .checkup-lead-grid > .lead-copy p { color: rgba(255,255,255,.75); margin: 0 0 1.5rem; font-size: 1.02rem; max-width: 42ch; }
.lead-points { display: flex; flex-direction: column; gap: .7rem; }
.lead-points li { color: rgba(255,255,255,.85); position: relative; padding-left: 1.7rem; font-size: .96rem; }
.lead-points li::before {
  content: ""; position: absolute; left: 0; top: .5em; width: 12px; height: 7px;
  border-left: 2px solid var(--orange); border-bottom: 2px solid var(--orange); transform: rotate(-45deg);
}
.lead-form { background: #fff; border-radius: var(--radius); padding: clamp(1.5rem, 3vw, 2rem); }
.lead-form h3 { font-size: 1.3rem; margin-bottom: 1.25rem; }
.lead-form .field:last-of-type { margin-bottom: 1.25rem; }

/* ---------- loading + empty states ---------- */
.checkup-loading { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.checkup-loading[hidden] { display: none; }
.spinner {
  width: 54px; height: 54px; margin: 0 auto 1.5rem; border-radius: 50%;
  border: 5px solid var(--line); border-top-color: var(--orange); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.checkup-loading p { color: var(--ink-2); font-size: 1.05rem; margin: 0; }
.checkup-loading .loading-sub { color: var(--ink-3); font-size: .9rem; margin-top: .4rem; }

.checkup-alert {
  display: flex; align-items: flex-start; gap: .85rem; max-width: 640px;
  background: var(--score-bad-soft); color: #922; border-radius: var(--radius);
  padding: 1.1rem 1.25rem; font-size: .96rem; margin-top: 1.5rem;
}
.checkup-alert[hidden] { display: none; }
.checkup-alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .checkup-lead-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .url-row { flex-direction: column; border-radius: var(--radius); padding: .85rem; }
  .url-row input { padding: .5rem .5rem; }
  .url-row .btn { justify-content: center; }
  .result-headline { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .tested-url { justify-content: center; }
  .score-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .ring .ring-value { transition: none; }
}

/* CTA under the fix list (shown only when issues exist) */
.opps-cta { margin-top: 1.25rem; }
