/* ──────────────────────────────────────────────────────────────────────────
   Hochzeits-Fotoupload · Katha & Bennet
   Gestaltung analog https://hochzeit.matschullat.de/ (Creme, Salbei, Gold)
   ────────────────────────────────────────────────────────────────────────── */

@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-var.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-italic-latin-var.woff2') format('woff2');
}
@font-face {
    font-family: 'Jost';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('../fonts/jost-latin-var.woff2') format('woff2');
}

:root {
    --cream: #faf6f0;
    --warm-white: #fffdf9;
    --sage: #8a9e8c;
    --sage-light: #b8c9ba;
    --sage-dark: #5c7260;
    --gold: #c9a96e;
    --gold-light: #e8d5b0;
    --brown: #6b4f3a;
    --text: #2e2a26;
    --text-light: #7a7068;
    --border: rgba(138, 158, 140, 0.25);

    /* Ergänzungen mit geprüftem Kontrast (WCAG AA):
       --text-light auf --warm-white 4,7:1; auf --cream nur 4,5:1 → für kleine Hinweise auf Creme --text-muted (5,2:1) */
    --text-muted: #6f665e;
    --error: #9a5148;
    --error-bg: #f7ece9;
    --success: #4f6b53;
    --line: rgba(138, 158, 140, 0.45);

    --serif: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
    --sans: 'Jost', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    --radius: 2px;
    --gutter: 20px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-family: var(--sans);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
p, h1, h2, h3, figure, ul { margin: 0; }
[hidden] { display: none !important; }

a { color: var(--sage-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brown); }

:focus-visible { outline: 2px solid var(--sage-dark); outline-offset: 3px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -60px;
    background: var(--sage-dark); color: var(--cream);
    padding: 10px 16px; z-index: 10; border-radius: var(--radius);
    font-size: 14px; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--cream); }

/* ── Icons (lokale SVGs als Maske, Farbe über currentColor) ── */
.icon {
    display: inline-block;
    width: 1em; height: 1em;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
    flex: none;
}
.icon-camera { --icon: url('../icons/camera.svg'); }
.icon-upload { --icon: url('../icons/upload.svg'); }
.icon-remove { --icon: url('../icons/remove.svg'); }
.icon-check { --icon: url('../icons/check.svg'); }
.icon-warning { --icon: url('../icons/warning.svg'); }

/* ── Seite ── */
.page {
    width: 100%;
    max-width: calc(1100px + 2 * 32px);
    margin: 0 auto;
    padding: 56px 32px 40px;
}

.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.brand {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 32px;
    line-height: 1.1;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.01em;
}
.brand:hover { color: var(--sage-dark); }

.header-meta {
    display: flex;
    align-items: baseline;
    gap: 28px;
}

.brand, .header-date { white-space: nowrap; }
.date-short { display: none; }

.header-date {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.header-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.header-link:hover { color: var(--sage-dark); border-bottom-color: var(--sage-light); }

/* ── Zweispaltiges Hauptlayout (Desktop ≥ 960 px) ── */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 43fr) minmax(0, 57fr);
    gap: 44px;
    align-items: start;
    margin-top: 40px;
}

.hero { position: relative; }
.hero picture, .hero img { display: block; width: 100%; }
.hero img {
    height: 500px;
    object-fit: cover;
    object-position: 60% 50%;
    background: #c8d5c9;
    border-radius: var(--radius);
    transition: height 0.35s ease;
}
.hero::before {
    /* feine goldene Linie, versetzt wie auf der Hochzeitswebsite */
    content: '';
    position: absolute;
    top: -14px; left: -14px;
    width: 64%; height: 56%;
    border: 1px solid var(--gold-light);
    pointer-events: none;
    z-index: -1;
}
.hero figcaption {
    margin-top: 14px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 19px;
    line-height: 1.3;
    color: var(--text-muted);
}

/* ── Bedienfläche ── */
.panel {
    position: relative;
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 48px 40px;
    min-width: 0;
}
.panel:focus { outline: none; }
.panel::after {
    content: '';
    position: absolute;
    left: 48px; right: 48px; bottom: -1px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    opacity: 0.7;
}

.eyebrow {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sage-dark);
}

