/*
 * Impressum (legal/imprint.html.twig) — visual layer only.
 * Loaded exclusively on the imprint page, after aberle.css.
 * Must not reveal or contain any register/tax values.
 */

:root {
    --am-imprint-accent: #e41b18;
}

/* ---- Layout & reading width ---- */
.am-legal-layout .am-legal-content {
    max-width: 860px;
    margin-left: 0;
    min-width: 0;
}

.am-legal-content > p,
.am-legal-content > ul,
.am-legal-content > ol {
    max-width: 70ch;
}

.am-legal-content a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    overflow-wrap: anywhere;
}

/* ---- Section headings: one visual block per h2 ---- */
.am-legal-content > h2 {
    position: relative;
    margin: var(--am-space-12) 0 var(--am-space-4);
    padding: var(--am-space-8) 0 0 var(--am-space-4);
    border-top: 1px solid var(--am-border-faint);
    font-size: var(--am-text-2xl);
    line-height: var(--am-leading-tight);
}

.am-legal-content > h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: calc(var(--am-space-8) + 0.12em);
    bottom: 0.12em;
    width: 3px;
    border-radius: 2px;
    background: var(--am-imprint-accent);
}

.am-legal-content > h2:first-child,
.am-legal-content > h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.am-legal-content > h2:first-child::before,
.am-legal-content > h2:first-of-type::before {
    top: 0.12em;
}

.am-legal-content .am-legal-meta {
    margin-top: var(--am-space-10);
    padding-top: var(--am-space-4);
    border-top: 1px solid var(--am-border-faint);
}

/* ---- Location cards (Anbieter, Kontakt, Register, Standorte) ---- */
.am-legal-content .row > [class*="col-"]:has(.am-imprint-figure) {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

.am-legal-content .am-location-card {
    padding: var(--am-space-6);
    border-radius: var(--am-radius-lg);
    border: var(--am-card-border);
    border-top: 3px solid var(--am-imprint-accent);
    background: var(--am-bg-3);
    min-width: 0;
    overflow-wrap: anywhere;
}

.am-legal-content .am-location-card,
.am-legal-content .am-location-card:hover {
    transform: none;
}

.am-legal-content .am-location-card:hover {
    box-shadow: var(--am-shadow-sm);
}

.am-legal-content .am-location-card h3 {
    font-size: var(--am-text-xl);
    margin: 0 0 var(--am-space-3);
    color: var(--am-white);
}

.am-legal-content .am-location-card p,
.am-legal-content .am-location-card address {
    font-size: var(--am-text-base);
    line-height: var(--am-leading-normal);
    margin-bottom: var(--am-space-3);
}

.am-legal-content .am-location-card .am-location-card__label {
    display: inline-block;
    margin-bottom: var(--am-space-3);
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--am-imprint-accent);
    border-radius: var(--am-radius-full);
    font-size: var(--am-text-xs);
    font-weight: 600;
    line-height: 1.4;
}

.am-legal-content .am-location-card .text-secondary {
    color: var(--am-gray) !important;
}

.am-legal-content .am-location-card dl {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
    gap: var(--am-space-2) var(--am-space-4);
    margin: var(--am-space-4) 0;
    align-items: center;
}

.am-legal-content .am-location-card dt {
    font-weight: 600;
    color: var(--am-light-gray);
}

.am-legal-content .am-location-card dd {
    margin: 0;
    min-width: 0;
}

@media (max-width: 575.98px) {
    .am-legal-content .am-location-card {
        padding: var(--am-space-5) var(--am-space-4);
    }

    .am-legal-content .am-location-card dl {
        grid-template-columns: minmax(0, 1fr);
        gap: 0 0;
    }

    .am-legal-content .am-location-card dd {
        margin-bottom: var(--am-space-3);
    }
}

/* ---- Image lines (USt-IdNr. etc.): never cropped, magnifier beside ---- */
.am-legal-content .am-imprint-figure {
    display: inline-flex;
    align-items: center;
    gap: var(--am-space-2);
    max-width: 100%;
    min-width: 0;
    margin: var(--am-space-1) 0 var(--am-space-2);
    overflow: visible;
    vertical-align: middle;
}

.am-legal-content .am-location-card > .am-imprint-figure {
    display: flex;
    width: fit-content;
}

.am-imprint-figure > .am-imprint-figure__img {
    display: block;
    flex: 0 1 auto;
    width: auto;
    height: auto;
    min-width: 0;
    max-width: 100%;
    padding: 0.2rem 0.45rem;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--am-radius-sm);
}

.am-imprint-figure > .am-imprint-zoom {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--am-charcoal);
    border-radius: var(--am-radius-md);
    background: var(--am-bg-2);
    color: var(--am-white);
    cursor: zoom-in;
    transition: border-color var(--am-transition-fast), color var(--am-transition-fast), background-color var(--am-transition-fast);
}

.am-imprint-figure > .am-imprint-zoom svg {
    width: 1.25rem;
    height: 1.25rem;
}

.am-imprint-figure > .am-imprint-zoom:hover {
    border-color: var(--am-imprint-accent);
    color: var(--am-gold);
}

