/* =============================================================
   PartyPool — shared components
   Requires tokens.css to be loaded first.
   No hex values here — only token references.
   ============================================================= */


/* ============================================================
   1. LAYOUT SHELL
   ============================================================ */

.pp-page {
  /* Centred layout — partypool keeps its own grammar */
  width: 100%;
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.pp-page--wide {
  max-width: 90rem;
}


/* ============================================================
   2. NAV
   ============================================================ */

.pp-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: var(--hair);
}

.pp-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  max-width: var(--w-page);
  margin: 0 auto;
  padding: var(--s3) var(--pad);
}

.pp-nav__logo {
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: var(--ls-tight);
  text-transform: lowercase;
  color: var(--bone);
  text-decoration: none;
  flex-shrink: 0;
}

.pp-nav__logo span {
  /* accent dot on the logo */
  color: var(--accent);
}

.pp-nav__links {
  display: flex;
  align-items: center;
  gap: var(--s5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.pp-nav__links a {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--gray);
  text-decoration: none;
  transition: color 0.2s;
}

.pp-nav__links a:hover,
.pp-nav__links a[aria-current="page"] {
  color: var(--bone);
}

/* Mobile nav — collapses into <details> at 52rem */
.pp-nav__toggle {
  display: none; /* shown via breakpoint below */
  background: none;
  border: var(--hair);
  color: var(--bone);
  padding: var(--s2) var(--s3);
  font: inherit;
  font-size: var(--text-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 52rem) {
  .pp-nav__toggle { display: block; }

  .pp-nav__links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    border-top: var(--hair);
    padding: var(--s3) 0 var(--s4);
  }

  .pp-nav__links.open { display: flex; }

  .pp-nav__links a {
    display: block;
    width: 100%;
    padding: var(--s3) 0;
    border-bottom: var(--hair);
  }

  .pp-nav__inner {
    flex-wrap: wrap;
  }
}


/* ============================================================
   3. BUTTONS
   One family. One wipe. No exceptions.
   ============================================================ */

/*
  Base button — works on <button>, <a>, <input type="submit">
  Add class="btn" to everything clickable that isn't a link in prose.
*/
.btn {
  /* layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 0.55rem 1.1rem;
  /* type */
  font: inherit;
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  /* colour */
  color: var(--bone);
  background: transparent;
  border: 1px solid rgba(237, 234, 227, 0.45); /* bone at 45% */
  /* wipe setup */
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* transitions */
  transition: color 0.3s, border-color 0.3s;
  cursor: pointer;
}

/* The wipe bar — slides in from the left on hover/focus */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: translateX(-102%);
  transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);
}

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled) {
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.btn:hover:not(:disabled)::before,
.btn:focus-visible:not(:disabled)::before {
  transform: translateX(0);
}

/* Variant: go — safe forward action (Copy, Continue, Confirm) */
.btn.go {
  border-color: rgba(95, 211, 148, 0.6);
  color: var(--ok);
}

.btn.go::before { background: var(--ok); }

.btn.go:hover:not(:disabled),
.btn.go:focus-visible:not(:disabled) {
  color: #04210f; /* dark text on green wipe */
  border-color: var(--ok);
}

/* Variant: danger */
.btn.danger {
  border-color: rgba(0, 212, 255, 0.6); /* accent border for danger */
  color: var(--accent);
}

.btn.danger::before { background: var(--accent); }

/* Variant: sm */
.btn.sm {
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
  letter-spacing: var(--ls-label);
}

/* Disabled */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* "Copied" confirmation state on copy buttons */
.btn.copied {
  border-color: var(--ok);
  color: var(--ok);
  pointer-events: none;
}

.btn.copied::before {
  background: var(--ok);
  transform: translateX(0);
}

.btn.copied { color: #04210f; }


/* ============================================================
   4. PILLS (status badges)
   Never convey status by colour alone — always glyph + word.
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 0.18rem 0.7rem 0.18rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gray);
}

/* Glyph — the ::before content identifies the state */
.pill::before {
  content: "•";
  font-size: 1rem;
  line-height: 1;
}

/* ok — done, paid, confirmed, resolved */
.pill.ok {
  color: var(--ok);
  background: rgba(95, 211, 148, 0.10);
}
.pill.ok::before { content: "✓"; font-size: 0.85rem; font-weight: 700; }

/* warn — waiting, needs attention, unresolved */
.pill.warn {
  color: var(--warn);
  background: rgba(232, 176, 74, 0.10);
}
.pill.warn::before { content: "…"; font-weight: 700; }

/* info — refunds, neutral news, pending DD */
.pill.info {
  color: var(--info);
  background: rgba(89, 168, 224, 0.10);
}
.pill.info::before { content: "↺"; font-weight: 700; }

/* muted — inactive, closed, no data */
.pill.muted {
  color: var(--gray);
  background: transparent;
}
.pill.muted::before { content: "–"; }

/* live — active pool with pulse dot */
.pill.live {
  color: var(--accent);
  background: rgba(var(--glow), 0.08);
}
.pill.live::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--glow), 0.8);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* big — the one status that matters most on a page */
.pill.big {
  font-size: 1rem;
  padding: 0.4rem 1.2rem 0.4rem 1rem;
}
.pill.big::before { font-size: 1.15rem; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .pill.live::before { animation: none; }
}


