/* ============================================================
   TradersProxy — site styles
   Editorial direct-response layout system. Dark theme only for v1.
   Depends on tokens.css (load first).
   ============================================================ */

/* -------- Reset & base ------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; overflow-x: hidden; scroll-behavior: smooth; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--tp-font-sans);
  font-size: var(--tp-text-base);
  line-height: var(--tp-lh-base);
  color: var(--tp-text);
  background: var(--tp-bg);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: var(--tp-accent-hi); text-decoration: none; transition: color var(--tp-dur-fast); }
a:hover { color: var(--tp-accent); }
a:focus-visible { outline: 2px solid var(--tp-accent); outline-offset: 2px; border-radius: var(--tp-radius-sm); }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--tp-accent); color: var(--tp-bg); }

/* Grid background pattern (site-wide subtle texture) */
.bg-grid {
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 34px 34px;
}

/* -------- Skip nav (accessibility) ------------------------- */

.skip-nav {
  position: absolute;
  left: -9999px;
  top: 1rem;
  background: var(--tp-accent);
  color: var(--tp-bg);
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: var(--tp-text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 200;
  border-radius: var(--tp-radius-sm);
}
.skip-nav:focus { left: 1rem; }

/* -------- Typography primitives --------------------------- */

.eyebrow {
  font-size: var(--tp-text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--tp-accent-hi);
  line-height: 1;
  display: inline-block;
}

.eyebrow-dim { color: var(--tp-text-dim); }
.eyebrow-muted { color: var(--tp-muted); }

h1, h2, h3, h4 {
  color: var(--tp-text);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.h-hero {
  font-size: var(--tp-text-4xl);
  font-weight: 800;
  line-height: var(--tp-lh-tight);
  letter-spacing: -0.02em;
}

.h-chapter {
  font-size: var(--tp-text-3xl);
  font-weight: 700;
  line-height: var(--tp-lh-tight);
  letter-spacing: -0.015em;
}

.h-section {
  font-size: var(--tp-text-2xl);
  font-weight: 700;
  line-height: var(--tp-lh-snug);
}

.h-sub {
  font-size: var(--tp-text-xl);
  font-weight: 600;
  line-height: var(--tp-lh-snug);
}

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

.lede {
  font-size: var(--tp-text-lg);
  line-height: var(--tp-lh-base);
  color: var(--tp-text-dim);
  font-weight: 300;
}

p { margin: 0 0 1em 0; }

/* -------- Layout --------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--tp-container);
  margin: 0 auto;
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}
.container-wide { max-width: var(--tp-container-wide); }
.container-narrow { max-width: 44rem; }

.section { padding-top: clamp(3rem, 6vw, 5rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.section-lg { padding-top: clamp(4rem, 8vw, 7rem); padding-bottom: clamp(4rem, 8vw, 7rem); }

.divider-top { border-top: 1px solid var(--tp-border); }
.divider-bottom { border-bottom: 1px solid var(--tp-border); }
.divider-accent { border-top: 1px solid var(--tp-border-accent); }

/* Long-form editorial column */
.prose {
  max-width: var(--tp-measure);
  font-size: var(--tp-text-base);
  line-height: var(--tp-lh-base);
  color: var(--tp-text-dim);
}
.prose p { margin: 0 0 1.25em 0; }
.prose p strong { color: var(--tp-text); font-weight: 600; }
.prose p.first-line-bold::first-line { color: var(--tp-text); font-weight: 500; }
.prose h2, .prose h3 { color: var(--tp-text); margin: 2em 0 0.6em 0; }
.prose h2 { font-size: var(--tp-text-2xl); }
.prose h3 { font-size: var(--tp-text-xl); }
.prose code {
  font-family: var(--tp-font-mono);
  font-size: 0.875em;
  background: var(--tp-card);
  border: 1px solid var(--tp-border);
  padding: 0.1em 0.35em;
  border-radius: var(--tp-radius-sm);
  color: var(--tp-accent-hi);
}
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1.25em 0; }
.prose li { margin-bottom: 0.6em; }
.prose li::marker { color: var(--tp-accent); }
.prose hr { border: 0; border-top: 1px solid var(--tp-border); margin: 3em 0; }


/* -------- Backgrounds & surfaces ----------------------------- */

.surface-bg       { background: var(--tp-bg); }
.surface-deep     { background: var(--tp-bg-deep); }
.surface-panel    { background: var(--tp-bg-panel); }

/* -------- Cards ---------------------------------------------- */

.card {
  background: var(--tp-card);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  padding: var(--tp-space-6);
}
.card-alt { background: var(--tp-card-alt); }
.card-accent { border-color: var(--tp-border-accent); background: linear-gradient(180deg, rgba(16,185,129,0.04), transparent 60%), var(--tp-card); }

/* -------- Buttons & CTAs ------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  min-height: 44px;
  font-size: var(--tp-text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--tp-radius-sm);
  border: 1px solid transparent;
  transition: all var(--tp-dur-fast) var(--tp-ease-out);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--tp-accent);
  color: var(--tp-bg);
  box-shadow: 0 4px 16px var(--tp-accent-glow);
}
.btn-primary:hover { background: var(--tp-accent-hi); color: var(--tp-bg); box-shadow: 0 6px 24px var(--tp-accent-glow); }

.btn-secondary {
  background: transparent;
  color: var(--tp-text);
  border-color: var(--tp-border-strong);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.04); color: var(--tp-accent-hi); border-color: var(--tp-accent); }

.btn-ghost {
  background: transparent;
  color: var(--tp-text-dim);
  border: 0;
  padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { color: var(--tp-accent-hi); }

.btn-lg { padding: 1rem 1.75rem; font-size: var(--tp-text-sm); }
.btn-sm { padding: 0.6rem 1rem; font-size: 10px; }

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

/* -------- Pull quote (editorial emphasis) ------------------ */

.pullquote {
  margin: 2.5rem 0;
  padding: 1.5rem 0 1.5rem 2rem;
  border-left: 3px solid var(--tp-accent);
  font-size: var(--tp-text-xl);
  font-weight: 500;
  line-height: var(--tp-lh-snug);
  color: var(--tp-text);
  font-style: normal;
  max-width: calc(var(--tp-measure) - 2rem);
}
.pullquote cite {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-xs);
  font-style: normal;
  color: var(--tp-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Centered pull quote for dramatic breaks */
.pullquote-center {
  margin: 4rem auto;
  padding: 0 2rem;
  max-width: 48rem;
  text-align: center;
  border: 0;
  font-size: var(--tp-text-2xl);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--tp-text);
}
.pullquote-center::before {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--tp-accent);
  margin: 0 auto 2rem auto;
}

