/* com_wohnungen frontend – uses the cygnusx design tokens (--qah-*) with system fallbacks. */

.wohnungen-offer,
.wohnungen-detail {
    /* Same content width as the template's .qah-container, so modules above and the offer align */
    inline-size: min(100% - 2 * var(--qah-gutter, 1rem), var(--qah-max, 76rem));
    margin-inline: auto;
    padding-block: clamp(1rem, 4vw, 3rem);
    padding-inline: 0;
    color: var(--qah-text, inherit);
}

.wohnungen-offer {
    padding-block-start: var(--qah-space-sm, 1rem);
}

/* Without an introduction module above, the offer opens the page and gets the full section spacing */
.container-component > main:first-child .wohnungen-offer {
    padding-block-start: clamp(2rem, 5vw, 4.5rem);
}

.wohnungen-offer :focus-visible,
.wohnungen-detail :focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }

.wohnungen-offer .visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.wohnungen-preview {
    border-inline-start: 4px solid currentColor;
    padding: 1rem;
    background: var(--qah-background, Canvas);
}

/* Notice on the floor plans (Aufteilungspläne, furniture, bathrooms not final), shown once above the house tabs */
.wohnungen-plan-note {
    max-width: 68ch;
    margin: 0 auto 2rem;
    padding: .9rem 1.1rem;
    border-inline-start: 3px solid var(--qah-green, currentColor);
    background: var(--qah-surface, Canvas);
    font-size: .9375rem;
    line-height: 1.6;
}

/* House tabs: links that sit on a common baseline, the current house opens towards the content */
.wohnungen-houses {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-block: 0 2rem;
    border-block-end: 1px solid currentColor;
}

.wohnungen-offer .wohnungen-houses a {
    margin-block-end: -1px;
    padding: .9rem clamp(1rem, 3vw, 1.75rem);
    border: 1px solid transparent;
    color: inherit;
    font-size: .9rem;
    letter-spacing: .08em;
    text-decoration: none;
    text-transform: uppercase;
}

.wohnungen-houses a:hover { border-color: color-mix(in srgb, currentColor 30%, transparent); border-block-end-color: transparent; }

.wohnungen-houses a[aria-current] {
    border-color: currentColor;
    border-block-end-color: var(--qah-background, Canvas);
    background: var(--qah-background, Canvas);
    font-weight: 600;
}

/* Project overview with house hotspots */
.wohnungen-overview { margin: 0 0 2rem; }
.wohnungen-overview polygon { fill: transparent; stroke: transparent; transition: fill .2s; }
.wohnungen-overview a:is(:hover, :focus) polygon { fill: color-mix(in srgb, var(--qah-green, LinkText) 25%, transparent); stroke: var(--qah-green, LinkText); stroke-width: 2px; }
.wohnungen-overview a.is-current polygon { fill: color-mix(in srgb, var(--qah-green, LinkText) 45%, transparent); stroke: var(--qah-text, CanvasText); stroke-width: 2px; }

/* House panel */
.wohnungen-offer-panel { transition: opacity .2s; }
.wohnungen-offer-panel.is-loading { opacity: .4; }
.wohnungen-house__title { margin-block: 0 1rem; font-size: 1.5rem; text-align: center; }
.wohnungen-house__title small { display: block; font-size: .9rem; font-weight: 400; }
.wohnungen-house__title:focus { outline: none; }

/* Floor plans and floor tabs */
.wohnungen-floorplans { margin-block-end: 2.5rem; }
.wohnungen-floor-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-block-end: 1rem; }
.wohnungen-floor-tabs[hidden] { display: none; }

