/* =========================================================
   WEBSITE PAGE (js/features/website.js)
   Page-specific layout; panels, buttons, tables and charts come from
   shared components. The one new colour is the GA orange for post pins.
========================================================= */

#page-website { --web-ga: #e37400; }

.nav-item[hidden] { display: none; }

#page-website .page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.web-chip {
    display: inline-flex; align-items: center; padding: 3px 10px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    font-size: 11px; font-weight: 700; color: var(--text);
}
.web-chip[hidden] { display: none; }
.web-chip[href] { text-decoration: none; transition: border-color .15s; }
.web-chip[href]:hover { border-color: var(--primary); color: var(--primary-dark); }
.web-ga-dot {
    display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: -6px; margin-right: 6px;
    border-radius: 50%; background: var(--web-ga); color: #fff; font-size: 8px; font-weight: 800; position: relative; overflow: hidden;
}
.web-ga-dot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }

.web-controls { align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.web-synced { font-size: 10.5px; color: var(--text-3); }

.web-seg {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.web-seg button { padding: 6px 11px; min-height: 30px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; color: var(--text-2); background: none; }
.web-seg button:hover { color: var(--text); }
.web-seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }

#page-website button:focus-visible,
#page-website a:focus-visible,
#page-website .web-info:focus-visible,
#page-website .chart-svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

#page-website .loading-note { font-size: 11px; color: var(--text-3); padding: 14px 18px; }
#page-website [hidden] { display: none; }

/* ---------- state banner and empty state ---------- */

.web-banner {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 11px 14px; margin-bottom: 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border); font-size: 12px; font-weight: 600;
}
.web-banner > span { flex: 1 1 240px; }
.web-banner.is-bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.web-banner.is-warn { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.web-banner.is-info { background: var(--primary-soft-2); border-color: var(--primary-soft); color: var(--primary-dark); }
.web-banner .btn { color: var(--text); }

.web-ico { width: 16px; height: 16px; flex: none; }
.web-cta { margin-top: 14px; }

/* ---------- tabs ---------- */

.web-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 18px; overflow-x: auto; }
.web-tabs button {
    display: flex; align-items: center; gap: 7px; padding: 11px 14px; white-space: nowrap;
    font-size: 12px; font-weight: 700; color: var(--text-2); background: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.web-tabs button:hover { color: var(--text); }
.web-tabs button[aria-selected="true"] { color: var(--primary-dark); border-bottom-color: var(--primary); }
.web-tabs button[hidden] { display: none; }
.web-badge { font-size: 10px; font-weight: 800; background: var(--success-soft); color: var(--success); padding: 1px 7px; border-radius: 999px; }

#webPanel { display: flex; flex-direction: column; gap: 14px; }
#webPanel > .panel + .panel { margin-top: 0; }

/* ---------- answer lines, notes, links ---------- */

.web-answer { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.web-answer.is-small { font-size: 13px; margin-bottom: 10px; }
.web-answer-sub { font-size: 12px; color: var(--text-2); }
.web-muted { font-size: 11px; color: var(--text-3); padding: 12px 16px; margin: 0; }
.web-link { font-size: 11.5px; font-weight: 700; color: var(--primary); background: none; padding: 6px 0; }
.web-link:hover { color: var(--primary-dark); }
.web-link:disabled { color: var(--text-3); cursor: default; }
.web-pb { padding: 14px 16px; }
.web-pb .web-link { margin-top: 10px; }

/* ---------- verdict ---------- */

.web-verdict {
    display: flex; flex-direction: column; gap: 12px; background: var(--identity-gradient);
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 22px 26px;
}
.web-verdict .ab-who .web-status { margin-left: auto; }
.web-verdict h2 { font-size: clamp(18px, 2.2vw, 25px); line-height: 1.25; font-weight: 800; margin: 0; letter-spacing: -.02em; text-wrap: balance; max-width: 40ch; }
.web-verdict p { margin: 0; color: var(--text-2); font-size: 13px; max-width: 68ch; }
.web-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--surface);
    border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--success);
}
.web-verdict.is-dropping .web-status { color: var(--danger); }
.web-verdict.is-steady .web-status { color: var(--text-2); }
.web-ai-note { font-size: 10.5px; color: var(--text-3); }

