/* ---------------------------------------------------------------------------
   Aikido Osnabrück — additions on top of Quark2.
   Shadows quark2/css/custom.css via the theme stream.
   --------------------------------------------------------------------------- */

/* --- Buttons -------------------------------------------------------------- */
/* The migrated content links use `?classes=btn,btn-primary,btn-lg`; Quark2 ships
   `.btn`, `.btn-lg` and `.btn-ghost`, but no filled accent variant. */
.btn.btn-primary,
.btn.button,
a.button {
  background: var(--q2-accent);
  border-color: var(--q2-accent);
  color: var(--q2-accent-contrast, #fff);
}

.btn.btn-primary:hover,
.btn.button:hover,
a.button:hover {
  filter: brightness(1.1);
  color: var(--q2-accent-contrast, #fff);
}

.btn.text-light {
  color: #fff;
}

/* --- Full-width text modules ---------------------------------------------- */
/* `.modular-text .columns` becomes a 2-column grid from 860px up, which would
   squeeze an image-less module into the left half. A lone column spans both. */
.modular-text .columns > .column:only-child {
  grid-column: 1 / -1;
}

/* --- Tables --------------------------------------------------------------- */
/* The Übungszeiten timetable has seven columns and must not push the page into
   horizontal scrolling on phones. */
.table-scroll {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
  vertical-align: top;
  white-space: nowrap;
}

.table-hover tbody tr:hover {
  background: var(--q2-bg-elev, rgba(127, 127, 127, 0.08));
}

/* --- Trainer cards (modular/trainer) -------------------------------------- */
.card-grid {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2rem;
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Portraits fill the card width and stay square regardless of source ratio. */
.card-grid .card-image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.card-grid .card-body ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* --- Galleries (modular/gallery + partials/lightbox) ---------------------- */
.lightbox-gallery__columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 1.5rem;
}

.lightbox-gallery img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--q2-radius-md, 8px);
  box-shadow: var(--q2-shadow-card, 0 8px 24px -8px rgba(19, 19, 22, 0.2));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lightbox-gallery img:hover {
  transform: translateY(-2px);
  filter: brightness(0.92);
}

.lightbox-gallery .hidden {
  display: none;
}

/* Inline galleries in blog posts, built from Grav's native `?lightbox=` action. */
a[rel='lightbox'] {
  display: inline-block;
  margin: 0 0.5rem 0.5rem 0;
  cursor: zoom-in;
}

a[rel='lightbox'] img {
  display: block;
  border-radius: var(--q2-radius-md, 8px);
  box-shadow: var(--q2-shadow-card, 0 8px 24px -8px rgba(19, 19, 22, 0.2));
  transition: transform 0.2s ease, filter 0.2s ease;
}

a[rel='lightbox']:hover img {
  transform: translateY(-2px);
  filter: brightness(0.92);
}

/* --- Logo ----------------------------------------------------------------- */
/* The dojo mark is a wide 214×81 wordmark; Quark2's default 28px makes it tiny.
   42px is the height the old theme used. It shrinks with the animated header. */
.navbar-brand img,
.navbar-brand svg {
  height: 42px;
  transition: height 0.2s ease;
}

.header-animated.scrolled .navbar-brand img,
.header-animated.scrolled .navbar-brand svg {
  height: 32px;
}

/* --- Navigation quicklink ------------------------------------------------- */
.navigation .quicklink a i {
  font-size: 0.75em;
  opacity: 0.7;
  margin-left: 0.3em;
}

/* --- Footer --------------------------------------------------------------- */
.footer-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 640px) {
  .footer-columns {
    flex-direction: column;
    text-align: center;
  }
}

/* --- Leaflet map ---------------------------------------------------------- */
/* `.modular-text img` gives every image in a text module a card shadow and
   rounded corners. Leaflet's tiles, marker icons and marker shadows are <img>
   elements too, so the decoration has to be switched off inside the map. */
.leaflet-container img {
  box-shadow: none;
  border-radius: 0;
}

/* --- Dark-mode body.bg-gray --------------------------------------------- */
/* `bg-gray` on <body> recesses the whole page canvas. In dark mode the muted
   token is a section/hover surface and is lighter than the card surface
   (--q2-bg-elev), so as a canvas it looks washed out and inverts card
   elevation. There the canvas keeps the base background; recessed sections
   (.modular-text.bg-gray) are unaffected. */
:root[data-theme="dark"] body.bg-gray {
  background: var(--q2-bg);
}

/* --- header-transparent / header-dark on heroless pages ------------------ */
/* `body_class()` (Grav core) falls back to the theme's global defaults
   (quark2-aikido.yaml: header-transparent/header-dark both true) for any of
   the paired classes a page's own body_classes doesn't mention, and a page
   can't opt out by omission. header-transparent/header-dark only make sense
   over a hero image; on a page with none (currently just /impressum) the nav
   ends up with a transparent background and white text over the plain page
   background — unreadable in light mode. Neutralise both whenever there's no
   hero to sit over. */
body.header-transparent:not(:has(.hero, #blog-hero)) #header {
  background: var(--q2-nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom-color: var(--q2-nav-border);
}
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header,
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header .navbar-brand,
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header .theme-toggle,
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header .login-status-wrapper,
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header .dropmenu > ul > li > a {
  color: var(--q2-text-strong);
}
body.header-dark:not(:has(.hero, #blog-hero)):not(.scrolled) #header .navbar-brand svg path {
  fill: var(--q2-text-strong);
}

/* --- hero h4 readability -------------------------------------------------- */
/* quark2's hero rules recolor h1/h2/h3 (and p) for readability over a hero
   background image or on .text-light/.text-dark heroes, but omit h4. Pages
   like /uebungszeiten use a h4 subheading in the hero and it was rendering
   in the normal (dark) heading color, unreadable over the dark hero photo. */
.hero[style*="background-image"] h4 {
  color: #ffffff;
}
.hero.text-light h4 {
  color: #ffffff;
}
.hero.text-dark h4 {
  color: var(--q2-text-strong, #111111);
}
