/* TAG.VU components — plain CSS on top of tokens.css. Class prefix: tv-.
   Every colour comes from a semantic token, so a section with data-theme="dark"
   re-themes everything inside it. */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
}

/* ---------- Base ---------- */

[data-theme] {
  background-color: var(--ground);
  color: var(--fg);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 27px;
  -webkit-font-smoothing: antialiased;
}

.tv-wrap {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter-wide));
  margin-inline: auto;
  padding-inline: var(--gutter);
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .tv-wrap { padding-inline: var(--gutter-wide); }
}

.tv-section {
  padding-block: var(--space-16);
}

@media (min-width: 900px) {
  .tv-section { padding-block: var(--space-24); }
}

.tv-section--alt { background: var(--ground-alt); }

.tv-icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Button ---------- */

.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-6);
  box-sizing: border-box;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.tv-btn:hover { background: var(--brand-hover); }

.tv-btn .tv-icon { width: 18px; height: 18px; transition: transform var(--dur) var(--ease-out); }
.tv-btn:hover .tv-icon--trail { transform: translateX(3px); }

.tv-btn--secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--fg);
}

.tv-btn--secondary:hover {
  background: transparent;
  border-color: var(--fg);
}

.tv-btn--quiet {
  background: transparent;
  color: var(--fg);
  padding-inline: var(--space-3);
}

.tv-btn--quiet:hover {
  background: var(--sunken);
}

.tv-btn--danger {
  background: var(--danger);
  color: var(--on-danger);
}

.tv-btn--danger:hover { background: var(--danger); filter: brightness(.94); }

.tv-btn--sm { min-height: 36px; padding-inline: var(--space-4); font-size: 14px; }
.tv-btn--lg { min-height: 52px; padding-inline: var(--space-8); font-size: 16px; }

.tv-btn:disabled,
.tv-btn[aria-disabled="true"] {
  background: var(--sunken);
  border-color: var(--line);
  color: var(--fg-disabled);
  cursor: not-allowed;
}

.tv-btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* ---------- Tag label (the signature) ----------
   The logo's tag end: square body, 45-degree cut on both right corners leaving a
   flat tip one third of the height, and an eyelet punched through the end. */

.tv-tag {
  --tag-h: 26px;
  --tag-cut: calc(var(--tag-h) / 3);
  --tag-hole: 2px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--tag-h);
  padding: 0 calc(var(--tag-cut) + 10px) 0 10px;
  box-sizing: border-box;
  background: var(--tag);
  color: var(--brand-text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - var(--tag-cut)) 0, 100% var(--tag-cut), 100% calc(100% - var(--tag-cut)), calc(100% - var(--tag-cut)) 100%, 0 100%);
  -webkit-mask: radial-gradient(circle at calc(100% - var(--tag-cut) / 2) 50%, #0000 var(--tag-hole), #000 calc(var(--tag-hole) + .5px));
  mask: radial-gradient(circle at calc(100% - var(--tag-cut) / 2) 50%, #0000 var(--tag-hole), #000 calc(var(--tag-hole) + .5px));
}

.tv-tag .tv-icon { width: 14px; height: 14px; }

.tv-tag--solid { background: var(--brand); color: var(--on-brand); }
.tv-tag--live { background: var(--live); color: var(--on-live); }
.tv-tag--ink { background: var(--ground-inverse); color: var(--fg-inverse); }

.tv-tag--lg {
  --tag-h: 34px;
  --tag-hole: 2.75px;
  padding-left: 14px;
  padding-right: calc(var(--tag-cut) + 14px);
  font-size: 13px;
}

/* ---------- Status chip ---------- */

.tv-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tv-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex: none;
}

.tv-status--live { background: var(--live); color: var(--on-live); box-shadow: var(--shadow-voltage); }
.tv-status--active { background: var(--brand-tint); box-shadow: none; color: var(--brand-text); }
.tv-status--danger { background: var(--danger-tint); box-shadow: none; color: var(--danger-text); }
.tv-status--warning { background: var(--warning-tint); box-shadow: none; color: var(--warning-text); }

.tv-status--live::before { animation: tv-pulse 1.6s var(--ease-out) infinite; }

@keyframes tv-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 7px color-mix(in oklab, currentColor 0%, transparent); }
}

/* ---------- Card (tag cut) ----------
   Two layers: the element paints the edge colour and is clipped to the tag cut;
   ::before paints the fill, inset by the edge width with the cut moved in to stay
   parallel (0.586 = 2 - sqrt 2). Focus thickens the edge instead of an outline,
   which clip-path would cut off. */