/* -------- Stat strips --------------------------------------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 1px;
  background: var(--tp-border);
  border-radius: var(--tp-radius-sm);
  overflow: hidden;
}
.stat-strip > * {
  background: var(--tp-card);
  padding: 1rem 0.75rem;
  text-align: center;
}
.stat-strip .stat-value {
  font-size: var(--tp-text-xl);
  font-weight: 700;
  color: var(--tp-text);
  line-height: 1;
}
.stat-strip .stat-value em { font-style: normal; font-weight: 400; color: var(--tp-text-dim); font-size: 0.75em; }
.stat-strip .stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-muted);
  margin-top: 0.35rem;
}

/* -------- Comparison table -------------------------------- */
/* CSS grid that works with both <div class="comparison"> and <table class="comparison"> */

.comparison {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 1fr 1fr;
  width: 100%;
  margin: 2rem 0;
  font-size: var(--tp-text-sm);
  border-top: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  overflow: hidden;
}
.comparison > div,
.comparison > th,
.comparison > td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--tp-border);
  vertical-align: top;
  text-align: left;
  line-height: 1.55;
  color: var(--tp-text-dim);
}
/* First column (question labels) */
.comparison > div:nth-child(3n+1):not(.head) {
  font-weight: 600;
  color: var(--tp-text);
}
/* Header row (first 3 cells with class="head") */
.comparison > .head {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tp-muted);
  background: var(--tp-bg-panel, var(--tp-card));
  border-bottom: 1px solid var(--tp-border-strong);
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
/* TradersProxy column highlight */
.comparison > .highlight {
  background: rgba(16, 185, 129, 0.06);
  border-bottom-color: rgba(16, 185, 129, 0.25);
  color: var(--tp-text);
}
.comparison > .head.highlight {
  color: var(--tp-accent);
  background: rgba(16, 185, 129, 0.1);
  border-bottom: 1px solid rgba(16, 185, 129, 0.4);
}
/* Column separators */
.comparison > div:nth-child(3n+2),
.comparison > div:nth-child(3n) {
  border-left: 1px solid var(--tp-border);
}
.comparison .check {
  color: var(--tp-accent);
  font-weight: 700;
  margin-right: 0.3rem;
}
.comparison .cross {
  color: var(--tp-muted);
  font-weight: 700;
  margin-right: 0.3rem;
}
/* Responsive: stack on mobile with section labels */
@media (max-width: 640px) {
  .comparison {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .comparison > div {
    border-left: none !important;
    padding-left: 1rem;
  }
  .comparison > div:nth-child(3n+1) {
    padding-top: 1.25rem;
    background: var(--tp-bg-deep, var(--tp-card));
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tp-muted);
  }
  .comparison > .head:nth-child(1) { display: none; }
}

