/* IEEE CIS London Section Chapter */

:root {
  --ieee-blue: #00629B;
  --ieee-blue-dark: #004A75;
  --navy: #06192E;
  --navy-2: #0B2745;
  --cyan: #00B5E2;
  --gold: #FFB81C;

  --bg: #FFFFFF;
  --bg-alt: #F4F7FA;
  --surface: #FFFFFF;
  --text: #0F1B2A;
  --text-2: #4A5A6E;
  --text-3: #6B7A8D;
  --border: #DFE6EE;
  --link: #00629B;
  --accent-soft: #E6F1F8;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 27, 42, 0.05), 0 4px 16px rgba(15, 27, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(6, 25, 46, 0.18);
  --ease: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 68px;
  color-scheme: light;
}

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

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; }
a { color: var(--link); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ieee-blue);
  color: #fff;
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

.btn-primary { background: var(--ieee-blue); color: #fff; }
.btn-primary:hover { background: var(--ieee-blue-dark); }

.btn-accent { background: var(--gold); color: #1B1300; }
.btn-accent:hover { background: #FFC94D; }

.btn-ghost { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.6); }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ieee-blue); color: var(--link); }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-weight: inherit;
}
.link-button:hover { color: var(--link); }
a.link-button { color: inherit; text-decoration: none; }

/* ---------- Meta bar & header ---------- */

