/*
 * Drawdown-protection proof page (/protection/).
 *
 * Page-specific styles for the headline verdict banner, the per-basket table,
 * the event gallery + drill-down modal, the storm-check widget and the live
 * AI-rout card. All values reference the design tokens in css/styles.css
 * (loaded site-wide). The storm-check form reuses the shared .pf-* row UI from
 * css/portfolio-entry.css.
 */

/* ── Hero ─────────────────────────────────────────────────────────────── */
.prot-hero {
  background: var(--color-bg-dark);
  padding: 140px 0 64px;
  text-align: center;
}
.prot-hero .section__label {
  color: var(--color-teal);
}
.prot-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(30px, 4.6vw, 50px);
  font-weight: 800;
  line-height: 1.12;
  color: #fff;
  margin: 8px 0 16px;
}
.prot-hero__lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text-muted);
  max-width: 680px;
  margin: 0 auto;
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.prot-container {
  padding-top: 56px;
  padding-bottom: 96px;
}
.prot-section {
  margin-bottom: 64px;
}
.prot-section__title {
  font-family: var(--font-heading);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}
.prot-section__sub {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 640px;
}
.prot-loading {
  font-size: 15px;
  color: var(--color-text-muted);
  padding: 24px 0;
}
.prot-empty {
  font-size: 15px;
  color: var(--color-text-secondary);
  padding: 28px 24px;
  background: var(--color-bg-tinted);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-align: center;
}

/* Signed drawdown-reduction colouring (positive = fell less = good). */
.prot-pp--up { color: #16a34a; }
.prot-pp--down { color: #dc2626; }
.prot-pp--flat { color: var(--color-text-muted); }

.prot-pill,
.prot-banner__verdict {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Headline verdict banner ──────────────────────────────────────────── */
.prot-banner {
  border: 1px solid var(--card-border);
  border-left: 5px solid var(--prot-verdict, var(--color-blue));
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 68, 238, 0.04), rgba(3, 246, 209, 0.03));
  padding: 28px 32px;
  box-shadow: var(--card-shadow);
}
.prot-banner__lede {
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.45;
  color: var(--color-text);
  margin: 0 0 20px;
}
.prot-banner__lede strong { font-weight: 800; }
.prot-banner__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
}
.prot-banner__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prot-banner__stat-value {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 800;
  color: var(--color-text);
}
.prot-banner__stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.prot-banner__verdict {
  font-size: 15px;
  padding: 6px 16px;
}

/* ── Per-basket table ─────────────────────────────────────────────────── */
.prot-table-wrap {
  overflow-x: auto;
}
.prot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.prot-table thead th {
  text-align: left;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
.prot-table__num { text-align: right; }
.prot-table tbody td {
  padding: 16px;
  border-bottom: 1px solid var(--card-border);
  color: var(--color-text);
  vertical-align: middle;
}
.prot-table tbody tr:nth-child(-n+3) .prot-table__name {
  font-weight: 700;
}
.prot-table__name { font-weight: 600; }
.prot-table tbody td.prot-table__num { text-align: right; font-variant-numeric: tabular-nums; }
.prot-table tbody td.prot-pp { font-weight: 700; }

/* ── Event gallery ────────────────────────────────────────────────────── */
.prot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.prot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  padding: 22px 22px 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  font-family: var(--font-body);
}
.prot-card:hover,
.prot-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--card-border-hover);
  outline: none;
}
.prot-card__name {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  padding-right: 52px;
}
.prot-card__range {
  font-size: 13px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.prot-card__metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
}
.prot-card__metric-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.prot-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 3px 9px;
  border-radius: 100px;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.prot-badge--live {
  background: #dc2626;
  color: #fff;
  animation: prot-live-pulse 2s ease-in-out infinite;
}
@keyframes prot-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* The live AI-rout card styles live in css/protection-live.css (shared with
   the homepage, which does not load this file). */

/* ── Storm check ──────────────────────────────────────────────────────── */
.prot-storm__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 860px) {
  .prot-storm__layout { grid-template-columns: 1fr; }
}
.prot-storm__form {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--card-shadow);
}
.prot-storm__event-field {
  margin-bottom: 20px;
}
.prot-storm__event-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.prot-storm__event-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background: #fff;
}
.prot-storm__event-select:focus { outline: none; border-color: var(--color-blue); }

.prot-storm__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.prot-storm__clear {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-base);
  margin-left: auto;
}
.prot-storm__clear:hover { color: #dc2626; }
.prot-storm__error {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: rgba(238, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(238, 68, 68, 0.2);
  display: none;
}
.prot-storm__error--visible { display: block; }

.prot-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 4px solid rgba(6, 68, 238, 0.15);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: prot-spin 0.9s linear infinite;
}
@keyframes prot-spin {
  to { transform: rotate(360deg); }
}

.prot-storm__result {
  min-height: 100%;
}
.prot-storm__placeholder {
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  padding: 40px 28px;
  text-align: center;
  background: var(--color-bg-tinted);
}
.prot-storm__placeholder-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}
.prot-storm__placeholder-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
}
.prot-storm__loading {
  text-align: center;
  padding: 48px 20px;
}
.prot-storm__loading-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 12px;
}
.prot-storm__loading-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 4px auto 0;
  max-width: 320px;
  line-height: 1.5;
}
.prot-storm__card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  padding: 28px;
}

