/* ---------------------------------------------------------------------------
   kodang-layout.css - structure, spacing and type scale.
   Contains no colour literals: every colour comes from theme-tokens.css.
   Responsive from 320px up; checked at 320, 375, 768 and 1280.
   --------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    /* The header is sticky, so in-page anchors must not land underneath it.
       The bar grows with the logo, so this offset is a token and is raised
       again below 600px, where the bar stacks. */
    scroll-padding-top: var(--header-offset);
}

@media (max-width: 37.5rem) {
    html { scroll-padding-top: var(--header-offset-narrow); }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--size-base);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    margin: 0 0 var(--space-3);
    line-height: var(--leading-tight);
    font-weight: var(--weight-bold);
    letter-spacing: -0.015em;
}

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
    transition: color var(--transition);
}
a:hover { color: var(--link-hover); }

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

/* Available to screen readers, invisible on screen. Used for the homepage
   <h1>, which the hero replaces visually but which the document still needs. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* --- layout primitives --------------------------------------------------- */

.wrap {
    width: 100%;
    max-width: var(--wrap-max);
    margin-inline: auto;
    padding-inline: var(--wrap-pad);
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main { flex: 1 0 auto; }

.skip-link {
    position: absolute;
    left: var(--space-2);
    top: var(--space-2);
    z-index: 30;
    padding: var(--space-2) var(--space-4);
    background: var(--card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    transform: translateY(-200%);
}
.skip-link:focus-visible { transform: translateY(0); }

/* --- header -------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    /* Opaque fallback first: without backdrop-filter a translucent bar would
       let the page text run visibly through it. */
    background: var(--bg);
    box-shadow: var(--header-shadow);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .site-header {
        background: var(--header-bg);
        -webkit-backdrop-filter: var(--header-blur);
        backdrop-filter: var(--header-blur);
    }
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    padding-block: var(--space-3);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

/* Height-driven: the logo is 749x760, so forcing a square box would letterbox
   it by a pixel or two and leave the artwork looking off-centre. */
.brand__mark {
    flex: none;
    width: auto;
    height: var(--logo-size);
}

.brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand__name {
    font-size: var(--size-lg);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

.brand__tagline {
    font-size: var(--size-xs);
    color: var(--ink2);
}

.site-nav { margin-left: auto; }

/* The pill: one rounded container, the current item filled. */
.site-nav__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1);
    margin: 0;
    padding: var(--space-1);
    list-style: none;
    background: var(--nav-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
}

.site-nav__link {
    display: inline-block;
    padding: var(--space-1) var(--space-4);
    font-size: var(--size-sm);
    font-weight: var(--weight-medium);
    color: var(--nav-ink);
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--radius-pill);
    transition: background var(--transition), color var(--transition);
}
.site-nav__link:hover { color: var(--nav-ink-hover); }

.site-nav__list .is-current > .site-nav__link,
.site-nav__list .is-current-parent > .site-nav__link {
    background: var(--nav-current-bg);
    color: var(--nav-current-ink);
}

/* Between roughly 600 and 990px the brand and the pill share one row, but the
   club name is long enough to push "Kontakt" onto a second line. Tightening
   both keeps the bar a single row down to the point where it stacks. */
@media (max-width: 62rem) {
    .brand__name { font-size: var(--size-base); }
    .site-nav__link { padding-inline: var(--space-3); }
}

/* Below 600px the bar stacks: brand on its own line, the nav pill centred
   underneath and free to wrap onto two rows at 320px. The logo comes down with
   it - at 68px it would take a third of a 320px-tall viewport before any
   content appeared. */
@media (max-width: 37.5rem) {
    .site-header__inner {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .site-nav { margin-left: 0; }

    .brand__mark { height: var(--logo-size-narrow); }

    .brand__name { font-size: var(--size-base); }

    .site-nav__link { padding-inline: var(--space-3); }
}

/* --- page body ----------------------------------------------------------- */

.page { padding-block: var(--space-7) var(--space-8); }

.page__header { margin-bottom: var(--space-6); }

.page__title {
    font-size: var(--size-3xl);
    margin-bottom: var(--space-2);
}

.page__meta {
    font-size: var(--size-sm);
    color: var(--ink2);
}

.page__body { max-width: 42rem; }
.page__body h2 { margin-top: var(--space-6); font-size: var(--size-xl); }
.page__body h3 { margin-top: var(--space-5); font-size: var(--size-lg); }

/* One button in the theme: a pill, filled red. .button--secondary is the same
   pill, outlined. min-height keeps the touch target at 48px even if the label
   is ever shortened - padding alone would not. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: var(--space-3) var(--space-6);
    background: var(--button-bg);
    color: var(--button-ink);
    font-size: var(--size-base);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    transition: background var(--transition), color var(--transition),
                border-color var(--transition);
}

.button:hover {
    background: var(--button-bg-hover);
    color: var(--button-ink);
}

.button--secondary {
    background: var(--button-outline-bg);
    color: var(--button-outline-ink);
    border-color: var(--button-outline-border);
}

.button--secondary:hover {
    background: var(--button-outline-bg-hover);
    color: var(--button-outline-ink);
    border-color: var(--button-bg-hover);
}

/* --- homepage hero ------------------------------------------------------- */

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding-block: var(--space-4) var(--space-6);
}

/* Narrow: the logo sits above the copy and stays small enough to leave the
   first sentence visible without scrolling. */
.hero__logo {
    order: -1;
    justify-self: center;
    width: min(100%, var(--hero-logo-max-narrow));
    height: auto;
}

/* Copy and buttons are one grid cell, not two: a third grid child would land
   in the logo's column on wide screens. */
.hero__main {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    align-items: start;
}

.hero__copy { max-width: 42rem; }

.hero__copy > :first-child {
    font-size: var(--size-lg);
    line-height: var(--leading-body);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* Below 600px they stack and go full width - two pills side by side would each
   be too narrow to read, and a full-width target is easier to hit on a phone. */
@media (max-width: 37.5rem) {
    .hero__main { align-items: stretch; }

    .hero__actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (min-width: 51.25rem) {
    .hero {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        align-items: center;
        gap: var(--space-7);
        padding-block: var(--space-6) var(--space-7);
    }

    .hero__logo {
        order: 0;
        justify-self: end;
        width: min(100%, var(--hero-logo-max));
    }
}

/* --- the taegeuk --------------------------------------------------------- */

/* Only one element still uses it: the small mark in the "Nächstes Training"
   box. The hero used to carry a large rotating copy; it shows the club logo
   now, which contains lettering and must not spin. The .taegeuk--hero modifier
   was removed with it rather than left lying around. */

.taegeuk {
    flex: none;
    display: block;
    width: 56px;
    height: 56px;
}

.taegeuk__svg {
    display: block;
    width: 100%;
    height: 100%;
    animation: taegeuk-spin var(--spin-duration) linear infinite;
}

/* On the blue box the blue half of the mark is the box colour, so the mark has
   to sit on a disc of its own. This padding is what makes it a disc rather than
   a hairline: with box-sizing: border-box the padding eats into the 56px, so
   3px left a 1-pixel-looking ring around a 50px mark and the blue half still
   ran straight into the background. 8px leaves a ring that reads as white
   space and closes the mark off from the box. KNOWN_ISSUES.md #20. */
.taegeuk--onblue {
    padding: 8px;
    background: var(--next-disc);
    border-radius: var(--radius-pill);
}

/* The script also sets data-motion="reduced", so the rotation is stopped both
   declaratively and at runtime. */
.taegeuk[data-motion="reduced"] .taegeuk__svg { animation: none; }

@keyframes taegeuk-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .taegeuk__svg { animation: none; }
}

/* --- next training ------------------------------------------------------- */

.next-session {
    margin-block: var(--space-6);
    padding: var(--space-5);
    background: var(--next-bg);
    color: var(--next-ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.next-session__heading {
    margin-bottom: var(--space-4);
    font-size: var(--size-sm);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--next-ink-muted);
}

.next-session__body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.next-session__text {
    margin: 0;
    font-size: var(--size-lg);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
}

/* --- schedule ------------------------------------------------------------ */

.schedule { margin-block: var(--space-6) var(--space-7); }

.schedule__heading {
    font-size: var(--size-xl);
    margin-bottom: var(--space-5);
}

.schedule__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--schedule-card-min), 1fr));
    gap: var(--space-4);
    margin: 0 0 var(--space-5);
    padding: 0;
    list-style: none;
}

