/* ---------- Design tokens ---------- */

:root {
    --color-primary: #1d4e5f;
    --color-primary-hover: #163d49;
    --color-accent: #2f8f78;
    --color-bg: #ffffff;
    --color-surface: #f5f7f7;
    --color-text: #202124;
    --color-text-muted: #5f6368;
    --color-border: #e0e3e2;
    --color-danger: #b0413e;
    /* Header colours default to the page colours, so a club only has to set
       them when the navigation should differ from the rest of the site. Both
       are overridable per club under /admin/settings. */
    --nav-bg: var(--color-bg);
    --nav-text: var(--color-text);
    /* Accent links inside the header (member login). Separate from
       --nav-text so the default stays the accent colour, but a club that
       picks a header text colour gets it applied here too — otherwise a
       petrol link on a petrol header would be invisible. */
    --nav-link: var(--color-primary);
    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset & base typography ---------- */

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

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.55;
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 0.6em;
}

p {
    margin: 0 0 1em;
}

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

a:hover {
    color: var(--color-primary-hover);
}

img {
    max-width: 100%;
}

/* ---------- Site header / navigation ---------- */

.site-header {
    border-bottom: 1px solid var(--color-border);
    background: var(--nav-bg);
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--nav-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.site-brand:hover {
    color: var(--color-primary);
}

.site-brand-logo {
    height: 40px;
    width: auto;
    display: block;
}

.site-nav-toggle {
    display: none;
    color: var(--nav-text);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4em 0.6em;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.site-nav li {
    position: relative;
}

.site-nav > ul > li > a {
    text-decoration: none;
    color: var(--nav-text);
    font-weight: 600;
    font-size: 0.95rem;
}

.site-nav > ul > li > a:hover {
    color: var(--color-primary);
}

.site-nav .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 180px;
    margin: 0.4rem 0 0;
    padding: 0.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 20;
}

.site-nav .dropdown a {
    display: block;
    padding: 0.35em 0.5em;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--color-text);
}

.site-nav .dropdown a:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.site-nav li.has-dropdown:hover .dropdown,
.site-nav li.has-dropdown:focus-within .dropdown {
    display: flex;
}

.site-nav-members {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-nav-members a:not(.button) {
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--nav-link);
}

.site-nav-members .button {
    font-size: 0.85rem;
    padding: 0.4em 0.9em;
}

@media (max-width: 720px) {
    .site-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding-top: 0.75rem;
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .site-nav .dropdown {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
        margin: 0.25rem 0 0;
    }

    .site-nav li.has-dropdown .dropdown {
        display: flex;
    }

    .site-nav-members {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ---------- Page container ---------- */

.site-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

/* ---------- Buttons & form fields (element selectors so every block/
   form template picks these up without being touched individually) ---------- */

button,
.button,
input[type="submit"] {
    display: inline-block;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.6em 1.2em;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
    background: var(--color-primary-hover);
}

button:disabled {
    background: var(--color-text-muted);
    cursor: not-allowed;
}

input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.55em 0.7em;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-honeypot {
    position: absolute;
    left: -9999px;
}

.form-success,
.form-error {
    padding: 0.75em 1em;
    border-radius: var(--radius-sm);
    margin: 0 0 1em;
}

.form-success {
    color: #1f6b4f;
    background: #eafaf3;
    border: 1px solid #b8e6d1;
}

.form-error {
    color: var(--color-danger);
    background: #fceceb;
    border: 1px solid #f2c6c2;
}

/* ---------- Fixtures / standings tables ---------- */

.fixtures-table,
.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg);
}

