/*
 * Clef Weekend Cup (css/cup.css): /cup only, after css/clef.css and built on its tokens. A page head with the cup's
 * clock and facts, the standings (rows like the practice leaderboard's, a two line card on phones), how to enter as
 * three cards on the alabaster band, and the rules in a cream panel. Checked from 320 px: names, labels and commands
 * wrap anywhere, no horizontal scroll, tap targets of 44 px on touch screens.
 * CSP: no inline styles.
 */

main[data-cup-root] { min-height: calc(100svh - var(--hdr-h, 64px)); }

/* ------------------------------------------------------------------ page head */

.cp-head { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--cream), var(--paper) 78%); }
.cp-head .wrap { position: relative; z-index: 1; }
.cp-head .eyebrow { margin-bottom: 14px; overflow-wrap: anywhere; }
.cp-tagline { margin-top: 12px; max-width: 640px; font: 600 clamp(20px, 2.6vw, 28px)/1.3 var(--display); letter-spacing: -.015em; color: var(--ink); text-wrap: balance; }
.cp-staff { overflow: visible; pointer-events: none; }
.cp-staff .staff-lines path { stroke: var(--staff-soft, #fde2bd); stroke-width: 1.5; fill: none; }
.cp-staff .staff-note { fill: var(--amber-soft, #fdd7a3); }
.cp-staff .staff-spark { fill: var(--spark, #f8a225); }
@media (max-width: 1100px) { .cp-staff { display: none; } }

.cp-clock { display: grid; gap: 8px; margin-top: 22px; max-width: 700px; }
.cp-count { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.cp-chip { flex: none; }
.cp-chip .dot { background: var(--faint); }
.cp-chip.is-live .dot { background: var(--orange); animation: pulse 1.6s var(--ease) infinite; }
.cp-chip.is-final .dot { background: var(--ink); }
.cp-count-k { font: 600 12.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.cp-count-v { font: 600 clamp(26px, 3.6vw, 36px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.cp-count-v:empty { display: none; }
.cp-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; font-size: 14px; line-height: 1.5; color: var(--body); }
.cp-when[hidden] { display: none; }
.cp-when-k { flex: none; font: 600 11px/1.4 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cp-when-v { min-width: 0; font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .cp-chip.is-live .dot { animation: none; } }

.cp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.cp-actions .btn { display: inline-flex; gap: 6px; }
.cp-share { display: inline-flex; flex-wrap: wrap; gap: 10px; min-width: 0; }
.cp-share[hidden], .cp-share [hidden] { display: none; }

.cp-facts { display: grid; grid-template-columns: repeat(6, minmax(0, auto)); justify-content: start; gap: 16px 36px; margin: 28px 0 0; }
.cp-facts[hidden] { display: none; }
.cp-facts > div { display: grid; align-content: start; gap: 6px; min-width: 0; }
.cp-facts dt { font: 600 11.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cp-facts dd { display: grid; gap: 3px; margin: 0; min-width: 0; font: 500 22px/1.15 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--ink); min-height: 25px; }
.cp-fact-sub { font: 500 12.5px/1.4 var(--sans); letter-spacing: 0; color: var(--muted); overflow-wrap: anywhere; }
.cp-num { color: inherit; text-decoration: underline; text-decoration-color: var(--amber-soft); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.cp-num:hover { text-decoration-color: var(--orange); }
@media (max-width: 1100px) { .cp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; } .cp-facts dd { font-size: 19px; } }

.cp-cups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.cp-cups[hidden] { display: none; }
.cp-cups .btn { display: inline-flex; gap: 6px; }

/* ------------------------------------------------------------------ sections */

.cp-sec { padding-top: clamp(36px, 5vw, 56px); }
.cp-sec-last { padding-bottom: clamp(48px, 7vw, 80px); }
.cp-band { margin-top: clamp(40px, 6vw, 72px); padding-block: clamp(48px, 7vw, 88px); }
.cp-sec-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 40px; align-items: end; margin-bottom: 22px; }
.cp-sec-head > div:first-child { display: grid; gap: 10px; min-width: 0; }
.cp-sec-head .eyebrow { overflow-wrap: anywhere; }
.cp-sec-note { max-width: 460px; font-size: 14px; line-height: 1.6; color: var(--body); }
@media (max-width: 860px) { .cp-sec-head { grid-template-columns: minmax(0, 1fr); align-items: start; } }

/* ------------------------------------------------------------------ the standings */

.cp-seg { justify-self: start; }
.cp-you { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; padding: 10px 14px; border: 1.5px solid var(--amber); border-radius: var(--r-md); background: var(--cream); font-size: 14px; line-height: 1.5; color: var(--rust); overflow-wrap: anywhere; }
.cp-you[hidden] { display: none; }
.cp-you-ico { flex: none; display: inline-flex; margin-top: 2px; }
.cp-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--paper); }
.cp-list:has(.cp-empty-box), .cp-list:has(.cp-empty) { border: 0; background: none; }
.cp-empty { padding: 12px 0; font-size: 14px; color: var(--muted); }
.cp-empty-box { display: grid; justify-items: center; gap: 10px; padding: 36px 18px; border: 1px dashed var(--line-2); border-radius: var(--r-md); background: var(--alabaster); text-align: center; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.cp-empty-box p { max-width: 60ch; text-wrap: balance; overflow-wrap: anywhere; }
.cp-empty-ico { display: inline-flex; color: var(--faint); }

.cp-row { display: grid; grid-template-columns: 44px minmax(0, 1.8fr) minmax(0, .6fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, .8fr); align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 14px; }
.cp-head-row { border-top: 0; background: var(--alabaster); padding-block: 11px; font: 600 11px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cp-row .num { text-align: right; }
.cp-rank { font: 600 14px/1.2 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.cp-nick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font: 600 14.5px/1.3 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.cp-name { min-width: 0; overflow-wrap: anywhere; }
.cp-tag { flex: none; padding: 3px 7px; border-radius: 999px; background: var(--chip); color: var(--rust); font: 600 10.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.cp-tag-model { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.cp-tag-bench { background: var(--ink); color: #fff; }
.cp-agent { flex: 1 1 100%; min-width: 0; font: 500 12px/1.4 var(--sans); color: var(--muted); overflow-wrap: anywhere; }
.cp-c { min-width: 0; }
/* the label is read by screen readers on every width and shown on phones, where the header row is hidden */
.cp-k { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cp-v { font: 500 13.5px/1.2 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.cp-mean .cp-v { font-weight: 600; }
.cp-row.is-you { background: #fff8f3; box-shadow: inset 3px 0 0 var(--orange); }
.cp-row.is-bench { background: var(--alabaster); }
.cp-row.is-prov .cp-rank, .cp-row.is-prov .cp-mean .cp-v { color: var(--muted); }
.cp-note { margin-top: 10px; max-width: 80ch; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.cp-note:empty { display: none; }
@media (max-width: 720px) {
  .cp-head-row { display: none; }
  .cp-row { grid-template-columns: 34px repeat(3, minmax(0, 1fr)); grid-template-areas: 'rank nick nick mean' 'rank hours vs above'; gap: 8px 12px; padding: 14px 16px; }
  .cp-row:nth-child(2) { border-top: 0; }
  .cp-rank { grid-area: rank; align-self: start; }
  .cp-nick { grid-area: nick; font-size: 13.5px; }
  .cp-mean { grid-area: mean; }
  .cp-hours { grid-area: hours; }
  .cp-vs { grid-area: vs; }
  .cp-above { grid-area: above; }
  .cp-row .num { text-align: left; }
  .cp-mean.num { text-align: right; }
  .cp-c { display: grid; gap: 3px; }
  .cp-k { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; font: 600 10px/1.15 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
}

/* ------------------------------------------------------------------ how to enter */

.cp-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; }
.cp-way { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.cp-way-k { display: inline-flex; align-items: center; gap: 10px; font: 600 12.5px/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--orange-text); }
.cp-way-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--chip); color: var(--rust); font: 600 13px/1 var(--mono); letter-spacing: 0; }
.cp-way-title { font: 600 20px/1.3 var(--display); letter-spacing: -.015em; color: var(--ink); }
.cp-way-text { font-size: 14.5px; line-height: 1.6; color: var(--body); overflow-wrap: anywhere; }
.cp-way .arrow-link { margin-top: auto; }
.cp-code { align-self: stretch; min-width: 0; }
.cp-code .code-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-code .copy-btn { flex: none; }
/* a command wraps inside its card instead of scrolling it sideways on a phone */
.cp-code pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 960px) { .cp-ways { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .cp-way { padding: 18px 16px; } }

/* ------------------------------------------------------------------ rules */

.cp-rules { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px clamp(24px, 4vw, 56px); padding: clamp(22px, 3vw, 32px); border: 1.5px solid var(--amber); border-radius: var(--r-md); background: var(--cream); }
.cp-rules-head { display: grid; gap: 10px; align-content: start; min-width: 0; }
.cp-rule-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.cp-rule-list li { position: relative; padding-left: 22px; font-size: 15px; line-height: 1.6; color: var(--body); overflow-wrap: anywhere; }
.cp-rule-list li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.cp-rule-list b { color: var(--ink); }
@media (max-width: 860px) { .cp-rules { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ touch: 44 px targets */

@media (max-width: 820px), (pointer: coarse) {
  .cp-seg button { height: 44px; padding: 0 16px; }
  .cp-num { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 420px) {
  .cp-seg { display: flex; width: 100%; }
  .cp-seg button { flex: 1 1 0; padding: 0 8px; }
  .cp-actions > .btn, .cp-share, .cp-share .btn { flex: 1 1 auto; justify-content: center; }
}
