/* =============================================================
   EXPLORE PAGE — public frame gallery (/explore)
   No inline styles allowed: the page runs under a strict CSP.
   ============================================================= */

body { background: var(--pg-bg); }

body::before {
  content: ''; position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,196,176,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,196,176,.02) 1px, transparent 1px);
  background-size: 72px 72px; pointer-events: none; z-index: 0;
}

[hidden] { display: none !important; }

/* ── Landing-style navbar (same as tutorials.html) ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 5vw, 80px);
  z-index: 1000;
  transition: background .3s, backdrop-filter .3s;
}
.nav::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,196,176,.25), rgba(123,97,255,.25), transparent);
}
.nav.scrolled {
  background: rgba(14,14,12,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo-icon { flex-shrink: 0; }
.logo-text { font-size: 18px; font-weight: 400; color: var(--pg-accent); letter-spacing: -.01em; }
.logo-text strong { font-weight: 800; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 500; }
.nav-links a { color: var(--pg-muted); text-decoration: none; transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--pg-accent); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-btn {
  display: inline-flex; align-items: center;
  padding: 8px 20px; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: all .18s; border: none; white-space: nowrap;
}
.nav-btn-ghost { background: transparent; border: 1.5px solid var(--pg-border); color: var(--pg-fg); }
.nav-btn-ghost:hover { border-color: var(--pg-accent); color: var(--pg-accent); }
.nav-btn-teal { background: var(--pg-accent); color: #0E0E0C; font-weight: 700; }
.nav-btn-teal:hover { background: #00d9c3; box-shadow: 0 0 22px rgba(0,196,176,.45); transform: translateY(-1px); }
@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-btn { padding: 7px 12px; font-size: 13px; }
  .nav-actions .nav-btn-ghost { display: none; }
}

/* ── Hero ── */
.ex-hero {
  position: relative; text-align: center;
  padding: 108px clamp(16px, 5vw, 80px) 44px;
  overflow: hidden;
}
.ex-hero-glow {
  position: absolute; top: -80px; left: 50%; transform: translateX(-50%);
  width: min(700px, 100%); height: 420px;
  background: radial-gradient(ellipse, rgba(0,196,176,.08), transparent 65%);
  pointer-events: none; z-index: 0;
}
.ex-hero-inner { position: relative; z-index: 1; }
.ex-hero-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--pg-accent); margin-bottom: 16px;
}
.ex-hero-title {
  font-size: clamp(30px, 5vw, 48px); font-weight: 700;
  letter-spacing: -.03em; line-height: 1.1; margin-bottom: 14px;
}
.ex-hero-title .grad {
  background: linear-gradient(135deg, #00C4B0, #7B61FF);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.ex-hero-sub { font-size: 15px; color: var(--pg-muted); max-width: 500px; margin: 0 auto; line-height: 1.65; }

/* ── Main ── */
.ex-main {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 8px clamp(16px, 3vw, 32px) 80px;
}

/* Author banner */
.ex-author {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; margin-bottom: 18px;
  background: rgba(0,196,176,.05); border: 1px solid rgba(0,196,176,.18); border-radius: 12px;
}
.ex-author-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--pg-muted); margin-bottom: 2px;
}
.ex-author-name { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--pg-fg); overflow-wrap: anywhere; }
.ex-author-clear { font-size: 13px; color: var(--pg-accent); text-decoration: none; white-space: nowrap; }
.ex-author-clear:hover { text-decoration: underline; }

/* Toolbar */
.ex-toolbar { display: flex; gap: 10px; margin-bottom: 24px; }
.ex-search {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
  color: var(--pg-muted);
}
.ex-search svg { position: absolute; left: 12px; pointer-events: none; }
.ex-search input, .ex-sort {
  width: 100%; height: 42px; box-sizing: border-box;
  background: var(--pg-surface); border: 1px solid var(--pg-border); border-radius: 10px;
  color: var(--pg-fg); font-family: inherit; font-size: 14px; outline: none;
  transition: border-color .15s;
}
.ex-search input { padding: 0 14px 0 38px; }
.ex-search input:focus, .ex-sort:focus { border-color: var(--pg-accent); }
.ex-sort { width: auto; padding: 0 12px; cursor: pointer; }