.wohnungen-floor-tabs button {
    min-block-size: 2.75rem;
    padding: .5rem 1rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.wohnungen-floor-tabs [aria-selected="true"] { background: var(--qah-green, Highlight); border-color: var(--qah-green, Highlight); color: var(--qah-surface, HighlightText); }

.wohnungen-floorplan { margin-block-end: 1rem; padding: clamp(.75rem, 2vw, 1.5rem); border: 1px solid color-mix(in srgb, currentColor 15%, transparent); background: #fff; }
.wohnungen-plan { margin: 0; }
.wohnungen-plan figcaption { margin-block-end: .5rem; font-size: .9rem; }
/* In the offer, house title and floor tabs already name the plan; the caption stays for screen readers
   and becomes visible again when plans are stacked without JavaScript. */
.wohnungen-offer .wohnungen-plan figcaption { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wohnungen-offer .wohnungen-floorplans:has(> .wohnungen-floor-tabs[hidden]) .wohnungen-plan figcaption { position: static; inline-size: auto; block-size: auto; overflow: visible; clip-path: none; white-space: normal; }
.wohnungen-plan img,
.wohnungen-overview img { display: block; inline-size: 100%; block-size: auto; }
/* Plans are limited in height so the unit table below stays close; the width follows the image ratio. */
.wohnungen-plan-stage {
    position: relative;
    inline-size: min(100%, calc(var(--plan-max-height, clamp(18rem, 58vh, 36rem)) * (var(--plan-ratio, 4 / 3))));
    margin-inline: auto;
}
.wohnungen-plan-stage > svg { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
.wohnungen-plan polygon { fill: color-mix(in srgb, var(--qah-green, LinkText) 25%, transparent); stroke: var(--qah-green, LinkText); stroke-width: 2px; }
.wohnungen-plan a:is(:hover, :focus) polygon,
.wohnungen-plan a.is-highlighted polygon { fill: color-mix(in srgb, var(--qah-green, LinkText) 55%, transparent); stroke: var(--qah-text, CanvasText); stroke-width: 4px; }

/* Maisonettes: hatch over the hotspot, a marker naming the other level, stair symbol in tabs and tables */
.wohnungen-stair { display: inline-block; inline-size: 1em; block-size: 1em; vertical-align: -.125em; }
.wohnungen-plan pattern rect { fill: var(--qah-green, LinkText); opacity: .55; }
/* Higher specificity than the hover rule, so the hatch never gets a (non-scaled, plan-wide) stroke */
.wohnungen-plan .wohnungen-plan-stage polygon.wohnungen-plan__hatch { stroke: none; pointer-events: none; }
.wohnungen-plan__marker {
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1em;
    padding: .3em .6em;
    border: 1px solid var(--qah-green, LinkText);
    border-radius: .4em;
    background: var(--qah-surface, #fff);
    color: var(--qah-text, CanvasText);
    font-size: clamp(.62rem, 1.4vw, .8rem);
    line-height: 1.15;
    white-space: nowrap;
    text-decoration: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgb(0 0 0 / .15);
}
.wohnungen-plan__marker > span:first-child { display: inline-flex; align-items: center; gap: .3em; font-weight: 600; }
a.wohnungen-plan__marker:is(:hover, :focus-visible),
.wohnungen-plan__marker.is-highlighted { background: var(--qah-green, Highlight); color: var(--qah-surface, HighlightText); }
.wohnungen-floor-tabs .wohnungen-stair { margin-inline-start: .35em; }
.wohnungen-badge {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    margin-inline-start: .4em;
    padding: .1em .5em;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .75rem;
    white-space: nowrap;
}

/* Unit table */
.wohnungen-table { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wohnungen-table th,
.wohnungen-table td { padding: .75rem 1rem; text-align: start; vertical-align: middle; }
.wohnungen-table thead th { font-weight: 600; white-space: nowrap; }
.wohnungen-table tbody tr { border-block-end: 1px solid currentColor; }
.wohnungen-table tbody th { font-weight: 400; }
.wohnungen-table tbody th a { color: inherit; font-weight: 600; }
.wohnungen-table tbody tr.is-highlighted { background: color-mix(in srgb, var(--qah-green, Highlight) 12%, transparent); }
.wohnungen-table tbody tr.is-verkauft { background: color-mix(in srgb, currentColor 12%, transparent); }
.wohnungen-table__action { text-align: end; }

.wohnungen-status::before {
    content: "";
    display: inline-block;
    inline-size: .6em;
    block-size: .6em;
    margin-inline-end: .5em;
    border-radius: 50%;
    background: currentColor;
    opacity: .35;
}

.wohnungen-status--verfuegbar::before { background: var(--qah-green, green); opacity: 1; }
.wohnungen-status--reserviert::before { background: #c48621; opacity: 1; }
.wohnungen-status--verkauft::before { background: currentColor; opacity: .8; }

.wohnungen-button {
    display: inline-flex;
    align-items: center;
    min-block-size: 2.75rem;
    padding: .5rem 1rem;
    background: var(--qah-green, ButtonText);
    color: var(--qah-surface, ButtonFace);
    text-decoration: none;
    white-space: nowrap;
}

/* Two classes outrank the template's a:hover link colour, which would otherwise match the background */
.wohnungen-button:is(:hover, :focus-visible) { background: var(--qah-text, ButtonText); color: var(--qah-surface, ButtonFace); }
.wohnungen-button--small { min-block-size: 2.25rem; padding: .3rem .75rem; }

/* Detail page: facts beside a large plan (exposé pages 6-8); on small screens facts first, then the plan. */
.wohnungen-detail { padding-block-start: clamp(1.5rem, 4vw, 3rem); }
.wohnungen-detail .visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wohnungen-detail__back { margin-block: 0 var(--qah-space-md, 2rem); font-size: .9rem; }
.wohnungen-detail__back a { color: inherit; text-underline-offset: .2em; }
.wohnungen-detail__layout { display: grid; gap: var(--qah-space-lg, 2.5rem); align-items: start; }
.wohnungen-detail__eyebrow { margin: 0 0 .5rem; color: var(--qah-text-muted, inherit); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.wohnungen-detail__title { margin: 0; font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.1; }
.wohnungen-detail__tags { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .9rem 0 0; }
.wohnungen-detail__tags .wohnungen-badge { margin: 0; }

.wohnungen-facts { margin: var(--qah-space-md, 2rem) 0 0; border-block-start: 1px solid var(--qah-line, currentColor); }
.wohnungen-facts > div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .8rem; border-block-end: 1px solid var(--qah-line, currentColor); }
.wohnungen-facts dt { color: var(--qah-text-muted, inherit); }
.wohnungen-facts dd { margin: 0; font-weight: 500; text-align: end; font-variant-numeric: tabular-nums; }
.wohnungen-detail__note { margin: .8rem 0 0; color: var(--qah-text-muted, inherit); font-size: .9rem; }
.wohnungen-detail__text { margin: var(--qah-space-sm, 1.25rem) 0 0; max-inline-size: var(--qah-measure, 38rem); }

/* Olive info box as in the exposé's unit type pages */
.wohnungen-detail__features { margin-block-start: var(--qah-space-md, 2rem); padding: var(--qah-space-sm, 1.25rem) clamp(1.25rem, 3vw, 1.75rem); background: var(--qah-green, #555e4f); color: var(--qah-on-green, #fff); }
.wohnungen-detail__features h2 { margin: 0 0 .6rem; color: inherit; font-size: 1.35rem; }
.wohnungen-detail__features ul { margin: 0; padding: 0; list-style: none; }
.wohnungen-detail__features li { padding-block: .3rem; border-block-end: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.wohnungen-detail__features li:last-child { border-block-end: 0; }

.wohnungen-detail__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-block-start: var(--qah-space-md, 2rem); }
.wohnungen-detail__actions:empty { display: none; }
.wohnungen-button--outline { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.wohnungen-button--outline:is(:hover, :focus-visible) { background: var(--qah-text, ButtonText); color: var(--qah-surface, ButtonFace); }
.wohnungen-detail__contact { margin: var(--qah-space-sm, 1.25rem) 0 0; font-size: .95rem; line-height: 1.7; }
.wohnungen-detail__contact a { color: inherit; }

.wohnungen-detail__plans .wohnungen-floorplans { margin: 0; }
.wohnungen-detail__plans .wohnungen-floorplan { margin: 0; }
.wohnungen-detail__plans .wohnungen-floor-tabs small { display: block; font-size: .75em; opacity: .8; }
.wohnungen-detail__plans .wohnungen-floor-tabs button { line-height: 1.2; }
.wohnungen-detail .wohnungen-plan-stage { --plan-max-height: clamp(20rem, 72vh, 46rem); }
/* With tabs the caption only serves screen readers; without JavaScript the stacked plans keep it visible. */
.wohnungen-detail .wohnungen-plan figcaption { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wohnungen-detail .wohnungen-floorplans:has(> .wohnungen-floor-tabs[hidden]) .wohnungen-plan figcaption,
.wohnungen-detail .wohnungen-floorplans:not(:has(> .wohnungen-floor-tabs)) .wohnungen-plan figcaption { position: static; inline-size: auto; block-size: auto; overflow: visible; clip-path: none; white-space: normal; }
.wohnungen-detail .wohnungen-floorplan + .wohnungen-floorplan { margin-block-start: 1rem; }
/* Own unit: strong outline, rest of the plan dimmed */
.wohnungen-detail .wohnungen-plan polygon { fill: transparent; stroke: var(--qah-green, LinkText); stroke-width: 3px; }
.wohnungen-plan__dim { fill: var(--qah-surface-strong, #fff); opacity: .62; pointer-events: none; }
.wohnungen-detail__noplan { padding: var(--qah-space-md, 2rem); border: 1px solid var(--qah-line, currentColor); }

.wohnungen-detail__gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; margin-block-start: var(--qah-space-lg, 2.5rem); }
.wohnungen-detail__gallery figure { margin: 0; }
.wohnungen-detail__gallery img { display: block; inline-size: 100%; block-size: auto; }
.wohnungen-detail__gallery figcaption { margin-block-start: .4rem; font-size: .85rem; }
.wohnungen-detail__inquiry { margin-block-start: var(--qah-space-xl, 4rem); }

@media (min-width: 62rem) {
    .wohnungen-detail__layout { grid-template-columns: minmax(0, 1.75fr) minmax(19rem, 1fr); }
    .wohnungen-detail__plans { grid-column: 1; grid-row: 1; }
    .wohnungen-detail__facts { grid-column: 2; grid-row: 1; position: sticky; top: var(--qah-space-md, 2rem); }
    .wohnungen-detail__plans .wohnungen-floor-tabs { justify-content: flex-start; }
}

/* Inquiry form */
/* Fields, legends, consent and submit come from the template's contact form styles (.qah-interest, .qah-form). */
.wohnungen-detail__inquiry .qah-interest__grid { inline-size: min(100%, 54rem); margin-inline: auto; }
/* Heading size as on the contact page, where the form heading sits below the page H1 */
.wohnungen-detail__inquiry .qah-interest__intro .qah-heading { font-size: clamp(1.625rem, 1.4rem + .9vw, 2.25rem); }
.wohnungen-detail__inquiry { scroll-margin-top: var(--qah-space-sm, 1.25rem); }
.wohnungen-inquiry__privacy .form-check-label { font-size: .9375rem; }
.wohnungen-trap { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }

/* Small screens: each table row becomes a compact card */
@media (max-width: 48rem) {
    .wohnungen-table thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
    .wohnungen-table,
    .wohnungen-table tbody { display: block; }

    .wohnungen-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .35rem 1rem;
        padding-block: 1rem;
        padding-inline: .5rem;
    }

    .wohnungen-table tbody :is(th, td) { display: block; min-inline-size: 0; padding: 0; overflow-wrap: anywhere; }
    .wohnungen-table tbody :is(th, td)[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; opacity: .75; }
    .wohnungen-table tbody th { grid-row: 1; grid-column: 1; font-size: 1.2rem; }
    .wohnungen-table tbody td:first-child { grid-row: 1; grid-column: 2; }
    .wohnungen-table__action { grid-column: 1 / -1; text-align: start; }
    .wohnungen-houses { flex-wrap: nowrap; }
    .wohnungen-offer .wohnungen-houses a { flex: 1 1 0; min-inline-size: 0; padding-inline: .25rem; text-align: center; letter-spacing: .04em; }
}

@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .wohnungen-table tbody tr { animation: wohnungen-enter linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
        @keyframes wohnungen-enter { from { opacity: .6; transform: translateY(8px); } to { opacity: 1; transform: none; } }
    }
}

@media print {
    .wohnungen-houses,
    .wohnungen-floor-tabs,
        .wohnungen-inquiry { display: none; }
    .wohnungen-floorplan[hidden] { display: block; }
    .wohnungen-table tbody tr { animation: none; }
}