.am-imprint-figure > .am-imprint-zoom:focus-visible {
    outline: 2px solid var(--am-gold);
    outline-offset: 2px;
    box-shadow: var(--am-focus-ring);
}

/* ---- Overlay layer (state driven by the existing is-large / aria-pressed toggle) ---- */
body:has(.am-imprint-figure__img.is-large) {
    overflow: hidden;
}

.am-imprint-figure:has(> .am-imprint-figure__img.is-large)::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(0, 0, 0, 0.86);
}

.am-imprint-figure > .am-imprint-figure__img.is-large {
    position: fixed;
    z-index: 2101;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    min-width: 0;
    height: auto;
    max-width: calc(100vw - 2rem);
    padding: clamp(0.75rem, 2vw, 1.5rem);
    box-sizing: border-box;
    background: #ffffff;
    border: 0;
    border-radius: var(--am-radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"] {
    position: fixed;
    z-index: 2102;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
    width: 3rem;
    height: 3rem;
    border: 2px solid #ffffff;
    border-radius: var(--am-radius-full);
    background: var(--am-red);
    color: #ffffff;
    cursor: zoom-out;
    box-shadow: var(--am-shadow-lg);
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"]:hover {
    background: var(--am-red-dark);
    color: #ffffff;
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"]:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: none;
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"] svg {
    display: none;
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"]::before,
.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"]::after {
    content: "";
    position: absolute;
    width: 1.25rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transform: rotate(45deg);
}

.am-imprint-figure > .am-imprint-zoom[aria-pressed="true"]::after {
    transform: rotate(-45deg);
}

/* Dedicated overlay markup (dialog or div), if rendered */
dialog.am-imprint-overlay::backdrop {
    background: rgba(0, 0, 0, 0.86);
}

.am-imprint-overlay {
    padding: 0;
    border: 0;
    background: transparent;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    overflow: visible;
}

div.am-imprint-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: none;
    max-height: none;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.86);
}

div.am-imprint-overlay[hidden] {
    display: none;
}

.am-imprint-overlay img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 2rem);
    padding: clamp(0.75rem, 2vw, 1.5rem);
    box-sizing: border-box;
    background: #ffffff;
    border-radius: var(--am-radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.am-imprint-overlay__close {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
    z-index: 2102;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    height: 3rem;
    padding: 0 0.9rem;
    border: 2px solid #ffffff;
    border-radius: var(--am-radius-full);
    background: var(--am-red);
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--am-shadow-lg);
}

.am-imprint-overlay__close:hover {
    background: var(--am-red-dark);
}

.am-imprint-overlay__close:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
    box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
    .am-imprint-figure:has(> .am-imprint-figure__img.is-large)::before,
    .am-imprint-figure > .am-imprint-figure__img.is-large,
    dialog.am-imprint-overlay[open],
    div.am-imprint-overlay:not([hidden]) {
        animation: am-imprint-fade 160ms var(--am-ease-out) both;
    }
}

@keyframes am-imprint-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Request panel (Steuernummer / EORI per E-Mail) ---- */
.am-legal-content .am-imprint-tax {
    max-width: 70ch;
    margin: var(--am-space-8) 0 var(--am-space-4);
    padding: var(--am-space-6);
    border: var(--am-card-border);
    border-left: 3px solid var(--am-imprint-accent);
    border-radius: var(--am-radius-lg);
    background: var(--am-bg-2);
    color: var(--am-light-gray);
}

.am-imprint-tax > :last-child {
    margin-bottom: 0;
}

.am-imprint-tax h2,
.am-imprint-tax h3,
.am-imprint-tax h4 {
    margin: 0 0 var(--am-space-3);
    padding: 0;
    border: 0;
    font-size: var(--am-text-xl);
    color: var(--am-white);
}

.am-imprint-tax h2::before {
    content: none;
}

.am-imprint-tax > p {
    font-size: var(--am-text-sm);
    line-height: var(--am-leading-normal);
}

.am-imprint-tax form {
    margin: 0;
    padding: var(--am-space-5) 0 0;
}

.am-imprint-tax form + form {
    margin-top: var(--am-space-5);
    border-top: 1px dashed var(--am-border-faint);
}

.am-imprint-tax .form-label {
    margin-bottom: var(--am-space-1);
    font-size: var(--am-text-sm);
    font-weight: 600;
    color: var(--am-white);
}

.am-imprint-tax .form-control:not([tabindex="-1"]) {
    min-height: 2.75rem;
}

.am-imprint-tax .form-control {
    border: 1px solid var(--am-charcoal);
    border-radius: var(--am-radius-sm);
    background-color: var(--am-bg-1);
    color: var(--am-white);
}

.am-imprint-tax .form-control::placeholder {
    color: var(--am-gray);
    opacity: 1;
}

.am-imprint-tax .form-control:focus,
.am-imprint-tax .form-control:focus-visible {
    border-color: var(--am-gold);
    background-color: var(--am-bg-1);
    color: var(--am-white);
    box-shadow: var(--am-focus-ring);
    outline: none;
}

.am-imprint-tax .form-control:user-invalid {
    border-color: #f87171;
}