.tv-card {
  --cut: var(--cut-md);
  --edge: var(--line);
  --edge-w: 1px;
  --fill: var(--raised);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-6);
  background: var(--edge);
  color: var(--fg);
  text-decoration: none;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

.tv-card::before {
  content: "";
  position: absolute;
  inset: var(--edge-w);
  z-index: -1;
  background: var(--fill);
  clip-path: polygon(0 0, calc(100% - var(--cut) + var(--edge-w) * .586) 0, 100% calc(var(--cut) - var(--edge-w) * .586), 100% 100%, 0 100%);
}

@media (min-width: 900px) {
  .tv-card { padding: var(--space-8); }
}

a.tv-card:hover { --edge: var(--line-strong); }
a.tv-card:focus-visible { outline: none; --edge: var(--focus); --edge-w: 3px; }

.tv-card--sm { --cut: var(--cut-sm); padding: var(--space-4); gap: var(--space-2); }
.tv-card--lg { --cut: var(--cut-lg); }
.tv-card--tint { --fill: var(--brand-tint); --edge: var(--brand-line); }

.tv-card__icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--tag);
  color: var(--brand-text);
}

.tv-card__eyebrow {
  margin: 0;
  color: var(--brand-text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tv-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.005em;
  text-wrap: balance;
}

.tv-card__body {
  margin: 0;
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 23px;
}

.tv-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
  color: var(--brand-text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.tv-card__link .tv-icon { width: 18px; height: 18px; transition: transform var(--dur) var(--ease-out); }
a.tv-card:hover .tv-card__link .tv-icon { transform: translateX(3px); }

.tv-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* ---------- Section header ---------- */

.tv-section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: var(--measure);
  margin-bottom: var(--space-12);
}

.tv-section-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.tv-section-head__lede {
  margin: 0;
  color: var(--fg-muted);
  font-size: 20px;
  line-height: 31px;
}

.tv-section-head--center {
  align-items: center;
  margin-inline: auto;
  text-align: center;
}

@media (max-width: 639px) {
  .tv-section-head__title { font-size: 26px; }
  .tv-section-head__lede { font-size: 18px; line-height: 28px; }
}

/* ---------- Actor response ---------- */

.tv-actors {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.tv-actors__row {
  display: grid;
  grid-template-columns: 9.5rem 24px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.tv-actors__arrow { color: var(--fg-muted); }

.tv-actors__response {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
  font-size: 17px;
  line-height: 27px;
}

@media (max-width: 639px) {
  .tv-actors__row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .tv-actors__arrow { display: none; }
}

/* ---------- Scan record ---------- */

.tv-scan {
  --cut: var(--cut-sm);
  --edge: var(--line);
  --edge-w: 1px;
  --fill: var(--sunken);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-3) calc(var(--space-4) + var(--cut)) var(--space-3) var(--space-4);
  background: var(--edge);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  letter-spacing: .01em;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

.tv-scan::before {
  content: "";
  position: absolute;
  inset: var(--edge-w);
  z-index: -1;
  background: var(--fill);
  clip-path: polygon(0 0, calc(100% - var(--cut) + var(--edge-w) * .586) 0, 100% calc(var(--cut) - var(--edge-w) * .586), 100% 100%, 0 100%);
}

.tv-scan__time { color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.tv-scan__serial { font-weight: 600; letter-spacing: .04em; }
.tv-scan__actor { color: var(--fg-muted); text-transform: uppercase; letter-spacing: .08em; }
.tv-scan__place { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--fg-muted); }
.tv-scan__place .tv-icon { width: 14px; height: 14px; }

.tv-scan__proof {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  color: var(--live-text);
  font-weight: 600;
}

.tv-scan__proof .tv-icon { width: 16px; height: 16px; }

/* The record of a tap that just happened: the edge takes the live colour. */
.tv-scan--live { --edge: var(--live-text); }

.tv-scan-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------- Field ---------- */

.tv-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.tv-field__label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  color: var(--fg);
}

.tv-field__optional { font-weight: 400; color: var(--fg-muted); }

.tv-field__hint {
  margin: 0;
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 23px;
}

.tv-input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  box-sizing: border-box;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 24px;
}

.tv-input::placeholder { color: var(--fg-muted); opacity: 1; }
.tv-input:hover { border-color: var(--fg-muted); }
.tv-input:focus-visible { border-color: var(--focus); }

.tv-input--serial {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

textarea.tv-input { min-height: 120px; resize: vertical; }

.tv-field--error .tv-input { border-color: var(--danger-text); }

.tv-field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  color: var(--danger-text);
  font-size: 15px;
  line-height: 23px;
  font-weight: 700;
}

.tv-field__error .tv-icon { width: 18px; height: 18px; margin-top: 2px; }

/* ---------- Notice ---------- */

.tv-notice {
  --notice-ink: var(--fg);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sunken);
  color: var(--fg);
}