/* -------- Pricing cards ------------------------------------ */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--tp-space-5);
  align-items: stretch;
  margin-top: var(--tp-space-6);
}
@media (min-width: 960px) {
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
}

.plan {
  background: var(--tp-card);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform var(--tp-dur-base) var(--tp-ease-out),
              border-color var(--tp-dur-base),
              box-shadow var(--tp-dur-base);
  position: relative;
}
.plan:hover { transform: translateY(-3px); box-shadow: var(--tp-shadow-md); }

.plan.is-selected {
  border-color: var(--tp-accent);
  box-shadow: 0 0 0 1px var(--tp-accent), var(--tp-shadow-glow);
  transition: border-color var(--tp-dur-base), box-shadow var(--tp-dur-base), transform var(--tp-dur-base);
}
@media (min-width: 960px) {
  .plan.is-selected { transform: translateY(-4px); }
  .plan-featured.is-selected { transform: translateY(-1rem); }
}

.plan-featured {
  border-color: var(--tp-border-accent);
  background: linear-gradient(180deg, rgba(16,185,129,0.05), transparent 40%), var(--tp-card);
}
@media (min-width: 960px) {
  .plan-featured { transform: translateY(-0.75rem); }
  .plan-featured:hover { transform: translateY(-1rem); }
}

.plan-featured .plan-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--tp-accent);
  color: var(--tp-bg);
  font-size: 10px;
  font-weight: 800;
  padding: 0.3rem 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--tp-radius-sm);
}

.plan-name {
  font-size: var(--tp-text-xs);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tp-muted);
  text-align: center;
}
.plan-featured .plan-name { color: var(--tp-accent-hi); }

.plan-price {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  margin: 0.6rem 0 0.25rem 0;
}
.plan-price .amount { font-size: 2.75rem; font-weight: 700; color: var(--tp-text); line-height: 1; letter-spacing: -0.02em; }
.plan-price .period { font-family: var(--tp-font-mono); font-size: var(--tp-text-sm); color: var(--tp-muted); padding-bottom: 0.3rem; }

.plan-tagline {
  font-size: var(--tp-text-xs);
  color: var(--tp-muted);
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.plan-featured .plan-tagline { color: var(--tp-text-dim); }

.plan-features {
  flex: 1;
  margin: 0 0 1.25rem 0;
  padding: 0;
  list-style: none;
  font-size: var(--tp-text-xs);
}
.plan-features li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--tp-text-dim);
  padding: 0.3rem 0;
  line-height: 1.45;
}
.plan-features li.disabled { color: var(--tp-muted); text-decoration: line-through; }
.plan-features li .tick {
  width: 12px; height: 12px;
  color: var(--tp-accent);
  flex-shrink: 0;
}
.plan-features li.disabled .tick { color: var(--tp-faint); }
.plan-featured .plan-features li { color: var(--tp-text); }
.plan-featured .plan-features li .tick { color: var(--tp-accent-hi); }

