/* =============================================================
   /showcase — public gallery of student work.
   Loaded by app/showcase/layout.tsx. Builds on the tokens in
   public/styles.css (--brand, --ink, --muted, --border, --radius…).
   ============================================================= */

.showcase-page { overflow-x: clip; }

.showcase-main { padding-top: 40px; }

/* ---------- Filters ---------- */
.showcase-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.showcase-filters[aria-busy="true"] { opacity: 0.85; }

.showcase-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.showcase-field > span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.showcase-field input,
.showcase-field select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
.showcase-field input:focus,
.showcase-field select:focus {
  outline: 2px solid var(--brand-soft);
  border-color: var(--brand);
}

.showcase-filters__buttons {
  display: flex;
  gap: 8px;
}

/* ---------- Buttons ---------- */
.showcase-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.showcase-filters .showcase-btn { min-height: 40px; }
.showcase-btn:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.showcase-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.showcase-btn--primary:hover:not(:disabled) {
  background: var(--brand-deep) !important;
  border-color: var(--brand-deep) !important;
}
.showcase-btn:disabled,
.showcase-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.showcase-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: page-spin 0.7s linear infinite;
  flex: none;
}

.showcase-summary {
  margin: 20px 2px 16px;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Grid + cards ---------- */
.showcase-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.showcase-grid > li { min-width: 0; }

.showcase-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Fixed portrait frame; the image is absolutely positioned so an
   aspect-ratio box never grows to the photo's intrinsic height. */
.showcase-card__frame {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  overflow: hidden;
  background: #EEF0F6;
}
.showcase-card__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.showcase-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.showcase-card__cover:hover img { transform: scale(1.03); }
.showcase-card__cover--video {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
}
.showcase-card__play {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.2rem;
  padding-left: 4px;
}
.showcase-card__count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  pointer-events: none;
}

.showcase-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  min-width: 0;
}
.showcase-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.showcase-card__student {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.showcase-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.showcase-tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 700;
}
.showcase-tag--branch { background: var(--l1-soft); color: #047857; }
.showcase-tag--muted { background: transparent; color: var(--muted); padding-left: 0; }
.showcase-card__date {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.showcase-card__actions {
  margin-top: auto;
  padding-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.showcase-btn--wide { grid-column: 1 / -1; }

/* ---------- Empty + pager ---------- */
.showcase-empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.showcase-empty__title { font-weight: 700; color: var(--ink); margin-bottom: 4px; }

.showcase-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}
.showcase-pager .showcase-btn { min-width: 40px; }
.showcase-pager__gap { align-self: center; color: var(--muted); padding: 0 2px; }

/* ---------- Media dialog (native <dialog>, top layer) ---------- */
.showcase-modal {
  /* Own tokens: the dialog must not depend on page-scoped variables. */
  --sm-accent: #6366F1;
  --sm-ink: #0F172A;
  --sm-muted: #64748B;
  --sm-surface: #FFFFFF;
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--sm-surface);
  color: var(--sm-ink);
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.5);
  overflow: auto;
}
.showcase-modal::backdrop { background: rgba(15, 23, 42, 0.7); }
.showcase-modal__inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.showcase-modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.showcase-modal__heading { flex: 1; min-width: 0; }
.showcase-modal__heading h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.showcase-modal__heading p {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: var(--sm-muted);
}
.showcase-modal__close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background: #fff;
  color: var(--sm-ink);
  font-size: 1rem;
  cursor: pointer;
}
.showcase-modal__close:hover { background: #F1F5F9; }
.showcase-modal .showcase-btn--primary {
  background: var(--sm-accent);
  border-color: var(--sm-accent);
  color: #fff;
}
.showcase-modal__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.showcase-modal__photo { display: block; }
.showcase-modal__photo img {
  display: block;
  width: 100%;
  max-height: 68dvh;
  object-fit: contain;
  border-radius: 10px;
  background: #F1F5F9;
}
.showcase-modal__video {
  overflow: hidden;
  border-radius: 10px;
  background: #000;
}
.showcase-modal__video video,
.showcase-modal__video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}
.showcase-modal__nolink {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 16 / 9;
  background: #F1F5F9;
  color: var(--sm-muted);
}
.showcase-modal__nolink a { color: var(--sm-accent); font-weight: 700; }
.showcase-modal__thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.showcase-modal__thumbs button {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: none;
  cursor: pointer;
}
.showcase-modal__thumbs button.is-active { border-color: var(--sm-accent); }
.showcase-modal__thumbs img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .showcase-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .showcase-field--search { grid-column: 1 / -1; }
  .showcase-filters__buttons { grid-column: 1 / -1; }
  .showcase-filters__buttons .showcase-btn { flex: 1; }
}
@media (max-width: 560px) {
  .showcase-main { padding-top: 24px; }
  .showcase-grid { grid-template-columns: 1fr; }
  .showcase-card__frame { aspect-ratio: 4 / 3; }
  .showcase-modal__inner { padding: 12px; }
}