.tv-notice > .tv-icon { color: var(--notice-ink); margin-top: 2px; }

.tv-notice__title {
  margin: 0;
  color: var(--notice-ink);
  font-size: 15px;
  line-height: 23px;
  font-weight: 700;
}

.tv-notice__body {
  grid-column: 2;
  margin: 0;
  color: var(--fg-muted);
  font-size: 15px;
  line-height: 23px;
}

.tv-notice--success { --notice-ink: var(--brand-text); background: var(--brand-tint); border-color: var(--brand-line); }
.tv-notice--warning { --notice-ink: var(--warning-text); background: var(--warning-tint); border-color: color-mix(in oklab, var(--warning-text) 30%, transparent); }
.tv-notice--danger { --notice-ink: var(--danger-text); background: var(--danger-tint); border-color: color-mix(in oklab, var(--danger-text) 30%, transparent); }

/* ---------- Site header ---------- */

.tv-header {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--ground);
}

.tv-header__logo { display: inline-flex; flex: none; }
.tv-header__logo img { display: block; height: 22px; width: auto; }

.tv-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tv-header__link {
  color: var(--fg);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.tv-header__link:hover { text-decoration-line: underline; text-decoration-color: var(--brand); }
.tv-header__link[aria-current="page"] { text-decoration-line: underline; text-decoration-color: var(--brand); }

.tv-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.tv-header__menu { display: none; }

@media (max-width: 799px) {
  .tv-header__nav, .tv-header__actions .tv-btn--quiet { display: none; }
  .tv-header__menu { display: inline-flex; }
}

/* ---------- Hero ---------- */

.tv-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-12);
  align-items: center;
  padding-block: var(--space-16);
}

@media (min-width: 960px) {
  .tv-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); padding-block: var(--space-24); }
}

.tv-hero__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-6);
  min-width: 0;
}

.tv-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.tv-hero__title em { font-style: normal; color: var(--brand-text); }

.tv-hero__lede {
  margin: 0;
  max-width: 34em;
  color: var(--fg-muted);
  font-size: 20px;
  line-height: 31px;
}

@media (max-width: 639px) {
  .tv-hero__title { font-size: 44px; line-height: 1.02; }
  .tv-hero__lede { font-size: 18px; line-height: 28px; }
}

/* ---------- Prose (CMS rich text) ---------- */

.tv-prose {
  max-width: var(--measure);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 27px;
}

.tv-prose > :where(*) { margin-block: 0; }
.tv-prose > :where(* + *) { margin-top: var(--space-4); }

.tv-prose :where(h2, h3, h4) {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
}

.tv-prose > :where(h2) { margin-top: var(--space-12); font-size: 32px; line-height: 1.15; letter-spacing: -.01em; }
.tv-prose > :where(h3) { margin-top: var(--space-8); font-size: 24px; line-height: 1.25; }
.tv-prose > :where(h4) { margin-top: var(--space-6); font-size: 19px; line-height: 1.35; }
.tv-prose > :where(h2, h3, h4) + :where(*) { margin-top: var(--space-3); }
.tv-prose > :first-child { margin-top: 0; }

.tv-prose :where(a) {
  color: var(--brand-text);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.tv-prose :where(a:hover) { text-decoration-thickness: 2.5px; }
.tv-prose :where(strong) { font-weight: 700; }
.tv-prose :where(ul, ol) { padding-left: 1.25em; }
.tv-prose :where(li + li) { margin-top: var(--space-2); }
.tv-prose :where(li)::marker { color: var(--brand-text); }

.tv-prose :where(blockquote) {
  padding-left: var(--space-6);
  border-left: 3px solid var(--brand);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
}

.tv-prose :where(code) {
  padding: .1em .35em;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  font-family: var(--font-mono);
  font-size: .88em;
}

.tv-prose :where(hr) {
  margin-block: var(--space-12);
  border: 0;
  border-top: 1px solid var(--line);
}

.tv-prose :where(img, video) { max-width: 100%; height: auto; border-radius: var(--radius-md); }
.tv-prose :where(figcaption) { margin-top: var(--space-2); color: var(--fg-muted); font-size: 13px; line-height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .tv-status--live::before { animation: none; }
  .tv-btn, .tv-btn .tv-icon, .tv-card__link .tv-icon { transition: none; }
}
