/* ============================================================
   MWCCDC Website — styles.css
   Light-first theme with dark mode toggle.
   Orange/blue palette. Cyber accents in monospace elements.
   ============================================================ */

/* ===== Palette: light (default) ===== */
:root {
  --bg: #f7f9fc;
  --bg-panel: #ffffff;
  --text: #1b2733;
  --text-muted: #55657a;
  --blue: #14538c;        /* primary brand blue */
  --blue-bright: #1f6fc0;
  --orange: #f07818;      /* primary brand orange */
  --border: #d8e0ea;
  --link: var(--blue-bright);
  --code-bg: #eef3f8;
}

/* ===== Palette: dark (explicit toggle) ===== */
[data-theme="dark"] {
  --bg: #10161d;
  --bg-panel: #17202a;
  --text: #dde6ef;
  --text-muted: #93a3b5;
  --blue: #7db3e8;
  --blue-bright: #8ec2f5;
  --orange: #ffa94d;
  --border: #2a3846;
  --link: var(--blue-bright);
  --code-bg: #1d2833;
}

/* Users with OS dark preference and no explicit choice */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #10161d;
    --bg-panel: #17202a;
    --text: #dde6ef;
    --text-muted: #93a3b5;
    --blue: #7db3e8;
    --blue-bright: #8ec2f5;
    --orange: #ffa94d;
    --border: #2a3846;
    --code-bg: #1d2833;
  }
}

/* ===== Universal link styling =====
   Overrides browser-default purple visited links everywhere.
   Higher-specificity rules below still win where they apply. */
a,
a:visited {
  color: var(--link);
}
a:hover {
  color: var(--orange);
}

/* ============================================================
   Layout: fluid three columns
   Left nav rail + center content + right sponsor rail.
   ============================================================ */
* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  flex-wrap: wrap;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Left navigation sidebar ===== */
.sidebar {
  width: clamp(210px, 18vw, 260px);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 2px solid var(--orange);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
.logo {
  height: 44px;
  width: auto;
  max-width: 140px;   /* keeps wide lockups inside the sidebar */
}
.brand-text { display: flex; flex-direction: column; }
.brand-top { font-weight: 700; font-size: 1.05rem; color: var(--blue); }
.brand-sub {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.7rem;
  color: var(--orange);
}

#theme-toggle {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  margin-bottom: 1rem;
}
#theme-toggle:hover { border-color: var(--orange); color: var(--orange); }

.sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar nav a:hover { background: var(--code-bg); color: var(--blue-bright); }
.sidebar nav a.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

/* ===== Right sponsor rail ===== */
.sponsor-rail {
  width: clamp(170px, 15vw, 230px);
  flex: 0 0 auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  border-right: 3px solid var(--orange);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.rail-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  border-bottom: 2px solid var(--orange);
  padding-bottom: 0.4rem;
  margin: 0 0 1rem;
}
.sponsor-list { list-style: none; margin: 0; padding: 0; }
.sponsor-list li { margin-bottom: 1.25rem; }
.sponsor-list img {
  max-width: 100%;
  max-height: 70px;
  object-fit: contain;
  filter: grayscale(60%);
  opacity: 0.85;
  transition: filter 0.2s, opacity 0.2s;
}
.sponsor-list a:hover img { filter: none; opacity: 1; }
.sponsor-name { font-size: 0.9rem; color: var(--text); }
.rail-more { font-size: 0.78rem; margin-top: 1.5rem; }
.rail-empty { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Schedule list in the rail ===== */
.rail-schedule-title { margin-top: 2rem; }
.rail-schedule {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
}
.rail-schedule li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--border);
}
.rail-schedule li:last-child { border-bottom: none; }
.rail-date {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--orange);
  flex-shrink: 0;
  min-width: 3.4em;     /* aligns event names in a tidy column */
}
.rail-event { color: var(--text); }
/* Past events fade; future ones stay prominent */
.rail-schedule li.past { opacity: 0.45; }

/* ===== Main content column =====
   Takes all remaining space between the rails (no max-width cap —
   the .content wrapper handles readability instead). */
main {
  flex: 1 1 0;
  min-width: 0;            /* allows shrinking below content size */
  max-width: none;
  padding: 2.5rem clamp(1rem, 4vw, 4rem);
  margin: 0 auto;
}

/* Inner measure so text lines stay readable on ultrawide screens */
.content {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.crumb {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.content h1 {
  color: var(--blue);
  border-bottom: 3px solid var(--orange);
  padding-bottom: 0.35rem;
}
.content h2 { color: var(--blue); margin-top: 2rem; }
.content a,
.content a:visited { color: var(--link); }

.content table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.content th, .content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.content th { background: var(--code-bg); color: var(--blue); }

.content code {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* ===== Hero (home page) ===== */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, #0d3a66 100%);
  color: #fff;
  border-radius: 10px;
  border-left: 5px solid var(--orange);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
}
.hero h1 { color: #fff; border: none; margin: 0 0 0.5rem; }
.hero .tagline {
  font-family: ui-monospace, Consolas, monospace;
  color: #ffc37a;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* ============================================================
   Responsive tiers
   1) <= 1150px: sponsor rail docks to a bottom band, nav becomes
      a wrapped top bar
   2) <=  560px: phone refinements
   ============================================================ */

/* ===== Narrow desktop / tablet ===== */
@media (max-width: 1150px) {
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 2px solid var(--orange);
  }
  .sidebar nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .sidebar nav a { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
  .sidebar-footer { display: none; }

  main { flex: 1; padding: 1.5rem 1rem; }

  .sponsor-rail {
    width: 100%;
    height: auto;
    position: static;
    border-left: none;
    border-right: none;
    border-top: 3px solid var(--orange);
  }
  .sponsor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
  }
  .sponsor-list li { margin-bottom: 0; }
  .sponsor-list img { max-height: 54px; }
  .rail-more { margin-top: 0.75rem; }

  /* Schedule renders as a compact two-column layout in the band */
  .rail-schedule {
    columns: 2;
    column-gap: 2rem;
  }
  .rail-schedule li { break-inside: avoid; }
}

/* ===== Phones ===== */
@media (max-width: 560px) {
  main { padding: 1.25rem 0.75rem; }
  .crumb { font-size: 0.7rem; }
  .hero { padding: 1.25rem 1rem; }
  .content table { display: block; overflow-x: auto; }
}
