:root {
  --bg: #050505;
  --fg: #f4f4f4;
  --accent: #e02222;
  --muted: #888;
  --border: #222;
  --panel-bg: rgba(0,0,0,0.92);
}
.back-button {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 2rem auto 1.5rem;
  padding: 0.75rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: 0.25s ease;
}

.back-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
}

/* ---------- NAV ---------- */

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0,0,0,0.9);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
}

.nav-links a {
  margin-left: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-decoration: none;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--accent);
}

/* ---------- HERO (SPIRAL + TITLE) ---------- */

.hero {
  position: relative;
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

/* spinning spiral behind hero */
.hero::before {
  content: "";
  position: absolute;
  inset: -25vmin;
  background-image: url("images/spiral.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 150vmin;
  opacity: 0.22;
  animation: spin 90s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* slight darkening so text is readable */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
              rgba(0,0,0,0.15), rgba(0,0,0,0.8));
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
}

.hero-inner h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-sub {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* spin animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- FORM SECTION ---------- */

.form-section {
  padding: 2.5rem 1rem 3rem;
  display: flex;
  justify-content: center;
}

.panel {
  width: 100%;
  max-width: 700px;
  padding: 2rem 1.6rem 2.4rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 0 40px rgba(0,0,0,0.7);
}

/* ---------- FORM ---------- */


.dream-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1.5rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* each field is a block */
.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.form-group textarea,
.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7rem;
  background: rgba(0,0,0,0.65);
  color: var(--fg);
  border: 1px solid #333;
  font-size: 0.9rem;
}

.form-group textarea {
  min-height: 150px;
}

/* submit button */
.dream-form button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
  padding: 0.9rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}

.dream-form button:hover {
  background: #ff3d3d;
}

.consent-note {
  margin-top: 0.5rem;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-align: center;
}

/* ---------- GALLERY PAGE ---------- */

.page-gallery {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* header text */

.gallery-header h1 {
  font-size: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.gallery-intro {
  max-width: 40rem;
  line-height: 1.5;
  font-size: 0.95rem;
  color: var(--muted);
}

/* filter buttons */

.gallery-filters {
  margin: 1.75rem 0 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* controls row */
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0 1.5rem;
}

/* "clear filter" button (you may already have something similar) */
.clear-filter-button {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: 0.25s ease;
}

.clear-filter-button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255,0,0,0.1);
}

.clear-filter-button.is-hidden {
  display: none;
}

/* "show all thumbnails" toggle */
.toggle-view-button {
  padding: 0.5rem 0.9rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.25s ease;
}

.toggle-view-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === THUMBNAIL MODE (simple) === */

/* when in thumbnail mode, .gallery-grid has .thumbs-mode */
.gallery-grid.thumbs-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-grid.thumbs-mode .gallery-item {
  padding: 0.4rem;
  cursor: pointer;
}

/* thumbnails fill their card */
.gallery-grid.thumbs-mode .gallery-item img {
  max-width: 100%;
  height: auto;
  margin: 0;
}

/* hide tags + text in thumbnail mode */
.gallery-grid.thumbs-mode .gallery-tags,
.gallery-grid.thumbs-mode .gallery-caption {
  display: none;
}

/* === MODAL VIEW === */

.dream-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dream-modal.is-hidden {
  display: none;
}

.dream-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
}

.dream-modal-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  width: 90%;
  max-height: 90vh;
  padding: 1.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0,0,0,0.9);
}

.dream-modal-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 1rem;
}

.dream-modal-caption {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
}

.dream-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.filter-btn {
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  color: var(--muted);
}

.filter-btn:hover {
  background: rgba(255,255,255,0.04);
}

.filter-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* grid layout */

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  max-width: 600px;
  margin: 0 auto;
}


/* each card */

.gallery-item {
  border: 1px solid var(--border);
  padding: 0.9rem;
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Make gallery images small and controlled */
.gallery-item img {
  display: block;
  max-width: 320px;   /* width of the image itself */
  height: auto;
  margin: 0 auto;     /* center the image inside the card */
}

/* hidden by filter */

.gallery-item.is-hidden {
  display: none;
}

/* thumbnail */

.gallery-thumb-link {
  display: block;
  overflow: hidden;
}

.gallery-thumb-link img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  transform: translateZ(0);
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

.gallery-thumb-link:hover img {
  transform: scale(1.03);
  opacity: 0.9;
}

/* text on card */

.gallery-meta {
  margin-top: 0.5rem;
}

.gallery-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--fg);
}

.gallery-meta-line {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.gallery-meta-line span + span::before {
  content: "·";
  padding: 0 0.35rem;
}

/* tags + caption */

.gallery-tags {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

.gallery-caption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

/* responsive tweaks */

@media (max-width: 640px) {
  .page-gallery {
    padding-inline: 1rem;
  }

  .gallery-header h1 {
    font-size: 1.7rem;
  }
/* In thumbnail mode, make items just bare images (no box) */
.gallery-grid.thumbs-mode .gallery-item {
  padding: 0;                  /* remove inner spacing */
  background: transparent;     /* no black panel */
  border: none;                /* no border box */
}

/* make sure the image just fills the cell naturally */
.gallery-grid.thumbs-mode .gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;             /* override the 320px from normal view */
  margin: 0;
}
.gallery-grid {
  display: flex;
  flex-direction: column-reverse;
}

}