.schedule-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-5);
    background: var(--card);
    border: 1px solid var(--line);
    border-top: var(--card-rule-width) solid var(--card-rule-a);
    border-radius: var(--radius);
}

/* The cards alternate their top rule. nth-child counts the cards that were
   actually rendered, so hiding a group in the theme settings does not leave a
   gap in the rhythm. */
.schedule-card:nth-child(even) { border-top-color: var(--card-rule-b); }

.schedule-card p { margin: 0; }

.schedule-card__day {
    font-size: var(--size-sm);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink2);
}

.schedule-card__time {
    font-size: var(--size-xl);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
}

.schedule-card__venue { font-weight: var(--weight-medium); }

.schedule-card__address {
    font-size: var(--size-sm);
    color: var(--ink2);
}

.schedule-card__badge {
    align-self: start;
    margin-top: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--badge-bg);
    color: var(--badge-ink);
    font-size: var(--size-xs);
    font-weight: var(--weight-medium);
    border-radius: var(--radius-pill);
}

.schedule__as-of,
.schedule__note {
    max-width: 42rem;
    font-size: var(--size-sm);
    color: var(--ink2);
}

/* --- two-column page (Verein) -------------------------------------------- */

.split {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: start;
}

@media (min-width: 51.25rem) {
    .split { grid-template-columns: minmax(0, 1fr) minmax(0, 19rem); gap: var(--space-7); }
}

