/*
 * TSV Firnhaberau – Modernisierungsschicht
 * © TSV Firnhaberau, Andreas Berndt, 2026
 * ----------------------------------------
 *
 * Stand: 2026-08-10
 */

/* ============================================================
   1. Design-Tokens / Grundsystem
   ============================================================ */

:root {
    --tsv-red: #b20000;
    --tsv-red-dark: #840000;
    --tsv-red-soft: #f7eeee;

    --tsv-teal: #004b4b;
    --tsv-teal-dark: #003737;

    --tsv-text: #2b2b2b;
    --tsv-text-muted: #616161;
    --tsv-border: #d9d9d9;
    --tsv-border-light: #e9e9e9;

    --tsv-surface: #ffffff;
    --tsv-surface-soft: #f7f7f6;
    --tsv-surface-dark: #292929;

    --tsv-focus: #005fcc;

    --tsv-radius-sm: 6px;
    --tsv-radius-md: 10px;
    --tsv-radius-lg: 14px;

    --tsv-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.07);
    --tsv-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.10);

    --tsv-content-max: 1280px;
    --tsv-gap: clamp(1rem, 2.5vw, 2rem);

    --tsv-font-ui: "Roboto", Arial, Helvetica, sans-serif;
    --tsv-font-display: "Noto Serif", Georgia, serif;
}


/* ============================================================
   2. Globale Basis
   ============================================================ */

html {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    margin: 0;
    color: var(--tsv-text);
    background-color: #333;
    font-family: var(--tsv-font-ui);
    /* Schriftgröße bewusst nicht festsetzen:
       Das vorhandene Barrierefreiheits-Plugin steuert die Basisgröße. */
    line-height: 1.6;
    overflow-wrap: break-word;
}

#wrap {
    width: min(calc(100% - 2rem), var(--tsv-content-max));
    max-width: none;
    margin: clamp(0rem, 2vw, 1.875rem) auto;
    padding: clamp(0.75rem, 2vw, 1.5rem) clamp(0.75rem, 3vw, 2.5rem) 0;
    background: var(--tsv-surface);
    box-shadow: var(--tsv-shadow-md);
}

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

img {
    border: 0;
}

p,
li {
    line-height: 1.6;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

strong,
b {
    font-weight: 700;
}

hr {
    border: 0;
    border-top: 1px solid var(--tsv-border);
    margin: 2rem 0;
}


/* ============================================================
   3. Typografie
   ============================================================ */

header h1 {
    font-family: var(--tsv-font-display);
    color: var(--tsv-text);
}

h1,
h2,
h3,
h4 {
    color: var(--tsv-text);
    text-wrap: balance;
}

h2 {
    width: 100%;
    margin: 0 0 1.1rem;
    padding: 0 0 0.45rem;
    border-bottom: 3px solid var(--tsv-red);
    font-family: var(--tsv-font-ui);
    font-size: clamp(1.28em, 1.8vw, 1.62em);
    line-height: 1.2;
    font-weight: 700;
}

h3 {
    font-size: clamp(1.15em, 1.8vw, 1.45em);
    line-height: 1.3;
}

h4 {
    font-size: 1em;
    line-height: 1.35;
}

section,
aside {
    font-size: 1em;
}

section .gross {
    font-size: clamp(1.08em, 1.5vw, 1.2em);
    line-height: 1.6;
}


/* ============================================================
   4. Links, Fokus und Klickziele
   ============================================================ */

#primary a {
    color: var(--tsv-teal);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

#primary a:hover {
    color: var(--tsv-red-dark);
}

#primary p a,
#primary li a {
    text-decoration-line: underline;
}

nav a,
#topnav a,
footer a,
.newspiccombo a,
#fotoalbum a,
#primary a.darktag {
    text-decoration: none;
}

a,
button,
input,
select,
textarea,
[tabindex] {
    -webkit-tap-highlight-color: rgba(178, 0, 0, 0.14);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
#fotoalbum .gal_comb:focus-visible {
    outline: 3px solid var(--tsv-focus) !important;
    outline-offset: 3px;
}

