/* Neo Gothic City — gallery chrome */

:root {
  --bg-0: #05060f;
  --bg-1: #0a0d1f;
  --bg-2: #12173a;
  --panel: rgba(16, 19, 44, 0.72);
  --panel-border: rgba(140, 130, 255, 0.14);
  --gold: #e8b04b;
  --gold-dim: rgba(232, 176, 75, 0.55);
  --text: #e8e9f5;
  --text-dim: #9aa0c0;
  --ink: #0b0e1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 600px at 50% -12%, rgba(64, 56, 160, 0.28), transparent 62%),
    radial-gradient(900px 500px at 88% 18%, rgba(40, 44, 110, 0.22), transparent 60%),
    radial-gradient(700px 700px at 8% 78%, rgba(56, 34, 96, 0.16), transparent 65%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 55%, #060810 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.5;
}

/* ---------- Hero ---------- */

#hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 24px 36px;
  text-align: center;
}

.title {
  margin: 0 0 6px;
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fdf3d8 0%, var(--gold) 45%, #8a6420 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 46px rgba(232, 176, 75, 0.25);
}

.eyebrow {
  margin: 0 0 26px;
  font-size: 0.8rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.title::after {
  content: "";
  display: block;
  width: 96px;
  height: 1px;
  margin: 22px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow: 0 0 12px var(--gold-dim);
}

#prompt {
  position: relative;
  margin: 26px auto 0;
  max-width: 820px;
  padding: 20px 26px 20px 56px;
  text-align: left;
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.75;
  color: #c7cce6;
  background: linear-gradient(180deg, rgba(18, 21, 52, 0.7), rgba(10, 12, 30, 0.7));
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--gold-dim);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.prompt-marker {
  position: absolute;
  left: 20px;
  top: 18px;
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Gallery grid ---------- */

.grid {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 26px;
}

.card {
  position: relative;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
}

.card:hover,
.card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(232, 176, 75, 0.45);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(232, 176, 75, 0.14);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
  border-bottom: 1px solid rgba(140, 130, 255, 0.1);
  contain: layout paint;
}

.gif-preview {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card.ready .gif-preview {
  display: block;
}

.capture {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  transform-origin: top left;
  will-change: transform;
  pointer-events: none;
}

.card.capturing .capture {
  display: block;
}

.fail-msg {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  padding: 0 12px;
}

.card.failed .fail-msg {
  display: flex;
}

.card.failed .loader {
  opacity: 0;
  visibility: hidden;
}

.card-meta {
  padding: 13px 16px 15px;
  text-align: center;
}

.model-name {
  display: block;
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  color: #f0ecff;
}

.reasoning {
  display: block;
  margin-top: 4px;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--gold);
}

/* ---------- Card loader ---------- */

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(24, 28, 62, 0.9), rgba(8, 10, 22, 0.96));
  transition: opacity 0.35s ease, visibility 0.35s;
  z-index: 2;
}

.loader span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(232, 176, 75, 0.18);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 18px rgba(232, 176, 75, 0.2);
}

.card.ready .loader {
  opacity: 0;
  visibility: hidden;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 24px 46px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ---------- Fullscreen view ---------- */

.view {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
}

.view iframe {
  display: block;
  width: 100vw;
  height: 100vh;
  border: 0;
}

.back-btn {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 60;
  padding: 9px 18px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  color: #fff;
  text-decoration: none;
  background: rgba(10, 12, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.back-btn:hover {
  background: rgba(232, 176, 75, 0.85);
  border-color: transparent;
  color: var(--ink);
}

/* Hide page chrome while in fullscreen view */
body.in-view #hero,
body.in-view .grid,
body.in-view .site-footer {
  display: none;
}

/* ---------- Error state ---------- */

.gallery-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
}
