/* ============================================================================
   Store Doctor — isolated styling. All selectors are prefixed .sd- so this
   file never affects the rest of the site. Uses the shared design tokens
   from tokens.css (--primary, --surface, --text, --radius, etc.).
   ============================================================================ */

.sd-page {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.sd-page .container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.sd-narrow {
    max-width: 820px;
}

/* ---- Hero / scan --------------------------------------------------------- */
.sd-hero {
    position: relative;
    padding: 84px 0 40px;
    background:
        radial-gradient(1200px 480px at 50% -10%, rgba(16, 185, 129, .16), transparent 60%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
    text-align: center;
}

.sd-hero-inner {
    max-width: 760px;
}

.sd-eyebrow {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: rgba(16, 185, 129, .1);
    padding: 7px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.sd-title {
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 16px;
}

.sd-subtitle {
    font-size: 18px;
    line-height: 1.6;
    color: var(--muted);
    margin: 0 auto 30px;
    max-width: 620px;
}

.sd-scan-form {
    display: flex;
    gap: 12px;
    max-width: 620px;
    margin: 0 auto;
    background: var(--surface);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.sd-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 14px 16px;
    color: var(--text);
    min-width: 0;
}

.sd-submit {
    white-space: nowrap;
    flex-shrink: 0;
}

.sd-submit[disabled] {
    opacity: .65;
    cursor: not-allowed;
}

.sd-trust {
    margin-top: 16px;
    font-size: 14px;
    color: var(--muted);
}

.sd-error {
    color: #dc2626;
    font-size: 14px;
    margin-top: 14px;
    font-weight: 600;
}

/* ---- Progress panel ------------------------------------------------------ */
.sd-progress-panel {
    max-width: 640px;
    margin: 36px auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    text-align: left;
}

.sd-progress-head {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.sd-progress-head h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.sd-progress-pct {
    font-weight: 800;
    color: var(--primary-dark);
    margin-left: auto;
}

.sd-progress-hint {
    font-size: 13px;
    color: var(--muted);
    margin: 14px 0 0;
}

.sd-progress-bar {
    height: 10px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 22px;
}

.sd-progress-fill {
    height: 100%;
    width: 0%;
    min-width: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #34e6a9, var(--primary));
    transition: width .5s cubic-bezier(.16, 1, .3, 1);
    position: relative;
    overflow: hidden;
}

/* Continuous sweep so the bar always looks "alive", even when a single stage
   (e.g. mobile PageSpeed, which can take 30-50s) holds the width steady. */
.sd-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: translateX(-100%);
    animation: sd-shimmer 1.25s ease-in-out infinite;
}

.sd-progress-fill.is-complete::after {
    animation: none;
    display: none;
}

@keyframes sd-shimmer {
    100% { transform: translateX(100%); }
}

/* Small inline spinner in the progress header — a second, always-moving cue. */
.sd-progress-spin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, .25);
    border-top-color: var(--primary);
    animation: sd-spin .8s linear infinite;
    flex-shrink: 0;
}

.sd-progress-panel.is-complete .sd-progress-spin {
    display: none;
}

@keyframes sd-spin {
    100% { transform: rotate(360deg); }
}

.sd-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sd-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--muted);
    transition: color .2s ease;
}

.sd-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    position: relative;
    transition: all .2s ease;
}

.sd-steps li.is-active {
    color: var(--text);
    font-weight: 600;
}

.sd-steps li.is-active .sd-dot {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .15);
    animation: sd-pulse 1.1s ease-in-out infinite;
}

.sd-steps li.is-done {
    color: var(--text);
}

.sd-steps li.is-done .sd-dot {
    background: var(--primary);
    border-color: var(--primary);
}

.sd-steps li.is-done .sd-dot::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2.5px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes sd-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
    50% { box-shadow: 0 0 0 7px rgba(16, 185, 129, .05); }
}

/* ---- Sections ------------------------------------------------------------ */
.sd-section {
    padding: 56px 0;
}

.sd-h1 {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 18px;
}

.sd-h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0 0 14px;
}

.sd-body {
    font-size: 17px;
    line-height: 1.7;
    color: var(--muted);
}

/* ---- FAQ ----------------------------------------------------------------- */
.sd-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 22px;
}

.sd-faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
}

.sd-faq-item summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.sd-faq-item summary::-webkit-details-marker { display: none; }

.sd-faq-item p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

/* ---- CTA ----------------------------------------------------------------- */
.sd-cta-inner {
    text-align: center;
}

.sd-cta {
    background: linear-gradient(180deg, var(--bg), #eef2f7);
}

/* ---- Report -------------------------------------------------------------- */
.sd-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin: 22px 0;
}

.sd-card-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 18px;
}

.sd-detect-row,
.sd-page-meta li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.sd-detect-row:last-child,
.sd-page-meta li:last-child { border-bottom: none; }

.sd-detect-row span,
.sd-page-meta span { color: var(--muted); }

.sd-url-val { word-break: break-all; text-align: right; }