.plan-cta {
  width: 100%;
  padding: 0.85rem;
  font-size: var(--tp-text-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--tp-radius-sm);
  border: 1px solid var(--tp-border);
  background: #1A2030;
  color: var(--tp-text);
  cursor: pointer;
  transition: all var(--tp-dur-fast);
}
.plan-cta:hover { background: #252C40; }
.plan-featured .plan-cta {
  background: var(--tp-accent);
  color: var(--tp-bg);
  border-color: transparent;
  box-shadow: 0 4px 18px var(--tp-accent-glow);
}
.plan-featured .plan-cta:hover { background: var(--tp-accent-hi); }

.plan-trial-note {
  margin-top: 0.7rem;
  text-align: center;
}
.plan-trial-note .trial { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tp-accent-hi); }
.plan-trial-note .sub { font-size: 10px; color: var(--tp-muted); margin-top: 0.2rem; }
.plan-trial-note .committed { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tp-text-dim); }

/* -------- Trial policy strip --------------------------------- */

.trial-strip {
  margin: 2.5rem auto 0;
  padding: 1.25rem 1.5rem;
  background: var(--tp-accent-dim);
  border: 1px solid var(--tp-border-accent);
  border-radius: var(--tp-radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.trial-strip .trial-copy { flex: 1; min-width: 16rem; }
.trial-strip .trial-title { color: var(--tp-text); font-weight: 600; font-size: var(--tp-text-sm); margin: 0 0 0.2rem 0; }
.trial-strip .trial-body { color: var(--tp-text-dim); font-size: var(--tp-text-xs); line-height: 1.55; margin: 0; }
.trial-strip .trial-tag { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tp-accent-hi); text-align: right; }

/* -------- Show-don't-tell diagrams -------------------------- */

.lane-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
@media (max-width: 720px) { .lane-diagram { grid-template-columns: 1fr; } }

.lane {
  padding: 1.25rem;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  background: var(--tp-card);
}
.lane h4 { font-size: var(--tp-text-xs); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tp-muted); margin: 0 0 1rem 0; }
.lane.lane-bad h4 { color: var(--tp-danger); }
.lane.lane-good h4 { color: var(--tp-accent-hi); }

.lane-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.4rem;
  background: var(--tp-bg);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  font-size: var(--tp-text-xs);
  font-family: var(--tp-font-mono);
  color: var(--tp-text-dim);
}
.lane-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tp-muted); flex-shrink: 0; }
.lane-row .dot-good { background: var(--tp-accent); box-shadow: 0 0 8px var(--tp-accent-glow); }
.lane-row .dot-bad { background: var(--tp-danger); }
.lane-row .weight { margin-left: auto; color: var(--tp-muted); font-size: 10px; }

/* -------- Header / navigation ------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--tp-border);
  transition: box-shadow var(--tp-dur-base);
}
.site-header.is-scrolled { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3); }

.site-nav {
  max-width: var(--tp-container);
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--tp-header-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--tp-text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--tp-accent);
  border-radius: var(--tp-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 16px; height: 16px; }
.logo em { font-style: normal; color: var(--tp-muted); font-weight: 600; }

.nav-links {
  display: none;
  gap: 1.75rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tp-text-dim);
}
@media (min-width: 900px) { .nav-links { display: flex; } }
.nav-links a:hover { color: var(--tp-accent-hi); }
.nav-links a.is-active { color: var(--tp-text); }

/* -------- Footer -------------------------------------------- */

.site-footer {
  padding: 4rem 0 3rem 0;
  background: var(--tp-bg-deep);
  border-top: 1px solid var(--tp-border);
  color: var(--tp-text-dim);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer-col h5 { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tp-muted); margin: 0 0 0.9rem 0; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.5rem; font-size: var(--tp-text-sm); }
.footer-col a { color: var(--tp-text-dim); }
.footer-col a:hover { color: var(--tp-accent-hi); }

.footer-meta {
  padding-top: 2rem;
  border-top: 1px solid var(--tp-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--tp-text-xs);
  color: var(--tp-muted);
}

/* -------- FAQ accordion ------------------------------------- */

