/* ============================================================
   My Workout Plan — Styles
   80s-90s Iron Culture Aesthetic
   Dark gym floor · Rust & gold accents · Industrial typography
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:                 #0a0a0a;
  --bg-surface:         #141414;
  --bg-surface-raised:  #1c1c1c;
  --bg-surface-alt:     #111111;
  --text:               #e8e4df;
  --text-muted:         #8a8279;
  --text-dim:           #5c5549;
  --accent:             #d4701a;
  --accent-light:       #e8923e;
  --gold:               #c9a84c;
  --gold-dark:          #a07d2e;
  --iron:               #3a3632;
  --iron-light:         #4a4540;
  --danger:             #c0392b;
  --success:            #27ae60;
  --radius:             6px;
  --font-heading: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans",
               "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Texture: grain overlay ---------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3Oeli4teleVlZWQkJCLi4ubm5uenpqeli8teleGhoeli4AAAAGBgYJCQkFBQUCAgICAgIAAAAGBgYAAAA7e3tIAAAAXklEQVR4Ae3NMQEAIAzAsAL/ntcMOHBo6p8zcwNAkvT+RABJIABIAAFIABKABBCABCCBRABJQAK=");
  background-repeat: repeat;
}

/* ---------- Texture: vignette ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
}

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.008) 2px,
      rgba(255, 255, 255, 0.008) 4px
    ),
    linear-gradient(180deg, #1a1816 0%, #12100e 100%);
}

/* Gold gradient bottom border */
.site-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold-dark) 70%, transparent 100%);
}

.site-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #ddc36c 0%, var(--gold) 40%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.site-subtitle {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.next-workout-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.5rem 1.25rem 0.5rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--iron);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 1rem;
}

.next-label {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.next-value {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  font-size: 1.125rem;
  text-transform: uppercase;
}

/* ---------- Main ---------- */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ---------- Rotation nav ---------- */
.rotation-nav {
  margin-bottom: 1.5rem;
}

.rotation-list {
  display: flex;
  gap: 0.625rem;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
}

.rotation-btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-family: var(--font-heading);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--iron);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
  min-width: 44px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rotation-btn:hover,
.rotation-btn:focus-visible {
  background: var(--bg-surface-raised);
  color: var(--text);
  border-color: var(--iron-light);
}

.rotation-btn.active {
  background: linear-gradient(180deg, var(--accent) 0%, #b85e15 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 12px rgba(212, 112, 26, 0.25);
}

.rotation-btn.completed {
  border-color: var(--success);
  color: var(--success);
}

.rotation-btn.next {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(212, 112, 26, 0.12);
}

/* ---------- Workout detail ---------- */
.workout-detail {
  background: var(--bg-surface);
  border: 1px solid var(--iron);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.workout-heading {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gold);
}

.workout-focus {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
  margin-bottom: 1.25rem;
  font-style: italic;
}

/* ---------- Exercise table ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.exercise-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.exercise-table th,
.exercise-table td {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--iron);
  white-space: nowrap;
}

.exercise-table th {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 2px solid var(--iron);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
}

.exercise-table tbody tr:nth-child(even) {
  background: var(--bg-surface-alt);
}

.exercise-table tbody tr:hover {
  background: var(--bg-surface-raised);
}

/* Hard Set rows */
.exercise-table tbody tr.is-hard-set td {
  color: var(--accent-light);
}

.exercise-table tbody tr.is-hard-set td:first-child {
  border-left: 3px solid var(--accent);
}

.exercise-table tbody tr.is-hard-set {
  background: rgba(212, 112, 26, 0.04);
}

.exercise-table tbody tr.is-hard-set:nth-child(even) {
  background: rgba(212, 112, 26, 0.06);
}

.exercise-table tbody tr.is-hard-set td.col-intensity {
  font-weight: 700;
}

.col-check {
  width: 2.75rem;
  text-align: center;
}

.col-exercise {
  min-width: 10rem;
  white-space: normal;
  font-weight: 600;
}

.col-sets,
.col-reps,
.col-intensity {
  text-align: center;
}

.col-notes {
  white-space: normal;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Custom checkboxes */
.exercise-check {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--iron-light);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
  vertical-align: middle;
}

.exercise-check:hover {
  border-color: var(--accent);
}

.exercise-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.exercise-check:checked::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.exercise-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Rules section ---------- */
.rules-section {
  margin-bottom: 1.5rem;
}

.rules-details {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--iron);
}

.rules-summary {
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--gold);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.rules-summary::before {
  content: "\25B6";
  font-size: 0.625rem;
  color: var(--gold-dark);
  transition: transform 0.2s ease;
}

.rules-details[open] .rules-summary::before {
  transform: rotate(90deg);
}

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

.rules-body {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.7;
}

.rules-body h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1.25rem;
  margin-bottom: 0.375rem;
  font-size: 0.9375rem;
  color: var(--gold);
}

.rules-body ul,
.rules-body dl {
  margin-left: 1rem;
}

.rules-body li {
  margin-bottom: 0.25rem;
}

.rules-body li::marker {
  color: var(--accent);
}

.glossary dt {
  font-family: var(--font-heading);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gold);
  margin-top: 0.625rem;
}

.glossary dd {
  margin-left: 1rem;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold-dark) 30%, var(--gold) 70%, transparent 100%);
}

/* ---------- Toast / notification ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: var(--bg-surface-raised);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--iron);
  border-left: 4px solid var(--iron);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 10000;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-danger {
  border-left-color: var(--danger);
}

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

/* Mobile */
@media (max-width: 600px) {
  .site-title {
    font-size: 1.5rem;
  }

  .site-subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
  }

  .site-header {
    padding: 1.75rem 0.75rem 1.25rem;
  }

  .rotation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .rotation-list li {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }

  .rotation-btn {
    width: 100%;
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
  }

  .workout-detail {
    padding: 1rem;
  }

  .exercise-table th,
  .exercise-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
  }

  .col-exercise {
    min-width: 7rem;
  }

  .main-content {
    padding: 1rem 0.75rem;
  }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 900px) {
  .main-content {
    padding: 1.5rem 1.25rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  body::after,
  body::before {
    display: none;
  }
}
