/* ===========================================================
   Video Library — "Archive Deck" design direction
   Palette:
     --bg:        #14110F  (near-black, warm undertone)
     --bg-raised: #1C1815
     --line:      #322C26
     --paper:     #EDE6D6  (warm paper, primary text)
     --paper-dim: #A89E8C
     --amber:     #E8A33D  (phosphor/tape-deck accent)
     --amber-dim: #8C6526
   Type:
     Display: "Fraunces" (characterful serif, used sparingly for brand)
     Body/UI: "Inter"
     Utility/meta: "IBM Plex Mono" (timestamps, sizes, paths)
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #14110F;
  --bg-raised: #1C1815;
  --bg-raised-hover: #231E19;
  --line: #322C26;
  --line-soft: #251F1A;
  --paper: #EDE6D6;
  --paper-dim: #A89E8C;
  --paper-faint: #6E665A;
  --amber: #E8A33D;
  --amber-dim: #8C6526;
  --amber-glow: rgba(232, 163, 61, 0.18);
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--paper);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

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

/* Signature element: a perforated "tape edge" strip down the left,
   referencing physical film/tape stock — the one bold visual risk. */
.tape-edge {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 100%;
  background-image: radial-gradient(circle, var(--line) 2.5px, transparent 2.6px);
  background-size: 14px 22px;
  background-position: center 11px;
  z-index: 5;
  pointer-events: none;
}
@media (max-width: 640px) {
  .tape-edge { display: none; }
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-raised), var(--bg));
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 28px 18px 42px;
  display: flex;
  align-items: baseline;
  gap: 28px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.01em;
  color: var(--paper);
  flex-shrink: 0;
}

.brand-mark {
  color: var(--amber);
  font-size: 16px;
}

.crumbs {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--paper-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.crumb-root {
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}
.crumb-root:hover { color: var(--amber); }

.crumb-sep { color: var(--paper-faint); }

.crumb { color: var(--paper-dim); }
.crumb:hover { color: var(--amber); }

.crumb.current { color: var(--amber); }

/* ---------- Layout ---------- */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 28px 80px 42px;
  min-height: calc(100vh - 140px);
}

.section { margin-bottom: 44px; }

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--paper-faint);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-pill {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--paper-dim);
}

/* ---------- Folder grid ---------- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.folder-card:hover {
  border-color: var(--amber-dim);
  background: var(--bg-raised-hover);
  transform: translateY(-1px);
}

.folder-icon {
  color: var(--amber);
  font-size: 18px;
  line-height: 1;
}

.folder-name {
  font-weight: 500;
  color: var(--paper);
  word-break: break-word;
  font-size: 14.5px;
}

.folder-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--paper-faint);
}

/* ---------- Video list ---------- */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-row {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line-soft);
}
.video-row:last-child { border-bottom: none; }

.video-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: none;
  border: none;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
}

.video-toggle:hover { background: var(--bg-raised-hover); }

.play-glyph {
  color: var(--amber);
  font-size: 11px;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  transition: transform 0.15s ease;
}

.video-toggle[aria-expanded="true"] .play-glyph {
  transform: rotate(90deg);
}

.video-name {
  flex: 1;
  word-break: break-word;
  min-width: 0;
}

.video-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--paper-faint);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 100px;
}

.video-row {
  position: relative;
}

.download-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius);
  padding: 5px 10px;
  background: rgba(232, 163, 61, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.download-btn:hover {
  background: var(--amber-glow);
  border-color: var(--amber);
}

.video-row .video-toggle { padding-right: 110px; }

.player-wrap {
  padding: 0 16px 18px;
}

.player-wrap video {
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  background: #000;
  display: block;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 90px 20px;
  color: var(--paper-dim);
}

.empty-glyph {
  font-size: 32px;
  color: var(--amber-dim);
  margin-bottom: 14px;
}

.empty-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  color: var(--paper);
  margin: 0 0 6px;
}

.empty-sub {
  font-size: 14px;
  color: var(--paper-faint);
  margin: 0 0 20px;
}

.back-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--amber);
}
.back-link:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 28px 24px 42px;
  text-align: center;
}
.site-footer span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--paper-faint);
  letter-spacing: 0.04em;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner, .content, .site-footer { padding-left: 18px; padding-right: 18px; }
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .video-row .video-toggle { padding-right: 16px; flex-wrap: wrap; }
  .download-btn { position: static; margin: 0 16px 14px; display: inline-block; }
  .video-meta { width: 100%; margin-right: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .folder-card, .play-glyph, .download-btn { transition: none; }
}