.sd-yes { color: var(--primary-dark); }
.sd-no { color: #b45309; }

.sd-page-block {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.sd-page-block:last-child { border-bottom: none; }

.sd-page-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sd-page-type { font-weight: 800; font-size: 16px; }

.sd-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}

.sd-badge-ok { background: rgba(16, 185, 129, .12); color: var(--primary-dark); }
.sd-badge-warn { background: #fef3c7; color: #92400e; }

.sd-page-url {
    display: inline-block;
    color: var(--primary-dark);
    word-break: break-all;
    margin-bottom: 10px;
    font-size: 14px;
}

.sd-page-meta {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sd-page-note { color: var(--muted); margin: 6px 0 0; }

.sd-alert {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 18px 20px;
    color: var(--text);
    line-height: 1.6;
}

.sd-alert-info { border-left-color: var(--primary); background: rgba(16, 185, 129, .05); }
.sd-alert-error { border-left-color: #dc2626; background: #fef2f2; }
.sd-alert strong { display: block; margin-bottom: 6px; }
.sd-alert p { margin: 0 0 14px; color: var(--muted); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 640px) {
    .sd-scan-form {
        flex-direction: column;
    }
    .sd-submit { width: 100%; }
    .sd-hero { padding-top: 56px; }
}

/* ============================================================================
   Report — score, category cards, filters, findings (Phase 2)
   ============================================================================ */
.sd-score-panel {
    display: flex;
    align-items: center;
    gap: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin: 22px 0;
}

.sd-score-ring {
    flex-shrink: 0;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    text-align: center;
    background: conic-gradient(var(--primary) 0, var(--primary) 100%);
    color: #fff;
    box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .25);
}

.sd-score-ring.sd-score-good { background: linear-gradient(135deg, #34e6a9, #10b981); }
.sd-score-ring.sd-score-ok { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.sd-score-ring.sd-score-bad { background: linear-gradient(135deg, #fb7185, #e11d48); }

.sd-score-num { font-size: 38px; font-weight: 800; line-height: 1; }
.sd-score-den { font-size: 13px; opacity: .85; }
.sd-score-copy h2 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.sd-score-copy p { margin: 0; color: var(--muted); line-height: 1.6; }

.sd-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 8px 0 30px;
}

.sd-cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-cat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.sd-cat-score { font-size: 30px; font-weight: 800; }
.sd-cat-score.sd-score-good { color: var(--primary-dark); }
.sd-cat-score.sd-score-ok { color: #b45309; }
.sd-cat-score.sd-score-bad { color: #be123c; }
.sd-cat-soon { font-size: 15px; font-weight: 700; color: #94a3b8; }

.sd-block-head { margin: 30px 0 12px; }

.sd-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.sd-filter {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.sd-filter:hover { border-color: var(--primary); color: var(--text); }
.sd-filter.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }

.sd-issues { display: flex; flex-direction: column; gap: 12px; }

.sd-issue {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
}

.sd-issue[data-severity="critical"] { border-left-color: #e11d48; }
.sd-issue[data-severity="high"] { border-left-color: #f59e0b; }
.sd-issue[data-severity="medium"] { border-left-color: #eab308; }
.sd-issue[data-severity="low"] { border-left-color: #94a3b8; }
.sd-issue[data-severity="informational"] { border-left-color: #60a5fa; }

.sd-issue-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sd-issue-title { font-size: 17px; font-weight: 700; margin: 0; }

.sd-sev {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 6px;
    flex-shrink: 0;
}

.sd-sev-critical { background: #fee2e2; color: #b91c1c; }
.sd-sev-high { background: #ffedd5; color: #c2410c; }
.sd-sev-medium { background: #fef9c3; color: #a16207; }
.sd-sev-low { background: #f1f5f9; color: #475569; }
.sd-sev-informational { background: #dbeafe; color: #1d4ed8; }

.sd-issue-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.sd-chip { font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); padding: 3px 9px; border-radius: 6px; }
.sd-affected { font-size: 13px; color: var(--muted); }
.sd-issue-line { margin: 6px 0; line-height: 1.6; color: var(--text); }
.sd-rec { color: var(--muted); }
.sd-no-match { color: var(--muted); padding: 20px 0; }

.sd-passes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sd-passes li { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.sd-check { color: var(--primary-dark); font-weight: 800; }

@media (max-width: 640px) {
    .sd-score-panel { flex-direction: column; text-align: center; }
    .sd-cat-grid { grid-template-columns: repeat(2, 1fr); }
    .sd-passes { grid-template-columns: 1fr; }
}

/* ---- Milestone: band, calculator, technologies ---------------------------- */
.sd-band {
    display: inline-block;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
    background: var(--surface-2);
    color: var(--text);
}
.sd-band.sd-score-good { background: rgba(16, 185, 129, .14); color: var(--primary-dark); }
.sd-band.sd-score-ok { background: #fef3c7; color: #b45309; }
.sd-band.sd-score-bad { background: #fee2e2; color: #be123c; }

.sd-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.sd-calc-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sd-calc-grid input {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}
.sd-calc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sd-calc-out > div {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sd-calc-out span { font-size: 13px; color: var(--muted); }
.sd-calc-out strong { font-size: 22px; font-weight: 800; }
.sd-calc-hi { border-color: var(--primary) !important; background: rgba(16, 185, 129, .06) !important; }
.sd-calc-hi strong { color: var(--primary-dark); }

.sd-tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.sd-tech {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sd-tech strong { font-size: 15px; }
.sd-tech span { font-size: 12px; color: var(--muted); }
.sd-tech em { font-size: 11px; font-weight: 700; color: var(--primary-dark); font-style: normal; }

/* ---- Lead gate, AI plan, next steps -------------------------------------- */
.sd-gate { border: 2px solid var(--primary); }
.sd-lead-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 16px 0; }
.sd-lead-grid label, .sd-consent { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sd-lead-grid input, .sd-lead-grid select {
    border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; font-size: 15px; color: var(--text); background: var(--bg);
}
.sd-consent { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 14px; }
.sd-consent input { width: auto; }
.sd-unlock-btn { width: 100%; }

.sd-plan-list { margin: 6px 0 0; padding-left: 20px; line-height: 1.7; }
.sd-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.sd-plan-week { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.sd-plan-week strong { display: block; margin-bottom: 6px; color: var(--primary-dark); }
.sd-plan-week ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }

.sd-next-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- AI & Agentic Readiness (separate score section) --------------------- */
.sd-agentic { display: grid; gap: 18px; }
.sd-agentic-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sd-agentic-score {
    flex: 0 0 auto; display: flex; align-items: baseline; gap: 2px;
    min-width: 104px; padding: 14px 18px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--border);
}
.sd-agentic-num { font-size: 40px; font-weight: 800; line-height: 1; color: var(--primary-dark); }
.sd-agentic-of { font-size: 15px; color: var(--muted); font-weight: 600; }
.sd-agentic-score[data-band="excellent"] { background: #dcfce7; border-color: #86efac; }
.sd-agentic-score[data-band="good"] { background: #ecfccb; border-color: #bef264; }
.sd-agentic-score[data-band="needs-attention"] { background: #fef9c3; border-color: #fde047; }
.sd-agentic-score[data-band="significant-opportunities"] { background: #fee2e2; border-color: #fca5a5; }
.sd-agentic-intro { flex: 1 1 240px; }
.sd-agentic-intro strong { font-size: 16px; color: var(--text); }

.sd-agentic-group { border-top: 1px solid var(--border); padding-top: 14px; }
.sd-agentic-grouphead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sd-h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--text); }
.sd-agentic-gscore {
    font-size: 13px; font-weight: 800; color: var(--primary-dark);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 2px 10px;
}
.sd-agentic-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sd-agentic-item { display: flex; gap: 10px; align-items: flex-start; }
.sd-agentic-badge {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; margin-top: 1px;
}
.sd-agentic-item.is-pass .sd-agentic-badge { background: #dcfce7; color: #15803d; }
.sd-agentic-item.is-warning .sd-agentic-badge { background: #fef9c3; color: #a16207; }
.sd-agentic-item.is-fail .sd-agentic-badge { background: #fee2e2; color: #b91c1c; }
.sd-agentic-item.is-info .sd-agentic-badge { background: #dbeafe; color: #1d4ed8; }
.sd-agentic-text { display: block; font-size: 14px; line-height: 1.5; }
.sd-agentic-text strong { display: block; color: var(--text); }
.sd-agentic-summary { display: block; color: var(--muted); }
.sd-agentic-rec { display: block; color: var(--primary-dark); margin-top: 2px; font-size: 13px; }

/* ---- Store Audit landing page (pillar) ----------------------------------- */
.sd-visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sd-breadcrumb { padding: 14px 0 0; font-size: 13px; color: var(--muted); }
.sd-breadcrumb a { color: var(--primary-dark); text-decoration: none; }
.sd-breadcrumb a:hover { text-decoration: underline; }
.sd-breadcrumb span { margin: 0 6px; }
.sd-section-alt { background: var(--surface-2); }
.sd-center { text-align: center; }
.sd-block-head.sd-center { max-width: 760px; margin: 0 auto 28px; }
.sd-lead { font-size: 17px; color: var(--muted); }
.sd-inline-cta { margin-top: 16px; }

/* 7-category grid */
.sd-cat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.sd-cat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 18px;
}
.sd-cat-title { font-size: 16px; font-weight: 700; margin: 0 0 6px; color: var(--primary-dark); }
.sd-cat p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Agentic checklist */
.sd-check-list {
    list-style: none; margin: 18px 0 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 18px;
}
.sd-check-list li { position: relative; padding-left: 24px; color: var(--text); font-size: 14px; }
.sd-check-list li::before {
    content: "✓"; position: absolute; left: 0; top: 0;
    color: var(--primary-dark); font-weight: 800;
}

/* Example findings */
.sd-findings { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.sd-finding { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text); }
.sd-sev-warning { background: #fef3c7; color: #92400e; }
.sd-sev-information { background: #dbeafe; color: #1d4ed8; }
