/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary: #1a3a5c;
  --color-primary-light: #2a5a8c;
  --color-accent: #e8913a;
  --color-bg: #ffffff;
  --color-bg-alt: #f5f7fa;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-border: #dee2e6;
  --color-white: #ffffff;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container-width: 1100px;
  --header-height: 64px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--color-primary-light); text-decoration: none; }
a:hover { color: var(--color-accent); text-decoration: underline; }

img { max-width: 100%; height: auto; }

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Header / Nav ===== */
.site-header {
  background: var(--color-primary);
  color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-white);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
}
.site-logo:hover { color: var(--color-white); text-decoration: none; }

.logo-img { height: 40px; width: auto; }
.logo-text { letter-spacing: 0.05em; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-white);
  transition: 0.2s;
}

.nav-list {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 0;
}

.nav-item { position: relative; }

.nav-link {
  display: block;
  padding: 0 0.9rem;
  line-height: var(--header-height);
  color: rgba(255,255,255,0.9);
  background: none;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.nav-link:hover { color: var(--color-white); background: rgba(255,255,255,0.1); text-decoration: none; }

.dropdown-toggle::after {
  content: " ▾";
  font-size: 0.7em;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-white);
  min-width: 200px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-radius: 0 0 6px 6px;
  list-style: none;
  z-index: 200;
}
.dropdown-open > .dropdown-menu { display: block; }

.dropdown-link {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--color-text);
  font-size: 0.9rem;
}
.dropdown-link:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  text-decoration: none;
}

/* ===== Hero (homepage) ===== */
.hero {
  background: #0d2137;
  color: var(--color-white);
  text-align: center;
  padding: 0;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Video background (desktop) */
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Dark overlay on top of video/image */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 2rem 1.5rem;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.hero .tagline {
  font-size: 1.5rem;
  font-style: italic;
  opacity: 0.9;
  margin-top: 1rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.hero .hero-logo {
  max-width: 350px;
  margin: 1.5rem auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

/* ===== Page Header (inner pages) ===== */
.page-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, #0d2137 100%);
  color: var(--color-white);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* Page header with video background */
.page-header-video {
  min-height: 30vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-header-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.page-header-video h1 {
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ===== Content ===== */
.content {
  padding: 3rem 0;
}
.content h2 {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin: 2rem 0 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-border);
}
.content h2:first-child { margin-top: 0; }
.content h3 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin: 1.5rem 0 0.75rem;
}
.content p { margin-bottom: 1rem; }
.content ul, .content ol {
  margin: 0.5rem 0 1rem 1.5rem;
}
.content li { margin-bottom: 0.4rem; }
.content .lead {
  font-size: 1.1rem;
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
}

/* ===== Tables ===== */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}
.content th {
  background: var(--color-primary);
  color: var(--color-white);
  text-align: left;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
}
.content td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--color-border);
}
.content tr:hover td { background: var(--color-bg-alt); }

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

/* ===== Team Bios ===== */
.bio {
  margin-bottom: 2rem;
  overflow: hidden;
}
.bio h3 { margin-top: 0; }
.bio h3 small {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--color-text-light);
}
.bio-photo {
  float: left;
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 1.5rem 1rem 0;
}

/* ===== Contact ===== */
.contact-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.contact-card {
  flex: 1;
  min-width: 200px;
  background: var(--color-bg-alt);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}
.contact-card h3 { margin-bottom: 0.5rem; }
.contact-card a { font-size: 1.1rem; font-weight: 600; }

/* ===== Sponsor Logos ===== */
.sponsor-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
  margin: 1.5rem 0;
}
.sponsor-logos img, .sponsor-logos a {
  height: 50px;
  width: auto;
}

/* ===== Participant Legend ===== */
.legend {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.row-member { background: transparent; }
.row-exempt td:first-child { border-left: 3px solid var(--color-accent); }
.row-infra td:first-child { border-left: 3px solid var(--color-primary); }
.nowrap { white-space: nowrap; }
.table-footer { font-size: 0.85rem; color: var(--color-text-light); margin-top: 1rem; }

/* Participants: desktop table visible, mobile cards hidden */
.participants-mobile { display: none; }

/* Mobile expandable participant cards */
.participant-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.participant-card summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}
.participant-card summary::-webkit-details-marker { display: none; }
.participant-card summary::marker { content: ""; }
.participant-card summary::before {
  content: "▸";
  margin-right: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
}
.participant-card[open] summary::before { content: "▾"; }
.participant-meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
  white-space: nowrap;
}
.participant-details {
  padding: 0 1rem 0.75rem;
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
}
.participant-details p { margin: 0.5rem 0; }
.participant-port {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}
.participant-port:last-child { border-bottom: none; }
.participant-port code { font-size: 0.75rem; }
.participant-card.row-exempt { border-left: 3px solid var(--color-accent); }
.participant-card.row-infra { border-left: 3px solid var(--color-primary); }

/* ===== Route Server Cards ===== */
.rs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.rs-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  background: var(--color-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rs-card h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.rs-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
}
.rs-card dt {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
}
.rs-card dd {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem;
}
.rs-card dd code {
  background: rgba(0,0,0,0.04);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
}

/* Spacing below content on inner pages */
.content { padding-bottom: 3rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }
  .site-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-link { line-height: 3rem; padding: 0 1.5rem; }
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0,0,0,0.15);
  }
  .dropdown-link { color: rgba(255,255,255,0.85); padding-left: 2rem; }
  .dropdown-link:hover { background: rgba(255,255,255,0.1); color: var(--color-white); }

  /*
   * Mobile hero: hide video, show Flickr image as background
   * "Sutro Tower" by Marc Liyanage — CC BY-SA 2.0
   * https://www.flickr.com/photos/liyanage/5584629572/
   */
  .hero-video { display: none; }
  .hero {
    background: #0d2137 url('../img/hero-mobile-sutro-tower.jpg') center/cover no-repeat;
    min-height: 85vh;
  }
  .hero h1 { font-size: 1.6rem; }
  .hero .tagline { font-size: 1.1rem; }
  .hero .hero-logo { max-width: 250px; }

  /* Mobile participants: cards instead of table */
  .participants-desktop { display: none; }
  .participants-mobile { display: block; }

  /* Mobile inner page headers: hide video, show mobile image */
  .page-header-bg { display: none; }
  .page-header-video {
    background: var(--mobile-bg, linear-gradient(135deg, var(--color-primary) 0%, #0d2137 100%)) center/cover no-repeat;
    background-color: #0d2137;
  }

  .content table { font-size: 0.8rem; }
  .card-grid { grid-template-columns: 1fr; }
}
