/**
 * Crop-Faktor-Rechner
 *
 * Identisch gepflegt in Blocksy-Child und im MVC
 * (tempteria-mvc/public/assets/css/tools/crop-factor-calculator.css).
 * Aenderungen bitte immer in beide Dateien uebertragen.
 *
 * Farbquelle: erst Blocksy-Palette, dann MVC-Brandvariablen, dann Hex-Fallback.
 */

.cfc {
    --cf-accent: var(--theme-palette-color-1, var(--brand-blue, #2872fa));
    --cf-frame: var(--brand-yellow, #ffd800);
    --cf-ink: var(--theme-headings-color, var(--ink, #1f1f1f));
    --cf-text: var(--theme-text-color, var(--muted, #5a5a5a));
    --cf-surface: var(--surface, #fff);
    --cf-surface-2: var(--surface-2, #f4f6fb);
    --cf-line: var(--border, #e5e7ea);
    --cf-radius: 16px;
    --cf-radius-sm: 10px;

    margin: 2.5rem 0;
    color: var(--cf-text);
    font-variant-numeric: tabular-nums;
    container-type: inline-size;
}

html[data-theme="dark"] .cfc {
    --cf-surface: var(--surface, #111a2e);
    --cf-surface-2: var(--surface-2, #162038);
    --cf-line: var(--border, #1e2942);
    --cf-ink: var(--ink, #e8ecf4);
    --cf-text: var(--muted, #9aa7bd);
}

.cfc *,
.cfc *::before,
.cfc *::after {
    box-sizing: border-box;
}

.cfc__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

@container (max-width: 720px) {
    .cfc__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 782px) {
        .cfc__grid {
            grid-template-columns: minmax(0, 1fr);
        }
    }
}

.cfc__panel,
.cfc__result {
    background: var(--cf-surface);
    border: 1px solid var(--cf-line);
    border-radius: var(--cf-radius);
    padding: 1.4rem;
}

.cfc__result {
    display: block;
}

.cfc__legend {
    display: block;
    margin: 0 0 0.9rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cf-accent);
}

/* ------------------------------------------------------------ Sensor-Chips */

.cfc__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.cfc__chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.2;
    color: var(--cf-ink);
    background: var(--cf-surface-2);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cfc__chip:hover {
    border-color: var(--cf-accent);
}

.cfc__chip[aria-pressed="true"] {
    background: var(--cf-accent);
    border-color: var(--cf-accent);
    color: #fff;
}

.cfc__chip-crop {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.65;
}

.cfc__chip[aria-pressed="true"] .cfc__chip-crop {
    opacity: 0.85;
}

.cfc__chip--more {
    background: transparent;
    border: 1px dashed var(--cf-line);
    color: var(--cf-text);
    font-weight: 600;
}

.cfc__chips[data-expanded="false"] .cfc__chip[data-extra="true"] {
    display: none;
}

/* ------------------------------------------------------------ Eingabefelder */

.cfc__fields {
    display: grid;
    gap: 1.1rem;
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--cf-line);
}

.cfc__pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.cfc__field > label,
.cfc__field-head label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cf-ink);
}

.cfc__field > label {
    margin-bottom: 0.35rem;
}

.cfc__field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.cfc__input,
.cfc__select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-variant-numeric: tabular-nums;
    color: var(--cf-ink);
    background: var(--cf-surface-2);
    border: 1px solid var(--cf-line);
    border-radius: var(--cf-radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cfc__input--compact {
    width: 7rem;
    padding: 0.35rem 0.55rem;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 700;
}

.cfc__input:focus-visible,
.cfc__select:focus-visible,
.cfc__chip:focus-visible,
.cfc__range:focus-visible {
    outline: 2px solid var(--cf-accent);
    outline-offset: 2px;
}

.cfc__input:focus,
.cfc__select:focus {
    border-color: var(--cf-accent);
}

.cfc__unit {
    margin-left: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cf-text);
}

.cfc__range {
    width: 100%;
    margin: 0.5rem 0 0;
    accent-color: var(--cf-accent);
    cursor: pointer;
}

.cfc__scale {
    display: flex;
    justify-content: space-between;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    opacity: 0.6;
}

.cfc__hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    opacity: 0.75;
}

.cfc__error {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    color: var(--danger, #d63637);
    background: color-mix(in srgb, var(--danger, #d63637) 8%, transparent);
    border-radius: var(--cf-radius-sm);
}

.cfc__error[hidden] {
    display: none;
}

/* ------------------------------------------------------------------ Ergebnis */

.cfc__headline {
    margin: 0 0 1.1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--cf-line);
}

.cfc__headline-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cf-text);
}

.cfc__headline-value {
    display: block;
    margin-top: 0.15rem;
    font-family: var(--font-head, inherit);
    font-size: clamp(2.4rem, 7cqi, 3.4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--cf-ink);
}

.cfc__headline-sub {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
}

.cfc__cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.cfc__card {
    padding: 0.8rem;
    background: var(--cf-surface-2);
    border-radius: var(--cf-radius-sm);
}

.cfc__card dt {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
}

.cfc__card dd {
    margin: 0.3rem 0 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cf-ink);
}

.cfc__card-note {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.7;
}

/* ------------------------------- Signature: Sensor im Kleinbild-Bildkreis */

.cfc__frame {
    margin-top: 1.3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--cf-line);
}

.cfc__frame-title {
    margin: 0 0 0.2rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cf-ink);
}

.cfc__frame-note {
    margin: 0 0 0.9rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

.cfc__frame-stage {
    display: block;
    width: 100%;
    height: auto;
    background: var(--cf-surface-2);
    border-radius: var(--cf-radius-sm);
}

.cfc__frame-ref {
    fill: none;
    stroke: currentColor;
    stroke-width: 0.4;
    stroke-dasharray: 1.6 1.2;
    opacity: 0.45;
}

.cfc__frame-sensor {
    fill: var(--cf-frame);
    fill-opacity: 0.22;
    stroke: var(--cf-frame);
    stroke-width: 0.5;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                x 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                y 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cfc__frame-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    margin: 0.7rem 0 0;
    font-size: 0.75rem;
}

.cfc__frame-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.cfc__key {
    width: 0.9rem;
    height: 0.65rem;
    border-radius: 2px;
    flex: none;
}

.cfc__key--ref {
    border: 1px dashed currentColor;
    opacity: 0.55;
}

.cfc__key--sensor {
    background: var(--cf-frame);
    opacity: 0.35;
    border: 1px solid var(--cf-frame);
}

/* ------------------------------------------------- Brennweiten-Umrechnung */

.cfc__equiv {
    margin-top: 1.3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--cf-line);
}

.cfc__equiv-title {
    margin: 0 0 0.7rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cf-ink);
}

.cfc__equiv-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin: 0;
}

@container (max-width: 420px) {
    .cfc__equiv-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cfc__equiv-item {
    padding: 0.5rem 0.6rem;
    text-align: center;
    background: var(--cf-surface-2);
    border-radius: 8px;
}

.cfc__equiv-item dt {
    font-size: 0.72rem;
    opacity: 0.7;
}

.cfc__equiv-item dd {
    margin: 0.1rem 0 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cf-ink);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
    .cfc__error {
        background: #fdeaea;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cfc *,
    .cfc *::before,
    .cfc *::after {
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================================
   Beitragsinhalt (.cf-prose)
   Gleiche Struktur wie .ec-prose beim Stromkostenrechner.
   ========================================================================= */

.cf-prose {
    --cf-accent: var(--theme-palette-color-1, var(--brand-blue, #2872fa));
    --cf-frame: var(--brand-yellow, #ffd800);
    --cf-ink: var(--theme-headings-color, var(--ink, #1f1f1f));
    --cf-text: var(--theme-text-color, var(--muted, #5a5a5a));
    --cf-surface-2: var(--surface-2, #f7f8fb);
    --cf-line: var(--border, #e5e7ea);
    --cf-soft: var(--soft-blue, #eaf1ff);

    max-width: none;
    color: var(--cf-text);
}

html[data-theme="dark"] .cf-prose {
    --cf-surface-2: var(--surface-2, #162038);
    --cf-line: var(--border, #1e2942);
    --cf-ink: var(--ink, #e8ecf4);
    --cf-text: var(--muted, #9aa7bd);
    --cf-soft: var(--soft-blue, #14213f);
}

.cf-prose p {
    margin: 0 0 16px;
    line-height: 1.72;
    color: var(--cf-text);
}

.cf-prose h3 {
    margin: 0 0 8px;
    font-size: 17px;
    color: var(--cf-ink);
}

.cf-prose b,
.cf-prose strong {
    color: var(--cf-ink);
}

.cf-prose .cf-callout {
    margin: 26px 0;
    padding: 18px 22px;
    background: var(--cf-soft);
    border-left: 4px solid var(--cf-accent);
    border-radius: 0 12px 12px 0;
}

.cf-prose .cf-table-wrap {
    overflow-x: auto;
    margin: 0 0 8px;
}

.cf-prose .cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.cf-prose .cf-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 12.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--cf-text);
    border-bottom: 1px solid var(--cf-line);
}

.cf-prose .cf-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--cf-line);
    color: var(--cf-text);
    white-space: nowrap;
}

.cf-prose .cf-table td:first-child {
    font-weight: 700;
    color: var(--cf-ink);
    white-space: normal;
}

.cf-prose .cf-table th:not(:first-child),
.cf-prose .cf-table td:not(:first-child) {
    text-align: right;
}

.cf-prose .cf-table tr:last-child td {
    border-bottom: 0;
}

/* Kleinbild ist die Bezugsgroesse — deshalb hervorgehoben. */
.cf-prose .cf-table tr.is-marked td:first-child {
    box-shadow: inset 3px 0 0 var(--cf-frame);
    padding-left: 18px;
}

.cf-prose .cf-compare {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 24px 0 8px;
}

.cf-prose .cf-compare-card {
    padding: 22px;
    background: var(--cf-surface-2);
    border: 1px solid var(--cf-line);
    border-radius: 15px;
}

.cf-prose .cf-compare-card p:last-child {
    margin: 0;
    font-size: 14.5px;
}

.cf-prose .cf-figure {
    margin-bottom: 12px !important;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--cf-accent) !important;
}

.cf-prose .cf-faq details {
    border-bottom: 1px solid var(--cf-line);
}

.cf-prose .cf-faq summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    font-weight: 700;
    color: var(--cf-ink);
    cursor: pointer;
    list-style: none;
}

.cf-prose .cf-faq summary::-webkit-details-marker {
    display: none;
}

.cf-prose .cf-faq summary::after {
    content: "+";
    flex: 0 0 auto;
    font-size: 22px;
    font-weight: 400;
    color: var(--cf-accent);
    transition: transform 0.2s;
}

.cf-prose .cf-faq details[open] summary::after {
    transform: rotate(45deg);
}

.cf-prose .cf-faq details p {
    margin: 0 0 18px;
    padding-right: 36px;
}

@media (prefers-reduced-motion: reduce) {
    .cf-prose .cf-faq summary::after {
        transition: none;
    }
}