.am-imprint-tax input[inputmode="numeric"],
.am-imprint-tax input[autocomplete="one-time-code"] {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3em;
}

.am-imprint-tax .form-check-input {
    border-color: var(--am-gray);
    background-color: var(--am-bg-1);
}

.am-imprint-tax .form-check-input:checked {
    border-color: var(--am-red);
    background-color: var(--am-red);
}

.am-imprint-tax .form-check-input:focus-visible {
    border-color: var(--am-gold);
    box-shadow: var(--am-focus-ring);
}

.am-imprint-tax .form-check-label,
.am-imprint-tax .form-text,
.am-imprint-tax small,
.am-imprint-tax .small {
    font-size: var(--am-text-sm);
    color: var(--am-gray);
}

.am-imprint-tax .btn-primary,
.am-imprint-tax button[type="submit"] {
    min-height: 2.75rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--am-red);
    border-radius: var(--am-radius-sm);
    background: var(--am-red);
    color: #ffffff;
    font-weight: 600;
    font-size: var(--am-text-sm);
    letter-spacing: var(--am-tracking-wide);
    white-space: normal;
}

.am-imprint-tax .btn-primary:hover,
.am-imprint-tax button[type="submit"]:hover {
    border-color: var(--am-red-dark);
    background: var(--am-red-dark);
    color: #ffffff;
}

.am-imprint-tax .btn-primary:focus-visible,
.am-imprint-tax button[type="submit"]:focus-visible {
    box-shadow: var(--am-focus-ring);
    outline: none;
}

.am-imprint-tax .btn:disabled,
.am-imprint-tax .btn.disabled,
.am-imprint-tax button[type="submit"]:disabled,
.am-imprint-tax button[aria-busy="true"],
.am-imprint-tax form[aria-busy="true"] button[type="submit"],
.am-imprint-tax form.is-sending button[type="submit"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.am-imprint-tax .row > [class*="col-"] > .btn,
.am-imprint-tax .row > [class*="col-"] > button[type="submit"] {
    width: 100%;
}

/* Status messages (flash / inline) */
.am-imprint-tax [role="status"],
.am-imprint-tax [role="alert"],
.am-imprint-tax .alert {
    margin: var(--am-space-3) 0;
    padding: var(--am-space-3) var(--am-space-4);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-left-width: 3px;
    border-radius: var(--am-radius-sm);
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
    font-size: var(--am-text-sm);
}

.am-imprint-tax [role="status"].text-danger,
.am-imprint-tax [role="alert"],
.am-imprint-tax .alert-danger,
.am-imprint-tax .alert-error,
.am-imprint-tax .is-error {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(228, 27, 24, 0.12);
    color: #fecaca !important;
}

/* ---- Maps ---- */
.am-legal-content .am-osm-map-wrap--imprint .am-osm-map {
    border-radius: var(--am-radius-md);
}

.am-legal-content .am-osm-map__attr {
    color: var(--am-gray);
}

/* ---- Light theme ---- */
[data-theme="light"] .am-legal-content .am-location-card {
    background: #ffffff;
}

[data-theme="light"] .am-legal-content .am-imprint-tax {
    background: var(--am-cream);
}

[data-theme="light"] .am-imprint-tax .form-control,
[data-theme="light"] .am-imprint-tax .form-control:focus {
    background-color: #ffffff;
}

[data-theme="light"] .am-imprint-figure > .am-imprint-zoom:not([aria-pressed="true"]) {
    background: #ffffff;
    border-color: var(--am-charcoal);
    color: var(--am-white);
}

[data-theme="light"] .am-imprint-tax [role="status"],
[data-theme="light"] .am-imprint-tax .alert {
    border-color: rgba(21, 128, 61, 0.35);
    background: #ecfdf3;
    color: #14532d;
}

[data-theme="light"] .am-imprint-tax [role="status"].text-danger,
[data-theme="light"] .am-imprint-tax [role="alert"],
[data-theme="light"] .am-imprint-tax .alert-danger,
[data-theme="light"] .am-imprint-tax .alert-error,
[data-theme="light"] .am-imprint-tax .is-error {
    border-color: rgba(155, 21, 18, 0.35);
    background: #fdecec;
    color: #7f1d1d !important;
}

/* ---- Small screens ---- */
@media (max-width: 575.98px) {
    .am-legal-content > h2 {
        margin-top: var(--am-space-10);
        padding-top: var(--am-space-6);
        font-size: var(--am-text-xl);
    }

    .am-legal-content > h2::before {
        top: calc(var(--am-space-6) + 0.12em);
    }

    .am-legal-content .am-imprint-tax {
        padding: var(--am-space-5) var(--am-space-4);
    }

    .am-imprint-figure > .am-imprint-zoom[aria-pressed="true"],
    .am-imprint-overlay__close {
        top: auto;
        right: auto;
        bottom: max(1.5rem, env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ---- Print ---- */
@media print {
    .am-imprint-zoom,
    .am-imprint-overlay {
        display: none !important;
    }

    .am-legal-content .am-location-card,
    .am-legal-content .am-imprint-tax {
        border-color: #999;
        background: #ffffff;
        box-shadow: none;
    }
}