.meta-bar {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.78rem;
}
.meta-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}
.meta-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.meta-links a { color: inherit; text-decoration: none; }
.meta-links a:hover { color: #fff; }
.meta-region { color: var(--gold); font-weight: 600; white-space: nowrap; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand-mark { flex: none; width: 40px; height: 40px; border-radius: 10px; }
.brand-logo { flex: none; display: block; width: auto; height: 44px; }
.brand-divider { flex: none; width: 1px; height: 32px; background: var(--border); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-size: 1.06rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }
.brand-title b { color: var(--link); }
.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.site-nav a {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--ease), background var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--bg-alt); }
.site-nav a[aria-current] { color: var(--link); }
.site-nav .nav-cta { margin-left: 6px; background: var(--ieee-blue); color: #fff; }
.site-nav .nav-cta:hover { background: var(--ieee-blue-dark); color: #fff; }

.nav-toggle {
  display: none;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

/* ---------- Announcement ---------- */

.announcement { background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.announcement-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.announcement a { font-weight: 600; white-space: nowrap; }

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

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background-color: var(--navy);
  background-image:
    radial-gradient(1000px 500px at 85% -10%, rgba(0, 181, 226, 0.25), transparent 60%),
    linear-gradient(108deg, rgba(6, 25, 46, 0.90) 0%, rgba(10, 37, 68, 0.76) 52%, rgba(0, 62, 99, 0.60) 100%),
    url('../img/hero-western.jpg');
  background-size: cover;
  background-position: center 32%;
  background-repeat: no-repeat;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 96px;
  padding-bottom: 104px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  text-wrap: balance;
}
.hero-lead { max-width: 60ch; font-size: 1.1rem; color: rgba(255, 255, 255, 0.82); margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.eyebrow {
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--link);
}
.eyebrow-light { color: var(--gold); }

.next-event {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(6, 25, 46, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}
.next-event-label {
  margin-bottom: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
}
.next-event-cover {
  position: relative;
  display: block;
  width: 100%;
  height: 170px;
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  cursor: pointer;
}
.next-event-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.next-event-cover:hover img { transform: scale(1.05); }
.next-event-cover .badge { position: absolute; top: 10px; left: 10px; }
.next-event-summary {
  margin-top: 10px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.next-event-date { font-size: 0.9rem; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.next-event-title { font-size: 1.3rem; line-height: 1.3; margin-bottom: 8px; }
.next-event-meta { font-size: 0.9rem; color: rgba(255, 255, 255, 0.7); margin-bottom: 6px; }
.next-event-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.next-event-empty { font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.next-event-hint { font-size: 0.92rem; color: rgba(255, 255, 255, 0.72); }
.next-event-hint a { color: var(--cyan); }

/* ---------- Sections ---------- */

.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 36px;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.section-lead { margin-top: 8px; color: var(--text-2); max-width: 60ch; }

.prose { color: var(--text-2); font-size: 1.05rem; }
.prose p + p { margin-top: 14px; }

/* About */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 48px;
  margin-bottom: 48px;
}

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.feature h3 { font-size: 1.08rem; margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 0.95rem; }
.feature-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--link);
}

/* Segmented control */

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.segmented button {
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.segmented button[aria-selected="true"] { background: var(--ieee-blue); color: #fff; }

/* Events */

.search-input {
  width: 220px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.search-input:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }

.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 28px; }
.event-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(0, 98, 155, 0.35); }
.event-image-wrap { display: block; position: relative; height: 210px; overflow: hidden; background: var(--navy); }
.event-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.event-card:hover .event-image-wrap img { transform: scale(1.05); }
.event-card-placeholder .event-image-wrap img { filter: saturate(0.7) brightness(0.8); }
.event-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.badge { padding: 5px 11px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-upcoming { background: #10B981; color: #fff; }
.badge-soon { background: var(--gold); color: #1B1300; }
.badge-past { background: rgba(15, 23, 42, 0.75); color: #E2E8F0; backdrop-filter: blur(6px); }
.badge-category { background: rgba(255, 255, 255, 0.92); color: var(--navy); }

.event-body { display: flex; flex: 1; flex-direction: column; padding: 24px; }
.event-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 0.85rem; color: var(--text-2); }
.event-title { font-size: 1.2rem; line-height: 1.35; margin-bottom: 10px; color: var(--navy); }
.event-summary { flex: 1; margin-bottom: 20px; font-size: 0.93rem; color: var(--text-2); }
.event-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.event-footer-group { display: flex; flex-wrap: wrap; gap: 6px; }

.empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: var(--text-2);
}
.empty-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty p:not(.empty-title) { max-width: 52ch; margin: 0 auto; }

/* Research areas */

.area-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.area {
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.area:hover { border-color: var(--ieee-blue); transform: translateY(-2px); box-shadow: var(--shadow); }
.area-code {
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.area h3 { font-size: 1.1rem; margin-bottom: 8px; }
.area p { flex: 1; color: var(--text-2); font-size: 0.94rem; margin-bottom: 18px; }
.area a { font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.area a:hover { text-decoration: underline; }

/* Gallery */

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.chip:hover { border-color: var(--ieee-blue); color: var(--link); }
.chip[aria-pressed="true"] { background: var(--ieee-blue); border-color: var(--ieee-blue); color: #fff; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.gallery-card {
  position: relative;
  height: 270px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--navy);
  box-shadow: var(--shadow);
}
.gallery-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; }
.gallery-open img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.gallery-open:hover img { transform: scale(1.06); }
.gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  color: #fff;
  background: linear-gradient(to top, rgba(6, 25, 46, 0.92) 0%, rgba(6, 25, 46, 0.25) 55%, transparent 100%);
}
.gallery-tag {
  align-self: flex-start;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cyan);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
}
.gallery-title { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.gallery-caption { display: block; margin-top: 4px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.8); }
.gallery-delete { position: absolute; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.92); }
.gallery-count-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 25, 46, 0.78);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.gallery-card-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  color: #fff;
  background:
    radial-gradient(400px 220px at 100% 0%, rgba(0, 181, 226, 0.35), transparent 65%),
    linear-gradient(150deg, var(--navy-2), var(--ieee-blue-dark));
  box-shadow: none;
}
.gallery-card-placeholder svg { position: absolute; top: 22px; left: 22px; width: 44px; height: 44px; color: rgba(255, 255, 255, 0.55); }
.gallery-card-placeholder .gallery-tag { background: var(--gold); }
.gallery-card-placeholder h3 { font-size: 1.1rem; margin-bottom: 4px; }

/* Committee */

.committee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.member {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.member-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ieee-blue), var(--navy-2));
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  object-fit: cover;
}
.member-role {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--link);
  margin-bottom: 4px;
}
.member-name { font-size: 1.1rem; line-height: 1.3; }
.member-affil { margin-top: 4px; font-size: 0.9rem; color: var(--text-2); }
.member-bio {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-3);
  text-align: center;
}
.member-bio a {
  color: var(--ieee-blue);
  font-weight: 600;
  text-decoration: none;
}
.member-bio a:hover {
  text-decoration: underline;
}
.member-links { display: flex; gap: 16px; margin-top: auto; padding-top: 14px; font-size: 0.9rem; font-weight: 600; }
.member-links a { text-decoration: none; }
.member-links a:hover { text-decoration: underline; }
.member-vacant { border-style: dashed; background: transparent; }
.member-vacant .member-avatar { background: var(--bg-alt); color: var(--text-3); border: 1px dashed var(--border); }
.member-vacant .member-name { color: var(--text-3); font-weight: 600; }

