/* Programs page. Builds on /styles.css tokens (dark theme, emerald
   primary). Only page-specific rules live here. */

/* ── Header: current page + second-level nav ── */

.nav-links a.is-current {
  color: var(--sp-text);
  font-weight: 500;
}

/* No divider between the two levels on this page. */
.header {
  border-bottom: none;
}
.subnav {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
}
.subnav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  height: 44px;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.subnav-inner::-webkit-scrollbar {
  display: none;
}
.subnav-inner a {
  color: var(--sp-text-muted);
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color var(--sp-transition-fast), border-color var(--sp-transition-fast);
}
.subnav-inner a:hover {
  color: var(--sp-text);
}
.subnav-inner a.active {
  color: var(--sp-primary);
  border-bottom-color: var(--sp-primary);
}

.page-hero {
  padding: 184px 0 72px;
}
.page-hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin-bottom: 16px;
}
.page-hero .lede {
  max-width: 640px;
  font-size: 1.1rem;
  color: var(--sp-text-muted);
  margin-bottom: 32px;
}

#how-to-train,
#programs,
#what-you-get {
  scroll-margin-top: 108px;
}

/* ── How to train ── */

.howto {
  max-width: 760px;
}
.howto-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.howto-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  padding: 26px 0;
  border-top: 1px solid var(--sp-border);
}
.howto-list li:last-child {
  border-bottom: 1px solid var(--sp-border);
}
.howto-num {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2rem;
  line-height: 1;
  color: rgba(var(--sp-primary-rgb), 0.5);
  padding-top: 2px;
}
.howto-list h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--sp-text);
  margin: 0 0 8px;
}
.howto-list p {
  font-size: 0.97rem;
  margin: 0;
}

/* Labels and controls are not prose: no text selection on them. */
.program-banner-text,
.program-badge,
.filter-chip,
.program-details summary,
.volume th,
.subnav-inner a,
.btn {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Program finder ── */

.finder {
  margin: -16px 0 36px;
  padding: 20px 24px 14px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
}
.finder-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.finder-row + .finder-row {
  border-top: 1px solid var(--sp-border);
}
.finder-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sp-text-muted);
}
.finder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.finder-result {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--sp-text-secondary);
  display: flex;
  align-items: center;
  gap: 14px;
}
.finder-reset {
  font: inherit;
  font-size: 0.82rem;
  color: var(--sp-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.finder-reset:hover {
  color: var(--sp-primary-light);
}
.finder-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0 4px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sp-text-muted);
}
.finder-divider::before,
.finder-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sp-border);
}
.filter-chip {
  padding: 7px 16px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--sp-text-muted);
  background: transparent;
  border: 1px solid var(--sp-border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--sp-transition-fast), border-color var(--sp-transition-fast), background var(--sp-transition-fast);
}
.filter-chip:hover {
  color: var(--sp-text);
  border-color: rgba(255, 255, 255, 0.2);
}
.filter-chip[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.filter-chip[disabled]:hover {
  color: var(--sp-text-muted);
  border-color: var(--sp-border);
}
.filter-chip.active {
  color: var(--sp-bg);
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  font-weight: 500;
}

/* ── Program cards ── */

.program-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.program-loading,
.program-error {
  grid-column: 1 / -1;
  color: var(--sp-text-muted);
}
.program-error {
  color: var(--sp-danger);
}

.program-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
  transition: border-color var(--sp-transition), transform var(--sp-transition);
}
.program-card:hover {
  border-color: rgba(var(--sp-primary-rgb), 0.35);
  transform: translateY(-2px);
}
.program-card[hidden] {
  display: none;
}

.program-banner {
  position: relative;
  aspect-ratio: 16 / 8;
  background: #0a0d14;
  overflow: hidden;
}
.program-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: saturate(0.85);
  transition: transform 0.6s ease;
}
.program-card:hover .program-banner img {
  transform: scale(1.03);
}
.program-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--sp-surface) 0%, rgba(15, 19, 24, 0.35) 45%, transparent 100%);
}
.program-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-bg);
  background: var(--sp-primary);
  border-radius: 999px;
}
.program-badge--free {
  background: var(--sp-primary-light);
  color: var(--sp-bg);
}
.program-free-word {
  color: var(--sp-primary-light);
  font-weight: 600;
}
.program-banner-text {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 14px;
  z-index: 1;
}
.program-banner-text h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0 0 2px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.program-subtitle {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-primary-light);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.program-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}
.program-desc {
  font-size: 0.95rem;
  color: var(--sp-text-secondary);
  margin-bottom: 14px;
}
.program-equipment {
  font-size: 0.82rem;
  color: var(--sp-text-muted);
  margin-bottom: 16px;
}
.program-equipment strong {
  color: var(--sp-text-dim);
  font-weight: 500;
}

/* Volume table: muscle group, workouts hit, total sets, with a bar
   proportional to sets so the emphasis of the program reads at a
   glance. */