/* Alte Regeln mit outline:none gezielt neutralisieren */
nav a:focus,
#fotoalbum .gal_comb:focus {
    outline-color: var(--tsv-focus);
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
#newsletter-abo {
    min-height: 44px;
}


/* ============================================================
   5. Header
   ============================================================ */

header {
    font-family: var(--tsv-font-ui);
}

header h1 {
    margin: 0;
    line-height: 1.08;
}

header #claim {
    color: var(--tsv-text-muted);
    margin: 0;
    line-height: 1.3;
}

/* Auf Desktop sitzt der Claim unmittelbar unter dem Titel.
   Die horizontale Position des jeweiligen Breakpoints bleibt erhalten. */
@media (min-width: 768px) {
    header #claim {
        top: 88px;
    }
}

#topnav a {
    color: #696969;
}

#topnav a:hover,
#topnav a:focus-visible {
    color: var(--tsv-red-dark);
}


/* ============================================================
   6. Hauptnavigation Desktop
   ============================================================ */

nav {
    background: var(--tsv-surface-dark);
    border-bottom: 4px solid var(--tsv-red);
    margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
    min-height: 48px;
    font-family: var(--tsv-font-ui);
}

nav > ul {
    float: none;
}

nav ul li {
    line-height: normal;
}

nav a {
    min-height: 48px;
    display: flex;
    align-items: center;
    color: #f2f2f2;
    font-size: 0.94em;
    font-weight: 500;
    line-height: 1.25;
}

nav a:hover,
nav li:hover > a,
nav li.focus > a {
    color: #fff;
    background-color: #414141;
}

nav a.active {
    color: #fff;
    background-color: var(--tsv-red);
}

nav ul li ul {
    padding-top: 0;
    box-shadow: var(--tsv-shadow-md);
}

nav ul li ul li {
    height: auto;
    min-height: 44px;
    border-bottom: 1px solid #484848;
}

nav ul li ul li a {
    min-height: 44px;
    line-height: 1.25;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    background-color: var(--tsv-surface-dark);
}


/* ============================================================
   7. Hauptlayout: Inhalt + Sidebar
   ============================================================ */

#primary {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.75rem, 4vw, 1.5rem);
    align-items: start;
}

/* Zwei Spalten ausschließlich dann, wenn tatsächlich eine
   direkte ASIDE-Spalte vorhanden ist. Seiten wie Fotoalben oder
   Inhaltsseiten ohne Sidebar nutzen dadurch automatisch 100 %. */
#primary:has(> aside) {
    grid-template-columns: minmax(0, 2.1fr) minmax(250px, 0.9fr);
}

#primary::after {
    content: none;
}

#primary > section,
#primary > aside {
    float: none;
    width: auto;
    max-width: none;
    min-width: 0;
}

/* Sicherheitsregel für reine Inhaltsseiten */
#primary:not(:has(> aside)) > section,
#primary:has(> section:only-child) > section {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
}

aside .asidebox {
    padding-left: 0;
    line-height: 1.55;
}

aside .headline,
.asidebox h4 {
    font-size: 1em;
    line-height: 1.35;
}

aside ul {
    padding-top: 0.5rem;
}

#primary aside ul li a {
    color: var(--tsv-text);
}

#primary aside ul li a:hover {
    color: var(--tsv-red-dark);
}


/* ============================================================
   8. News
   ============================================================ */

.newspiccombo {
    position: relative;
    overflow: hidden;
    border-radius: var(--tsv-radius-md);
    background: #222;
    box-shadow: var(--tsv-shadow-sm);
}

.newspiccombo img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.newspiccombo span {
    width: 100%;
    bottom: 0;
    padding: 2.75rem 0 0;
    background:
        linear-gradient(
            to top,
            rgba(40, 0, 0, 0.90) 0%,
            rgba(80, 0, 0, 0.72) 55%,
            rgba(80, 0, 0, 0) 100%
        );
}

.newspiccombo h3 {
    margin: 0;
    padding: 0.9rem 1rem;
    color: #fff;
    font-size: clamp(1.15em, 2.4vw, 1.9em);
    line-height: 1.22;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

#news1 p {
    margin: 0.85rem 0 2rem;
    line-height: 1.65;
}

#news {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.25rem, 2.5vw, 2rem);
    align-items: start;
}

