/*
 * Bridges & Brains — Public Design System
 * =========================================
 * Architecture:
 *   1. CSS Reset & base
 *   2. Design tokens (custom properties)
 *   3. Typography
 *   4. Layout utilities
 *   5. Components: Header, Hero, Cards, Buttons, Forms, Badges, Speakers
 *   6. Pages: Homepage, Event detail, Registration, Confirmation
 *   7. Footer
 *   8. Responsive (mobile-first breakpoints)
 *   9. Animations
 *
 * Per-event theming: PHP injects :root overrides via ThemeHelper::inlineStyle()
 * BEFORE this stylesheet. All components use var(--color-*) tokens.
 */

/* ============================================================
   1. RESET & BASE
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg, #16213e);
  color: var(--color-text, #ffffff);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--color-accent, #e94560); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* ============================================================
   2. DEFAULT DESIGN TOKENS
   (overridden per-event by ThemeHelper::inlineStyle)
   ============================================================ */

:root {
  --color-primary:       #1a1a2e;
  --color-primary-light: #1f2040;
  --color-accent:        #e94560;
  --color-accent-dark:   #c73850;
  --color-text:          #ffffff;
  --color-bg:            #16213e;
  --hero-image:          none;

  /* Neutral palette (independent of event theme) */
  --neutral-50:   #f9fafb;
  --neutral-100:  #f3f4f6;
  --neutral-200:  #e5e7eb;
  --neutral-600:  #4b5563;
  --neutral-700:  #374151;
  --neutral-900:  #111827;

  /* Semantic */
  --success:  #22c55e;
  --warning:  #f59e0b;
  --error:    #ef4444;
  --info:     #3b82f6;

  /* Spacing scale */
  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   1.5rem;
  --space-xl:   2.5rem;
  --space-2xl:  4rem;

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-pill:9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

  /* Max content width */
  --max-width: 1100px;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem,   5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.15rem,2vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p  { margin-bottom: var(--space-md); max-width: 70ch; }
p:last-child { margin-bottom: 0; }

small { font-size: 0.85rem; opacity: 0.8; }

/* ============================================================
   4. LAYOUT UTILITIES
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.section {
  padding-block: var(--space-2xl);
}

.section--tight {
  padding-block: var(--space-xl);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap     { gap: var(--space-md); }
.flex-wrap    { flex-wrap: wrap; }

.text-center { text-align: center; }
.text-muted  { opacity: 0.65; }
.text-accent { color: var(--color-accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   5. COMPONENTS
   ============================================================ */

/* --- Site Header ------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(var(--color-primary), 0.92);
  background: color-mix(in srgb, var(--color-primary) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-header__logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.site-header__logo span {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.site-nav a {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.site-nav a:hover, .site-nav a.active {
  opacity: 1;
  text-decoration: none;
  color: var(--color-accent);
}

.lang-switcher {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-pill);
  color: var(--color-text);
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
}

.lang-switcher:hover {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

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

.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--color-primary);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  opacity: 0.35;
  transition: opacity 0.3s;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-block: var(--space-2xl);
}

.hero__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
  background: rgba(255,255,255,0.08);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
}

.hero__title {
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  font-size: 0.95rem;
  opacity: 0.85;
}

.hero__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hero__meta-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  display: inline;
}

/* --- Event Cards ------------------------------------------ */

.event-card {
  background: var(--color-primary);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.event-card__image {
  aspect-ratio: 16/9;
  object-fit: cover;
  width: 100%;
  background: var(--color-primary-light);
}

.event-card__image-placeholder {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.4;
}

.event-card__body {
  padding: var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.event-card__date {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.event-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.event-card__location {
  font-size: 0.85rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-card__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* --- Buttons --------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.65em 1.6em;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--color-accent);
  color: #ffffff;
}
.btn--primary:hover {
  background: var(--color-accent-dark);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.btn--outline {
  background: transparent;
  color: var(--color-text);
  border-color: rgba(255,255,255,0.3);
}
.btn--outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn--ghost {
  background: rgba(255,255,255,0.06);
  color: var(--color-text);
}
.btn--ghost:hover { background: rgba(255,255,255,0.12); }

.btn--sm { padding: 0.4em 1em; font-size: 0.85rem; }
.btn--lg { padding: 0.9em 2.2em; font-size: 1.05rem; }
.btn--full { width: 100%; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Badges ---------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge--accent   { background: var(--color-accent); color: #fff; }
.badge--success  { background: var(--success); color: #fff; }
.badge--warning  { background: var(--warning); color: #111; }
.badge--error    { background: var(--error); color: #fff; }
.badge--muted    { background: rgba(255,255,255,0.12); color: var(--color-text); }
.badge--free     { background: var(--success); color: #fff; }
.badge--full     { background: var(--error); color: #fff; }

/* --- Forms ----------------------------------------------- */

.form-card {
  background: var(--color-primary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  max-width: 560px;
  margin-inline: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.form-group:last-of-type { margin-bottom: 0; }

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  opacity: 0.9;
}

.form-label .required {
  color: var(--color-accent);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.65em 0.9em;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.form-input::placeholder { opacity: 0.4; }

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 25%, transparent);
}

.form-input.is-invalid {
  border-color: var(--error);
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-help {
  font-size: 0.8rem;
  opacity: 0.6;
}

/* Checkbox */

.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-md);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, background 0.2s;
}

.form-check:has(input:checked) {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--color-accent);
  cursor: pointer;
  margin-top: 2px;
}

.form-check-label {
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

/* --- Alert messages ------------------------------------- */

.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  font-size: 0.95rem;
  line-height: 1.5;
}

.alert--success { background: rgba(34,197,94,0.12); border-color: var(--success); color: #86efac; }
.alert--error   { background: rgba(239,68,68,0.12);  border-color: var(--error);   color: #fca5a5; }
.alert--warning { background: rgba(245,158,11,0.12); border-color: var(--warning); color: #fcd34d; }
.alert--info    { background: rgba(59,130,246,0.12); border-color: var(--info);    color: #93c5fd; }

/* --- Speakers section ----------------------------------- */

.speakers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.speaker-card {
  text-align: center;
}

.speaker-card__photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-inline: auto;
  margin-bottom: var(--space-md);
  border: 3px solid var(--color-accent);
  background: var(--color-primary-light);
}

.speaker-card__photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  margin-inline: auto;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: rgba(255,255,255,0.4);
}

.speaker-card__name {
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.speaker-card__bio {
  font-size: 0.85rem;
  opacity: 0.7;
  line-height: 1.5;
}

/* --- Section titles ------------------------------------- */

.section-title {
  margin-bottom: var(--space-xl);
}

.section-title__eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.section-title h2 { color: var(--color-text); }

/* --- Divider -------------------------------------------- */

.divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin-block: var(--space-xl);
}

/* --- Confirmation / status pages ----------------------- */

.status-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
}

.status-box {
  background: var(--color-primary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.status-box__icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  line-height: 1;
}

.status-box__title {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.status-box__text {
  opacity: 0.8;
  font-size: 1rem;
  margin-bottom: var(--space-xl);
  max-width: 100%;
}

/* --- Info table (event detail) ------------------------- */

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table tr + tr td { border-top: 1px solid rgba(255,255,255,0.07); }

.info-table td {
  padding: var(--space-sm) 0;
  font-size: 0.95rem;
  vertical-align: top;
}

.info-table td:first-child {
  width: 130px;
  font-weight: 600;
  opacity: 0.65;
  padding-right: var(--space-lg);
  white-space: nowrap;
}

/* ============================================================
   6. FOOTER
   ============================================================ */

.site-footer {
  margin-top: auto;
  background: rgba(0,0,0,0.25);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-block: var(--space-xl);
  font-size: 0.85rem;
  opacity: 0.7;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* ============================================================
   7. ANIMATIONS
   ============================================================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fadeUp 0.5s ease both;
}

.fade-up--delay-1 { animation-delay: 0.1s; }
.fade-up--delay-2 { animation-delay: 0.2s; }
.fade-up--delay-3 { animation-delay: 0.3s; }

/* Spinner for form submit */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ============================================================
   8. RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .site-nav { gap: var(--space-md); }
  .site-nav a:not(.lang-switcher) { font-size: 0.85rem; }

  .hero { min-height: 320px; }
  .hero__meta { gap: var(--space-md); }

  .form-card { padding: var(--space-lg); }

  .site-footer__inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .container { padding-inline: var(--space-md); }

  .site-nav .nav-text { display: none; }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }

  .btn--lg { padding: 0.75em 1.5em; }
}

/* ============================================================
   9. UTILITY: Scroll-reveal polyfill for JS-less graceful
   ============================================================ */

[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 0.5s, transform 0.5s; }
[data-reveal].visible { opacity: 1; transform: none; }

/* ============================================================
   10. EVENT DETAIL PAGE
   ============================================================ */

/* Display font for the event title */
.hero__title--display {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
}

/* Full-width hero image strip below the hero section */
.event-hero-img-wrap {
  width: 100%;
  max-height: 520px;
  overflow: hidden;
  line-height: 0;
  background: var(--color-primary);
}

.event-hero-img-wrap img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.event-hero-img-wrap:hover img {
  transform: scale(1.015);
}

/* Two-column content layout */
.event-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: start;
}

/* No content: single centered card */
.event-detail-layout--full {
  grid-template-columns: 1fr;
  max-width: 560px;
  margin-inline: auto;
}

/* Sidebar sticky card — replaces .form-card in event detail context */
.event-sidebar-card {
  background: var(--color-primary);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 80px;
}

/* Mobile: stack columns, sidebar first so CTA is above the fold */
@media (max-width: 900px) {
  .event-detail-layout {
    grid-template-columns: 1fr;
  }
  .event-detail-sidebar {
    order: -1;
  }
  .event-sidebar-card {
    position: static;
  }
}