.volume {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.volume th {
  padding: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sp-text-faint);
  text-align: left;
  border-bottom: 1px solid var(--sp-border);
}
.volume th.num,
.volume td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
  padding-left: 14px;
}
.volume td {
  padding: 5px 0;
  color: var(--sp-text-secondary);
  vertical-align: middle;
}
.volume td.group {
  width: 30%;
  white-space: nowrap;
}
.volume td.bar {
  padding-right: 8px;
}
.volume .bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
.volume .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(var(--sp-primary-rgb), 0.55), var(--sp-primary));
  border-radius: 2px;
}
.volume tr.total td {
  padding-top: 8px;
  border-top: 1px solid var(--sp-border);
  color: var(--sp-text);
  font-weight: 500;
}

.program-details {
  margin-top: 12px;
}
.program-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.82rem;
  color: var(--sp-primary);
  padding: 6px 0;
  user-select: none;
}
.program-details summary::-webkit-details-marker {
  display: none;
}
.program-details summary::after {
  content: " \2193";
}
.program-details[open] summary::after {
  content: " \2191";
}
.program-details summary:hover {
  color: var(--sp-primary-light);
}
.workout-block {
  margin-top: 12px;
}
.workout-block h4 {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-text-dim);
  margin: 0 0 4px;
}
.workout-block .volume td {
  padding: 3px 0;
}

.program-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}
.program-buy {
  width: 100%;
  text-align: center;
  padding: 14px 24px;
}
.program-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--sp-text-muted);
  letter-spacing: 0.02em;
  /* one line on every card so the buttons above line up across a row */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* ── Free program dialog ── */

.free-dialog {
  /* the global reset zeroes margins; dialogs centre via margin:auto */
  margin: auto;
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
  color: var(--sp-text-secondary);
}
.free-dialog::backdrop {
  background: rgba(var(--sp-bg-rgb), 0.8);
  backdrop-filter: blur(6px);
}
.free-dialog-form {
  position: relative;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
}
.free-dialog h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 500;
  margin: 0 0 10px;
}
.free-dialog-lede {
  font-size: 0.95rem;
  margin: 0 0 20px;
}
.free-dialog-program {
  color: var(--sp-text);
  font-weight: 500;
}
.free-dialog label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-text-muted);
  margin-bottom: 6px;
}
.free-dialog input[type="email"] {
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--sp-text);
  background: rgba(var(--sp-bg-rgb), 0.6);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
}
.free-dialog input[type="email"]::placeholder {
  color: var(--sp-text-placeholder);
}
.free-dialog input[type="email"]:focus {
  border-color: rgba(var(--sp-primary-rgb), 0.6);
  outline: none;
}
.free-dialog .program-buy-error {
  margin: -6px 0 12px;
}
.free-dialog-submit {
  width: 100%;
  text-align: center;
}
.free-dialog-submit[disabled] {
  opacity: 0.6;
  cursor: wait;
}
.free-dialog-done p {
  margin: 0 0 18px;
  color: var(--sp-text-secondary);
}
.free-dialog-done strong {
  color: var(--sp-primary);
  font-weight: 600;
}
.free-dialog-done .btn {
  width: 100%;
  text-align: center;
}
.free-dialog-close[aria-label="Close"] {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--sp-text-muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.free-dialog-close[aria-label="Close"]:hover {
  color: var(--sp-text);
  background: rgba(255, 255, 255, 0.06);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.program-buy[disabled] {
  opacity: 0.6;
  cursor: wait;
}
.program-buy-error {
  grid-column: 1 / -1;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--sp-danger);
}

/* ── Shared bits (mirrors train-with-me) ── */

.included-list {
  max-width: 680px;
}
.included-list li {
  list-style: none;
  padding: 14px 0 14px 32px;
  border-bottom: 1px solid var(--sp-border);
  position: relative;
  color: var(--sp-text-secondary);
}
.included-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 22px;
  width: 12px;
  height: 6px;
  border-left: 2px solid var(--sp-primary);
  border-bottom: 2px solid var(--sp-primary);
  transform: rotate(-45deg);
}
.included-list li strong {
  color: var(--sp-text);
  font-weight: 500;
}
.app-note {
  margin-top: 40px;
  padding: 20px 24px;
  border-left: 2px solid var(--sp-primary);
  background: rgba(var(--sp-bg-rgb), 0.5);
  border-radius: 0 var(--sp-radius) var(--sp-radius) 0;
  color: var(--sp-text-secondary);
  font-size: 0.98rem;
  max-width: 720px;
}
.app-note a {
  color: var(--sp-primary);
}

@media (max-width: 768px) {
  .subnav-inner {
    gap: 22px;
  }
  .page-hero {
    padding-top: 150px;
  }
  .page-hero {
    padding-bottom: 48px;
  }
  .program-grid {
    grid-template-columns: 1fr;
  }
  .howto-list li {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }
  .howto-num {
    font-size: 1.5rem;
  }
  .finder {
    margin-top: -8px;
    padding: 14px 16px 10px;
  }
  .finder-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  /* single column: nothing to align, let the note wrap */
  .program-note {
    white-space: normal;
  }
}
