:root {
  color-scheme: dark;

  /* Surfaces */
  --surface-base: #0D0030;
  --surface-raised: #18004A;
  --surface-card: #2D1A83;

  /* Glass */
  --glass-card: rgba(45, 26, 131, 0.6);
  --glass-subtle: rgba(24, 0, 74, 0.5);
  --border-glass: rgba(88, 64, 255, 0.25);
  --border-strong: rgba(88, 64, 255, 0.4);

  /* Text */
  --text-primary: #FCFFFF;
  --text-secondary: #DCDDFF;
  --text-muted: #A49FC6;
  --text-link: #6675F6;

  /* Accents */
  --ink: #5840FF;
  --soho-lights: #F05DFB;
  --voltage: #06F0FB;
  --blue-tang: #6675F6;

  /* Gradients */
  --grad-base: linear-gradient(135deg, #18004A 0%, #0D0030 100%);
  --grad-accent: linear-gradient(90deg, #5840FF 0%, #F05DFB 100%);

  /* Shadows */
  --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);

  /* Radius & spacing */
  --radius-card: 12px;
  --radius-sm: 8px;
  --gap-base: 16px;
  --gap-section: 32px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--grad-base);
  background-attachment: fixed;
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--text-primary);
  min-height: 100vh;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--voltage);
}

h1,
h2,
h3 {
  color: var(--text-primary);
  margin-top: 0;
}

h1 { font-weight: 700; }
h2 { font-weight: 600; }
h3 { font-weight: 500; }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Skip link (accessibility) ───────────────────────────────── */

.skip-link {
  position: absolute;
  left: -9999px;
  color: var(--surface-base);
  background: var(--voltage);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ── Layout ──────────────────────────────────────────────────── */

.site-header,
main {
  width: min(70rem, calc(100% - 2rem));
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: var(--gap-section);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand img {
  height: 28px;
  width: auto;
}

.site-header nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: wrap;
}

.site-header nav a {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.site-header nav a:hover {
  background: rgba(88, 64, 255, 0.15);
  color: var(--text-primary);
}

.site-header form button {
  min-height: 2.25rem;
  padding-inline: 1rem;
  font-size: 0.8125rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

.site-header form button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(88, 64, 255, 0.1);
}

/* ── Page heading ────────────────────────────────────────────── */

.page-heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-block: 1.5rem 2rem;
}

.page-heading p {
  margin: 0;
}

/* ── Buttons ─────────────────────────────────────────────────── */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 0;
  border-radius: 999px;
  padding-inline: 1.5rem;
  color: var(--text-primary);
  background: var(--ink);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
}

button:hover,
.button:hover {
  opacity: 0.88;
  box-shadow: 0 0 16px rgba(88, 64, 255, 0.35);
}

.button-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--soho-lights);
  border-radius: 999px;
  padding-inline: 1.5rem;
  color: var(--soho-lights);
  background: transparent;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.button-danger:hover {
  background: rgba(240, 93, 251, 0.12);
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding-inline: 1.5rem;
  color: var(--text-primary);
  background: transparent;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.button-secondary:hover {
  background: rgba(88, 64, 255, 0.15);
}

/* ── Form elements ───────────────────────────────────────────── */

label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  margin-block: 0.25rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.9375rem;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--voltage);
  box-shadow: 0 0 0 2px rgba(6, 240, 251, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  margin: 0 0.5rem 0 0;
  accent-color: var(--ink);
}

select option {
  background: var(--surface-raised);
  color: var(--text-primary);
}

input[type="file"] {
  padding: 0.5rem;
  font-size: 0.8125rem;
}

/* ── Auth card & form card ───────────────────────────────────── */

.auth-card,
.form-card {
  max-width: 30rem;
  margin: 4rem auto;
  padding: 2rem;
  border-radius: var(--radius-card);
  background: var(--glass-card);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}

.auth-card h1,
.form-card h1 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.form-card {
  max-width: 45rem;
  margin-block: 2rem;
}

/* ── Card grid ───────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--gap-base);
  margin-block: 1.5rem;
}

/* ── Cards ────────────────────────────────────────────────────── */

.card,
.event-detail {
  padding: 1.25rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  background: var(--glass-card);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

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

.card a:hover {
  color: var(--voltage);
}

.card h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.875rem;
  margin-block: 0.4rem;
}

/* ── Description lists inside cards ──────────────────────────── */

.card dl,
.event-detail dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.card dt,
.event-detail dt {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card dd,
.event-detail dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Event images ────────────────────────────────────────────── */

.event-image {
  width: 100%;
  max-height: 22rem;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-bottom: 1rem;
}

/* ── Profile ─────────────────────────────────────────────────── */

.profile-avatar {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--gap-base);
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

.stats > div {
  padding: 1rem;
  background: var(--glass-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  text-align: center;
}

.stats dt {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.stats dd {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* ── Tags & filters ──────────────────────────────────────────── */

.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0;
  list-style: none;
}

.tags li {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(88, 64, 255, 0.2);
  color: var(--blue-tang);
  border: 1px solid rgba(88, 64, 255, 0.3);
}

.filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filters a {
  display: inline-block;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  background: rgba(88, 64, 255, 0.12);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filters a:hover {
  background: rgba(88, 64, 255, 0.25);
  color: var(--text-primary);
  border-color: var(--border-glass);
}

/* ── Pagination ──────────────────────────────────────────────── */

.pagination,
#event-list > nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
  font-size: 0.875rem;
}

.pagination span,
#event-list > nav span {
  color: var(--text-muted);
}

/* ── Status & errors ─────────────────────────────────────────── */

.status-cancelled {
  color: var(--soho-lights);
  font-weight: 600;
}

.error {
  color: var(--soho-lights);
}

/* ── Unread indicator ────────────────────────────────────────── */

.unread {
  border-left: 4px solid var(--soho-lights);
}

/* ── Messages (Django messages framework) ────────────────────── */

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(88, 64, 255, 0.15);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ── HTMX request indicator ──────────────────────────────────── */

.request-status {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--voltage);
  min-height: 1.5rem;
}

/* ── Notification list ───────────────────────────────────────── */

#notification-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-base);
}

/* ── Event detail ────────────────────────────────────────────── */

.event-detail {
  max-width: 50rem;
}

.event-detail p {
  margin-block: 0.5rem;
}

.event-detail form {
  margin-top: 1rem;
}

/* ── Django form rendering (.as_div) ─────────────────────────── */

form > div {
  margin-bottom: 0.25rem;
}

form .helptext {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.75rem;
  margin-bottom: 1rem;
}

form .errorlist {
  list-style: none;
  padding: 0;
  margin: -0.5rem 0 0.75rem;
}

form .errorlist li {
  color: var(--soho-lights);
  font-size: 0.8125rem;
}

/* ── Hero section ────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 32rem;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.hero .button {
  padding-inline: 2rem;
  font-size: 1rem;
}

/* ── Accent line utility ─────────────────────────────────────── */

.accent-line {
  height: 2px;
  background: var(--grad-accent);
  border-radius: 1px;
  margin: var(--gap-section) 0;
}

/* ── Reduced motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