/* Founding Members page */
.members-hero {
  position: relative;
  color: #fff;
  background:
    radial-gradient(640px 320px at 85% 15%, rgba(0, 181, 226, 0.25), transparent 65%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, var(--ieee-blue-dark) 100%);
  padding-block: 56px 52px;
}
.members-hero-inner h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin-bottom: 14px;
}
.members-hero-lead {
  max-width: 720px;
  font-size: 1.06rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.86);
}
.founding-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Join */

.section-join { padding-top: 0; }
.join {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 48px;
  padding: 56px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(0, 181, 226, 0.25), transparent 60%),
    linear-gradient(135deg, var(--navy) 0%, var(--ieee-blue-dark) 100%);
}
.join h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 14px; }
.join-copy > p:not(.eyebrow) { color: rgba(255, 255, 255, 0.8); margin-bottom: 28px; max-width: 54ch; }
.join-facts {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}
.join-facts dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2px;
}
.join-facts dd { color: rgba(255, 255, 255, 0.88); overflow-wrap: anywhere; }
.join-facts a { color: #fff; }

/* Footer */

.site-footer {
  padding: 56px 0 28px;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-brand { color: #fff; font-weight: 700; font-size: 1rem; margin-bottom: 8px; }
.footer-heading { color: #fff; font-weight: 700; margin-bottom: 10px; }
.site-footer nav { display: flex; flex-direction: column; gap: 6px; }
.site-footer a { color: rgba(255, 255, 255, 0.72); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-legal { padding-top: 24px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.5); }
.footer-legal p + p { margin-top: 8px; }

/* ---------- Dialogs ---------- */

.dialog {
  margin: auto;
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(6, 25, 46, 0.6); backdrop-filter: blur(3px); }
.dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dialog-head h2 { font-size: 1.2rem; line-height: 1.35; }
.dialog-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-alt);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { background: var(--border); }
.dialog-body { padding: 24px; }
.dialog-image { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 20px; }

.detail-list {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  font-size: 0.94rem;
}
.detail-list div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; }
.detail-list dt { font-weight: 600; color: var(--text-3); }
.detail-text { white-space: pre-line; color: var(--text-2); line-height: 1.75; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.detail-actions:empty { display: none; }

.dialog-lightbox { width: min(980px, calc(100% - 32px)); background: var(--navy); color: #fff; }
.dialog-lightbox .dialog-head { background: var(--navy); border-color: rgba(255, 255, 255, 0.12); }
.dialog-lightbox .dialog-close { background: rgba(255, 255, 255, 0.1); color: #fff; }
.lightbox-figure { padding: 20px 24px 0; text-align: center; }
.lightbox-figure img { max-height: 65dvh; margin: 0 auto; border-radius: var(--radius-sm); object-fit: contain; }
.lightbox-figure figcaption { margin-top: 14px; color: rgba(255, 255, 255, 0.8); font-size: 0.94rem; }
.lightbox-nav { display: flex; justify-content: center; gap: 12px; padding: 20px; }
.dialog-lightbox .btn-outline { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ---------- Stats strip ---------- */

.stats-wrap { position: relative; z-index: 2; margin-top: -44px; }
.stats {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.stats-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { display: flex; flex-direction: column; padding: 18px 22px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; color: var(--link); }
.stat-label { margin-top: 4px; font-size: 0.88rem; color: var(--text-2); }
.stats .admin-only { margin-right: 12px; }
.stats-grid:empty::before { content: 'No stats yet — use “Edit stats” to add some.'; padding: 18px 22px; color: var(--text-3); }

.admin-note {
  grid-column: 1 / -1;
  padding: 12px 16px;
  border: 1px dashed var(--ieee-blue);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 0.9rem;
}

.section-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---------- Admin ---------- */

.btn-danger { background: transparent; color: #C62828; border-color: color-mix(in srgb, #C62828 40%, transparent); }
.btn-danger:hover { background: #C62828; color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.footer-admin {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.72);
  font-size: inherit;
  cursor: pointer;
}
.footer-admin:hover { color: #fff; text-decoration: underline; }

.admin-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 60;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  width: min(760px, calc(100% - 32px));
  padding: 10px 12px 10px 18px;
  border-radius: 14px;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
}
.admin-bar strong { color: #fff; }
.admin-bar-status { color: var(--gold); }
.spacer { flex: 1; }
body.is-admin { padding-bottom: 88px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 70;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
}

.dialog-form { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dialog-form .dialog-body { overflow-y: auto; }
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; }
.field input,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.field input:focus,
.field textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }
.field textarea { resize: vertical; }
.field input[type="file"] { padding: 7px; }

.field-gap { margin: 14px 0 18px; }
.form-help .form-note { margin: 10px 0 0; }
.form-help .field { margin-top: 12px; }
.form-note { margin-bottom: 14px; color: var(--text-2); font-size: 0.92rem; }
.form-note code, .form-help code { font-size: 0.85em; padding: 1px 5px; border-radius: 4px; background: var(--bg-alt); }
.form-help { margin-bottom: 16px; font-size: 0.9rem; color: var(--text-2); }
.form-help summary { cursor: pointer; font-weight: 600; color: var(--link); }
.form-help ol { margin-top: 8px; padding-left: 20px; display: grid; gap: 4px; }
.form-error { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, #C62828 12%, transparent); color: #C62828; font-size: 0.9rem; }

.stats-rows { display: grid; gap: 12px; margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 10px; align-items: end; }

/* ---------- Responsive ---------- */

/* ---------- Event page ---------- */

.event-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: var(--navy);
}
.event-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}
.event-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 25, 46, 0.25) 0%, rgba(6, 25, 46, 0.9) 100%);
}
.event-hero-inner { position: relative; z-index: 1; padding-block: 64px 48px; }
.event-hero .event-badges { position: static; margin-bottom: 16px; }
.event-hero h1 { max-width: 24ch; font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; line-height: 1.15; margin-bottom: 12px; }
.event-hero-date { font-size: 1.05rem; font-weight: 600; color: var(--gold); }
.event-back {
  display: inline-block;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  text-decoration: none;
}
.event-back:hover { color: #fff; }

.event-page-body { padding-block: 56px 72px; }
.event-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; align-items: start; }
.event-page-lead { font-size: 1.15rem; font-weight: 500; color: var(--text); margin-bottom: 18px; line-height: 1.6; }
.event-page-main .detail-text { font-size: 1.02rem; }

/* Dedicated Speaker Introduction card on event.html */
.event-speaker-card {
  margin-top: 36px;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--ieee-blue);
  border-radius: var(--radius);
  background: var(--surface-alt);
}
.event-speaker-card .eyebrow { margin-bottom: 12px; }
.event-speaker-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.event-speaker-avatar {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ieee-navy), var(--ieee-blue));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.event-speaker-name {
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text);
}
.event-speaker-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ieee-blue);
  text-decoration: none;
}
.event-speaker-link:hover {
  text-decoration: underline;
}
.event-speaker-bio {
  color: var(--text-2);
  font-size: 0.98rem;
  line-height: 1.7;
}
.event-speaker-bio-empty {
  font-style: italic;
  color: var(--text-3);
}

