:root {
    color-scheme: light;
    --bg: #fbf8f3;
    --surface: #ffffff;
    --text: #1d2528;
    --muted: #5b6469;
    --line: #d8ded8;
    --primary: #1f6f5b;
    --primary-dark: #174f42;
    --secondary: #7047a3;
    --danger: #a33a2b;
    --focus: #c58a00;
    --soft: #f3eee6;
    --shadow: 0 18px 48px rgba(29, 37, 40, 0.12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image: url("/assets/img/flohmarkt-muster.svg");
    background-repeat: repeat;
    background-size: 520px 520px;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.site-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 0.85rem clamp(1rem, 4vw, 3rem);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(29, 37, 40, 0.03);
    position: relative;
    z-index: 10;
}

.brand {
    color: var(--text);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    width: 184px;
    height: auto;
    display: block;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.site-header nav a {
    border-radius: 999px;
    color: #063f36;
    font-weight: 700;
    padding: 0.45rem 0.55rem;
    text-decoration: none;
}

.site-footer {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem clamp(1rem, 4vw, 3rem);
    background: #ffffff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -1px 0 rgba(29, 37, 40, 0.03);
}

.footer-brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.footer-brand img {
    width: 158px;
    height: auto;
    display: block;
}

.footer-brand p {
    margin: 0;
    color: var(--muted);
}

.footer-nav {
    gap: 1rem;
}

.footer-nav a {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.footer-nav a:hover,
.site-header nav a:hover {
    background: #eef6f1;
    text-decoration: none;
}

.page {
    width: min(1120px, calc(100% - 2rem));
    flex: 1 0 auto;
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2.25rem) 0;
}

.map-page {
    flex: 1 0 auto;
}

.section,
.event-hero {
    padding: clamp(1.25rem, 4vw, 3rem) 0;
}

.event-hero {
    min-height: 54vh;
    display: grid;
    align-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    border: 1px solid rgba(216, 222, 216, 0.9);
    border-radius: 8px 8px 0 0;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f7efe4, #ffffff);
    box-shadow: var(--shadow);
}

.event-hero-with-image {
    min-height: clamp(460px, 64vh, 680px);
    padding: clamp(2rem, 6vw, 5.25rem);
    color: #ffffff;
}

.event-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.event-hero-with-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(11, 31, 29, 0.84), rgba(11, 31, 29, 0.48) 48%, rgba(11, 31, 29, 0.22)),
        linear-gradient(0deg, rgba(11, 31, 29, 0.48), rgba(11, 31, 29, 0.08) 45%);
    z-index: 1;
}

.event-hero-content {
    max-width: 760px;
    position: relative;
    z-index: 2;
}

.event-hero-with-image .lead,
.event-hero-with-image .eyebrow {
    color: #ffffff;
}

.event-hero-actions {
    margin-top: clamp(1rem, 3vw, 1.5rem);
}

.event-description {
    background: var(--surface);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 18px 48px rgba(29, 37, 40, 0.08);
    padding: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 5vw, 4rem);
}

.event-description .action-row {
    margin-top: 1.25rem;
}

.rich-text {
    max-width: 72ch;
}

.event-page .stats-grid {
    padding: clamp(1rem, 3vw, 1.5rem) 0 0;
}

.rich-text > *:first-child {
    margin-top: 0;
}

.rich-text > *:last-child {
    margin-bottom: 0;
}

.rich-text h2,
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6 {
    margin-top: 1.5rem;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 4vw, 2.65rem);
    line-height: 1.05;
}

.event-hero h1 {
    font-size: clamp(3rem, 6vw, 4.6rem);
}

h2 {
    margin: 0 0 0.75rem;
    font-size: 1.45rem;
}

h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.lead {
    max-width: 48rem;
    font-size: 1.25rem;
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--secondary);
    font-weight: 700;
    text-transform: uppercase;
}

.action-row,
.copy-row,
.split-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.split-heading {
    justify-content: space-between;
}