.fact-card {
    padding: var(--space-5);
    background: var(--card);
    border: 1px solid var(--line);
    border-top: var(--card-rule-width) solid var(--card-rule-b);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.fact-card__number {
    margin: 0;
    font-size: var(--size-3xl);
    font-weight: var(--weight-bold);
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--fact-number);
}

.fact-card__label {
    margin: var(--space-2) 0 var(--space-2);
    font-size: var(--size-sm);
    color: var(--ink2);
}

.fact-card__note {
    margin: 0 0 var(--space-5);
    font-size: var(--size-xs);
    line-height: 1.5;
    color: var(--ink2);
}

.fact-card__list,
.contact-card__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
}

.fact-card__row,
.contact-card__row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.fact-card__row dt,
.contact-card__row dt {
    font-size: var(--size-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink2);
}

.fact-card__row dd,
.contact-card__row dd {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: 0;
    font-size: var(--size-sm);
}

.fact-card__link {
    margin: var(--space-5) 0 0;
    font-size: var(--size-sm);
}

/* --- contact card -------------------------------------------------------- */

.contact-card {
    margin-top: var(--space-6);
    padding: var(--space-6);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.contact-card__heading {
    margin-bottom: var(--space-5);
    font-size: var(--size-xl);
}

.contact-card__columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}

@media (min-width: 34rem) {
    .contact-card__columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
}

/* --- footer -------------------------------------------------------------- */

.site-footer {
    flex: none;
    margin-top: var(--space-8);
    padding-block: var(--space-7) var(--space-5);
    background: var(--card);
    border-top: 1px solid var(--line);
}

.site-footer__inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

@media (min-width: 40rem) {
    .site-footer__inner { grid-template-columns: repeat(3, 1fr); }
}

.site-footer__heading {
    margin-bottom: var(--space-3);
    font-size: var(--size-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink2);
}

.site-footer__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.contact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-style: normal;
    font-size: var(--size-sm);
}

.site-footer__legal {
    margin-top: var(--space-6);
    font-size: var(--size-xs);
    color: var(--ink2);
}

/* --- posts: no posts today, kept so post.hbs never renders unstyled ------- */

.post-list {
    display: grid;
    gap: var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-list__title {
    font-size: var(--size-lg);
    margin-bottom: var(--space-2);
}

[hidden] { display: none !important; }