/* Multi-photo gallery on event.html */
.event-photos-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

/* Floating highlight video window on event.html */
.floating-video {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 340px;
  max-width: calc(100vw - 24px);
  border-radius: 14px;
  overflow: hidden;
  background: #06192e;
  border: 1px solid rgba(120, 214, 240, 0.28);
  box-shadow: 0 20px 48px rgba(4, 16, 32, 0.45), 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: width 220ms ease, box-shadow 220ms ease;
}
.floating-video[hidden],
.floating-video-pill[hidden] {
  display: none !important;
}
.floating-video.is-expanded {
  width: 560px;
}
.floating-video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  background: linear-gradient(90deg, #06192e, #0a2b4e);
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.floating-video-bar:active {
  cursor: grabbing;
}
.floating-video-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.95);
}
.floating-video-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}
.floating-video-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.floating-video-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--ease);
}
.floating-video-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}
.floating-video-stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}
.floating-video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.floating-video-unmute {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(6, 25, 46, 0.82);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.floating-video-unmute:hover {
  background: var(--ieee-blue);
  transform: scale(1.03);
}
.floating-video-pill {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(120, 214, 240, 0.35);
  border-radius: 999px;
  background: #06192e;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(4, 16, 32, 0.35);
  cursor: pointer;
  transition: transform var(--ease), background var(--ease);
}
.floating-video-pill:hover {
  background: var(--ieee-blue);
  transform: translateY(-2px);
}
@media (max-width: 560px) {
  .floating-video {
    right: 12px;
    bottom: 12px;
    width: 280px;
  }
  .floating-video.is-expanded {
    width: calc(100vw - 24px);
  }
}
.event-sub-title {
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--text);
}
.event-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.event-photo-thumb {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-alt);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.event-photo-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--ieee-blue);
  box-shadow: var(--shadow);
}
.event-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Attached event photos strip inside #event-editor */
.event-images-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.event-image-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-alt);
}
.event-image-item.is-cover {
  border-color: var(--ieee-blue);
  box-shadow: 0 0 0 2px rgba(0, 98, 155, 0.18);
}
.event-image-item img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  display: block;
}
.event-image-item-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
}
.event-image-badge {
  font-weight: 700;
  color: var(--ieee-blue);
  padding: 1px 4px;
}
.event-image-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}
.event-image-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.event-image-remove {
  font-size: 1rem;
  line-height: 1;
  color: #b42318;
  margin-left: auto;
}
.event-image-remove:hover {
  background: #fef3f2;
  color: #912018;
}
.event-page-side {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.event-page-side .detail-list { margin-bottom: 0; }
.event-page-side .detail-actions { margin-top: 16px; }
.event-page-side .detail-actions .btn { flex: 1 1 100%; justify-content: center; }
.event-page-side .btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.event-page-missing { padding-block: 96px; text-align: center; }
.event-page-missing h1 { font-size: 2rem; margin-bottom: 8px; }
.event-page-missing p { color: var(--text-2); margin-bottom: 24px; }

.more-events { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; padding: 0; }
.more-events a {
  display: block;
  height: 100%;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--ease), transform var(--ease);
}
.more-events a:hover { border-color: var(--ieee-blue); transform: translateY(-2px); }
.more-events-date { display: block; font-size: 0.85rem; color: var(--text-3); margin-bottom: 4px; }
.more-events-title { font-weight: 700; }