.title {
    margin-top: 18px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(52px, 5.4vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.005em;
    color: var(--text);
}
.title span, .title em { display: block; }
.title em { font-style: italic; color: var(--sage-dark); }
.title-small { font-size: clamp(38px, 4.5vw, 52px); }

.intro {
    margin-top: 20px;
    max-width: 40ch;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
}

/* ── Auswahlfläche ── */
.upload-form { margin-top: 32px; }

.dropzone {
    min-height: 150px;
    padding: 24px;
    background: var(--cream);
    border: 1px solid var(--sage-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s;
}
.dropzone.is-dragover {
    border-color: var(--sage-dark);
    background: #f3f0e7;
}
.dropzone-icon { color: var(--sage); font-size: 30px; line-height: 0; }
.dropzone-alt { font-size: 14px; color: var(--text-muted); }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
    .hint-drag { display: none; }
    .hint-touch { display: inline; }
}

.format-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 28px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--sage-dark); color: var(--cream); }
.btn-primary:hover { background: var(--brown); }
.btn-primary:disabled { background: #a9b5aa; color: var(--warm-white); cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--sage-dark); border-color: var(--sage-dark); }
.btn-secondary:hover { background: var(--sage-dark); color: var(--cream); }
.btn-block { width: 100%; min-height: 52px; margin-top: 20px; }
.btn-pick .icon { font-size: 18px; }

.link-button {
    background: none;
    border: 0;
    padding: 10px 0;
    min-height: 44px;
    font: 500 14px var(--sans);
    letter-spacing: 0.02em;
    color: var(--sage-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    cursor: pointer;
}
.link-button:hover { color: var(--brown); }

/* ── Felder ── */
.field { margin-top: 24px; }
.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text);
}
.label-optional { font-weight: 400; color: var(--text-light); }
.field input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font: 400 16px var(--sans);
    color: var(--text);
    background: var(--warm-white);
    border: 1px solid var(--sage-light);
    border-radius: var(--radius);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.field input:focus { border-color: var(--sage-dark); outline: 2px solid rgba(92, 114, 96, 0.25); outline-offset: 0; }
.field input:disabled { background: var(--cream); color: var(--text-light); }
.field-code { margin-top: 0; margin-bottom: 24px; }
.field-hint { margin-top: 6px; font-size: 13px; color: var(--text-light); }
.field-error, .form-error {
    margin-top: 8px;
    font-size: 14px;
    color: var(--error);
}
.form-error {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--error-bg);
    border-left: 2px solid var(--error);
}

.privacy-note {
    margin-top: 18px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-light);
}

/* ── Auswahl: Zusammenfassung, Kacheln, Liste ── */
.selection { margin-top: 22px; }
.selection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.selection-summary { font-size: 15px; font-weight: 500; }

.selection-errors {
    margin-top: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--error);
    background: var(--error-bg);
    border-left: 2px solid var(--error);
}
.selection-errors p + p { margin-top: 4px; }
.selection-errors .with-icon { display: flex; gap: 8px; align-items: flex-start; }
.selection-errors .icon { margin-top: 0.25em; }

.tiles {
    list-style: none;
    padding: 0;
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 12px 10px;
}

.tile { position: relative; min-width: 0; }
.tile-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.tile-media img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.tile-placeholder {
    position: absolute; inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    text-align: center;
    background: linear-gradient(160deg, #eef2ec 0%, #e3eae2 100%);
    color: var(--sage-dark);
}
.tile-format {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0.04em;
}
.tile-placeholder-text { font-size: 11px; line-height: 1.3; color: var(--text-muted); }

.tile-name {
    margin-top: 6px;
    display: flex;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--text);
}
.name-start { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.name-end { white-space: nowrap; flex: none; }
.tile-meta { font-size: 12px; line-height: 1.35; color: var(--text-light); }
.tile[data-status="invalid"] .tile-meta,
.tile[data-status="failed"] .tile-meta { color: var(--error); }
.tile[data-status="done"] .tile-meta { color: var(--success); }

.tile-remove {
    position: absolute;
    top: -6px; right: -6px;
    width: 44px; height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
.tile-remove::before {
    content: '';
    position: absolute;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255, 253, 249, 0.92);
    border: 1px solid var(--border);
}
.tile-remove .icon { position: relative; font-size: 14px; }
.tile-remove:hover::before { background: var(--warm-white); border-color: var(--sage); }

.tile-badge {
    position: absolute;
    left: 6px; bottom: 6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--warm-white);
}
.tile[data-status="done"] .tile-badge { display: flex; background: var(--success); }
.tile[data-status="failed"] .tile-badge,
.tile[data-status="invalid"] .tile-badge { display: flex; background: var(--error); }
.tile[data-status="invalid"] .tile-media img { opacity: 0.45; filter: grayscale(0.6); }

.tile-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(255, 253, 249, 0.7);
    display: none;
}
.tile-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--sage-dark);
    transition: width 0.3s ease;
}
.tile[data-status="uploading"] .tile-progress,
.tile[data-status="processing"] .tile-progress { display: block; }
.tile[data-status="processing"] .tile-progress span { width: 100%; background: var(--sage); }

.tile-more .tile-media {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
}
.tile-more button {
    position: absolute; inset: 0;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: var(--serif);
    font-size: 26px;
    color: var(--sage-dark);
}
.tile-more .tile-name { white-space: normal; }

.file-list { margin-top: 16px; border-top: 1px solid var(--border); }
.file-list summary {
    cursor: pointer;
    padding: 12px 0;
    min-height: 44px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sage-dark);
}
.file-rows { list-style: none; padding: 0; }
.file-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 44px;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.file-row .tile-name { margin: 0; }
.file-row-status { color: var(--text-light); white-space: nowrap; font-size: 12px; }
.file-row[data-status="invalid"] .file-row-status,
.file-row[data-status="failed"] .file-row-status { color: var(--error); }
.file-row[data-status="done"] .file-row-status { color: var(--success); }
.file-row .tile-remove { position: static; }

