/* Hitzepaten Wettenberg – base stylesheet.
   Mobile-first. Calm, quiet palette. Self-hosted system fonts only (no CDNs,
   privacy + CSP self). High contrast (>= 4.5:1), large touch targets (>= 44px),
   visible focus. WCAG 2.1 AA. */

:root {
    --color-bg: #f7f8f7;
    --color-surface: #ffffff;
    --color-text: #1a201e;          /* on --color-bg: ~14:1 */
    --color-muted: #4a544f;         /* on --color-surface: ~7.5:1 */
    --color-primary: #1f5c4d;       /* deep calm green */
    --color-primary-dark: #16433a;
    --color-primary-contrast: #ffffff;
    --color-border: #d3dad6;
    --color-focus: #0b4f8a;         /* high-contrast focus ring */

    --flash-success-bg: #e3f3ea;
    --flash-success-text: #144a30;  /* ~8:1 on bg */
    --flash-success-border: #1f7a4d;
    --flash-error-bg: #fbe6e6;
    --flash-error-text: #7a1717;    /* ~8:1 on bg */
    --flash-error-border: #b32626;
    --flash-info-bg: #e6eef6;
    --flash-info-text: #133a5c;
    --flash-info-border: #1f5c8a;

    --heat-bg: #fff1e0;
    --heat-text: #6b3410;           /* ~7:1 on bg */
    --heat-border: #c2660f;
    --heat-extrem-bg: #fde2e0;
    --heat-extrem-text: #7a1c14;
    --heat-extrem-border: #c0291c;

    --space: 1rem;
    --radius: 8px;
    --maxw: 60rem;
    --touch: 2.75rem;               /* 44px minimum target */

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;           /* ~17px, comfortable reading */
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Links & focus -------------------------------------------------------- */
a { color: var(--color-primary-dark); }
a:hover { color: var(--color-primary); }

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

/* Skip link – visible on focus only */
.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    z-index: 1000;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0.5rem;
    color: var(--color-primary-contrast);
}

/* ---- Layout containers ---------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--space);
}

.site-main {
    flex: 1 0 auto;
    padding-block: 1.5rem;
}
.site-main:focus { outline: none; }   /* programmatic focus target only */

/* ---- Header & brand ------------------------------------------------------- */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
    max-width: var(--maxw);
    margin-inline: auto;
    padding: 0.5rem var(--space);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
    flex-wrap: wrap;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-primary-dark);
    text-decoration: none;
    min-height: var(--touch);
}
.brand__mark { color: var(--heat-border); font-size: 1.3rem; }

/* ---- Navigation ----------------------------------------------------------- */
.main-nav { position: relative; }

.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--touch);
    padding: 0.4rem 0.8rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font: inherit;
    color: var(--color-text);
    cursor: pointer;
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: currentColor;
    position: relative;
}
.nav-toggle__bar::before,
.nav-toggle__bar::after {
    content: "";
    position: absolute;
    left: 0;
}
.nav-toggle__bar::before { top: -6px; }
.nav-toggle__bar::after { top: 6px; }

.nav-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    width: 100%;
}
.nav-list.is-open { display: flex; }

.nav-list a,
.nav-logout {
    display: block;
    width: 100%;
    min-height: var(--touch);
    padding: 0.6rem 0.9rem;
    text-decoration: none;
    color: var(--color-text);
    border-radius: var(--radius);
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.nav-list a:hover,
.nav-logout:hover { background: var(--color-bg); }
.nav-list a[aria-current="page"] {
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    font-weight: 600;
}
.nav-list__logout form { margin: 0; }

/* Desktop nav */
@media (min-width: 48rem) {
    .nav-toggle { display: none; }
    .nav-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        margin: 0;
        border: 0;
        background: none;
        width: auto;
        gap: 0.25rem;
    }
    .nav-list a, .nav-logout { width: auto; }
}

/* ---- Heat banner ---------------------------------------------------------- */
.heat-banner {
    background: var(--heat-bg);
    color: var(--heat-text);
    border-top: 4px solid var(--heat-border);
    border-bottom: 1px solid var(--heat-border);
}
.heat-banner--extrem {
    background: var(--heat-extrem-bg);
    color: var(--heat-extrem-text);
    border-top-color: var(--heat-extrem-border);
    border-bottom-color: var(--heat-extrem-border);
}
.heat-banner__inner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-block: 0.85rem;
}
.heat-banner__icon { font-size: 1.6rem; line-height: 1; }
.heat-banner__title { margin: 0 0 0.2rem; font-size: 1.1rem; }
.heat-banner__note { margin: 0; }

/* ---- Flash messages ------------------------------------------------------- */
.flash-list { margin-bottom: 1.25rem; display: grid; gap: 0.6rem; }
.flash {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border-left: 5px solid;
}
.flash__icon {
    flex: 0 0 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}
.flash--success { background: var(--flash-success-bg); color: var(--flash-success-text); border-color: var(--flash-success-border); }
.flash--success .flash__icon { background: var(--flash-success-border); }
.flash--error { background: var(--flash-error-bg); color: var(--flash-error-text); border-color: var(--flash-error-border); }
.flash--error .flash__icon { background: var(--flash-error-border); }
.flash--info { background: var(--flash-info-bg); color: var(--flash-info-text); border-color: var(--flash-info-border); }
.flash--info .flash__icon { background: var(--flash-info-border); }

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
    flex-shrink: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
    padding-block: 1.25rem;
    color: var(--color-muted);
    font-size: 0.95rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-bottom: 0.5rem; }
.footer-nav a { min-height: var(--touch); display: inline-flex; align-items: center; }
.footer-note { margin: 0.25rem 0; }
.footer-copy { margin: 0.25rem 0 0; }

/* ---- Generic components --------------------------------------------------- */
h1, h2, h3 { line-height: 1.25; color: var(--color-text); }
h1 { font-size: 1.7rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch);
    padding: 0.6rem 1.2rem;
    background: var(--color-primary);
    color: var(--color-primary-contrast);
    border: 1px solid var(--color-primary-dark);
    border-radius: var(--radius);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--color-primary-dark); color: var(--color-primary-contrast); }
.btn--danger { background: var(--flash-error-border); border-color: #8c1d1d; }
.btn--danger:hover { background: #8c1d1d; }
.btn--secondary {
    background: var(--color-surface);
    color: var(--color-primary-dark);
    border-color: var(--color-border);
}
.btn--secondary:hover { background: var(--color-bg); color: var(--color-primary-dark); }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input, select, textarea {
    width: 100%;
    min-height: var(--touch);
    padding: 0.55rem 0.7rem;
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
textarea { min-height: 6rem; }
.form-row { margin-bottom: 1rem; }
.form-hint { font-weight: 400; color: var(--color-muted); font-size: 0.9rem; margin-top: 0.25rem; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--color-border); }
th { background: var(--color-bg); }

/* Visually-hidden but available to assistive tech */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* ---- Error page ----------------------------------------------------------- */
.error-page { max-width: 38rem; text-align: center; padding-block: 2rem; }
.error-page__status { font-size: 4rem; font-weight: 800; color: var(--color-primary); margin: 0; line-height: 1; }
.error-page__title { margin: 0.25rem 0 1rem; }
.error-page__detail { text-align: left; background: var(--color-surface); border: 1px solid var(--color-border); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.error-page__actions { margin: 1.5rem 0; }
.error-page__note { color: var(--color-muted); }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
