/* Palette matches search.carlcon.net (MCP Search) exactly, so the two
   sites read as one family. */
:root {
  --bg: #14151a;
  --bg2: #1c1f2a;
  --panel: #1d1f27;
  --border: #2c2f3a;
  --text: #e8e9ee;
  --muted: #9299ab;
  --accent: #e0393e;
  --img-bg: #0c0d10;
  --well: #14151a;
  --featured-outline: #e0b23d;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e0dcd2;
    --bg2: #cfc5b0;
    --panel: #f2efe9;
    --border: #c2b8a5;
    --text: #201f1c;
    --muted: #6b6558;
    --accent: #e0393e;
    --well: #d9d3c5;
    --featured-outline: #b5850f;
  }
}

:root[data-theme="light"] {
  --bg: #e0dcd2;
  --bg2: #cfc5b0;
  --panel: #f2efe9;
  --border: #c2b8a5;
  --text: #201f1c;
  --muted: #6b6558;
  --accent: #e0393e;
  --well: #d9d3c5;
  --featured-outline: #b5850f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

header {
  padding: 28px 20px 24px;
  text-align: center;
  position: relative;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#themeToggle {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

#themeToggle img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
  border: 1px solid var(--border);
}

#themeToggle .themeLabel {
  color: var(--muted);
  font-size: 0.75rem;
}

#searchWrap {
  max-width: 640px;
  margin: 20px auto 0;
  padding: 0 20px;
  text-align: left;
}

#search {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}

#search:focus { border-color: var(--accent); }

.virtual-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.virtual-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

main {
  flex: 1;
  background: radial-gradient(ellipse at top, var(--panel) 0%, var(--bg) 55%, var(--bg2) 100%);
  padding: 8px 20px 56px;
}

section {
  max-width: 1300px;
  margin: 0 auto;
}

section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 32px 0 16px;
}

.empty-msg {
  color: var(--muted);
  font-style: italic;
}

/* ===== Gallery ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tile:hover, .tile:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  outline: none;
}

.tile-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--img-bg);
}

.tile.is-featured {
  border: 3px solid var(--featured-outline);
}

/* ===== Generated poster (events with no organizer flyer) ===== */
.poster-tile {
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #241b38 0%, #33436a 55%, #4d6f92 100%);
  color: #fff;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.poster-art {
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(160deg, #171b28 0%, #2a3550 100%);
  clip-path: polygon(0 0, 100% 0, 74% 100%, 0 100%);
}

.poster-content {
  position: absolute;
  inset: 0;
  left: 34%;
  padding: 5cqw 5cqw 5cqw 4cqw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2cqw;
}

.poster-brand {
  display: flex;
  align-items: center;
  gap: 2cqw;
}

.poster-venue-logo {
  width: 9cqw;
  height: 9cqw;
  min-width: 24px;
  min-height: 24px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 0.6cqw;
  flex-shrink: 0;
}

.poster-mcp-logo {
  height: 9cqw;
  min-height: 22px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.poster-name {
  font-size: 5cqw;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.08;
  text-wrap: balance;
}

.poster-details {
  font-size: 2.3cqw;
  line-height: 1.55;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.95;
}

.poster-details b { font-weight: 800; }

.poster-corner-logo {
  position: absolute;
  top: 3cqw;
  right: 3cqw;
  width: 13cqw;
  height: 13cqw;
  min-width: 28px;
  min-height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

div.detail-image {
  overflow: hidden;
  border-radius: 10px;
}

.tile-info {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.tile-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
}

.tile-location {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

footer p { margin: 0; }
footer p + p { margin-top: 6px; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===== Detail overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.detail-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.detail-close:hover, .detail-close:focus-visible { color: var(--accent); }

.detail-image {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 16px;
  display: block;
}

.detail-body h3 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.detail-sub {
  color: var(--muted);
  margin-bottom: 16px;
}

.detail-major-badge {
  display: inline-block;
  margin: 14px 0 -2px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--featured-outline);
  color: #201f1c;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 8px;
  column-gap: 14px;
  font-size: 0.92rem;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 600;
}

.detail-grid dd { margin: 0; }

.detail-grid dd a { color: var(--accent); text-decoration: none; }
.detail-grid dd a:hover { text-decoration: underline; }

.detail-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.detail-link:hover { text-decoration: underline; }

.detail-notes {
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.detail-copy-link {
  display: block;
  margin-top: 18px;
  padding: 8px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.detail-copy-link:hover, .detail-copy-link:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}