#news .newscombo {
    width: auto;
    min-width: 0;
    overflow: hidden;
}

#news .newscombo img {
    display: block;
    width: 100%;
    max-width: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--tsv-radius-sm);
}

#news h4 {
    margin: 0.65rem 0 0.35rem;
    font-size: 1.05em;
    line-height: 1.3;
    font-weight: 700;
}

#news p {
    margin: 0 0 0.75rem;
    color: var(--tsv-text-muted);
    line-height: 1.6;
}


/* ============================================================
   9. Breaking News
   ============================================================ */

#breakingnews {
    width: 100%;
    margin-bottom: 1.25rem;
    padding: 0.9rem 1rem;
    border-left: 5px solid var(--tsv-red);
    border-radius: 0 var(--tsv-radius-sm) var(--tsv-radius-sm) 0;
    background: var(--tsv-red-soft);
}


/* ============================================================
   10. Veranstaltungen
   ============================================================ */

.eventmonat {
    margin: 1rem 0 0.9rem;
    color: var(--tsv-red-dark);
    font-size: 1.2em;
    line-height: 1.3;
    font-style: normal;
    font-weight: 700;
}

.event {
    position: relative;
    min-height: 76px;
    margin: 0 0 0.85rem;
    padding: 0.85rem;
    border: 1px solid var(--tsv-border-light);
    border-radius: var(--tsv-radius-sm);
    background: var(--tsv-surface);
}

.event img {
    float: left;
    width: 58px;
    height: 58px;
    max-height: none;
    margin-right: 0.85rem;
    object-fit: contain;
}

.event h4 {
    margin: 0 0 0.25rem;
    padding: 0;
    border: 0;
    font-size: 1em;
    line-height: 1.3;
}

.event p {
    margin: 0 0 0.18em;
    padding: 0;
    color: var(--tsv-text-muted);
    line-height: 1.4;
}

.event p:last-child {
    margin-bottom: 0;
}

.event .sportarten {
    font-size: 0.92em;
    line-height: 1.4;
}

.event .verband {
    color: #6f6f6f;
    font-size: 0.82em;
    line-height: 1.4;
}

.eventcloser {
    clear: both;
}


/* ============================================================
   11. Fotoalbum
   ============================================================ */

#fotoalbum {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
}

#fotoalbum .gal_comb {
    margin: 0;
    overflow: hidden;
    border-radius: var(--tsv-radius-md);
    background: #222;
    box-shadow: var(--tsv-shadow-sm);
}

#fotoalbum a {
    display: block;
}

#fotoalbum img {
    display: block;
    width: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 180ms ease;
}

#fotoalbum a:hover img {
    transform: scale(1.025);
}

#fotoalbum span {
    right: 0;
    bottom: 0;
    left: 0;
    padding-top: 2.4em;
    border-radius: 0;
    background:
        linear-gradient( to top, rgba(91, 0, 0, 0.67) 0%, rgba(103, 78, 78, 0.42) 55%, rgba(255, 255, 255, 0) 100% );
}

#fotoalbum span h4 {
    margin: 0;
    padding: 1.6rem 0.75rem 0.6rem;
    color: #fff;
    font-size: 0.92em;
    line-height: 1.25;
    font-weight: 600;
    text-shadow: none;
}

#fotoalbum .single_image img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
    object-fit: contain;
}


/* ============================================================
   12. Funktionsboxen
   ============================================================ */

#funktionsboxen {
    width: 100%;
    margin: 2rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
    overflow: visible;
}

.funktionsbox {
    width: auto;
    height: auto;
    min-height: 140px;
    overflow: hidden;
    border-radius: var(--tsv-radius-md);
    background-color: #4a4a4a;
    text-align: center;
    box-shadow: var(--tsv-shadow-sm);
}

