/* BC Chess Federation — hand-written, mobile-first.
   Palette derives from logo.svg green (#27775c). */

:root {
  --green: #27775c;
  --green-dark: #1d5a46;
  --green-pale: #e7f1ed;
  --ink: #1d1d1d;
  --ink-soft: #555;
  --link: #2c6aa0;
  --link-visited: #1f4b72;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --border: #d8dedb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

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

a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

h1, h2, h3 {
  line-height: 1.25;
  color: var(--green-dark);
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

/* ---------- Header & navigation ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 4px solid var(--green);
  position: relative;
}

.brand a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* keep clear of the absolutely-positioned menu toggle (44px + margins) */
  padding: 0.6rem 4.75rem 0.6rem 1rem;
  text-decoration: none;
  color: var(--green-dark);
}

.brand-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
}

/* Mobile: hamburger toggle (CSS-only) */

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-label {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--green-dark);
  position: relative;
}

.nav-toggle-bar::before {
  position: absolute;
  top: -7px;
}

.nav-toggle-bar::after {
  position: absolute;
  top: 7px;
}

.site-nav {
  display: none;
}

.nav-toggle:checked ~ .site-nav {
  display: block;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.65rem 1rem;
  text-decoration: none;
  font-weight: 600;
}

.nav-main {
  background: var(--green);
}

.nav-main a {
  color: #fff;
}

.nav-main a[aria-current="page"] {
  background: var(--green-dark);
}

.nav-org {
  background: var(--green-pale);
}

.nav-org a {
  color: var(--green-dark);
  font-weight: 500;
}

.nav-org a[aria-current="page"] {
  text-decoration: underline;
}

/* Desktop navigation */

@media (min-width: 800px) {
  .nav-toggle-label {
    display: none;
  }

  .site-nav {
    display: block;
  }

  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-main a {
    padding: 0.55rem 0.9rem;
  }

  .nav-org a {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
  }

  .brand a {
    justify-content: center;
    padding: 0.6rem 1rem;
  }

  .brand-logo {
    width: 104px;
    height: 104px;
  }

  .brand-name {
    font-size: 2.3rem;
  }
}

/* ---------- Layout ---------- */

.layout {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem 1.5rem;
  min-width: 0;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 170px;
    padding: 1.5rem 1rem;
  }
}

/* ---------- Banners (sidebar ads) ---------- */

.banners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.banner {
  display: block;
  max-width: 160px;
}

@media (min-width: 900px) {
  .banners {
    flex-direction: column;
    align-items: center;
  }
}

/* ---------- Home page sections ---------- */

.news {
  margin-top: 1.5rem;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-pale);
  padding: 0.25rem 1rem 1rem;
}

.news > h2 {
  text-align: center;
}

.news-item,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 1rem;
  margin-bottom: 1rem;
}

.card img {
  max-height: 280px;
  width: auto;
}

.news-item img {
  max-height: 240px;
  width: auto;
}

.news-date {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 1rem 1rem;
}

.panel > h2 {
  text-align: center;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.button {
  display: inline-block;
  background: var(--link);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
}

.button:hover {
  filter: brightness(1.1);
}

.button-green {
  background: var(--green);
}

.puzzle-frame {
  display: flex;
  justify-content: center;
}

.puzzle-frame iframe {
  width: 300px;
  height: 350px;
  border: 0;
}

.calendar-frame iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
}

/* ---------- Preformatted blocks (crosstables) ---------- */

pre {
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* ---------- City index (clubs page) ---------- */

.city-index ul {
  columns: 2;
  column-gap: 2rem;
  list-style: none;
  padding: 0;
}

.city-index li {
  margin: 0 0 0.35rem;
}

@media (min-width: 800px) {
  .city-index ul {
    columns: 3;
  }
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

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

th, td {
  text-align: left;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
}

th {
  background: var(--green-pale);
  color: var(--green-dark);
}

tbody tr:nth-child(even) {
  background: var(--bg);
}

/* ---------- Champions ---------- */

.champions-list {
  columns: 2;
  column-gap: 2rem;
}

.champions-list p {
  margin: 0 0 0.25rem;
  padding: 0;
  break-inside: avoid;
}

@media (max-width: 600px) {
  .champions-list {
    columns: 1;
  }
}

/* ---------- Lists & articles ---------- */

.list-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.list-item h2 {
  margin-bottom: 0.15rem;
}

.list-item .news-date {
  margin-top: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--green-dark);
  color: #fff;
  text-align: center;
  padding: 0.75rem 1rem;
  margin-top: 2rem;
  font-size: 0.9rem;
}
