/* Event Summoner — Phase 1 styles
   Theme: goblin-mine (default). Phase 4 adds more themes via CSS custom properties.
*/

:root {
  --base-color: #1a1612;
  --accent: #d4a02f;
  --accent-glow: rgba(212, 160, 47, 0.25);
  --text-primary: #e8dfd0;
  --text-secondary: #a89780;
  --text-muted: #6f6252;
  --card-bg: rgba(20, 16, 12, 0.82);
  --card-border: rgba(212, 160, 47, 0.18);
  --radius: 16px;
  --radius-lg: 24px;
  --max-width: 720px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino", "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body.theme-dark {
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 17px;
  position: relative;
  overflow-x: hidden;
}

/* Background layers — solid color, animated canvas, atmospheric overlay (Phase 4) */
.bg-base {
  position: fixed;
  inset: 0;
  background: var(--base-color);
  z-index: -3;
}

#bg-animation {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  display: block;
  width: 100vw;
  height: 100vh;
}

/* Aurora-draft theme: pure-CSS animated gradient (no canvas particles needed) */
#bg-animation.aurora-draft {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(80, 200, 180, 0.18), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(160, 100, 220, 0.16), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(60, 150, 220, 0.10), transparent 60%);
  background-size: 200% 200%, 220% 220%, 180% 180%;
  animation: aurora-shift 24s ease-in-out infinite alternate;
}

@keyframes aurora-shift {
  0%   { background-position: 0% 0%, 100% 100%, 50% 0%; }
  33%  { background-position: 60% 40%, 30% 60%, 0% 80%; }
  66%  { background-position: 100% 80%, 0% 30%, 80% 100%; }
  100% { background-position: 20% 100%, 80% 0%, 100% 30%; }
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(212, 160, 47, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(212, 160, 47, 0.06), transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* Main event card */
.event-card {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

@media (min-width: 720px) {
  .event-card { padding: 80px 32px 120px; }
}

/* Cover image with blurred halo behind it (Luma-style glow trick) */
.cover-wrap {
  position: relative;
  margin-bottom: 32px;
  border-radius: var(--radius-lg);
  overflow: visible;
}

.cover-glow {
  position: absolute;
  inset: -8px;
  background-size: cover;
  background-position: center;
  filter: brightness(0.85) blur(28px) saturate(1.3);
  opacity: 0.5;
  border-radius: var(--radius-lg);
  z-index: -1;
  transform: scale(0.97);
}

.cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* Headers / typography */
.event-header {
  margin-bottom: 32px;
}

.event-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.8rem);
  line-height: 1.15;
  margin: 8px 0 12px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.kicker {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 4px;
  font-weight: 600;
}

.organizer {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 4px 0 0;
}

/* Card panels — frame text areas so animated backgrounds don't reduce readability */
.next-instance,
.when-where,
.about,
.upcoming {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.next-instance .when,
.when-where .when {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 6px 0 4px;
  color: var(--text-primary);
  font-weight: 500;
}

.where {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
}

.where a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.where a:hover { color: var(--text-primary); }

/* RSVP form */
.rsvp-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rsvp-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.rsvp-form input[type="text"],
.rsvp-form input[type="email"],
.rsvp-form label input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 11px 14px;
  font-size: 1rem;
  border-radius: 10px;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.rsvp-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.5);
}

.rsvp-type {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rsvp-type legend {
  padding: 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
}

.rsvp-type label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.95rem;
}

.rsvp-type input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
}

.rsvp-form button {
  background: var(--accent);
  color: #1a1210;
  border: none;
  padding: 14px 20px;
  font-size: 1.02rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  margin-top: 4px;
}

.rsvp-form button:hover {
  background: #e5b444;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.rsvp-form button:active {
  transform: translateY(1px);
}

.rsvp-form button[disabled] {
  opacity: 0.5;
  cursor: wait;
}

.rsvp-status {
  font-size: 0.9rem;
  margin: 4px 0 0;
  min-height: 1.2em;
  color: var(--text-secondary);
}