.prot-result__headline {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--color-text);
  margin: 0 0 8px;
}
.prot-result__headline .prot-result__num { font-size: 24px; }
.prot-result__sub-inline {
  font-weight: 600;
  color: var(--color-text-secondary);
}
.prot-result__sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 20px;
}
.prot-result__none {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  padding: 16px 0 8px;
}
.prot-result__freshness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 16px;
  padding: 6px 12px;
  border-radius: 100px;
  background: rgba(3, 246, 209, 0.08);
  border: 1px solid rgba(3, 246, 209, 0.22);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}
.prot-result__freshness strong {
  color: var(--color-text);
  font-weight: 700;
}
.prot-result__freshness-icon {
  color: var(--color-teal);
  flex-shrink: 0;
}
.prot-result__freshness--stale {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.22);
}
.prot-result__freshness--stale .prot-result__freshness-icon {
  color: #d97706;
}
.prot-result__missing {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: rgba(238, 68, 68, 0.06);
  border: 1px solid rgba(238, 68, 68, 0.18);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-secondary);
}
.prot-result__missing-chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(238, 68, 68, 0.12);
  color: #b91c1c;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: normal;
}
.prot-result__group-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.prot-result__basket-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
}
.prot-result__basket-name { color: var(--color-text); }
.prot-result__basket-val {
  font-family: var(--font-heading);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.prot-result__study {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--gradient-subtle);
  border: 1px solid rgba(6, 68, 238, 0.12);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-secondary);
}
.prot-result__study strong { color: var(--color-text); }
.prot-result__cta {
  display: block;
  width: 100%;
  margin-top: 20px;
  text-align: center;
}

/* ── Methodology card ─────────────────────────────────────────────────── */
.prot-methodology {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--card-shadow);
}
@media (max-width: 600px) {
  .prot-methodology { padding: 24px 20px; }
}
.prot-methodology__intro {
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  margin: 0 0 24px;
}
.prot-methodology__sub-heading {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin: 28px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}
.prot-methodology__sub-heading:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.prot-methodology p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin: 0 0 12px;
}
.prot-methodology p:last-child {
  margin-bottom: 0;
}
.prot-methodology ul {
  margin: 0 0 14px;
  padding-left: 22px;
}
.prot-methodology li {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.prot-methodology li strong {
  color: var(--color-text);
  font-weight: 700;
}

/* ── Drill-down modal ─────────────────────────────────────────────────── */
.prot-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  overflow-y: auto;
}
.prot-modal[hidden] { display: none; }
.prot-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 10, 30, 0.6);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.prot-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  padding: 32px;
}
.prot-modal__close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 28px;
  line-height: 1;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
}
.prot-modal__close:hover { color: var(--color-text); }

.prot-dd__title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text);
  margin: 0 0 4px;
  padding-right: 32px;
}
.prot-dd__range {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 0 20px;
  font-variant-numeric: tabular-nums;
}
.prot-dd__section-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 24px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.prot-dd__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.prot-dd__table th {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  padding: 0 10px 8px;
}
.prot-dd__table th:first-child { text-align: left; }
.prot-dd__table td {
  padding: 9px 10px;
  border-top: 1px solid var(--card-border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.prot-dd__table td:first-child { text-align: left; font-weight: 600; }
.prot-dd__tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.prot-dd__ticker {
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(6, 68, 238, 0.07);
  border: 1px solid rgba(6, 68, 238, 0.16);
  color: var(--color-blue);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
}

/* Attribution waterfall: three proportional bars. */
.prot-wf {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prot-wf__row {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  align-items: center;
  gap: 12px;
}
.prot-wf__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.prot-wf__track {
  position: relative;
  height: 14px;
  background: rgba(100, 116, 139, 0.12);
  border-radius: 7px;
  overflow: hidden;
}
.prot-wf__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 7px;
}
.prot-wf__fill--market { background: var(--color-blue); }
.prot-wf__fill--style { background: var(--color-cyan); }
.prot-wf__fill--specific { background: var(--color-teal); }
.prot-wf__val {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.prot-dd__percentile {
  margin-top: 8px;
  padding: 16px 18px;
  background: var(--gradient-subtle);
  border: 1px solid rgba(6, 68, 238, 0.12);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-secondary);
}
.prot-dd__percentile strong {
  color: var(--color-text);
  font-weight: 800;
}
.prot-dd__loading,
.prot-dd__error {
  font-size: 15px;
  color: var(--color-text-secondary);
  padding: 24px 0;
}
