/*
Minimal, mobile‑friendly styles for weekly class materials.
Upload notes:
- Place weekly files under weeks/YYYY-MM-DD/ (audio.mp3, whiteboard.jpg/png)
- Update weeks.json with the new entry; index.html loads it automatically.
*/

:root {
  --bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --card: #BABABA; /* medium gray */
  --primary: #1f6feb; /* accessible blue */
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.site-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0 0 .25rem 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem;
}

/* Tabs for topics */
.topic-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .25rem 0 1rem;
}

.topic-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: .4rem .7rem;
  border-radius: .5rem;
  cursor: pointer;
}

.topic-tab[aria-selected="true"], .topic-tab.active {
  background: #eef6ff;
  border-color: #cfe1ff;
}

.topic-tab:focus {
  outline: 3px solid rgba(31,111,235,.3);
}

.search-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin: .25rem 0 1rem;
}

#search-input {
  flex: 1 1 auto;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
}

.loading, .error {
  margin: 1rem 0;
}

.error { color: #b00020; }

.debug-panel {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: rgba(255, 255, 255, 0.92);
  padding: .75rem 1rem;
}

.debug-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem 1rem;
  margin-top: .75rem;
}

.debug-grid div {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: .95rem;
}

.debug-panel pre {
  margin: .75rem 0 0;
  padding: .75rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: .5rem;
  overflow: auto;
  font-size: .8rem;
}

.weeks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .weeks-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .debug-grid { grid-template-columns: 1fr; }
}

.week-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem;
}

.week-title {
  margin: 0 0 .5rem 0;
  font-size: 1.125rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

button.play-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: .5rem;
  cursor: pointer;
}

button.play-btn:focus { outline: 3px solid rgba(31,111,235,.3); }
button.play-btn:hover { background: #fafafa; }

audio {
  width: 100%;
}

video {
  width: 100%;
  max-height: 320px;
}

.audio-placeholder {
  color: var(--muted);
  font-size: .95rem;
}

.whiteboard {
  margin-top: .5rem;
}

.whiteboard img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: .5rem;
  border: 1px solid var(--border);
  background: #fff;
}

.whiteboard img.placeholder {
  background: #fffbe6; /* subtle hint */
  border-color: #f59e0b;
}

.link-row {
  margin-top: .5rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

/* Background override */
body { background: #00A2E8; }