.button,
button {
    min-height: 44px;
    min-width: 44px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:hover,
button:hover {
    background: var(--primary-dark);
    box-shadow: 0 10px 24px rgba(31, 111, 91, 0.22);
    transform: translateY(-1px);
}

.button-secondary {
    background: var(--secondary);
}

.button-secondary:hover {
    background: #56377e;
    box-shadow: 0 10px 24px rgba(112, 71, 163, 0.22);
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #7c2c20;
    box-shadow: 0 10px 24px rgba(163, 58, 43, 0.22);
}

.event-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.email-reveal-button {
    min-height: 0;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
    color: #ffffff;
    padding: 0.3rem 0.7rem;
    font-size: 0.95rem;
}

.email-reveal-button:hover {
    background: rgba(255, 255, 255, 0.24);
    box-shadow: none;
    transform: none;
}

.event-hero:not(.event-hero-with-image) .email-reveal-button,
.email-reveal-button-plain {
    border-color: rgba(31, 111, 91, 0.32);
    background: #eef6f1;
    color: var(--primary-dark);
}

.event-hero:not(.event-hero-with-image) .email-reveal-button:hover,
.email-reveal-button-plain:hover {
    background: #dceee6;
}

.email-reveal-target a {
    color: inherit;
    font-weight: 700;
}

.stats-grid,
.event-list,
.stand-list {
    display: grid;
    gap: 1rem;
}

.home-events .action-row {
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.home-events .event-list {
    gap: clamp(1.25rem, 3vw, 1.75rem);
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stats-grid article,
.item-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.stats-grid article {
    box-shadow: 0 10px 26px rgba(29, 37, 40, 0.06);
}

.event-card {
    color: var(--text);
    display: grid;
    gap: 0.35rem;
    position: relative;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.event-card h2,
.event-card p {
    margin-top: 0;
}

.event-card:hover {
    border-color: rgba(31, 111, 91, 0.45);
    box-shadow: 0 18px 42px rgba(29, 37, 40, 0.12);
    transform: translateY(-2px);
}

.event-card:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.card-action {
    justify-self: end;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: #eef6f1;
    color: var(--primary-dark);
    padding: 0.45rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.event-card:hover .card-action {
    background: var(--primary);
    color: #ffffff;
}

.stats-grid strong {
    display: block;
    font-size: 2rem;
}

.steps {
    padding-left: 1.5rem;
}

form {
    display: grid;
    gap: 1.25rem;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.nested-fieldset {
    margin-top: 1rem;
    padding: 0.75rem;
}

legend {
    font-weight: 700;
}

label {
    display: block;
    margin: 0.75rem 0 0.35rem;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #aeb8b0;
    border-radius: 6px;
    padding: 0.65rem 0.75rem;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

input[type="checkbox"] {
    width: 1.15rem;
    min-height: 1.15rem;
    height: 1.15rem;
    flex: 0 0 1.15rem;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #9aa79d;
    border-radius: 4px;
    padding: 0;
    background: #ffffff;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    border-color: var(--primary);
    background:
        linear-gradient(45deg, transparent 58%, #ffffff 58% 72%, transparent 72%),
        linear-gradient(-45deg, transparent 52%, #ffffff 52% 66%, transparent 66%),
        var(--primary);
}

textarea {
    resize: vertical;
}

.character-count {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.check-row {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    min-height: 44px;
    margin: 0.5rem 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.78);
    font-weight: 400;
    cursor: pointer;
}

.check-row input[type="checkbox"] {
    width: 1.15rem;
}

.field-error {
    min-height: 1.4rem;
    margin: 0.25rem 0 0;
    color: var(--danger);
    font-weight: 700;
}

.error-summary {
    border: 2px solid var(--danger);
    border-radius: 8px;
    padding: 1rem;
    background: #fff6f3;
}

.map-page {
    min-height: calc(100vh - 76px);
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    background: #f8faf6;
}

.map-tools {
    min-height: calc(100vh - 76px);
    padding: clamp(1rem, 2vw, 1.5rem);
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 30px rgba(29, 37, 40, 0.06);
    overflow: auto;
    position: relative;
    z-index: 2;
}

.filters {
    gap: 0.7rem;
}

.filters label {
    margin: 0;
}

.filters .check-row {
    margin: 0;
}

.filters input[type="search"] {
    margin-bottom: 0.35rem;
}

.view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 1rem 0;
    border: 1px solid var(--line);
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

.view-switch button {
    border-radius: 0;
    background: #ffffff;
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.view-switch button.is-active {
    background: var(--primary);
    color: #ffffff;
}

.map-panel {
    min-width: 0;
    min-height: calc(100vh - 76px);
    position: relative;
}

.map-canvas {
    height: calc(100vh - 76px);
    min-height: 620px;
    background: #e9efe9;
}

.admin-map-canvas {
    width: 100%;
    min-height: 360px;
    margin: 0.75rem 0 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #e9efe9;
}

.map-fallback {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    max-width: min(34rem, calc(100% - 2rem));
    padding: 0.75rem 1rem;
    border: 1px solid #eadfbd;
    border-radius: 8px;
    background: rgba(255, 248, 223, 0.94);
    box-shadow: 0 10px 24px rgba(29, 37, 40, 0.12);
    margin: 0;
}

.map-popup-route {
    margin-top: 0.65rem;
    width: 100%;
}

.stand-list {
    grid-column: 2;
    grid-row: 1;
    align-content: start;
    align-items: start;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 420px));
    min-height: calc(100vh - 76px);
    padding: clamp(1.25rem, 3vw, 2rem);
    background: rgba(251, 248, 243, 0.72);
}

.stand-list h2 {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.stand-item[hidden] {
    display: none;
}

.stand-item {
    display: grid;
    gap: 0.45rem;
    min-height: 0;
}

.stand-item h3,
.stand-item p {
    margin: 0;
}

.stand-item .button {
    justify-self: start;
    margin-top: 0.35rem;
}

.number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

.route-dialog {
    max-width: min(92vw, 32rem);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.25rem;
}

.route-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.details {
    display: grid;
    grid-template-columns: minmax(130px, 190px) 1fr;
    gap: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.details dt {
    font-weight: 700;
}

.details dd {
    margin: 0;
}

.legal-content {
    max-width: 72ch;
}

.legal-content h2,
.legal-content h3 {
    margin-top: 2rem;
}

@media (max-width: 780px) {
    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer-brand {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-page {
        display: block;
        background: var(--surface);
    }

    .map-tools {
        min-height: 0;
        padding: 1.1rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: none;
    }

    .map-tools h1 {
        margin-bottom: 0.75rem;
        font-size: 2rem;
    }

    .view-switch {
        margin: 0.75rem 0 1.25rem;
    }

    .filters {
        gap: 0.65rem;
    }

    .filters input[type="search"] {
        margin-bottom: 0.15rem;
    }

    .status {
        margin: 0.85rem 0 0;
        color: var(--muted);
        font-weight: 700;
    }

    .map-panel,
    .map-canvas {
        height: auto;
        min-height: 56vh;
    }

    .map-fallback {
        position: static;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
    }

    .stand-list {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 1rem;
    }

    .details {
        grid-template-columns: 1fr;
    }

    .page {
        width: min(100% - 1rem, 1120px);
    }

    .event-hero,
    .event-description {
        border-radius: 0;
    }

    .event-hero-with-image {
        min-height: 520px;
        padding: 1.5rem;
    }
}
