/* Calculator page — layered on top of styles.css */

main {
  padding-bottom: 2rem;
}

.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.panel-hint {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

/* ---------- Form ---------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.field-grid:empty {
  display: none;
}

.field {
  margin-bottom: 1.75rem;
}

.field-grid .field {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.625rem;
}

.field-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0.625rem 0 0;
}

.control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  transition: border-color 0.2s;
}

.control:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select.control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 18px;
  padding-right: 2.5rem;
}

.chip-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  flex: 1;
  min-width: 64px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: #52525b;
  color: var(--text-primary);
}

.chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chip--active:hover {
  color: #fff;
}

/* ---------- Lift inputs ---------- */

.lifts {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
}

.lifts h2 {
  margin-bottom: 0.5rem;
}

.lift-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.lift-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.lift-name {
  font-weight: 600;
  font-size: 1.0625rem;
}

.lift-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .control {
  width: 108px;
  padding-right: 3rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.input-suffix {
  position: absolute;
  right: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  pointer-events: none;
}

.input-times {
  color: var(--text-secondary);
}

.lift-readout {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--accent);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Results ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.results-actions .btn {
  cursor: pointer;
  font-family: inherit;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
}

/* ---------- Program output ---------- */

.print-header {
  display: none;
}

/* styles.css renders every <section> as a dark card. The program is a list of
   workouts, not a stack of cards — strip it back to plain flow. */
.week {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 2.5rem;
}

.week:hover {
  border: none;
}

.week-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.125rem;
  font-weight: 700;
}

.week-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
}

.days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem 2.5rem;
}

.day-name {
  margin: 0 0 0.875rem;
}

.day-number {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.day-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 700;
}

.exercise + .exercise {
  margin-top: 1.125rem;
}

.exercise-name {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
}

/* When the column is too narrow for both, the prescription drops to its own
   line rather than breaking the exercise name across two. */
.line--exercise {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 1rem;
  padding: 0.25rem 0;
}

.line--exercise .exercise-name {
  white-space: nowrap;
}

.line--exercise .exercise-name {
  margin: 0;
}

.exercise-volume {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.group-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0.5rem 0 0.125rem;
}

.exercise .group-label:first-of-type {
  margin-top: 0;
}

.line {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.1875rem 0;
  font-variant-numeric: tabular-nums;
}

.line-label {
  width: 3rem;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.line-value {
  font-weight: 600;
}

.line--warmup .line-value {
  font-weight: 400;
  color: var(--text-secondary);
}

.line--amrap .line-value {
  color: var(--accent);
}

.amrap-note {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.deload-note {
  font-size: 0.875rem;
  margin-top: -1rem;
}

/* ---------- App CTA ---------- */

.app-cta {
  text-align: center;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin: 3rem 0;
}

.app-cta h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: 0.75rem;
}

.app-cta p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-secondary);
}

.app-cta .hero-buttons {
  margin-top: 1.75rem;
}

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

.faq {
  margin-top: 4rem;
}

.faq .section-title {
  margin-bottom: 1.5rem;
}

.faq details {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}

.faq details:hover {
  border-color: #52525b;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
  flex-shrink: 0;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  margin: 0.875rem 0 0;
  font-size: 0.9375rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .panel {
    padding: 1.5rem;
  }

  .lift-row {
    grid-template-columns: 1fr;
  }

  .lift-inputs {
    justify-content: space-between;
  }

  .input-wrap .control {
    width: 100%;
  }

  .input-wrap {
    flex: 1;
  }

  .results-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ---------- Print ----------
   The printed sheet is the same markup as the screen, restyled for paper:
   one week per page, that week's workouts in two columns. */

@page {
  margin: 14mm;
}

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.3;
  }

  body::before,
  nav,
  header,
  .form-panel,
  .results-actions,
  .app-cta,
  .faq,
  .empty-state,
  .deload-note,
  footer {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  /* styles.css styles every <section> as a dark card. On paper that prints as
     a solid block of ink with white text on it — strip it back to plain flow. */
  section {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .print-header {
    display: block;
    margin-bottom: 6mm;
  }

  .print-title {
    font-size: 16pt;
    font-weight: 700;
    margin: 0 0 1.5mm;
    color: #000;
  }

  .print-meta {
    color: #000;
    font-size: 9.5pt;
    margin: 0 0 1mm;
    font-variant-numeric: tabular-nums;
  }

  /* One week per sheet, so you always know which week you're holding. */
  .week {
    break-before: page;
  }

  .week:first-of-type {
    break-before: auto;
  }

  .week-title {
    border-bottom: 1pt solid #000;
    color: #000;
    font-size: 12pt;
    margin: 0 0 4mm;
    padding-bottom: 1mm;
    break-after: avoid;
  }

  .week-label {
    color: #444;
    font-size: 9.5pt;
  }

  /* A grid, not CSS columns: columns fill top-to-bottom, which would put days
     1 and 2 above each other and read 1|3 across the first row. A week always
     fits one page, so the grid never has to fragment. */
  .days {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6mm 9mm;
  }

  .days--compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 5mm 8mm;
  }

  /* A workout is a unit — never let one split across a page. */
  .day {
    break-inside: avoid;
    margin-bottom: 0;
  }

  .day-number {
    color: #555;
    font-size: 8pt;
  }

  .day-title,
  .exercise-name,
  .line-value {
    color: #000;
  }

  .exercise-volume {
    color: #222;
  }

  .line--exercise {
    padding: 0.6mm 0;
  }

  .day-title {
    font-size: 11.5pt;
  }

  .exercise + .exercise {
    margin-top: 2.5mm;
  }

  .exercise-name {
    font-size: 10pt;
  }

  .group-label {
    color: #555;
    font-size: 7.5pt;
    margin: 1.5mm 0 0.5mm;
  }

  .line {
    padding: 0.3mm 0;
    gap: 4mm;
  }

  .line-label {
    width: 11mm;
    color: #555;
    font-size: 9pt;
  }

  .line--warmup .line-value {
    color: #555;
    font-weight: 400;
  }

  /* Accent orange goes muddy in greyscale; weight carries the emphasis. */
  .line--amrap .line-value {
    color: #000;
    font-weight: 700;
  }

  .amrap-note {
    color: #000;
    font-size: 7.5pt;
  }
}