.fixtures-table td {
    padding: 0.6em 0.5em;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.fixtures-table tr:nth-child(even) {
    background: var(--color-surface);
}

.fixtures-date {
    white-space: nowrap;
}

.fixtures-time,
.fixtures-competition {
    font-size: 0.85em;
    opacity: 0.7;
}

.fixtures-own {
    font-weight: bold;
    color: var(--color-primary);
}

.fixtures-score {
    text-align: right;
    white-space: nowrap;
    font-weight: bold;
}

.standings-table th,
.standings-table td {
    padding: 0.5em;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.standings-table th {
    color: var(--color-text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.standings-table tr:nth-child(even) {
    background: var(--color-surface);
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
    text-align: left;
}

.standings-own {
    font-weight: bold;
    color: var(--color-primary);
}

@media (max-width: 480px) {
    .standings-hide-small {
        display: none;
    }
}

/* ---------- News block ---------- */

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-list-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: box-shadow 0.15s ease;
}

.news-list-item:hover {
    box-shadow: var(--shadow-sm);
}

.news-list-image {
    width: 120px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.news-list-date {
    font-size: 0.85em;
    opacity: 0.7;
}

.news-list-title {
    margin: 0.2em 0;
}

.news-list-teaser {
    margin: 0;
}

.news-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.news-grid-item {
    display: flex;
    flex-direction: column;
    flex: 1 1 220px;
    max-width: 320px;
    text-decoration: none;
    color: inherit;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.news-grid-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.news-grid-item .news-list-body {
    padding: 0.9rem 1rem;
}

.news-grid-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.news-article-date {
    font-size: 0.9em;
    opacity: 0.7;
}

.news-article-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: var(--radius-md);
}

/* ---------- Kurse (courses) block ---------- */

.course-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.course-list-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: box-shadow 0.15s ease;
}

.course-list-item:hover {
    box-shadow: var(--shadow-sm);
}

.course-list-image {
    width: 120px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.course-list-date {
    font-size: 0.85em;
    opacity: 0.7;
}

.course-list-title {
    margin: 0.2em 0;
}

.course-list-teaser {
    margin: 0;
}

.course-list-price {
    font-size: 0.85em;
    font-weight: bold;
    color: var(--color-primary);
}

.course-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.course-grid-item {
    display: flex;
    flex-direction: column;
    flex: 1 1 220px;
    max-width: 320px;
    text-decoration: none;
    color: inherit;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.course-grid-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.course-grid-item .course-list-body {
    padding: 0.9rem 1rem;
}

.course-grid-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.course-article-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: var(--radius-md);
}

.course-article-meta {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.course-article-sessions {
    margin: 0.2em 0 1rem;
}

.course-booking-full {
    color: var(--color-danger);
    font-weight: bold;
}

/* ---------- Slider block ---------- */

.slider-block {
    position: relative;
}

.slider-slides {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.slider-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.slider-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.slider-slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slider-slide-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0.75em 1em;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

/* "Neben dem Bild" variant — text sits beside the image instead of
   overlaid on top of it. flex: 1 1 0 (not a fixed 50%) so a slide with
   only an image or only text naturally takes the full width. */
.slider-block-side .slider-slide {
    display: flex;
    align-items: stretch;
    background: var(--color-surface);
}

.slider-block-side .slider-slide-image {
    flex: 1 1 0;
    width: auto;
    height: 100%;
    min-width: 0;
}

.slider-block-side .slider-slide-text {
    flex: 1 1 0;
    min-width: 0;
    position: static;
    margin: 0;
    padding: 1.5rem;
    background: none;
    color: var(--color-text);
    overflow-y: auto;
}

@media (max-width: 720px) {
    .slider-block-side .slider-slide {
        flex-direction: column;
        overflow-y: auto;
    }

    .slider-block-side .slider-slide-image {
        flex: 0 0 45%;
        width: 100%;
    }
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.2em;
    height: 2.2em;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.slider-nav:hover {
    background: rgba(0, 0, 0, 0.65);
}

.slider-nav-prev {
    left: 0.5em;
}

.slider-nav-next {
    right: 0.5em;
}

.slider-dots {
    position: absolute;
    bottom: 0.6em;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4em;
}

.slider-dot {
    width: 0.6em;
    height: 0.6em;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.slider-dot:hover {
    background: rgba(255, 255, 255, 0.85);
}

.slider-dot.is-active {
    background: #fff;
}

/* ---------- Kalender (calendar) block ---------- */

.calendar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.calendar-list-date {
    font-size: 0.85em;
    opacity: 0.7;
}

.calendar-list-title {
    margin: 0.2em 0;
}

.calendar-list-description {
    margin: 0.2em 0;
}

.calendar-list-tags {
    margin: 0;
    font-size: 0.85em;
    opacity: 0.7;
}

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

.calendar-grid-item {
    flex: 1 1 220px;
    max-width: 320px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.calendar-grid-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.calendar-badge-members {
    font-size: 0.7em;
    font-weight: 600;
    background: var(--color-accent);
    color: #fff;
    padding: 0.15em 0.6em;
    border-radius: 999px;
    vertical-align: middle;
}

/* ---------- Downloads block ---------- */

.downloads-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.downloads-list-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.downloads-list-link {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
}

.downloads-list-link:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

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

.gallery-grid {
    display: grid;
    gap: 1rem;
}

.gallery-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-figure {
    margin: 0;
}

/* A button, not a div, so the lightbox is reachable by keyboard — the
   default button chrome is reset away here. */
.gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    cursor: pointer;
}

/* Fixed square crop: club photos come in wildly different aspect ratios,
   and without it every row of the grid would have a different height. */
.gallery-image {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.04);
}

.gallery-caption {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.85);
    padding: 3rem 1rem;
    text-align: center;
}

.gallery-lightbox.is-open {
    display: block;
}

.gallery-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.gallery-lightbox-caption {
    margin: 0.75rem 0 0;
    color: #fff;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
    position: absolute;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.75rem;
    line-height: 1;
    padding: 0.2em 0.5em;
    cursor: pointer;
}

.gallery-lightbox-close {
    top: 1rem;
    right: 1rem;
}

.gallery-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox-prev {
    left: 1rem;
}

.gallery-lightbox-next {
    right: 1rem;
}

@media (max-width: 720px) {
    /* Three or four columns leave thumbnails unusably small on a phone. */
    .gallery-grid-cols-3,
    .gallery-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- Instagram block: profile header ---------- */

/* Modelled on Instagram's own profile layout: round avatar left, handle,
   counts, name and bio right. Everything shown here is served from this
   server — the avatar is downloaded during the sync like the posts. */
.instagram-profile {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.instagram-avatar {
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.instagram-profile-body {
    min-width: 0;
}

.instagram-profile-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.instagram-username {
    font-size: 1.15rem;
    font-weight: 600;
}

.instagram-follow {
    font-size: 0.85rem;
    padding: 0.35em 1em;
}

.instagram-stats {
    display: flex;
    gap: 1.5rem;
    margin: 0.6rem 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.instagram-stats strong {
    color: var(--color-text);
}

.instagram-name {
    font-weight: 600;
}

.instagram-bio {
    margin: 0.25rem 0 0;
}

.instagram-website {
    font-weight: 600;
    font-size: 0.95rem;
}

@media (max-width: 480px) {
    .instagram-profile {
        gap: 1rem;
    }

    .instagram-avatar {
        width: 64px;
        height: 64px;
    }

    .instagram-stats {
        gap: 1rem;
        font-size: 0.9rem;
    }
}
