/* ------------------------------------------------------------------ *
 * BJJ4Life — base stylesheet
 * Plain CSS, no framework. Edit freely; there is no build step for CSS.
 * ------------------------------------------------------------------ */

:root {
  --ink: #14181d;
  --ink-soft: #46505a;
  --paper: #f7f5f1;
  --paper-card: #ffffff;
  --accent: #b3001b; /* mat red */
  --accent-dark: #7d0013;
  --line: #e2ddd4;
  --max-width: 64rem;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

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

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

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px solid var(--accent);
}

.brand {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: #fff;
  text-transform: uppercase;
}

.brand:hover {
  text-decoration: none;
  color: var(--paper);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-right: auto;
}

.main-nav a {
  color: #d7d2c8;
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.lang-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
}

.lang-switcher a {
  color: #b9b3a8;
}

.lang-switcher a:hover {
  color: #fff;
}

.lang-current {
  font-weight: 800;
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0 0.35rem;
}

/* --- Page layout --------------------------------------------------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) 4rem;
}

.page-header h1 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 0.25rem;
}

.page-subtitle {
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-top: 0;
}

.page-body h2 {
  margin-top: 2.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--line);
  font-size: 1.5rem;
}

/* Sits close to its paragraph, so it reads as a label rather than a section. */
.page-body h3 {
  margin: 1.25rem 0 0.25rem;
  font-size: 1.05rem;
}

.page-body h3 + p {
  margin-top: 0;
}

/* Tables (e.g. schedule) */
.page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--paper-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.page-body th,
.page-body td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.page-body th {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.page-body tr:last-child td {
  border-bottom: none;
}

/* Call-to-action buttons (Markdown links given the `.button` class) */
.button,
a.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

/* --- Map embed (contact page) -------------------------------------- */

.map-embed {
  aspect-ratio: 16 / 9;
  margin-top: 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.map-embed .maplibregl-canvas {
  border-radius: var(--radius);
}

.map-link {
  margin-top: 0.6rem;
  font-size: 0.95rem;
}

/* --- Photos (e.g. home page) --------------------------------------- */

.photo {
  margin: 1.75rem 0;
}

.photo img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* --- Coaches (club page) ------------------------------------------- */

.coaches {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.coach {
  width: 12rem;
  text-align: center;
}

.coach img,
.coach-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.coach-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 4rem;
  font-weight: 800;
}

.coach-name {
  display: block;
  margin-top: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

@media (max-width: 40rem) {
  .coach {
    width: calc((100% - 1.5rem) / 2);
  }
}

/* --- Gallery ------------------------------------------------------- */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
}

/* Three columns; one column on phones (see media query below). */
.gallery-item {
  flex: 0 0 calc((100% - 2rem) / 3);
}

@media (max-width: 40rem) {
  .gallery-item {
    flex-basis: 100%;
  }
}

.gallery-item a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: zoom-in;
}

/* Uniform tiles; the full, uncropped photo shows when clicked. */
.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.gallery-item a:hover img,
.gallery-item a:focus-visible img {
  transform: scale(1.03);
}

/* Fills the visible window (excluding any scrollbar, unlike 100vw). */
.lightbox {
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: rgba(10, 12, 15, 0.9);
}

/*
 * Room on each side for the previous/next arrows, so they never cover the
 * photo. Keep in sync with the `sizes` calculation in page.njk.
 */
.lightbox {
  --nav-size: 3rem;
  --nav-edge: 0.375rem;
  --nav-gutter: calc(var(--nav-size) + 2 * var(--nav-edge));
}

@media (max-width: 40rem) {
  .lightbox {
    --nav-size: 2.25rem;
    --nav-edge: 0.25rem;
  }
}

/* Let the photo size itself against the lightbox, not its <picture> wrapper. */
.lightbox-picture {
  display: contents;
}

.lightbox img {
  max-width: calc(100% - 2 * var(--nav-gutter));
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 4px;
}

/* Sits in the right-hand arrow gutter, so it never covers the photo either. */
.lightbox-close {
  position: fixed;
  top: var(--nav-edge);
  right: var(--nav-edge);
  width: var(--nav-size);
  height: var(--nav-size);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: calc(var(--nav-size) * 0.65);
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--accent);
}

/* Previous / next arrows: half visible, fully visible on hover or focus. */
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: var(--nav-size);
  height: var(--nav-size);
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: calc(var(--nav-size) * 0.75);
  line-height: 1;
  padding: 0 0 0.2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.lightbox-prev {
  left: var(--nav-edge);
}

.lightbox-next {
  right: var(--nav-edge);
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  opacity: 1;
  background: var(--accent);
}

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

.site-footer {
  background: var(--ink);
  color: #c9c3b8;
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.95rem;
}

.site-footer a {
  color: #fff;
}

.footer-name {
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.footer-social {
  margin-top: 0.75rem;
}

.footer-social a {
  margin: 0 0.4rem;
}
