/* =========================================================================
   materials — conference library (slides / handouts / recordings)
   Owns every .mat-* class. Tokens come from css/app.css, so light and dark
   both follow the shell with no per-theme overrides needed here except the
   two type tints below.
   ========================================================================= */

/* --------------------------------------------------------------- intro card */

.mat-intro .section-head { margin-bottom: var(--s-2); }

.mat-confs { margin-top: var(--s-3); }

.mat-chip-note {
  margin-left: var(--s-2);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .7;
}

.mat-intro .btn-row { margin-top: var(--s-3); }

/* ------------------------------------------------------------------ search */

.mat-search-wrap { margin: var(--s-4) 0 var(--s-3); }

.mat-search {
  width: 100%;
  display: block;
}

/* Safari renders a search input with its own inner padding + cancel button. */
.mat-search::-webkit-search-decoration,
.mat-search::-webkit-search-results-button { -webkit-appearance: none; }

.mat-filters { margin-bottom: var(--s-4); }

/* --------------------------------------------------------------- day groups */

.mat-day { margin-bottom: var(--s-6); }

.mat-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  padding: 0 var(--s-1) var(--s-2);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-3);
}

.mat-day-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.mat-day-note {
  flex: 1 1 160px;
  min-width: 0;
  font-size: .82rem;
  color: var(--muted);
}

.mat-day-count {
  margin-left: auto;
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* --------------------------------------------------------------------- rows */

.mat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-2);
}

.mat-row {
  display: flex;
  align-items: stretch;
  gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.mat-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.mat-main:hover { background: var(--surface-2); }
.mat-main:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.mat-glyph {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 1.05rem;
  line-height: 1;
  background: var(--surface-3);
}

/* Per-kind tints — deliberately low-chroma so a long list stays calm. */
.mat-glyph-slides { background: var(--blue-soft); }
.mat-glyph-handout { background: var(--surface-3); }
.mat-glyph-recording { background: rgba(224, 57, 57, .12); }
.mat-glyph-resource { background: rgba(255, 128, 68, .16); }
.mat-glyph-photos { background: rgba(70, 123, 184, .16); }

.mat-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mat-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.mat-title {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mat-new {
  flex: 0 0 auto;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  border-radius: var(--r-pill);
  padding: 2px 7px;
}

.mat-sub,
.mat-by {
  font-size: .8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.mat-by { font-size: .78rem; }

/* ------------------------------------------------------------------- side */

.mat-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-2) var(--s-2) 0;
}

.mat-save,
.mat-remove {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.mat-save:hover,
.mat-remove:hover { background: var(--surface-2); color: var(--ink); }

.mat-save.on { color: var(--orange); }

.mat-remove { font-size: .85rem; }
.mat-remove:hover { color: var(--danger); }

.mat-save:focus-visible,
.mat-remove:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.mat-save[disabled],
.mat-remove[disabled] { opacity: .5; cursor: default; }

/* ------------------------------------------------------------------ sheet */

.mat-sheet-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  margin-bottom: var(--s-3);
}

.mat-type {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-2);
}

.mat-type-slides { background: var(--blue-soft); }
.mat-type-recording { background: rgba(224, 57, 57, .12); }
.mat-type-resource { background: rgba(255, 128, 68, .16); }
.mat-type-photos { background: rgba(70, 123, 184, .16); }

.mat-type-glyph { font-size: .9rem; line-height: 1; }

.mat-sheet-meta,
.mat-sheet-by {
  font-size: .82rem;
  color: var(--muted);
}

.mat-sheet-by { margin: 0 0 var(--s-3); }

.mat-sheet-session {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.mat-sheet-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.mat-sheet-body { margin: 0 0 var(--s-4); color: var(--ink-2); }

.mat-sheet-h3 {
  margin: var(--s-4) 0 var(--s-2);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.mat-highlights {
  margin: 0 0 var(--s-4);
  padding-left: 1.15em;
  color: var(--ink-2);
}

.mat-highlights li { margin-bottom: var(--s-1); }

.mat-chapters {
  list-style: none;
  margin: 0 0 var(--s-4);
  padding: 0;
  display: grid;
  gap: var(--s-1);
}

.mat-chapter {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.mat-chapter-at {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
}

.mat-chapter-title { min-width: 0; color: var(--ink-2); font-size: .9rem; }

.mat-sheet-actions {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.mat-sheet-note {
  margin: var(--s-3) 0 0;
  font-size: .78rem;
  color: var(--muted);
}

/* ------------------------------------------------------- add form (admin) */

.mat-add-form {
  display: grid;
  gap: var(--s-3);
}

.mat-add-form textarea { resize: vertical; }

/* ------------------------------------------- embedded block (session sheet) */

.mat-session-block {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.mat-list-compact .mat-row { box-shadow: none; }
.mat-list-compact .mat-main { padding: var(--s-2) var(--s-3); }
.mat-list-compact .mat-glyph { width: 32px; height: 32px; font-size: .95rem; }
.mat-list-compact .mat-by { display: none; }

.mat-see-all { margin-top: var(--s-2); }

/* ----------------------------------------------------------- session page */

.mat-back { margin-bottom: var(--s-3); }
.mat-session-head { margin-bottom: var(--s-4); }
.mat-foot { margin-top: var(--s-6); }

/* ------------------------------------------------------------------ desktop */

@media (min-width: 720px) {
  .mat-list { gap: var(--s-3); }
  .mat-glyph { width: 44px; height: 44px; font-size: 1.2rem; }
  .mat-search { max-width: 420px; }
}

/* Dark mode: the rgba tints above are mixed over --surface, which already
   flips, so they stay legible. Only the "New" pill needs a nudge so red on a
   dark card is not shouting. */
@media (prefers-color-scheme: dark) {
  .mat-new { background: #b32a2a; }
  .mat-glyph-recording { background: rgba(224, 57, 57, .2); }
  .mat-glyph-resource { background: rgba(255, 128, 68, .2); }
}

@media (prefers-reduced-motion: no-preference) {
  .mat-main { transition: background .14s ease; }
  .mat-save, .mat-remove { transition: background .14s ease, color .14s ease; }
}