.funktionsbox a {
    min-height: 140px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.funktionsbox img {
    width: auto;
    max-height: 58px;
}

.funktionsbox h3 {
    margin: 0.35rem 0 0;
    padding: 0;
    color: #fff;
    font-family: var(--tsv-font-ui);
    font-size: clamp(1.2em, 2vw, 1.55em);
    line-height: 1.25;
    font-weight: 600;
}

.fbox1 {
    margin: 0;
}


/* ============================================================
   13. Bilder im redaktionellen Inhalt
   ============================================================ */

.imgnews,
.imglinks,
.imgrechts {
    max-width: 100%;
    height: auto;
}

.imgnews {
    width: min(100%, 420px);
    margin: 0 1.25rem 0.8rem 0;
}

.imglinks {
    margin: 0 1.25rem 0.8rem 0;
}

.imgrechts {
    margin: 0 0 0.8rem 1.25rem;
}

.imghalb {
    width: min(50%, 100%);
    height: auto;
}

.img200,
.img300,
.img400 {
    max-width: 100%;
    height: auto;
}


/* ============================================================
   14. Ansprechpartner / Abteilungsleitung
   ============================================================ */

.abtltg {
    margin: 0.75rem 0;
}

.abtltg p {
    margin: 0.4rem 0;
    line-height: 1.5;
}

/* Ansprechpartner: Kontaktlinks und FontAwesome-Icons nicht unterstreichen.
   Die höhere Spezifität überschreibt #primary p a aus dieser Datei. */
#primary .abtltg a,
#primary .abtltg p a,
#primary .abtltg a .fa,
#primary .abtltg a::before,
#primary .abtltg a::after {
    text-decoration: none !important;
}


/* ============================================================
   15. Tabellen / Trainingszeiten
   ============================================================ */

.trainingszeiten {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    margin-bottom: 1.25rem;
    -webkit-overflow-scrolling: touch;
}

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

th {
    background-color: var(--tsv-red-soft);
    color: var(--tsv-text);
    font-weight: 700;
    text-align: left;
}

th,
td {
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--tsv-border);
    vertical-align: top;
}

tr:nth-child(odd),
tr:nth-child(even) {
    background-color: transparent;
}

tbody tr:nth-child(odd) {
    background-color: #fafafa;
}


/* ============================================================
   16. Formulare
   ============================================================ */

#feedback input,
#feedback textarea,
#feedback button,
#feedback select,
input,
select,
textarea,
button {
    font: inherit;
}

#feedback input,
#feedback textarea,
#feedback select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: 0.7rem 0.8rem;
    border: 1px solid #a9a9a9;
    border-radius: var(--tsv-radius-sm);
    background: #fff;
    color: var(--tsv-text);
    box-shadow: none;
}

#feedback textarea {
    min-height: 8rem;
    resize: vertical;
}

/* Honeypot des Kontaktformulars robust aus dem sichtbaren Layout nehmen.
   Der Container bleibt im DOM erhalten, ist aber weder sichtbar noch bedienbar. */
#mailformsubject {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#mailformsubject *,
#mailformsubject input,
#mailformsubject label,
#feedback #mailformsubject input {
    width: 1px !important;
    min-width: 0 !important;
    max-width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    max-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

/* Falls ein Label außerhalb des Containers über 'for' angebunden ist. */
label[for="mailformsubject"] {
    display: none !important;
}

#feedback input[type="submit"],
#newsletteraside button,
#newsletter-abo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0.7rem 1rem;
    border: 1px solid var(--tsv-red);
    border-radius: var(--tsv-radius-sm);
    background: var(--tsv-red) !important;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

#feedback input[type="submit"]:hover,
#newsletteraside button:hover,
#newsletter-abo:hover {
    background: var(--tsv-red-dark) !important;
    border-color: var(--tsv-red-dark);
}

::placeholder {
    color: #666;
    opacity: 1;
}


/* ============================================================
   17. Tags und kleine Aktionsflächen
   ============================================================ */

#primary .darktag {
    margin: 0.2rem 0.3rem 0.2rem 0;
    padding: 0.35rem 0.55rem;
    border-radius: var(--tsv-radius-sm);
    background: #454545;
    color: #fff;
    box-shadow: none;
}

#primary a.darktag:hover {
    background: #333;
    color: #fff;
}


/* ============================================================
   18. Footer
   ============================================================ */

footer {
    clear: both;
    margin-top: clamp(2rem, 5vw, 4rem);
}

