/* Website Audit Tool - styles. No external fonts or frameworks. */
:root {
  --ink: #142a30;
  --muted: #56686c;
  --paper: #f3f6f5;
  --surface: #ffffff;
  --line: #d6dfdd;
  --brand: #125363;
  --brand-2: #0d7180;
  --accent: #ff6800;
  --excellent: #1d7a4e;
  --good: #276d93;
  --needs: #a8700f;
  --critical: #b3392a;
  --na: #87959a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 58, 68, .08), 0 4px 14px rgba(15, 58, 68, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--paper); }
img, svg { max-width: 100%; }
a { color: var(--brand-2); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.65rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #000; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
[hidden] { display: none !important; }

/* Header / footer */
.site-head { background: var(--brand); color: #fff; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.brand:hover { color: #fff; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.site-head nav { display: flex; gap: 18px; }
.site-head nav a { color: #d7e6e8; text-decoration: none; font-size: .95rem; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }
.site-foot { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); }
.foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 20px; padding-bottom: 20px; }
.foot-row p { margin: 0; max-width: 700px; }
.foot-row nav { display: flex; gap: 16px; }

/* Hero + form */
.hero { background: var(--brand); color: #fff; padding: 48px 0 56px; }
.hero h1 { color: #fff; }
.lede { font-size: 1.12rem; color: inherit; opacity: .92; max-width: 62ch; }
.audit-form { margin-top: 24px; }
.audit-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row input { flex: 1 1 320px; min-width: 0; font: inherit; font-size: 1.1rem; padding: 14px 16px; border-radius: var(--radius-sm); border: 2px solid transparent; background: #fff; color: var(--ink); }
.field-row input:focus { border-color: var(--accent); outline: none; }
.audit-form button, .btn { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: var(--radius-sm); padding: 14px 22px; background: var(--accent); color: #1d1600; text-decoration: none; display: inline-block; line-height: 1.2; }
.audit-form button:hover, .btn:hover { background: #f0b83a; color: #1d1600; }
.audit-form button:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); padding: 12px 20px; }
.btn-ghost:hover { background: var(--brand); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.help { font-size: .9rem; opacity: .85; margin: 8px 0 0; }
.form-error { margin: 10px 0 0; padding: 10px 12px; background: #fff1ef; color: var(--critical); border-radius: var(--radius-sm); font-weight: 600; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-top: 28px; box-shadow: var(--shadow); }
.panel-error { border-left: 5px solid var(--critical); }
.progress-bar { height: 8px; background: #e3eae8; border-radius: 99px; overflow: hidden; margin: 8px 0 18px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--brand-2); transition: width .4s ease; }
.steps { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 28px; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 4px 0; break-inside: avoid; color: var(--muted); font-size: .95rem; }
.steps li::before { content: ""; flex: 0 0 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { border-color: var(--brand-2); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--excellent); border-color: var(--excellent); }
.steps li.skipped::before { background: var(--na); border-color: var(--na); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Home content */
.content-block { margin-top: 56px; max-width: 820px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 28px; margin-top: 20px; }
.feature-grid h3 { margin-bottom: .25em; }
.feature-grid p { color: var(--muted); margin: 0; }
.note { background: #fff8e6; border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--brand-2); }
.faq details[open] summary::after { content: "−"; }
.faq summary h3 { margin: 0; font-size: 1.05rem; }
.faq details p { color: var(--muted); max-width: 70ch; }

/* Prose pages */
.prose { margin-top: 36px; max-width: 900px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .5em; }
.method-cat { margin: 28px 0; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef3f2; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.url-cell { word-break: break-all; min-width: 220px; }

/* Report */
.report { margin-top: 28px; }
.report-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.report-head h1 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: .2em; word-break: break-word; }
.report-kicker { color: var(--muted); font-size: .95rem; margin: 0 0 4px; }
.meta-list { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 8px 0 14px; padding: 0; list-style: none; font-size: .93rem; color: var(--muted); }
.meta-list strong { color: var(--ink); }
.counts { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.counts li { padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: .9rem; background: #eef3f2; }
.counts .c-critical { background: #fbe9e6; color: var(--critical); }
.counts .c-warning { background: #fdf2dc; color: #7c5208; }
.counts .c-notice { background: #e6f0f6; color: var(--good); }
.counts .c-passed { background: #e3f3ea; color: var(--excellent); }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ring { display: block; }
.ring-track { stroke: #e3eae8; }
.ring-value { transition: stroke-dasharray .6s ease; }
.ring-text { font-weight: 800; font-variant-numeric: tabular-nums; fill: var(--ink); }
.ring-sub { fill: var(--muted); font-size: 9px; }
.overall-ring { width: 168px; height: 168px; }
.state-excellent { color: var(--excellent); stroke: var(--excellent); }
.state-good { color: var(--good); stroke: var(--good); }
.state-needs_improvement { color: var(--needs); stroke: var(--needs); }
.state-critical { color: var(--critical); stroke: var(--critical); }
.state-unavailable { color: var(--na); stroke: var(--na); }

.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; padding: 0; list-style: none; }
.score-card { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font: inherit; color: var(--ink); box-shadow: var(--shadow); }
.score-card:hover { border-color: var(--brand-2); }
.score-card .ring { width: 84px; height: 84px; }
.score-card .overall-ring { width: 150px; height: 150px; }
.report-head > .score-card { padding: 16px 18px; }
.score-card .label { font-weight: 700; font-size: .95rem; }
.score-card .state { font-size: .8rem; font-weight: 600; }
.score-card .how { font-size: .75rem; color: var(--muted); }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-top: 26px; scrollbar-width: thin; position: sticky; top: 0; background: var(--paper); z-index: 5; }
.tabs button { font: inherit; font-size: .92rem; background: none; border: 0; padding: 11px 14px; cursor: pointer; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button[aria-selected="true"] { color: var(--brand); font-weight: 700; border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }
.tab-panel { padding: 22px 0; }
.tab-panel > h2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #eef3f2; color: var(--muted); vertical-align: middle; }
.pill.state-excellent, .pill.state-good, .pill.state-needs_improvement, .pill.state-critical { color: #fff; }
.pill.state-excellent { background: var(--excellent); }
.pill.state-good { background: var(--good); }
.pill.state-needs_improvement { background: var(--needs); }
.pill.state-critical { background: var(--critical); }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.section > h3 { margin-bottom: .6em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 0 0 12px; padding: 0; list-style: none; }
.stat-row li { background: #f6f9f8; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat-row b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: .82rem; color: var(--muted); }

/* Checks */
.checks { list-style: none; margin: 0; padding: 0; }
.check { border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check summary { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 10px 2px; cursor: pointer; list-style: none; }
.check summary::-webkit-details-marker { display: none; }
.check .cname { font-weight: 600; }
.check .cval { color: var(--muted); font-size: .88rem; text-align: right; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-body { padding: 0 2px 14px 108px; font-size: .94rem; }
.check-body p { margin: 0 0 .5em; }
.check-body ul { margin: 0 0 .6em; padding-left: 1.1em; }
.check-body li { word-break: break-word; }
.check-body .lbl { font-weight: 700; }
.badge { display: inline-block; text-align: center; font-size: .74rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: #eef3f2; color: var(--muted); }
.b-pass { background: #e3f3ea; color: var(--excellent); }
.b-fail, .b-critical { background: #fbe9e6; color: var(--critical); }
.b-warning { background: #fdf2dc; color: #7c5208; }
.b-notice { background: #e6f0f6; color: var(--good); }
.b-manual { background: #efe9f7; color: #5b3f8c; }
.b-unavailable, .b-na, .b-info { background: #eef1f1; color: var(--muted); }

.finding { border-left: 4px solid var(--line); padding: 10px 14px; margin-bottom: 12px; background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.finding.l-critical { border-left-color: var(--critical); }
.finding.l-warning { border-left-color: var(--accent); }
.finding.l-notice { border-left-color: var(--good); }
.finding h4 { margin: 0 0 .3em; font-size: 1rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.finding dl { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 6px 0 0; font-size: .92rem; }
.finding dt { font-weight: 600; color: var(--muted); }
.finding dd { margin: 0; word-break: break-word; }
.finding dd ul { margin: 0; padding-left: 1.1em; }
.plan-group { margin-bottom: 26px; }

.heading-tree { list-style: none; padding: 0; margin: 0; font-size: .93rem; }
.heading-tree li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.heading-tree .lvl { display: inline-block; min-width: 30px; font-family: var(--mono); font-size: .8rem; color: var(--brand-2); font-weight: 700; }
.serp { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; max-width: 640px; background: #fff; }
.serp .s-url { color: #2d5e3e; font-size: .85rem; word-break: break-all; }
.serp .s-title { color: #1a0dab; font-size: 1.15rem; margin: 2px 0; }
.serp .s-desc { color: #4d5156; font-size: .9rem; margin: 0; }

dialog.explain { border: 0; border-radius: var(--radius); padding: 0; max-width: 760px; width: calc(100% - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
dialog.explain::backdrop { background: rgba(10, 30, 35, .55); }
.explain-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #f6f9f8; }
.explain-head h2 { margin: 0; font-size: 1.2rem; }
.explain-body { padding: 16px 20px 20px; max-height: 70vh; overflow: auto; }
.close-btn { font: inherit; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; }
.loading { padding: 40px 0; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm); z-index: 50; }

/* Responsive */
@media (max-width: 768px) {
  .report-head { grid-template-columns: 1fr; justify-items: start; }
  .score-card .overall-ring { width: 128px; height: 128px; }
  .check summary { grid-template-columns: 84px 1fr; }
  .check .cval { grid-column: 2; text-align: left; max-width: none; white-space: normal; }
  .check-body { padding-left: 2px; }
  .finding dl, .kv { grid-template-columns: 1fr; }
  .finding dt, .kv dt { margin-top: 6px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 14px; }
  .hero { padding: 32px 0 40px; }
  .field-row button { width: 100%; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .panel, .report-head, .section { padding: 16px; }
}
@media (min-width: 1440px) { .wrap { max-width: 1280px; } }

/* Print / Save as PDF */
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-head nav, .site-foot nav, .hero, #home-content, .tabs, .report-actions, .skip, #progress-panel, #cached-panel, .score-card .how, .faq { display: none !important; }
  .site-head { background: #fff; color: #000; border-bottom: 2px solid #000; }
  .brand { color: #000; }
  .tab-panel { display: block !important; page-break-before: auto; }
  .tab-panel[hidden] { display: block !important; }
  .section, .finding, .score-card, .report-head { box-shadow: none; break-inside: avoid; }
  .check { break-inside: avoid; }
  .check-body { display: block !important; }
  a { color: #000; }
  .table-scroll { overflow: visible; }
}

/* Admin */
.admin { margin-top: 24px; }
.admin-nav { display: flex; gap: 18px; align-items: center; padding-top: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.admin-nav a[aria-current="page"] { font-weight: 700; color: var(--brand); }
.admin-nav form { margin-left: auto; }
.admin-form label { display: block; font-weight: 600; margin-bottom: 12px; font-size: .93rem; }
.admin-form input:not([type="checkbox"]), .admin-form select { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #b9c6c3; border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.admin-form input:focus, .admin-form select:focus { border-color: var(--brand-2); outline: 2px solid var(--accent); }
.admin-form .check-label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.admin-form fieldset { border: 1px solid var(--line); }
.admin-form legend { font-weight: 700; font-size: 1.05rem; padding: 0 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.weights { border-top: 1px solid var(--line); padding: 8px 0; }
.weights summary { cursor: pointer; font-weight: 600; padding: 4px 0 10px; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); background: #e3f3ea; color: var(--excellent); font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--critical); }
.inline-form { margin: 0; }
.reset-form { margin-top: 16px; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-family: var(--mono); font-size: .88em; background: #eef3f2; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
code.hash { display: block; padding: 10px; user-select: all; }