/* Grid */
.ex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.ex-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--pg-surface); border: 1px solid var(--pg-border); border-radius: 14px;
  overflow: hidden; transition: border-color .18s, transform .18s, box-shadow .18s;
}
.ex-card:hover {
  border-color: rgba(0,196,176,.45); transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.ex-thumb {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--pg-surface-2); border-bottom: 1px solid var(--pg-border);
}
.ex-thumb iframe {
  position: absolute; top: 0; left: 0;
  width: 1280px; height: 800px; border: 0;
  transform-origin: 0 0; pointer-events: none;
}
.ex-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: top center;
}
/* Transparent layer so the whole thumbnail is one click target */
.ex-thumb::after { content: ''; position: absolute; inset: 0; }

.ex-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; min-width: 0; }
.ex-title {
  font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--pg-fg);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-title:hover { color: var(--pg-accent); }
.ex-desc {
  font-size: 13px; color: var(--pg-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.ex-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--pg-muted);
}
.ex-by {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--pg-accent);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-by:hover { text-decoration: underline; }
.ex-views { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }

/* Skeleton while loading */
.ex-card.is-skeleton .ex-thumb,
.ex-card.is-skeleton .ex-sk-line {
  background: linear-gradient(90deg, var(--pg-surface-2), #24241f, var(--pg-surface-2));
  background-size: 200% 100%; animation: ex-shimmer 1.4s infinite linear;
}
.ex-sk-line { height: 12px; border-radius: 6px; }
.ex-sk-line.short { width: 55%; }
@keyframes ex-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .ex-card, .ex-card.is-skeleton .ex-thumb, .ex-card.is-skeleton .ex-sk-line { animation: none; transition: none; }
}

.ex-empty { text-align: center; padding: 60px 16px; color: var(--pg-muted); }
.ex-empty h3 { font-size: 17px; color: var(--pg-fg); margin-bottom: 6px; }
.ex-empty p { font-size: 14px; }

.ex-error { grid-column: 1 / -1; text-align: center; color: var(--pg-danger); padding: 24px 0; font-size: 14px; }

.ex-more-wrap { display: flex; justify-content: center; margin-top: 32px; }

/* In-page viewer: header + search stay, gallery parts hide */
body.ex-viewing .ex-hero,
body.ex-viewing .ex-author,
body.ex-viewing .ex-grid,
body.ex-viewing .ex-empty,
body.ex-viewing .ex-more-wrap { display: none !important; }
body.ex-viewing .ex-main { padding-top: 76px; }
body.ex-viewing .ex-toolbar { margin-bottom: 14px; }

.ex-viewer { display: flex; flex-direction: column; gap: 12px; }
.ex-viewer-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ex-viewer-report { text-decoration: none; opacity: .75; }
.ex-viewer-report:hover { opacity: 1; }
.ex-viewer-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ex-viewer-title {
  font-size: 18px; font-weight: 700; letter-spacing: -.015em; color: var(--pg-fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-viewer-info .ex-by { align-self: flex-start; }
.ex-viewer-frame {
  width: 100%; height: calc(100vh - 200px); min-height: 460px;
  border: 1px solid var(--pg-border); border-radius: 14px; background: #000; display: block;
}

/* Full screen: the whole viewer (bar + frame) fills the screen; the page stays underneath.
   Native :fullscreen where supported, .is-max fallback (e.g. iPhone) — kept as separate
   rules because an unsupported pseudo-class would invalidate a combined selector. */
.ex-viewer.is-max {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--pg-bg); padding: 10px 12px; gap: 8px;
}
.ex-viewer:fullscreen { background: var(--pg-bg); padding: 10px 12px; gap: 8px; }
.ex-viewer:-webkit-full-screen { background: var(--pg-bg); padding: 10px 12px; gap: 8px; width: 100%; height: 100%; }
.ex-viewer.is-max .ex-viewer-frame { flex: 1; height: auto; min-height: 0; border-radius: 8px; }
.ex-viewer:fullscreen .ex-viewer-frame { flex: 1; height: auto; min-height: 0; border-radius: 8px; }
.ex-viewer:-webkit-full-screen .ex-viewer-frame { flex: 1; height: auto; min-height: 0; border-radius: 8px; }

@media (max-width: 520px) {
  .ex-viewer-frame { height: calc(100vh - 230px); min-height: 380px; border-radius: 10px; }
  .ex-toolbar { flex-direction: column; }
  .ex-sort { width: 100%; }
  .ex-author { flex-direction: column; align-items: flex-start; }
}