@media (max-width: 860px) {
  .event-page-grid { grid-template-columns: 1fr; gap: 28px; }
  .event-page-side { position: static; order: -1; }
  .event-hero-inner { padding-block: 40px 32px; }
}

@media (max-width: 1000px) {
  .area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; padding-top: 72px; padding-bottom: 80px; }
  .next-event { max-width: 520px; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    box-shadow: var(--shadow);
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 14px; border-radius: var(--radius-sm); }
  .site-nav .nav-cta { margin: 6px 0 0; text-align: center; }

  .about-grid { grid-template-columns: 1fr; gap: 16px; }
  .feature-grid { grid-template-columns: 1fr; }
  .join { grid-template-columns: 1fr; gap: 32px; padding: 36px 28px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }

}

@media (max-width: 560px) {
  .container { padding-inline: 16px; }
  .stats { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 1.6rem; }
  .stats .admin-only { margin: 0 8px 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .meta-links a:nth-child(n + 4) { display: none; }
  .meta-region { display: none; }
  .brand-subtitle { display: none; }
  .section { padding: 64px 0; }
  .area-grid { grid-template-columns: 1fr; }
  .events-grid, .gallery-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .section-tools { width: 100%; }
  .announcement-inner { flex-direction: column; align-items: flex-start; gap: 4px; }
  .detail-list div { grid-template-columns: 1fr; gap: 0; }
}
