/* ============================================================
   Workout Schedule — local web app
   Dark, energetic theme with per-day accent colors.
   ============================================================ */

:root {
  --bg: #0e0f13;
  --bg-2: #14161c;
  --surface: #181b22;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --muted-2: #6b7382;
  --accent: #c8f65e;        /* overridden per-day via JS */
  --accent-soft: rgba(200, 246, 94, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over component display rules below. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200, 246, 94, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(77, 140, 255, 0.06), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: rgba(14, 15, 19, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent-soft), transparent);
  border: 1px solid var(--line);
  transition: background .3s ease;
}
.brand-text { min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: clamp(17px, 2.4vw, 22px);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.today-chip {
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
}
.ghost-btn {
  appearance: none; cursor: pointer;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 13px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  transition: border-color .2s, background .2s, transform .1s;
}
.ghost-btn:hover { border-color: var(--accent); background: var(--surface-2); }
.ghost-btn:active { transform: translateY(1px); }

/* ---------- Day tabs ---------- */
.day-tabs {
  display: flex; gap: 10px;
  padding: 16px clamp(16px, 4vw, 40px);
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  overflow-x: auto; scrollbar-width: thin;
}
.day-tabs::-webkit-scrollbar { height: 6px; }
.day-tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.day-tab {
  --tab-accent: var(--muted-2);
  cursor: pointer; flex: none;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 116px;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left;
  transition: transform .12s ease, border-color .2s, background .2s;
}
.day-tab:hover { transform: translateY(-2px); border-color: var(--tab-accent); }
.day-tab .dt-weekday { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.day-tab .dt-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.day-tab .dt-focus { font-size: 11px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-tab.is-active {
  background: linear-gradient(160deg, color-mix(in srgb, var(--tab-accent) 20%, var(--surface)), var(--surface));
  border-color: var(--tab-accent);
  box-shadow: 0 0 0 1px var(--tab-accent) inset, 0 8px 20px rgba(0,0,0,.35);
}
.day-tab.is-active .dt-name { color: var(--tab-accent); }
.day-tab.is-today .dt-weekday::after {
  content: "• today"; color: var(--tab-accent); margin-left: 5px; font-weight: 700;
}

/* ---------- Day panel ---------- */
.day-panel { max-width: var(--maxw); margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 40px; width: 100%; }

.day-hero {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  padding: 22px 24px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.day-hero::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 5px;
  background: var(--accent);
}
.hero-emoji {
  width: 64px; height: 64px; flex: none;
  display: grid; place-items: center; font-size: 34px;
  border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line);
}
.hero-main { flex: 1 1 240px; min-width: 0; }
.hero-title { margin: 0; font-size: clamp(20px, 3vw, 27px); letter-spacing: -0.015em; }
.hero-focus { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tag-badge {
  display: inline-block; margin-left: 10px; vertical-align: middle;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 3px 9px; border-radius: 999px;
}
.hero-stats { display: flex; gap: 22px; flex: none; }
.hero-stat { text-align: center; }
.hero-stat b { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.hero-stat span { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }

.warmup {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 16px 0 4px; padding: 13px 16px;
  background: var(--bg-2); border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--muted);
}
.warmup b { color: var(--text); }

/* ---------- Exercise grid ---------- */
.ex-grid {
  display: grid; gap: 16px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ex-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .14s ease, border-color .2s, box-shadow .2s;
}
.ex-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }

.ex-num {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #0c0d10;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.ex-imgwrap {
  position: relative; aspect-ratio: 16 / 11; cursor: zoom-in;
  background: #fff; overflow: hidden;
}
.ex-imgwrap .frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: opacity .35s ease;
}
.ex-imgwrap .frame-1 { opacity: 0; }
.ex-imgwrap:hover .frame-1 { opacity: 1; }
.ex-imgwrap .frame-hint {
  position: absolute; bottom: 8px; right: 8px; z-index: 2;
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.6);
  padding: 3px 8px; border-radius: 999px; pointer-events: none;
}

.ex-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.ex-name { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px;
}
.chip.primary { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }

.ex-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 2px; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 6px; text-align: center;
}
.stat b { display: block; font-size: 15px; font-weight: 700; line-height: 1.15; }
.stat span { font-size: 9.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }

.ex-weight {
  font-size: 13px; color: var(--text);
  display: flex; align-items: baseline; gap: 7px;
}
.ex-weight .lbl { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ex-cue { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.ex-cue::before { content: "💡 "; }

/* ---------- Rest day ---------- */
.rest-card {
  text-align: center; padding: 48px 24px; margin-top: 18px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.rest-card .big { font-size: 56px; }
.rest-card p { max-width: 540px; margin: 14px auto 0; color: var(--muted); }

/* ---------- Info panel ---------- */
.info-panel {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  padding: 4px clamp(16px, 4vw, 40px) 0;
}
.info-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px;
}
.info-card h2 { margin: 0 0 4px; font-size: 18px; }
.info-card .info-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.info-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.info-block h3 { margin: 0 0 7px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.info-block p, .info-block li { font-size: 13px; color: var(--muted); }
.info-block ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.note-box {
  margin-top: 16px; padding: 13px 16px; font-size: 12.5px; color: var(--muted);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
}
.note-box b { color: var(--text); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
  border-top: 1px solid var(--line); margin-top: 12px;
  color: var(--muted-2); font-size: 12px;
}
.footer a { color: var(--muted); }
.footer-sources { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0; }
.footer-d2d { margin-top: 12px; color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: rgba(6, 7, 10, 0.86); backdrop-filter: blur(6px);
}
.lightbox-inner {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); max-width: 880px; width: 100%;
  max-height: 90vh; overflow: auto; padding: 22px;
}
.lightbox-frames { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lightbox-frames figure { margin: 0; }
.lightbox-frames img { width: 100%; border-radius: var(--radius-sm); background: #fff; display: block; }
.lightbox-frames figcaption { text-align: center; font-size: 11px; color: var(--muted-2); margin-top: 6px; text-transform: uppercase; letter-spacing: .05em; }
.lightbox h3 { margin: 16px 0 6px; font-size: 20px; }
.lightbox-close {
  position: fixed; top: 18px; right: 22px; z-index: 101;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  font-size: 24px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
}
.lightbox-close:hover { border-color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .ex-stats { grid-template-columns: repeat(4, 1fr); }
  .lightbox-frames { grid-template-columns: 1fr; }
  .top-actions .ghost-btn { display: none; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .day-tabs, .info-panel, .footer, .ex-num, .frame-hint, .top-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .day-panel { max-width: 100%; }
  .ex-card { break-inside: avoid; border-color: #bbb; }
  .ex-imgwrap { aspect-ratio: 16/9; }
  .ex-grid { grid-template-columns: repeat(2, 1fr); }
}