.faq-list { margin: 2rem 0; border-top: 1px solid var(--tp-border); }
.faq-item {
  border-bottom: 1px solid var(--tp-border);
}
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  background: transparent;
  border: 0;
  color: var(--tp-text);
  font-family: inherit;
  font-size: var(--tp-text-base);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color var(--tp-dur-fast);
}
.faq-q:hover { color: var(--tp-accent-hi); }
.faq-q .chev {
  width: 16px; height: 16px;
  color: var(--tp-muted);
  transition: transform var(--tp-dur-base) var(--tp-ease-out);
  flex-shrink: 0;
}
.faq-item.is-open .faq-q .chev { transform: rotate(180deg); color: var(--tp-accent); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--tp-dur-slow) var(--tp-ease-out), padding var(--tp-dur-slow);
  color: var(--tp-text-dim);
  font-size: var(--tp-text-sm);
  line-height: 1.65;
  padding: 0 0;
}
.faq-a p { margin: 0 0 0.8em 0; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-item.is-open .faq-a { max-height: 800px; padding-bottom: 1.5rem; }

/* -------- Modal --------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tp-dur-base);
  padding: 1rem;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal-panel {
  background: var(--tp-card);
  border: 1px solid var(--tp-border-strong);
  border-radius: var(--tp-radius-md);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform var(--tp-dur-base) var(--tp-ease-out);
  display: flex;
  flex-direction: column;
}
.modal.is-open .modal-panel { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--tp-border); }
.modal-header h3 { font-size: var(--tp-text-lg); margin: 0; }
.modal-close { background: transparent; border: 0; color: var(--tp-muted); cursor: pointer; padding: 0.4rem; border-radius: var(--tp-radius-sm); }
.modal-close:hover { background: var(--tp-card-alt); color: var(--tp-text); }
.modal-body { padding: 1.5rem; }
body.modal-open { overflow: hidden; }

/* Checkout modal loader */
.checkout-loader { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.checkout-loader .spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--tp-accent);
  border-radius: 50%;
  animation: tp-spin 0.8s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* -------- Policies tabs (trial, terms, privacy) ------------ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.35rem;
  background: var(--tp-bg);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
}
.tabs button {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-muted);
  cursor: pointer;
  border-radius: calc(var(--tp-radius-sm) - 1px);
  transition: all var(--tp-dur-fast);
  min-width: 120px;
}
.tabs button.is-active { background: var(--tp-accent-dim); color: var(--tp-accent-hi); }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }

/* -------- Sticky mobile CTA ------------------------------- */

.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--tp-bg-deep);
  border-top: 1px solid var(--tp-border);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  z-index: 80;
  transform: translateY(110%);
  transition: transform var(--tp-dur-base) var(--tp-ease-out);
}
.sticky-cta.is-visible { transform: translateY(0); }
.sticky-cta .sc-label { font-size: 11px; color: var(--tp-text-dim); flex: 1; }
.sticky-cta .sc-label strong { color: var(--tp-text); font-weight: 700; }
@media (min-width: 900px) { .sticky-cta { display: none; } }

/* -------- Animation / reveal ------------------------------ */

@keyframes tp-reveal-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reveal-on-scroll: progressive enhancement. Default is VISIBLE so content
   renders even if JS fails. JS adds .reveal--animated to opt into the fade. */
.reveal { opacity: 1; transform: none; transition: opacity var(--tp-dur-slow), transform var(--tp-dur-slow); }
.reveal--animated:not(.is-visible) { opacity: 0; transform: translateY(14px); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* -------- Utility classes --------------------------------- */

.text-dim { color: var(--tp-text-dim); }
.text-muted { color: var(--tp-muted); }
.text-accent { color: var(--tp-accent-hi); }
.text-center { text-align: center; }
.measure { max-width: var(--tp-measure); }
.measure-wide { max-width: var(--tp-measure-wide); }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 2rem; }
.mt-8 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 2rem; }
.hidden-mobile { display: none; }
@media (min-width: 720px) { .hidden-mobile { display: initial; } }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }

/* ============================================================
   Latency Widget — #tp-latency-widget
   Timezone-derived RTT estimates. Standalone section.
   ============================================================ */

.lw-section {
  padding-top: clamp(2rem, 4vw, 3rem);
  padding-bottom: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--tp-border);
  background: var(--tp-bg-panel);
}

.lw-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.lw-title {
  font-size: var(--tp-text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--tp-text-dim);
  line-height: 1;
}