.rsvp-status.success { color: #a8d484; }
.rsvp-status.error { color: #d48484; }

/* About section */
.about {
  margin-top: 32px;
}

.about h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.description {
  color: var(--text-primary);
  font-size: 1.02rem;
  line-height: 1.65;
}

.description p {
  margin: 0 0 1em;
}

/* Upcoming sessions */
.upcoming { margin-top: 32px; }

.upcoming h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.upcoming-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upcoming-list li a {
  display: block;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s;
}

.upcoming-list li a:hover {
  border-color: var(--accent);
  background: rgba(30, 24, 18, 0.9);
}

.no-next {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
}

/* Footer */
.es-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.es-footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

/* ─── Light theme (parchment + dark ink) ─── */

body.theme-light {
  --text-primary: #2d1a0a;
  --text-secondary: #5d4a30;
  --text-muted: #7a6447;
  --accent: #a8841f;
  --accent-glow: rgba(168, 132, 31, 0.25);
  --card-bg: rgba(244, 235, 208, 0.85);
  --card-border: rgba(168, 132, 31, 0.3);
}

body.theme-light .bg-base {
  background:
    radial-gradient(ellipse 900px 700px at 12% 18%, rgba(232, 215, 170, 0.5), transparent 60%),
    radial-gradient(ellipse 800px 600px at 85% 75%, rgba(220, 200, 165, 0.45), transparent 60%),
    radial-gradient(ellipse 600px 500px at 50% 95%, rgba(238, 225, 190, 0.35), transparent 60%),
    radial-gradient(circle 220px at 22% 82%, rgba(180, 150, 100, 0.06), transparent 70%),
    radial-gradient(circle 180px at 78% 28%, rgba(170, 140, 90, 0.05), transparent 70%),
    var(--base-color);
}

/* Subtle SVG noise overlay for paper grain */
body.theme-light .bg-overlay {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.32 0 0 0 0 0.18 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
  background-size: 240px 240px;
  background-repeat: repeat;
  opacity: 0.22;
  mix-blend-mode: multiply;
}

/* Card and form colors */
body.theme-light .next-instance,
body.theme-light .when-where,
body.theme-light .about,
body.theme-light .upcoming {
  background: rgba(244, 235, 208, 0.92);
  border-color: rgba(168, 132, 31, 0.3);
  box-shadow: 0 4px 20px rgba(80, 50, 20, 0.08);
}

body.theme-light .rsvp-form input[type="text"],
body.theme-light .rsvp-form input[type="email"],
body.theme-light .rsvp-form label input {
  background: rgba(255, 248, 226, 0.8);
  border-color: rgba(168, 132, 31, 0.3);
  color: #2d1a0a;
}

body.theme-light .rsvp-form input:focus {
  border-color: #a8841f;
  background: rgba(255, 250, 230, 1);
}

body.theme-light .rsvp-type {
  border-color: rgba(168, 132, 31, 0.3);
}

body.theme-light .rsvp-form button {
  background: #a8841f;
  color: #f4ebd0;
}

body.theme-light .rsvp-form button:hover {
  background: #c39a2c;
  box-shadow: 0 4px 20px rgba(168, 132, 31, 0.4);
}

body.theme-light .upcoming-list li a {
  background: rgba(244, 235, 208, 0.85);
  border-color: rgba(168, 132, 31, 0.3);
  color: #2d1a0a;
}

body.theme-light .upcoming-list li a:hover {
  border-color: #a8841f;
  background: rgba(244, 235, 208, 1);
}

body.theme-light code {
  background: rgba(168, 132, 31, 0.15);
  color: #8a6814;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
}

/* ─── Public calendar (root /) ─── */

.events-index {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}

@media (min-width: 720px) {
  .events-index { padding: 96px 32px 120px; }
}

.index-header {
  text-align: center;
  margin-bottom: 56px;
}

.index-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 8px 0 12px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.index-header .subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
  font-style: italic;
}

.series-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  margin-bottom: 64px;
}

@media (min-width: 720px) {
  .series-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

.series-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* When a card has a cover image, remove top padding and wrap content in card-body */
.series-card.has-cover {
  padding: 0;
}

.card-cover-link {
  display: block;
  line-height: 0;
  overflow: hidden;
}

.card-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: top;
  display: block;
  border-bottom: 2px solid var(--card-border);
  transition: transform .4s ease;
}

.card-cover-link:hover .card-cover {
  transform: scale(1.03);
}

.series-card.has-cover .card-body {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.series-card:not(.has-cover) .card-body {
  display: contents; /* transparent wrapper — no layout effect */
}

.series-card h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.2;
  margin: 6px 0 8px;
  font-weight: 600;
}

.series-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
}

.series-card h2 a:hover { color: var(--accent); }

.series-card .hosts {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 14px;
  font-style: italic;
}

.series-card .next-when {
  color: var(--text-primary);
  margin: 0 0 4px;
  font-size: 1rem;
}

.series-card .next-when strong {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 500;
}

.series-card .gathering {
  color: var(--accent);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.series-card .gathering em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
}

.series-card .description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 20px;
  flex-grow: 1;
}

.series-card .cta-row { margin: auto 0 0; }

.series-card .cta {
  display: inline-block;
  background: var(--accent);
  color: #1a1210;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.series-card .cta:hover {
  background: #e5b444;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 48px 24px;
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
}

/* Upcoming timeline */

.upcoming-timeline h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
  margin: 0 0 16px;
}

.upcoming-timeline ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upcoming-timeline li a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

@media (min-width: 720px) {
  .upcoming-timeline li a {
    grid-template-columns: 220px 1fr auto;
    align-items: baseline;
    gap: 14px;
  }
}

.upcoming-timeline li a:hover {
  border-color: var(--accent);
  background: rgba(30, 24, 18, 0.9);
}

.timeline-when {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
}

.timeline-title {
  color: var(--text-primary);
  font-size: 1rem;
}

.timeline-where {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}
