/* ==========================================================================
   Packet Clarity — daily report styles
   Layers on top of /assets/css/site.css and reuses its tokens.
   ========================================================================== */

:root {
    --loss-clean:  #d6f0e0;
    --loss-trace:  #fef08a;
    --loss-low:    #fbbf24;
    --loss-mid:    #f97316;
    --loss-high:   #dc2626;
    --loss-nodata: #b9c2d0;

    --ink-clean: #15803d;
    --ink-warn:  #b45309;
    --ink-bad:   #b91c1c;
}

/* ------------------------------------------------------------------ hero -- */
.report-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(48px, 6vw, 84px) clamp(40px, 5vw, 64px);
    background: var(--dark);
    color: var(--dark-ink-2);
}

.report-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(680px 300px at 20% -10%, rgba(47, 111, 237, .38), transparent 70%),
        radial-gradient(520px 280px at 90% 10%, rgba(34, 211, 238, .18), transparent 70%);
}

.report-hero h1 { color: #fff; }

.report-sub {
    margin-top: 14px;
    font-size: 1.075rem;
    color: var(--dark-ink);
}

.report-meta {
    margin-top: 10px;
    font-size: .9rem;
    color: var(--ink-3);
}

.report-meta a, .back-link a { color: #7cc4ff; text-decoration: none; }
.report-meta a:hover, .back-link a:hover { text-decoration: underline; }

.section-title.spaced { margin-top: clamp(48px, 6vw, 76px); }

/* ------------------------------------------------------------- scorecard -- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(168px, 100%), 1fr));
    gap: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px 20px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.stat-value {
    font-family: var(--mono);
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -.03em;
    color: var(--ink);
}

.stat-note { font-size: .82rem; color: var(--ink-3); }

.stat.tone-clean { border-left-color: #34d399; }
.stat.tone-trace,
.stat.tone-low   { border-left-color: var(--loss-low); }
.stat.tone-mid   { border-left-color: var(--loss-mid); }
.stat.tone-high  { border-left-color: var(--loss-high); }
.stat.tone-nodata { border-left-color: var(--loss-nodata); }

.unit { margin-left: 2px; font-size: .62em; font-weight: 500; color: var(--ink-3); }
.nil  { color: #b6bece; }
.mono { font-family: var(--mono); font-size: .9em; }

/* ------------------------------------------------------------- ISP cards -- */
.isp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 20px;
}

.isp-card { display: flex; flex-direction: column; }

.isp-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.isp-head h3 { margin: 0; font-size: 1.2rem; }
.isp-head h3 a { color: inherit; text-decoration: none; }
.isp-head h3 a:hover { color: var(--brand); }

.isp-swatch {
    display: inline-block;
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    vertical-align: baseline;
}

.isp-head .isp-swatch { width: 14px; height: 30px; border-radius: 5px; }

.isp-port {
    font-family: var(--mono);
    font-size: .74rem;
    letter-spacing: .05em;
    color: var(--ink-3);
}

.isp-metrics {
    display: grid;
    gap: 1px;
    margin-bottom: 22px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.isp-metrics > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    background: var(--bg);
}

.isp-metrics dt {
    font-size: .86rem;
    color: var(--ink-3);
    white-space: nowrap;
}

.isp-metrics dd {
    font-family: var(--mono);
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.isp-card .btn { margin-top: auto; }

.isp-card.pending { opacity: .72; }

.pending-note {
    padding: 18px 0;
    font-size: .92rem;
    color: var(--ink-3);
}

/* ---------------------------------------------------------------- tables -- */
.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: .92rem;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-2);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.data-table th[scope="row"],
.data-table thead th:first-child {
    text-align: left;
    color: var(--ink);
    font-weight: 600;
}

.data-table td {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}

/* Column rules, so a highlighted "best" cell reads against the right column. */
.data-table td,
.data-table thead th + th { border-left: 1px solid #eef1f7; }

/* Stronger rule where one ISP's block of columns ends and the next begins. */
.data-table .group-start { border-left: 1px solid var(--line); }

.data-table.grouped thead tr:first-child th { border-bottom: 1px solid var(--line); }

.data-table.grouped thead tr:first-child th[colspan] { text-align: center; }

.data-table.grouped thead th.rowhead { vertical-align: bottom; }

.data-table td.emph { color: var(--ink); font-weight: 600; }

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td,
.data-table tbody tr:hover th { background: #fafbfe; }

.data-table td.best {
    background: rgba(52, 211, 153, .13);
    color: var(--ink);
    font-weight: 600;
}

.data-table .isp-swatch { margin-right: 7px; }

td.lvl-trace, td.lvl-low { color: var(--ink-warn); }
td.lvl-mid  { color: var(--loss-mid); font-weight: 600; }
td.lvl-high { color: var(--ink-bad); font-weight: 700; }
td.lvl-nodata { color: var(--ink-3); }

.pill-best {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(52, 211, 153, .18);
    color: var(--ink-clean);
    font-family: var(--font);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------- heatmap -- */
.heat-card { padding: 24px 22px; }

.heat-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.heatmap-scroll { overflow-x: auto; }

.heatmap { min-width: 720px; }

.heat-row {
    display: grid;
    grid-template-columns: 104px 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 3px;
}

.heat-label {
    font-size: .8rem;
    color: var(--ink-3);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heat-cells {
    display: flex;
    gap: 1px;
    height: 18px;
}

.heat-cells .cell {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 1px;
}

.cell { display: inline-block; background: var(--loss-nodata); }
.cell.clean  { background: var(--loss-clean); }
.cell.trace  { background: var(--loss-trace); }
.cell.low    { background: var(--loss-low); }
.cell.mid    { background: var(--loss-mid); }
.cell.high   { background: var(--loss-high); }
.cell.nodata { background: var(--loss-nodata); }

.heat-axis {
    display: flex;
    justify-content: space-between;
    margin: 10px 0 0 116px;
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--ink-3);
}

.heat-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 22px;
    font-size: .82rem;
    color: var(--ink-3);
}

.heat-legend span { display: inline-flex; align-items: center; gap: 8px; }

.heat-legend .cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ---------------------------------------------------------------- charts -- */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 18px;
}

.chart-card { padding: 20px 18px 16px; }

.chart-figure figcaption {
    margin-bottom: 12px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
}

svg.chart {
    width: 100%;
    height: 150px;
    overflow: visible;
}

svg.chart .grid   { stroke: var(--line); stroke-width: 1; }
svg.chart .axis   { fill: var(--ink-3); font-size: 9px; font-family: var(--mono); }
svg.chart .series { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.chart.empty {
    padding: 40px 0;
    text-align: center;
    color: var(--ink-3);
    font-size: .9rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    font-size: .8rem;
    color: var(--ink-3);
}

.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }

.chart-legend i {
    width: 10px;
    height: 3px;
    border-radius: 2px;
}

/* ------------------------------------------------------------ explainer -- */
.explainer {
    max-width: 900px;
    margin-inline: auto;
    padding: clamp(26px, 3.5vw, 40px);
}

.explainer-lead {
    font-size: 1.05rem;
    color: var(--ink-2);
}

.explainer-lead + .explainer-lead { margin-top: 14px; }
.explainer-lead b { color: var(--ink); }

.explainer-terms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 18px;
    margin-top: 30px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.explainer-terms > div {
    padding: 18px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
}

.explainer-terms dt {
    margin-bottom: 6px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand);
}

.explainer-terms dd {
    font-size: .93rem;
    color: var(--ink-2);
}

.explainer-terms dd b { color: var(--ink); }

/* ----------------------------------------------------------- methodology -- */
.method-card { max-width: 900px; margin-inline: auto; }

.method-list { display: grid; gap: 14px; margin-bottom: 26px; }

.method-list li {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: baseline;
    font-size: .93rem;
}

.method-list b {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--brand);
}

