/* WPT results page. Builds on the tokens and components in styles.css. */

.wpt-page {
  --wpt-pass: #4ade80;
  --wpt-fail: #f87171;
  --wpt-warn: #fbbf24;
  --wpt-info: #38bdf8;
  --wpt-focus: #38bdf8;
}

.wpt-page :focus-visible {
  outline: 2px solid var(--wpt-focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.wpt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wpt-skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10001;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  color: var(--text);
  font-weight: 600;
  transform: translateY(-200%);
}
.wpt-skip:focus { transform: none; }

.mono { font-family: var(--mono); }

/* The nav is transparent until scroll on the home page; keep it legible here too */
.wpt-page header.nav { background: rgba(6,8,16,0.7); backdrop-filter: blur(18px); border-bottom-color: var(--border); }
.wpt-page .nav-links a.lnk::after { display: none; }

/* ---------- layout ---------- */
.wpt-page .wpt-section { padding: 84px 0; }
.wpt-page .wpt-section + .wpt-section { border-top: 1px solid var(--border); }
.wpt-narrow { max-width: 1000px; }

.wpt-head { margin-bottom: 36px; }
.wpt-head .eyebrow { margin-bottom: 14px; }
.wpt-page h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.wpt-subhead {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 34px 0 12px;
}

.wpt-prose p {
  color: var(--text-dim);
  font-size: 1.08rem;
  line-height: 1.7;
  max-width: 72ch;
}
.wpt-prose p + p { margin-top: 16px; }

.wpt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
}

/* ---------- hero ---------- */
.wpt-page .wpt-hero {
  padding: 150px 0 90px;
  background:
    radial-gradient(60% 70% at 85% 10%, rgba(37,99,235,0.14), transparent 62%),
    radial-gradient(50% 60% at 5% 0%, rgba(124,58,237,0.12), transparent 60%);
}
.wpt-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 56px;
  align-items: center;
}
.wpt-hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin-bottom: 22px;
  text-wrap: balance;
}
.wpt-lede {
  font-size: 1.16rem;
  color: var(--text-dim);
  max-width: 560px;
  margin-bottom: 34px;
}
.wpt-hero .hero-actions { margin-bottom: 0; }
.wpt-page .hero-actions { justify-content: flex-start; }

.wpt-scorecard {
  background: linear-gradient(180deg, rgba(16,19,31,0.92), rgba(11,13,26,0.92));
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 34px 28px 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}
.wpt-ring {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 26px;
}
.wpt-ring-svg { width: 100%; height: 100%; }
.wpt-score {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 0 34px;
}
.wpt-score-num {
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.wpt-score-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.35;
  max-width: 13em;
}
.wpt-figures {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
}
.wpt-figures li + li { border-left: 1px solid var(--border); }
.wpt-figures li { padding: 0 6px; }
.wpt-figures .n {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(0.92rem, 1.5vw, 1.08rem);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.wpt-figures .l {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ---------- progress chart ---------- */
.wpt-chart figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 26px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.wpt-delta {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--wpt-pass);
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.28);
  white-space: nowrap;
}
.wpt-chart { --wpt-label-w: 190px; --wpt-value-w: 76px; }
.wpt-bars { list-style: none; }
.wpt-bar-row {
  display: grid;
  grid-template-columns: var(--wpt-label-w) minmax(0, 1fr) var(--wpt-value-w);
  align-items: center;
  gap: 16px;
  padding: 9px 0;
}
.wpt-bar-label { font-size: 0.95rem; color: var(--text-dim); }
.wpt-bar-row--current .wpt-bar-label { color: var(--text); font-weight: 600; }
.wpt-bar-track {
  display: block;
  height: 26px;
  border-radius: 7px;
  background: rgba(255,255,255,0.045);
  overflow: hidden;
}
.wpt-bar-fill {
  display: block;
  height: 100%;
  border-radius: 7px 0 0 7px;
  background: var(--grad);
}
/* earlier runs are hatched and outlined so the distinction does not rely on color */
.wpt-bar-row--previous .wpt-bar-fill,
.wpt-bar-row--past .wpt-bar-fill {
  background: repeating-linear-gradient(135deg, rgba(154,161,184,0.5) 0 2px, rgba(154,161,184,0.12) 2px 8px);
  box-shadow: inset 0 0 0 1px rgba(154,161,184,0.55);
}
.wpt-bar-value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wpt-bar-row--previous .wpt-bar-value,
.wpt-bar-row--past .wpt-bar-value { color: var(--text-dim); }
.wpt-bar-axis {
  margin: 4px calc(var(--wpt-value-w) + 16px) 0 calc(var(--wpt-label-w) + 16px);
  border-top: 1px solid var(--border-bright);
}
.wpt-bar-axis-inner { position: relative; display: block; height: 26px; }
.wpt-bar-axis-inner span {
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.wpt-bar-axis-inner span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 1px;
  height: 5px;
  background: var(--border-bright);
}
.wpt-bar-axis-inner span:first-child { transform: none; }
.wpt-bar-axis-inner span:first-child::before { left: 0; }
.wpt-bar-axis-inner span:last-child { transform: translateX(-100%); }
.wpt-bar-axis-inner span:last-child::before { left: 100%; }