/* ---------- Pali ---------- */

.ab-pali .web-ico { width: 16px; height: 16px; }
.web-pali-line { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--identity-gradient); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.web-pali-line .ab-pali { flex: none; }
.web-pali-who { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-dark); margin-bottom: 3px; }
.web-answer-sub { margin: 4px 0 0; }
.web-pali-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--primary-soft-2); color: var(--primary-dark); font-size: 10.5px; font-weight: 800; }
.web-pali-tag .web-ico { width: 12px; height: 12px; }
#page-website .web-thinking { display: flex; align-items: center; gap: 10px; }
.web-dots { display: inline-flex; gap: 4px; }
.web-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: web-think 1.2s infinite ease-in-out; }
.web-dots i + i { animation-delay: .15s; }
.web-dots i + i + i { animation-delay: .3s; }
@keyframes web-think { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
#webPanel.web-enter > * { animation: web-in .25s ease-out both; }
@keyframes web-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { #webPanel > *, .web-dots i { animation: none !important; } }

/* ---------- KPIs ---------- */

.web-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.web-kpi { transition: border-color .15s, box-shadow .15s; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.web-kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md, var(--shadow-sm)); }
.web-kpi-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--text-2); }
.web-kpi-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.web-kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.web-kpi-mean { font-size: 11px; color: var(--text-2); margin-top: 6px; }

.web-delta { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.web-delta.is-up { color: var(--success); background: var(--success-soft); }
.web-delta.is-down { color: var(--danger); background: var(--danger-soft); }
.web-delta.is-flat { color: var(--text-2); background: var(--surface-soft); }

.web-info {
    position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; flex: none;
    border-radius: 50%; border: 1.5px solid var(--text-3); color: var(--text-3);
    font-size: 9.5px; font-weight: 800; cursor: help;
}
.web-info:hover::after, .web-info:focus::after {
    content: attr(data-tip); position: absolute; left: 50%; top: 22px; transform: translateX(-50%);
    width: 220px; padding: 8px 10px; border-radius: 8px; z-index: 5;
    background: var(--text); color: var(--surface); font-weight: 500; font-size: 11px; line-height: 1.45; text-align: left;
}

/* ---------- layout ---------- */

.web-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; }
.web-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.web-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.web-grid, .web-two { align-items: start; }
.web-grid > .panel, .web-two > .panel { margin-top: 0; }

.web-chart { position: relative; padding: 6px 10px 10px; }
.web-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 11px; color: var(--text-2); }
.web-legend span { display: inline-flex; align-items: center; gap: 6px; }
.web-sw { display: inline-block; width: 16px; border-top: 2.5px solid var(--primary); }
.web-sw.is-prev { border-top: 2px dashed var(--text-3); }
.web-pin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--web-ga); }
#page-website .chart-pin-line { stroke: var(--web-ga); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; pointer-events: none; }
#page-website .chart-pin { fill: var(--surface); stroke: var(--web-ga); stroke-width: 2.5; }

/* ---------- what to know ---------- */

.web-ins { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.web-ins:last-child { border-bottom: 0; }
.web-ins-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft-2); color: var(--primary); }
.web-ins.is-win .web-ins-ic { background: var(--success-soft); color: var(--success); }
.web-ins.is-watch .web-ins-ic { background: var(--danger-soft); color: var(--danger); }
.web-ins-k { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-dark); }
.web-ins.is-win .web-ins-k { color: var(--success); }
.web-ins.is-watch .web-ins-k { color: var(--danger); }
.web-ins p { margin: 3px 0 4px; font-size: 12.5px; }

