/* Home page: the class tiles. Kept apart from styles.css, which the quiz pages share. */

.classes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));   /* four or five tiles in one row on a wide screen */
  gap: 16px;
  margin-bottom: 22px;
}

.class-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(180deg, #1b1408 0%, #0c0803 100%);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(.2, .8, .2, 1), box-shadow 0.3s, border-color 0.3s;
}

a.class-tile:hover,
a.class-tile:focus-visible {
  transform: translateY(-6px);
  border-color: var(--gold-bright);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.7), 0 0 22px rgba(246, 217, 106, 0.25);
  outline: none;
}

.class-tile { container-type: inline-size; }

.class-art {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  background: #0a0f1f;
}

.class-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
  padding: 12px 14px 14px;
}

.class-kicker {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  /* room for two lines, the text sitting on the lower one, so every tile's title starts at the same height */
  min-height: 2.7em;
  line-height: 1.35;
  display: flex;
  align-items: flex-end;
}

.class-tile h2 {
  margin: 0;
  font-family: var(--font-display);
  /* sized from the tile's own width, so the longest title (Occlumency) fits a narrow tile and never runs off its edge */
  font-size: clamp(15px, 10cqw, 26px);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  color: var(--gold-bright);
}

.class-tile p {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
}

.class-go {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--gold-bright);
}

.class-tile.is-shut { border-color: rgba(138, 122, 85, 0.4); box-shadow: none; }
.class-tile.is-shut .class-art { filter: grayscale(1) brightness(0.45); }
.class-tile.is-shut h2,
.class-tile.is-shut p { color: var(--ink-muted); }
.class-tile.is-shut .class-go { color: var(--ink-dim); }

.closed-note {
  max-width: 760px;
  margin: 0 auto 14px;
  padding: 10px 16px;
  text-align: center;
  font-size: 18px;
  color: var(--ink);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 8px;
  background: rgba(8, 5, 2, 0.75);
}

.token-count {
  margin-left: 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
}

.shelf { margin-bottom: 32px; }

@media (max-width: 900px) {
  .classes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .classes { gap: 10px; }
  .class-body { padding: 10px; }
  .class-tile p { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .class-tile { transition: none; }
  a.class-tile:hover, a.class-tile:focus-visible { transform: none; }
}

/* Parent dashboard: one switch for each class and child. */
.admin-classes { margin: 18px 0 6px; border: 1px solid rgba(212, 175, 55, 0.35); background: rgba(8, 5, 2, 0.88); padding: 16px 18px; border-radius: 8px; }
.admin-classes h2 { margin: 0 0 4px; font: 700 18px var(--font-display); color: var(--gold-bright); }
.admin-classes > p { margin: 0 0 12px; color: var(--ink-dim); }
.admin-classes table { border-collapse: collapse; width: 100%; max-width: 620px; }
.admin-classes th, .admin-classes td { padding: 6px 10px 6px 0; text-align: left; }
.admin-classes thead th { font: 12px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.admin-classes tbody th { font: 600 17px var(--font-serif); color: var(--ink); }
.class-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; color: var(--ink); }
.class-switch input { width: 20px; height: 20px; accent-color: var(--gold); cursor: pointer; }
.class-switch span { min-width: 3.6em; }

/* the shelf and its label disappear when the vocabulary class is closed */
.shelf[hidden], .shelf-label[hidden], .closed-note[hidden] { display: none; }

/* ---------- my room: a button in the top corner; the room itself is its own page ---------- */
.room-button {
  position: absolute; top: 14px; right: 24px; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  font-family: var(--font-display); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  color: var(--gold-bright); border: 1px solid rgba(246, 217, 106, 0.7);
  background: linear-gradient(180deg, #6a4410 0%, #2a1a06 100%);
  box-shadow: 0 0 18px rgba(246, 217, 106, 0.25);
  transition: transform 0.15s, box-shadow 0.25s;
}
.room-button[hidden] { display: none; }
.room-button:hover, .room-button:focus-visible { transform: translateY(-1px); box-shadow: 0 0 28px rgba(246, 217, 106, 0.45); outline: none; }
.room-button span { font-size: 18px; letter-spacing: 0; }
@media (max-width: 700px) {
  .room-button { top: 8px; right: 12px; padding: 7px 12px; font-size: 11px; }
}
