/* ═══════════════════════════════════════════════════════════════
   PIEDESTAL — stylesheet
   Mobile-first: swipe cards → desktop: scrollable grid
═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:           #0d0d0d;
  --surface:      #181818;
  --border:       rgba(255,255,255,0.07);
  --text:         #f0ece8;
  --text-dim:     #999;
  --text-muted:   #555;
  --radius:       18px;
  --header-h:     54px;
  --ease-out:     cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring:  cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
iframe { border: none; display: block; }

/* ── Base ───────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  overflow: hidden; /* mobile default — overridden on desktop */
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 50%, transparent);
}

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 5px;
  pointer-events: all;
}

/* ── Filter toggle button (mobile only) ─────────────────────── */
.filter-toggle {
  display: none;
}

@media (max-width: 767px) {
  .filter-toggle {
    display: block;
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 150;
    width: 38px;
    height: 38px;
    border-radius: 4px;
    overflow: hidden;
    border: none;
    padding: 0;
    cursor: pointer;
    background: none;
    pointer-events: all;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
  }
  .filter-toggle:hover { opacity: 1; transform: scale(1.08); }
  .filter-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: invert(1);
  }

  .filter-bar {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    padding: 10px 14px 14px;
    background: rgba(13,13,13,0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    transform: translateY(-105%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.18s;
    z-index: 99;
  }

  .filter-bar.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
}
.filter-pill {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.filter-pill:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}
.filter-pill.active {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
}

.logo {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--text);
}

.tagline {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Splash screen ───────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.7s ease;
}
#splash img {
  width: 140px;
  height: 140px;
}
.splash-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #555;
}
#splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ── Share button (bottom-left) ─────────────────────────────── */
.share-btn {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 150;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  overflow: hidden;
  border: none;
  padding: 0;
  cursor: pointer;
  background: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}
.share-btn:hover {
  opacity: 1;
  transform: scale(1.08);
}
.share-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: invert(1);
}

/* ── School logo button ─────────────────────────────────────── */
.school-logo {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 150;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}
.school-logo:hover {
  opacity: 1;
  transform: scale(1.08);
}
.school-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Type badge ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}
.badge-drawing   { color: #a8d8ea; }
.badge-artdesign { color: #f0d4a8; }
.badge-other   { color: #b5c9a8; }
.badge-render    { color: #f9c8d4; }
.badge-model3d   { color: #c4b5f5; }
.badge-animation { color: #a8e6cf; }
.badge-game      { color: #ffd3a5; }

/* ── Placeholder (when no file yet) ────────────────────────── */
.placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,0.12);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE — SWIPE VIEW
═══════════════════════════════════════════════════════════════ */

.swipe-view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Container that holds the stacked cards */
.card-stage {
  position: absolute;
  top:    calc(var(--header-h) + 10px);
  bottom: 136px; /* room for swipe-info (50px) + controls (76px) + gap (10px) */
  left:   22px;
  right:  22px;
}

/* Individual art card */
.card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  will-change: transform, opacity;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  transform-origin: center bottom;
}

.card-media-wrap {
  position: absolute;
  inset: 7%; /* pull media inside the frame border for all types */
}
.card-media-wrap img,
.card-media-wrap video,
.card-media-wrap model-viewer {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Drawings, images, paintings, projects & renders: extra inset + contain so the full image is visible */
.card.type-drawing .card-media-wrap,
.card.type-artdesign .card-media-wrap,
.card.type-artdesign .card-media-wrap,
.card.type-other .card-media-wrap,
.card.type-render .card-media-wrap {
  inset: 13%;
  background: #111;
}
.card.type-drawing .card-media-wrap img,
.card.type-artdesign .card-media-wrap img,
.card.type-artdesign .card-media-wrap img,
.card.type-other .card-media-wrap img,
.card.type-render .card-media-wrap img {
  object-fit: contain;
}

/* Title/author below the card stage (mobile only) */
.swipe-info {
  position: absolute;
  bottom: 80px;
  left: 0; right: 0;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.swipe-info-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}
.swipe-info-author {
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-dim);
}

/* Hide the in-card title/scrim on mobile — shown below the stage instead */
.card-scrim,
.card-info {
  display: none;
}

/* Gradient scrim at bottom of card */
.card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.82) 0%,
    rgba(0,0,0,0.3)  35%,
    transparent      60%
  );
  pointer-events: none;
}

/* Picture frame overlay — sits above artwork, below UI labels */
.artwork-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 3;
  border-radius: inherit;
}

.card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
}

.card-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 18px 18px 22px;
  z-index: 4;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 5px;
}
.card-author {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

/* Game card: thumbnail + play button */
.game-thumb {
  position: relative;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-thumb img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.play-btn {
  position: relative;
  z-index: 2;
  padding: 11px 26px;
  border-radius: 40px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fff;
  transition: background 0.2s, transform 0.15s;
}
.play-btn:hover, .play-btn:active {
  background: rgba(255,255,255,0.25);
  transform: scale(1.04);
}
.game-iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}

/* Bottom controls */
.swipe-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
}
.swipe-counter {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.swipe-nav {
  display: flex;
  gap: 28px;
}
.swipe-nav-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.swipe-nav-btn:hover  { background: rgba(255,255,255,0.14); color: var(--text); }
.swipe-nav-btn:disabled { opacity: 0.18; pointer-events: none; }

/* First-visit hint */
.swipe-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.2s ease;
  z-index: 5;
}
.swipe-hint.fade-out { opacity: 0; }