/* ---------- meaning ---------- */
.wpt-focus {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.wpt-focus li {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
}
.wpt-note { margin-top: 14px; font-size: 0.9rem; color: var(--text-dim); }

/* ---------- breakdown ---------- */
.wpt-stack {
  display: flex;
  gap: 2px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
}
.wpt-stack-seg { flex-basis: 0; flex-shrink: 0; min-width: 4px; }
.wpt-stack-seg--pass { background: var(--wpt-pass); }
.wpt-stack-seg--fail { background: repeating-linear-gradient(135deg, var(--wpt-fail) 0 3px, rgba(248,113,113,0.45) 3px 6px); }
.wpt-stack-seg--notrun { background: var(--text-dim); }
.wpt-stack-seg--precondition_failed { background: var(--wpt-warn); }
.wpt-stack-seg--timeout { background: var(--wpt-info); }
.wpt-stack-note { margin: 12px 0 22px; font-size: 0.85rem; color: var(--text-dim); }

.wpt-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wpt-table th, .wpt-table td {
  padding: 14px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-dim);
}
.wpt-table thead th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 0;
}
.wpt-table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.wpt-table .num + .num { padding-left: 18px; }
.wpt-table tbody th { color: var(--text); font-weight: 600; }
.wpt-table tbody td { color: var(--text); }
.wpt-table .wpt-row--pass th, .wpt-table .wpt-row--pass td { font-size: 1.12rem; font-weight: 800; color: #fff; }
.wpt-table tfoot th, .wpt-table tfoot td { border-bottom: none; color: var(--text); font-weight: 700; padding-bottom: 0; }

.wpt-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 12px;
  vertical-align: -1px;
  border-radius: 3px;
}
.wpt-mark--pass { background: var(--wpt-pass); }
.wpt-mark--fail { background: repeating-linear-gradient(135deg, var(--wpt-fail) 0 2px, rgba(248,113,113,0.35) 2px 4px); }
.wpt-mark--notrun { border: 2px solid var(--text-dim); }
.wpt-mark--precondition_failed { background: var(--wpt-warn); transform: rotate(45deg) scale(0.85); border-radius: 2px; }
.wpt-mark--timeout { border: 2px dotted var(--wpt-info); border-radius: 50%; }

/* ---------- methodology ---------- */
.wpt-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.wpt-fact {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.wpt-fact:nth-child(odd) { border-right: 1px solid var(--border); }
.wpt-fact:nth-last-child(-n+2) { border-bottom: none; }
.wpt-fact dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.wpt-fact dd {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.wpt-fact dd.mono { font-size: 0.86rem; font-weight: 500; }

.wpt-equation {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text) !important;
  font-size: 0.95rem !important;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.wpt-verify {
  margin-top: 36px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--surface);
}
.wpt-verify summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
}
.wpt-verify summary::-webkit-details-marker { display: none; }
.wpt-verify summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  flex-shrink: 0;
}
.wpt-verify[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.wpt-verify summary:hover { background: rgba(255,255,255,0.03); }
.wpt-verify-list { padding: 0 22px 8px; }
.wpt-verify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.wpt-verify-row dt {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.wpt-verify-row dd {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
  min-width: 0;
}
.wpt-verify-row dd:not(.wpt-digest) { grid-column: 1 / -1; }
.wpt-digest { word-break: break-all; }
.wpt-copy {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.wpt-copy:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.wpt-copy.ok { color: var(--wpt-pass); border-color: rgba(34,197,94,0.4); }

/* ---------- project + follow ---------- */
.wpt-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.wpt-page h2.wpt-card-title { font-size: 1.45rem; letter-spacing: -0.02em; margin-bottom: 14px; }
.wpt-pair p { color: var(--text-dim); font-size: 1rem; line-height: 1.7; }
.wpt-pair p + p { margin-top: 12px; }

.wpt-follow h2 { margin-bottom: 26px; }
.wpt-follow .hero-actions { margin-bottom: 44px; }
.wpt-footnote {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 76ch;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.wpt-page .footer-col a[aria-current="page"] { color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .wpt-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .wpt-scorecard { max-width: 460px; width: 100%; margin: 0 auto; }
  .wpt-page .wpt-hero { padding: 128px 0 70px; }
}
@media (max-width: 720px) {
  .wpt-page .wpt-section { padding: 62px 0; }
  .wpt-page .container { padding: 0 18px; }
  .wpt-card { padding: 22px 18px; }
  .wpt-facts, .wpt-pair { grid-template-columns: minmax(0, 1fr); }
  .wpt-fact:nth-child(odd) { border-right: none; }
  .wpt-fact:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  .wpt-bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 11px 0; }
  .wpt-bar-label { grid-column: 1; grid-row: 1; }
  .wpt-bar-value { grid-column: 2; grid-row: 1; }
  .wpt-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .wpt-bar-axis { margin-left: 0; margin-right: 0; }
  .wpt-verify summary { padding: 16px 18px; }
  .wpt-verify-list { padding: 0 18px 6px; }
  .wpt-hero .hero-actions .btn { white-space: normal; text-align: left; }
}
@media (max-width: 420px) {
  .wpt-scorecard { padding: 26px 16px 20px; }
  .wpt-figures .n { font-size: 0.82rem; }
  .wpt-figures .l { font-size: 0.72rem; }
  .wpt-table th, .wpt-table td { font-size: 0.9rem; padding: 12px 2px; }
  .wpt-table .wpt-row--pass th, .wpt-table .wpt-row--pass td { font-size: 0.98rem; }
  .wpt-mark { margin-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