/* ============================================================
   5. BANNERS
   For the moment that matters: Paid, Joined, Refunded.
   ============================================================ */

.banner {
  display: flex;
  align-items: center;
  gap: var(--s4);
  max-width: var(--w-panel);
  margin: 0 0 var(--s5);
  padding: var(--s4) 1.2rem;
  border: 1px solid rgba(95, 211, 148, 0.55);
  background: rgba(95, 211, 148, 0.08);
}

.banner__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--ok);
  color: #04210f;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
}

.banner__title {
  display: block;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ok);
  margin-bottom: var(--s1);
}

.banner__body {
  color: var(--bone);
  font-size: 0.95rem;
  margin: 0;
}

/* Variant: warn */
.banner.warn {
  border-color: rgba(232, 176, 74, 0.55);
  background: rgba(232, 176, 74, 0.08);
}
.banner.warn .banner__icon { background: var(--warn); color: #1a0f00; }
.banner.warn .banner__title { color: var(--warn); }

/* Variant: info (refund, neutral) */
.banner.info {
  border-color: rgba(89, 168, 224, 0.55);
  background: rgba(89, 168, 224, 0.08);
}
.banner.info .banner__icon { background: var(--info); color: #020c14; }
.banner.info .banner__title { color: var(--info); }

/* Variant: error */
.banner.error {
  border-color: rgba(var(--glow), 0.4);
  background: rgba(var(--glow), 0.06);
}
.banner.error .banner__icon { background: var(--accent); color: #000; }
.banner.error .banner__title { color: var(--accent); }


/* ============================================================
   6. FLASH MESSAGES (inline form feedback)
   ============================================================ */

.flash {
  display: flex;
  gap: var(--s3);
  align-items: baseline;
  padding: var(--s3) var(--s4);
  margin: var(--s4) 0;
  border-left: 3px solid var(--ok);
  background: rgba(95, 211, 148, 0.08);
  font-size: var(--text-sm);
  max-width: var(--w-panel);
}

.flash::before {
  content: "✓";
  color: var(--ok);
  font-weight: 700;
  flex-shrink: 0;
}

.flash.error {
  border-left-color: var(--accent);
  background: rgba(var(--glow), 0.08);
}
.flash.error::before { content: "!"; color: var(--accent); }

.flash.warn {
  border-left-color: var(--warn);
  background: rgba(232, 176, 74, 0.08);
}
.flash.warn::before { content: "⚠"; color: var(--warn); }


/* ============================================================
   7. FORMS
   ============================================================ */

.pp-form {
  max-width: var(--w-panel);
}

.pp-form label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: var(--s2);
}

.pp-form input,
.pp-form select,
.pp-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--ink);
  color: var(--bone);
  border: 1px solid rgba(138, 151, 166, 0.4);
  border-radius: 0;       /* square — never rounded */
  font: inherit;
  font-size: var(--text-md);
  font-weight: 400;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

.pp-form input:focus,
.pp-form select:focus,
.pp-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* iOS zoom fix — minimum 16px on mobile */
@media (max-width: 40rem) {
  .pp-form input,
  .pp-form select,
  .pp-form textarea {
    font-size: 1rem; /* never below 16px */
  }
}

.pp-form .field {
  margin-bottom: var(--s5);
}

.pp-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}