.lw-region-tag {
  font-size: var(--tp-text-xs);
  color: var(--tp-accent-hi);
  font-family: var(--tp-font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lw-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm);
  padding: 0.3rem 0.6rem;
  color: var(--tp-muted);
  font-size: var(--tp-text-xs);
  font-family: var(--tp-font-sans);
  cursor: pointer;
  transition: color var(--tp-dur-fast), border-color var(--tp-dur-fast);
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}
.lw-refresh:hover  { color: var(--tp-text); border-color: var(--tp-border-strong); }
.lw-refresh:focus-visible { outline: 2px solid var(--tp-accent); outline-offset: 2px; }

/* Skeleton loader */
.lw-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
}
.lw-skeleton-card {
  height: 64px;
  border-radius: var(--tp-radius-md);
  background: linear-gradient(
    90deg,
    var(--tp-card) 25%,
    var(--tp-card-alt) 50%,
    var(--tp-card) 75%
  );
  background-size: 200% 100%;
  animation: lw-shimmer 1.4s infinite;
}
@keyframes lw-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Node grid */
.lw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

/* Node card */
.lw-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 1rem 1.15rem;
  border-radius: var(--tp-radius-md);
  background: var(--tp-card);
  border: 1px solid var(--tp-border);
  transition: transform var(--tp-dur-fast), border-color var(--tp-dur-fast);
  position: relative;
  overflow: hidden;
}
.lw-card:hover {
  transform: translateY(-2px);
  border-color: var(--tp-border-strong);
}
.lw-card--top {
  border-color: var(--tp-border-accent);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.08) 0%,
    var(--tp-card) 80%
  );
}

.lw-city {
  font-size: var(--tp-text-sm);
  font-weight: 700;
  color: var(--tp-text);
  white-space: nowrap;
  letter-spacing: 0.01em;
  margin-bottom: 0.15rem;
}

.lw-rtt {
  font-size: var(--tp-text-sm);
  font-family: var(--tp-font-mono);
  color: var(--tp-text-dim);
  white-space: nowrap;
}
.lw-card--top .lw-rtt {
  color: var(--tp-text);
  font-weight: 600;
}

.lw-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tp-bg-deep);
  background: var(--tp-accent);
  padding: 0.15rem 0.4rem;
  border-radius: var(--tp-radius-sm);
  line-height: 1;
  margin-top: 0.25rem;
}

/* Fallback dropdown */
.lw-fallback {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.lw-fallback label {
  font-size: var(--tp-text-sm);
  color: var(--tp-text-dim);
  white-space: nowrap;
}
.lw-fallback select {
  font-family: var(--tp-font-sans);
  font-size: var(--tp-text-sm);
  color: var(--tp-text);
  background: var(--tp-card);
  border: 1px solid var(--tp-border-strong);
  border-radius: var(--tp-radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  min-height: 44px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.lw-fallback select:focus-visible {
  outline: 2px solid var(--tp-accent);
  outline-offset: 2px;
}

/* Disclaimer */
.lw-disclaimer {
  margin-top: 1rem;
  font-size: var(--tp-text-xs);
  color: var(--tp-faint);
  line-height: 1.6;
}
.lw-disclaimer a {
  color: var(--tp-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lw-disclaimer a:hover { color: var(--tp-text-dim); }

/* Real-test expandable */
.lw-test-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--tp-muted);
  font-size: var(--tp-text-xs);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
}
.lw-test-toggle:hover { color: var(--tp-text-dim); }
.lw-test-toggle:focus-visible { outline: 2px solid var(--tp-accent); outline-offset: 2px; }

.lw-test-panel {
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--tp-bg-deep);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  font-family: var(--tp-font-mono);
  font-size: var(--tp-text-xs);
  color: var(--tp-text-dim);
  line-height: 1.8;
}
.lw-test-panel b { color: var(--tp-text); font-weight: 600; }
.lw-test-panel code {
  display: block;
  margin-top: 0.25rem;
  color: var(--tp-accent-hi);
  white-space: pre;
}

/* Responsive: stack on 375px, grid at 480px+ */
@media (max-width: 479px) {
  .lw-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.gap-4 { gap: 1rem; }