/* ---------- tables ---------- */

#page-website table { min-width: 0; table-layout: auto; }
#page-website td.r { white-space: nowrap; }
#page-website td, #page-website th { overflow-wrap: normal; word-break: normal; }
.web-sm-only { display: none; }
.web-sm-only .web-tag { margin-top: 6px; }
#page-website .panel-header { flex-wrap: wrap; gap: 8px 12px; }
#page-website tbody tr { cursor: default; }
#page-website td { font-size: 11.5px; font-variant-numeric: tabular-nums; }
#page-website th { font-size: 9.5px; }
#page-website td.r, #page-website th.r { text-align: right; }
.web-url { display: block; font-size: 10px; color: var(--text-3); margin-top: 2px; overflow-wrap: anywhere; }

.web-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; }
.web-tag.is-good { background: var(--success-soft); color: var(--success); }
.web-tag.is-bad { background: var(--danger-soft); color: var(--danger); }
.web-tag.is-gem { background: var(--warning-soft); color: var(--warning); }
.web-tag.is-neutral { background: var(--surface-soft); color: var(--text-2); }

.web-minibar { display: inline-block; width: 60px; height: 6px; margin-left: 8px; vertical-align: middle; border-radius: 99px; background: var(--surface-soft); overflow: hidden; }
.web-minibar i { display: block; height: 100%; background: var(--primary); }

.web-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 16px; border-top: 1px solid var(--border); background: var(--surface-soft); font-size: 11px; color: var(--text-3); }
.web-pager { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- shares: stack, split, bars ---------- */

.web-c0 { background: var(--primary); }
.web-c1 { background: var(--purple); }
.web-c2 { background: var(--primary-2); }
.web-c3 { background: var(--text-3); }
.web-c4 { background: var(--success); }
.web-c5 { background: var(--primary-soft); }

.web-stack, .web-split { display: flex; gap: 2px; overflow: hidden; border-radius: 999px; }
.web-stack { height: 14px; margin: 0 0 12px; }
.web-split { height: 10px; margin-top: 10px; }
.web-stack span, .web-split span { display: block; height: 100%; }
.web-stack-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 11.5px; }
.web-stack-leg div { display: inline-flex; gap: 6px; }
.web-stack-leg i { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 3px; }

.web-fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.web-fact-lbl { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.web-fact-big { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.web-fact p { margin: 8px 0 0; font-size: 11.5px; color: var(--text-2); }

.web-bar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 46px; gap: 10px; align-items: center; padding: 6px 0; font-size: 11.5px; }
.web-bar b { text-align: right; }
.web-track { height: 8px; background: var(--surface-soft); border-radius: 99px; overflow: hidden; }
.web-track i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- heatmap: 7 weekdays x 12 two-hour buckets ---------- */

.web-heat { display: grid; grid-template-columns: 30px repeat(12, minmax(0, 1fr)); gap: 3px; font-size: 9.5px; color: var(--text-3); }
.web-heat-h { text-align: center; }
.web-heat-cell { height: 22px; border-radius: 4px; background: color-mix(in srgb, var(--primary) calc(var(--v) * 100%), var(--surface-soft)); }
.web-heat-cell.is-best { outline: 2px solid var(--primary-dark); outline-offset: -2px; }
.web-heat-d { align-self: center; }

/* ---------- responsive ---------- */

@media (max-width: 1150px) {
    .web-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .web-grid { grid-template-columns: 1fr; }
    .web-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .web-two, .web-three { grid-template-columns: 1fr; }
    .web-kpi-value { font-size: 22px; }
    .web-controls { justify-content: flex-start; }
    .web-seg { max-width: 100%; overflow-x: auto; }
    .web-bar { grid-template-columns: 80px minmax(0, 1fr) 40px; }
    .web-sm-hide { display: none; }
    .web-sm-only { display: block; }
    #page-website .panel-header { flex-direction: column; align-items: flex-start; }
}