@media (max-width: 40rem) {
  .pp-form .field-row {
    grid-template-columns: 1fr; /* stack on phones */
  }
}

.pp-form .hint {
  font-size: var(--text-xs);
  color: var(--gray);
  margin-top: var(--s1);
}

.pp-form input:disabled,
.pp-form select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* ============================================================
   8. PAYMENT PROGRESS (steps + bar)
   ============================================================ */

.pay-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  padding: 0;
  margin: var(--s4) 0 var(--s3);
  font-size: var(--text-xs);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--gray);
}

.pay-steps li::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.55rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  vertical-align: 0.02em;
}

/* Done step — green filled dot with tick */
.pay-steps li.done { color: var(--ok); }
.pay-steps li.done::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 0.95rem;
  height: 0.95rem;
  background: var(--ok);
  border-color: var(--ok);
  color: #04210f;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: -0.05em;
}

/* Current step — accent dot with glow */
.pay-steps li.now { color: var(--bone); }
.pay-steps li.now::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(var(--glow), 0.7);
}

/* Progress bar */
.pay-bar {
  position: relative;
  height: 4px;
  margin: 0 0 var(--s4);
  max-width: var(--w-text);
  overflow: hidden;
  background: rgba(138, 151, 166, 0.25);
}

.pay-bar span {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Busy — sweeps while waiting for confirmation */
.pay-bar.busy span {
  width: 32%;
  animation: pay-sweep 1.6s cubic-bezier(0.7, 0, 0.2, 1) infinite;
}

/* Determinate — fills to a known fraction */
.pay-bar.det span {
  width: max(var(--p, 0%), 6%);
  transition: width 0.6s cubic-bezier(0.7, 0, 0.2, 1);
}

@keyframes pay-sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(320%); }
}

/* Tabular numerals for countdowns */
.pay-clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-tight);
}

@media (prefers-reduced-motion: reduce) {
  .pay-bar.busy span { animation: none; width: 100%; opacity: 0.55; }
}


/* ============================================================
   9. FILTER CHIPS
   ============================================================ */

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: var(--s4) 0;
}

.filter-chip {
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(138, 151, 166, 0.35);
  background: transparent;
  color: var(--gray);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.filter-chip:hover {
  color: var(--bone);
  border-color: rgba(237, 234, 227, 0.45);
  text-decoration: none;
}

.filter-chip.active,
.filter-chip[aria-current] {
  color: var(--accent);
  border-color: var(--accent);
}


/* ============================================================
   10. CARDS (pools, stats)
   ============================================================ */

.pp-card {
  background: rgba(255, 255, 255, 0.04);
  border: var(--hair);
  border-radius: 0; /* square */
  padding: var(--s5);
  transition: border-color 0.2s;
}

.pp-card:hover {
  border-color: rgba(138, 151, 166, 0.45);
}

.pp-card__title {
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--s3);
  color: var(--bone);
}

.pp-card__meta {
  font-size: var(--text-xs);
  color: var(--gray);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

/* Pool grid */
.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: var(--s5);
  margin: var(--s5) 0;
}

/* Outcome bar inside a card */
.outcome-bar-wrap {
  margin: var(--s2) 0 var(--s3);
  background: rgba(138, 151, 166, 0.15);
  height: 6px;
  position: relative;
}

.outcome-bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent);
  transition: width 0.5s ease;
}


/* ============================================================
   11. LEAVING-SITE DIALOG
   Native <dialog> — call .showModal() from JS.
   ============================================================ */

dialog.leave {
  max-width: min(30rem, calc(100vw - 2rem));
  padding: var(--s6) 1.4rem;
  background: #0a1220;
  color: var(--bone);
  border: 1px solid rgba(237, 234, 227, 0.35);
  border-radius: 0;
}

dialog.leave::backdrop {
  background: rgba(2, 6, 12, 0.80);
}

dialog.leave h2 {
  margin: 0 0 var(--s3);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
}

dialog.leave p {
  margin: 0 0 var(--s3);
  line-height: 1.5;
  font-size: 0.95rem;
}

dialog.leave .leave-url {
  font-size: var(--text-sm);
  color: var(--gray);
  word-break: break-all;
}

dialog.leave .leave-act {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
  margin-top: var(--s4);
}