.method-list span { color: var(--ink-2); }

.method-scope {
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: .89rem;
    color: var(--ink-3);
}

.method-scope + .method-scope { border-top: none; padding-top: 10px; }

.back-link { margin-top: 32px; text-align: center; }
.back-link a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* --------------------------------------------------------------- archive -- */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
    gap: 16px;
}

.archive-card {
    display: block;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.archive-card:hover {
    transform: translateY(-3px);
    border-color: rgba(47, 111, 237, .35);
    box-shadow: var(--shadow);
}

.archive-date {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.archive-day {
    display: block;
    margin-bottom: 14px;
    font-size: .82rem;
    color: var(--ink-3);
}

.archive-bars { display: grid; gap: 5px; }

.archive-bar {
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: .76rem;
    color: var(--ink-3);
}

.archive-bar .track {
    height: 5px;
    border-radius: 3px;
    background: var(--bg-2);
    overflow: hidden;
}

.archive-bar .fill { display: block; height: 100%; border-radius: 3px; }

.archive-bar .val { font-family: var(--mono); font-size: .74rem; color: var(--ink-2); }

.empty-state {
    max-width: 620px;
    margin-inline: auto;
    padding: 44px 30px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    text-align: center;
    color: var(--ink-3);
}

.empty-state code {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--bg-2);
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--ink);
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 760px) {
    .stat-value { font-size: 1.55rem; }
    .method-list li { grid-template-columns: 1fr; gap: 3px; }
    .heat-row { grid-template-columns: 74px 1fr; }
    .heat-axis { margin-left: 86px; }
}

@media print {
    .site-header, .site-footer, .back-link { display: none; }
    .report-hero { background: #fff; color: #000; }
    .report-hero h1, .report-sub { color: #000; }
    .card, .table-scroll { box-shadow: none; break-inside: avoid; }
    .chart-card, .heat-card { break-inside: avoid; }
}