footer #bottom {
    width: 100%;
    min-height: 0;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 1.25rem;
    background: var(--tsv-surface-dark);
    border-bottom: 4px solid var(--tsv-red);
}

footer .bottomBox {
    width: auto;
    margin: 0;
    padding: 0;
    border-right: 0;
    color: #d0d0d0;
    font-size: 0.92em;
    line-height: 1.5;
}

footer h3 {
    margin: 0 0 0.65rem;
    padding: 0;
    color: #fff;
    font-size: 1em;
    line-height: 1.3;
    font-weight: 700;
}

footer ul {
    margin: 0;
    padding: 0;
}

footer ul li {
    padding: 0.18rem 0;
}

footer a {
    color: #d7d7d7;
    white-space: normal;
}

footer a:hover,
footer a:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

footer #lastline {
    padding: 0.85rem;
    color: #606060;
    font-size: 0.82em;
    line-height: 1.4;
}


/* ============================================================
   19. Kleine Displays
   ============================================================ */

@media (max-width: 767px) {

    body {
        background: var(--tsv-surface);
    }

    #wrap {
        width: 100%;
        margin: 0;
        padding: 0 0.9rem;
        box-shadow: none;
    }

    header {
        max-width: 100%;
    }

    /* Mobile Navigation:
       bestehende Ein-/Ausklapp-Logik bleibt erhalten */
    nav {
        margin-left: -0.9rem;
        margin-right: -0.9rem;
        margin-bottom: 1.5rem;
    }

    nav #menubutton {
        min-height: 48px;
        height: auto;
        display: flex;
        align-items: center;
    }

    nav a {
        min-height: 48px;
        font-size: 1em;
        line-height: 1.3;
        padding-top: 0.7rem;
        padding-bottom: 0.7rem;
    }

    nav > ul > li > ul > li > a {
        padding-left: 2rem;
    }

    nav > ul > li > ul > li > ul > li > a {
        padding-left: 3rem;
    }

    #primary,
    #primary:has(> aside) {
        display: block;
        grid-template-columns: minmax(0, 1fr);
    }

    #primary > section,
    #primary > aside {
        width: 100%;
    }

    #primary > aside {
        margin-top: 2.5rem;
    }

    #news {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #fotoalbum {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    }

    #funktionsboxen {
        grid-template-columns: 1fr;
    }

    .funktionsbox,
    .funktionsbox a {
        min-height: 112px;
    }

    .imgnews,
    .imglinks,
    .imgrechts,
    .imghalb {
        float: none;
        display: block;
        width: 100%;
        margin: 0 0 1rem;
    }

    .event {
        padding: 0.75rem;
    }

    footer {
        margin-left: -0.9rem;
        margin-right: -0.9rem;
    }

    footer #bottom {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }
}


/* ============================================================
   20. Sehr kleine Displays
   ============================================================ */

@media (max-width: 420px) {

    #wrap {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    nav {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }

    footer {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }

    h2 {
        font-size: 1.4em;
    }

    .newspiccombo h3 {
        font-size: 1.1em;
    }

    #fotoalbum {
        grid-template-columns: 1fr;
    }

    .event img {
        width: 50px;
        height: 50px;
    }
}


/* ============================================================
   21. Reduced Motion / Barrierefreiheit
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ============================================================
   22. Hoher Kontrast / systemseitige Präferenz
   ============================================================ */

@media (prefers-contrast: more) {

    :root {
        --tsv-text: #111;
        --tsv-text-muted: #333;
        --tsv-border: #777;
    }

    #primary a {
        text-decoration-thickness: 0.12em;
    }

    nav,
    footer #bottom {
        background: #111;
    }
}


/* ============================================================
   23. Druck
   Die eigentliche Druckdarstellung bleibt Aufgabe von style_print.css.
   style_modern.css sollte nach Möglichkeit NICHT für media="print"
   eingebunden werden. Falls doch, werden die wichtigsten Effekte
   hier neutralisiert.
   ============================================================ */

@media print {

    body {
        background: #fff;
        color: #000;
    }

    #wrap {
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    #primary {
        display: block;
    }

    .newspiccombo,
    #fotoalbum .gal_comb,
    .funktionsbox {
        box-shadow: none;
    }
}