/* The "go" button inside the dialog wipes green */
dialog.leave .btn.go { min-width: 8rem; }


/* ============================================================
   12. TOAST NOTIFICATIONS
   ============================================================ */

.toast {
  position: fixed;
  bottom: var(--s5);
  right: var(--s5);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  background: #0d1629;
  border: var(--hair);
  border-left: 3px solid var(--ok);
  color: var(--bone);
  font-size: var(--text-sm);
  letter-spacing: var(--ls-tight);
  max-width: min(22rem, calc(100vw - 2rem));
  animation: toast-in 0.25s ease;
}

.toast.error { border-left-color: var(--accent); }
.toast.warn  { border-left-color: var(--warn); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}


/* ============================================================
   13. SECTION HEADINGS
   ============================================================ */

.pp-section {
  margin-top: clamp(3rem, 10vh, 6rem);
  padding-top: var(--s5);
  position: relative;
}

/* Hairline rule at the top of each section */
.pp-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: min(100%, var(--w-panel));
  height: 1px;
  background: linear-gradient(90deg,
    rgba(138, 151, 166, 0.55),
    rgba(138, 151, 166, 0) 90%
  );
}

.pp-section__num {
  display: inline-block;
  margin-right: var(--s3);
  font-weight: 500;
  font-size: 0.55em;
  letter-spacing: var(--ls-caps);
  color: var(--gray);
  vertical-align: 0.25em;
}

.pp-section h2 {
  margin: 0 0 var(--s5);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
  color: var(--bone);
}

.pp-section h3 {
  margin: var(--s6) 0 var(--s3);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--gray);
}


/* ============================================================
   14. PAGE HEADER (status label + big title)
   ============================================================ */

.pp-header {
  padding: clamp(2rem, 6vh, 4rem) 0 var(--s5);
  max-width: var(--w-panel);
  margin: 0 auto;
}

/* Small uppercase status label, optionally with live dot */
.pp-header__status {
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: var(--s3);
}

.pp-header__status.live { color: var(--bone); }

.pp-header__status.live::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--glow), 0.7);
  vertical-align: 0.05em;
  animation: pulse-dot 2s ease-in-out infinite;
}

.pp-header h1 {
  margin: 0 0 var(--s3);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
  color: var(--bone);
}

/* Waterline — thin accent gradient rule below the title */
.pp-header__line {
  height: 3px;
  margin: var(--s3) 0 var(--s4);
  background: linear-gradient(90deg, var(--accent), rgba(0, 212, 255, 0) 75%);
  max-width: var(--w-text);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.pp-header__lede {
  font-size: var(--text-md);
  font-weight: 300;
  color: var(--gray);
  max-width: var(--w-text);
  margin: 0;
}


/* ============================================================
   15. HAIRLINE ROW LISTS
   ============================================================ */

.pp-rows {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: var(--w-panel);
}

.pp-rows li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: var(--hair);
  font-size: var(--text-sm);
}

.pp-rows li:first-child { border-top: var(--hair); }

.pp-rows__label { color: var(--gray); flex-shrink: 0; }
.pp-rows__value {
  color: var(--bone);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

@media (max-width: 40rem) {
  .pp-rows li {
    flex-direction: column;
    gap: var(--s1);
  }
  .pp-rows__value { text-align: left; }
}


/* ============================================================
   16. SPINNER / LOADING STATE
   ============================================================ */

.pp-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  padding: var(--s8) 0;
  color: var(--gray);
  font-size: var(--text-sm);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

.pp-spinner::before {
  content: "";
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(138, 151, 166, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .pp-spinner::before { animation: none; border-top-color: var(--gray); }
}


/* ============================================================
   17. EMPTY STATE
   ============================================================ */

.pp-empty {
  padding: var(--s8) 0;
  color: var(--gray);
  font-size: var(--text-sm);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  text-align: center;
  max-width: var(--w-panel);
  margin: 0 auto;
  border-top: var(--hair);
}


/* ============================================================
   18. CURRENCY TOGGLE (DGB / DD)
   ============================================================ */

.curr-toggle {
  display: inline-flex;
  gap: 0;
  border: var(--hair);
}

.curr-btn {
  padding: 0.3rem 0.9rem;
  background: transparent;
  color: var(--gray);
  border: none;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.curr-btn.active {
  background: rgba(var(--glow), 0.12);
  color: var(--accent);
}

.curr-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ============================================================
   12. CYPHERPUNK TEXTURE LAYER
   Optional modifier classes — apply to specific elements.
   All effects respect prefers-reduced-motion.
   No hex values — tokens only.
   ============================================================ */

/* ── Scanlines ──
   Add .cp-scan to any element for a CRT scanline overlay.
   Works best on heroes, full-bleed sections, card images.    */
.cp-scan { position: relative; isolation: isolate; }
.cp-scan::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.055) 2px,
    rgba(0, 0, 0, 0.055) 3px
  );
  pointer-events: none;
  z-index: 2;
}