/* ── Fortschritt ── */
.status-panel {
    margin-top: 28px;
    padding: 20px 22px;
    background: var(--cream);
    border: 1px solid var(--sage-light);
    border-radius: var(--radius);
}
.status-title {
    font-family: var(--serif);
    font-size: 26px;
    line-height: 1.2;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.progress-track {
    margin-top: 12px;
    height: 4px;
    background: rgba(138, 158, 140, 0.22);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 0;
    background: var(--sage-dark);
    transition: width 0.4s ease;
}
.status-detail {
    margin-top: 10px;
    font-size: 15px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.status-hint { margin-top: 4px; font-size: 14px; color: var(--text-muted); }

/* ── Ergebnis ── */
.result {
    margin-top: 28px;
    padding: 28px 24px;
    text-align: center;
    background: var(--cream);
    border: 1px solid var(--sage-light);
    border-radius: var(--radius);
}
.result:focus { outline: none; }
.result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1px solid var(--sage);
    color: var(--sage-dark);
    font-size: 26px;
}
.result[data-kind="partial"] .result-icon { border-color: var(--gold); color: var(--brown); }
.result-title {
    margin-top: 14px;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 44px;
    line-height: 1.05;
    color: var(--sage-dark);
}
.result-text { margin: 12px auto 0; max-width: 36ch; font-size: 17px; }
.result-note { margin: 8px auto 0; max-width: 40ch; font-size: 14px; color: var(--text-muted); }
.result-actions {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.notice {
    margin-top: 28px;
    padding: 18px 20px;
    background: var(--cream);
    border: 1px solid var(--sage-light);
    border-radius: var(--radius);
}
.notice-title { font-family: var(--serif); font-size: 24px; line-height: 1.2; color: var(--sage-dark); }

/* ── Zustände ── */
body[data-state="uploading"] .dropzone,
body[data-state="uploading"] .format-hint,
body[data-state="processing"] .dropzone,
body[data-state="processing"] .format-hint,
body[data-state="result"] .dropzone,
body[data-state="result"] .format-hint { display: none; }

/* ── Footer ── */
.site-footer {
    margin-top: 64px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.footer-photo img {
    width: 112px; height: 112px;
    object-fit: cover;
    object-position: 49% 62%;
    border-radius: 50%;
    border: 1px solid var(--gold-light);
    padding: 3px;
    background: var(--warm-white);
}
.footer-names {
    font-family: var(--serif);
    font-style: italic;
    font-size: 22px;
    color: var(--sage-dark);
}
.footer-links { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-muted); }
.footer-links a { color: var(--text-muted); padding: 10px 2px; }
.footer-links a:hover { color: var(--sage-dark); }

/* ── Textseiten ── */
.text-page {
    max-width: 680px;
    margin: 48px auto 0;
    background: var(--warm-white);
    border: 1px solid var(--border);
    padding: 44px 48px;
}
.text-page h2 {
    margin-top: 32px;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.25;
    color: var(--text);
}
.text-page p, .text-page ul { margin-top: 12px; }
.text-page ul { padding-left: 1.2em; }
.text-page li + li { margin-top: 6px; }
.back-link { margin-top: 32px !important; font-size: 15px; }

/* ── Mobil (< 960 px): einspaltig ── */
@media (max-width: 959.98px) {
    body { font-size: 16px; }
    .page { padding: 24px var(--gutter) 32px; }
    .brand { font-size: 30px; }
    .header-date { font-size: 11px; }
    .header-link { display: none; }

    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        margin-top: 16px;
    }
    .hero::before { display: none; }
    .hero img {
        height: 150px;
        object-position: 60% 30%;
    }
    .hero figcaption { display: none; }
    body[data-state="uploading"] .hero img,
    body[data-state="processing"] .hero img { height: 96px; }

    .panel {
        margin: 20px calc(-1 * var(--gutter)) 0;
        border-left: 0; border-right: 0;
        border-radius: 0;
        padding: 26px var(--gutter) 28px;
    }
    .panel::after { left: var(--gutter); right: var(--gutter); }
    .eyebrow { font-size: 11px; }
    .title { margin-top: 12px; font-size: clamp(36px, 10.6vw, 46px); }
    .intro { margin-top: 14px; font-size: 16px; }
    .upload-form { margin-top: 22px; }
    .dropzone { padding: 22px 16px; gap: 10px; }
    .btn-pick { width: 100%; max-width: 320px; }

    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
    .status-panel, .result { margin-top: 22px; }
    .result-title { font-size: 40px; }
    .result-actions .btn { width: 100%; }

    .site-footer { margin-top: 44px; }
    .text-page { margin: 24px calc(-1 * var(--gutter)) 0; padding: 28px var(--gutter); border-left: 0; border-right: 0; }
}

@media (min-width: 600px) and (max-width: 959.98px) {
    .hero img { height: 220px; object-position: 60% 24%; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
    .result-actions .btn { width: auto; }
}

@media (max-width: 359.98px) {
    :root { --gutter: 16px; }
    .brand { font-size: 28px; }
    .header-date { letter-spacing: 0.1em; }
    .date-long { display: none; }
    .date-short { display: inline; }
    .hero img { height: 130px; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