/* ═══════════════════════════════════════════════════════════════
   DESKTOP — GALLERY GRID
═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  body { overflow: auto; }

  .site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  #app {
    padding-top: calc(var(--header-h) + 2px);
  }

  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: center;
    gap: 60px 40px;
    padding: 40px 48px 80px;
    /* let rotated corners bleed outside their cells */
    overflow: visible;
  }

  .gallery-item {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: visible;
    background: var(--surface);
    cursor: pointer;
    transition: transform 0.25s ease, z-index 0s;
    will-change: transform;
  }

  .gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background 0.25s ease;
    pointer-events: none;
    z-index: 1;
  }
  .gallery-item:hover::after { background: rgba(0,0,0,0.2); }

  .gallery-media {
    width: 100%; height: 100%; padding:3%;
  }
  .gallery-media img,
  .gallery-media video {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease-out);
  }
  .gallery-item:hover .gallery-media img,
  .gallery-item:hover .gallery-media video { transform: scale(1.05); }

  /* 3D viewers in gallery cells */
  .gallery-media model-viewer,
  .gallery-media > div {
    width: 100%;
    height: 100%;
    display: block;
  }

  /* Drawings, images, paintings, projects & renders: show the full image instead of cropping */
  .gallery-item.type-drawing .gallery-media,
  .gallery-item.type-artdesign .gallery-media,
  .gallery-item.type-artdesign .gallery-media,
  .gallery-item.type-other .gallery-media,
  .gallery-item.type-render .gallery-media {
    background: #111;
    padding: 13%;
  }
  .gallery-item.type-drawing .gallery-media img,
  .gallery-item.type-artdesign .gallery-media img,
  .gallery-item.type-artdesign .gallery-media img,
  .gallery-item.type-other .gallery-media img,
  .gallery-item.type-render .gallery-media img {
    object-fit: contain;
    width: 100%;
    height: 100%;
  }

  /* Landscape orientation: wider card, frame rotated to match */
  .gallery-item.orientation-landscape {
    aspect-ratio: 4 / 3;
  }

  /* Square orientation: 1:1 card, frame stretched to fill */
  .gallery-item.orientation-square {
    aspect-ratio: 1 / 1;
  }
  /*
   * Rotate the portrait frame sprite to fill a 4:3 landscape item.
   * The frame element is resized to H×W (swap dims) then rotated 90°,
   * so the portrait image fills it without distortion.
   * For a 4:3 item (W=4u, H=3u): frame physical size = 3u × 4u →
   * width = 3/4 = 75%, height = 4/3 = 133.33%
   * centered: left = (4-3)/2 / 4 = 12.5%, top = (3-4)/2 / 3 = -16.67%
   */
  .gallery-item.orientation-landscape .artwork-frame {
    inset: auto;
    width: 75%;
    height: 133.33%;
    top: -16.67%;
    left: 12.5%;
    transform: rotate(90deg);
  }
  /* Landscape drawing/render: reduce padding since frame is landscape now */
  .gallery-item.orientation-landscape.type-drawing .gallery-media,
  .gallery-item.orientation-landscape.type-render .gallery-media {
    padding: 10%;
  }

  /* Overlay revealed on hover */
  .gallery-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 14px 15px;
    /*background: linear-gradient(to top, rgba(0,0,0,0.88), transparent);*/
    transform: translateY(100%);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 4;
  }
  .gallery-item:hover .gallery-overlay {
    opacity: 1;
    /*transform: translateY(0);*/
  }

  .gallery-title {
    font-size: 1.2rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
  }
  .gallery-author {
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-dim);
  }

  .gallery-badge {
    position: absolute;
    top: 11px;
    left: 11px;
    z-index: 4;
  }
}

@media (min-width: 1200px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
}
@media (min-width: 1600px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}


/* ═══════════════════════════════════════════════════════════════
   SOLO VIEW  (lightbox / modal)
═══════════════════════════════════════════════════════════════ */

#modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}
#modal.open {
  pointer-events: all;
  opacity: 1;
}

/* Dark blurred backdrop */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
}

/* Floating media — centered, no card/box */
.modal-media-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 78vh;
  pointer-events: all;
}
.modal-media-wrap img,
.modal-media-wrap video {
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.stl-viewer canvas {
  background: transparent;
  display: block;
}
.modal-media-wrap model-viewer,
.modal-media-wrap .stl-viewer {
  width: 100%;
  height: 100%;
  display: block;
}

/* 3D solo-view: expand the wrap to fill #modal (which is already viewport-sized) */
#modal.modal-3d .modal-media-wrap {
  position: absolute;
  inset: 0;
  max-width: none;
  max-height: none;
}
.modal-media-wrap iframe {
  width: 92vw;
  max-width: 1100px;
  height: 76vh;
  border-radius: 4px;
}
.modal-media-placeholder {
  width: 340px;
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,0.15);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 12px;
}

/* Plaque — small museum-label card in the bottom-left corner */
.modal-info {
  position: absolute;
  bottom: 32px;
  left: 36px;
  z-index: 2;
  max-width: 230px;
  pointer-events: all;
  background: rgba(20, 18, 14, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 3px;
  padding: 11px 15px 13px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
}
.modal-title {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1px;
  letter-spacing: 0.01em;
}
.modal-author {
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.modal-desc {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.71rem;
  line-height: 1.65;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 3.4em;
  overflow-y: auto;
}
.modal-desc::-webkit-scrollbar { width: 3px; }
.modal-desc::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

@media (max-width: 767px) {
  .card {
    border-radius: 0;
  }
  .modal-info {
    left: 14px;
    right: 14px;
    bottom: 16px;
    max-width: none;
  }
}

/* Close button — top right */
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  z-index: 10;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.22); }