/* ── Glitch ──
   Add .cp-glitch to a heading for an occasional glitch flash.
   Fires every ~8s, lasts 5 frames. Fully motion-safe.        */
@keyframes cp-glitch {
  0%, 91%, 100% { transform: none; clip-path: none; text-shadow: none; }
  92%  { transform: translateX(-3px); clip-path: inset(15% 0 55% 0);
         text-shadow: 3px 0 rgba(var(--glow), 0.6); }
  93%  { transform: translateX(3px);  clip-path: inset(55% 0 10% 0);
         text-shadow: -3px 0 rgba(255, 0, 200, 0.4); }
  94%  { transform: translateX(-1px) skewX(-2deg); clip-path: none; text-shadow: none; }
  95%  { transform: none; }
}
.cp-glitch {
  animation: cp-glitch 8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}
@media (prefers-reduced-motion: reduce) { .cp-glitch { animation: none; } }

/* ── Terminal prompt ──
   .cp-prompt adds a "> " prefix. Use on nav links, list items,
   any element that should feel like terminal output.          */
.cp-prompt::before {
  content: "> ";
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0.7;
}

/* Nav links: prompt appears on hover + active page           */
.pp-nav__links a:hover,
.pp-nav__links a[aria-current="page"] {
  color: var(--bone);
}
.pp-nav__links a:hover::before,
.pp-nav__links a[aria-current="page"]::before {
  content: "> ";
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: 0;
  opacity: 0.8;
}

/* ── Cursor blink ──
   .cp-cursor appends a blinking block cursor ▌ after content.
   Use on section titles, stat values, live counters.         */
.cp-cursor::after {
  content: " ▌";
  color: var(--accent);
  font-size: 0.7em;
  vertical-align: 0.1em;
  animation: cp-blink 1.1s step-end infinite;
}
@keyframes cp-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cp-cursor::after { animation: none; opacity: 1; }
}

/* ── Rail card ──
   .cp-rail replaces the full hairline border with a left rail
   only — feels more terminal / data-feed than polished UI.   */
.cp-rail {
  border: none;
  border-left: 2px solid rgba(var(--glow), 0.2);
  padding-left: var(--s5);
  background: transparent;
  transition: border-left-color 0.25s;
}
.cp-rail:hover { border-left-color: var(--accent); }

/* ── Line number ──
   .cp-ln styles a section number like a terminal line ref.   */
.cp-ln {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 0;
  opacity: 0.65;
  margin-right: var(--s3);
  user-select: none;
}

/* ── Noise grain ──
   Inject <svg id="cp-noise-filter"> once in <body> (see JS),
   then add .cp-grain to elements you want textured.
   Subtle — keep alpha under 0.05.                            */
.cp-grain { filter: url(#cp-noise-filter); }

/* ── Status flash ──
   .cp-flash briefly highlights a value updating live.        */
@keyframes cp-flash {
  0%   { color: var(--accent); }
  100% { color: inherit; }
}
.cp-flash { animation: cp-flash 0.6s ease-out forwards; }

/* ── Data row ──
   Terminal-style key: value rows for stats / metadata.       */
.cp-data-row {
  display: flex;
  gap: var(--s4);
  align-items: baseline;
  font-size: var(--text-sm);
  padding: var(--s2) 0;
  border-bottom: var(--hair);
}
.cp-data-key {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--gray);
  letter-spacing: 0;
  min-width: 10rem;
  flex-shrink: 0;
}
.cp-data-val {
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.cp-data-val.ok  { color: var(--ok); }
.cp-data-val.warn { color: var(--warn); }
.cp-data-val.accent { color: var(--accent); }
