/* ---------------------------------------------------------------------------
   Kondolenzbuch — Gestaltung
   Typografie, Weißraum, Haarlinien. Keine Karten, keine Schatten,
   keine Animationen. Größen in rem, damit Browser-Schriftvergrößerung wirkt.
--------------------------------------------------------------------------- */

:root {
    --paper:     #FBFAF8;
    --ink:       #23262B;
    --ink-muted: #5C6066;   /* bewusst dunkler als AA-Minimum, Reserve für 14-px-Text */
    --rule:      #E4E1DC;
    --accent:    #4C5A67;
    --error:     #7D3B35;

    --serif: "Source Serif 4", "Charter", "Iowan Old Style", "Times New Roman", Georgia, serif;
    --sans: "Source Sans 3", "Public Sans", -apple-system, BlinkMacSystemFont,
            "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* Selbst gehostete Variable Fonts (SIL OFL, siehe THIRD-PARTY.md).
   Die Systemschrift-Stapel bleiben als Fallback bis zum Laden aktiv. */
@font-face {
    font-family: "Source Serif 4";
    src: url("/assets/fonts/SourceSerif4Variable-Roman.ttf.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Source Sans 3";
    src: url("/assets/fonts/SourceSans3VF-Upright.ttf.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--paper);
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    font-optical-sizing: auto;
}

::selection {
    background: #DFE3E7;
}

.page,
.footer {
    max-width: 41.25rem;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.page {
    padding-top: clamp(2.75rem, 8vw, 4.5rem);
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--ink);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

hr.rule {
    border: 0;
    border-top: 1px solid var(--rule);
}

/* --- Kopf der Gedenkseite -------------------------------------------------- */

.book-label {
    font-family: var(--sans);
    font-size: 0.8125rem;
    font-weight: 450;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 2rem;
}

.memorial {
    margin-bottom: 4.5rem;
}

.memorial-name,
.page-head h1 {
    font-family: var(--serif);
    font-size: clamp(2rem, 6.5vw, 2.5rem);
    font-weight: 400;
    line-height: 1.18;
    text-wrap: balance;
    margin-bottom: 0.875rem;
}

.life-dates {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.4;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 1rem;
}

.portrait {
    display: block;
    max-width: min(20rem, 100%);
    height: auto;
    margin-top: 2.5rem;
    filter: grayscale(0.85);
}

/* --- Nachruf und Hinweise -------------------------------------------------- */

.obituary {
    margin-bottom: 4.5rem;
}

.obituary p {
    font-size: 1.3125rem;
    line-height: 1.75;
    text-wrap: pretty;
    margin-bottom: 1.5rem;
}

.obituary p:last-child {
    margin-bottom: 0;
}

.notice {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink-muted);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 1rem 0;
    margin-bottom: 2.5rem;
}

.intro {
    font-size: 1.125rem;
    margin-bottom: 2.5rem;
    max-width: 38rem;
}

/* Zurück-Links: oben wie unten identisch gesetzt, nur der Abstand variiert. */
.back-top,
.back-wrap {
    font-family: var(--sans);
    font-size: 0.9375rem;
}

.back-top {
    margin-bottom: 2rem;
}

.back-top a,
.back-wrap a {
    color: var(--ink-muted);
    text-decoration: none;
}

.back-top a:hover,
.back-wrap a:hover {
    color: var(--ink);
    text-decoration: underline;
}

.page-head {
    margin-bottom: 2.5rem;
}

.page-head .intro {
    margin-bottom: 0;
    margin-top: 1rem;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink-muted);
}

/* --- Handlungsaufruf ------------------------------------------------------- */

.cta-block {
    margin-bottom: 5rem;
}

.button {
    display: inline-block;
    font-family: var(--sans);
    font-size: 1.0625rem;
    font-weight: 450;
    line-height: 1.5;
    letter-spacing: 0.01em;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    padding: 0.8rem 2rem;
    min-height: 2.75rem;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    color: var(--paper);
    background: var(--accent);
}

.button-danger {
    color: var(--error);
    border-color: var(--error);
}

.button-danger:hover {
    background: var(--error);
    color: var(--paper);
}

.hint {
    font-family: var(--sans);
    font-size: 0.9375rem;
    color: var(--ink-muted);
    margin-top: 1rem;
}

/* --- Einträge -------------------------------------------------------------- */

.entries h2 {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 2.5rem;
}

.entry {
    margin-bottom: 3rem;
}

.entry .rule {
    margin-bottom: 1.5rem;
}

.entry-name {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
}

.entry-meta {
    font-family: var(--sans);
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--ink-muted);
    margin-bottom: 1rem;
}

.entry-message {
    font-size: 1.125rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    text-wrap: pretty;
}

@media (max-width: 30rem) {
    .entry-message,
    .obituary p {
        hyphens: auto;
        hyphenate-limit-chars: 8 4 4;
    }
}

.icon {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.15em;
}

.button .icon {
    margin-right: 0.4rem;
    vertical-align: -0.18em;
}

.candle .icon-candle {
    color: var(--accent);
}

.empty {
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink-muted);
}

.more-wrap {
    margin-top: 1rem;
}

.more {
    font-family: var(--sans);
    font-size: 1rem;
}

/* --- Formular -------------------------------------------------------------- */

.condolence-form {
    margin-bottom: 3rem;
}

.field {
    margin-bottom: 1.75rem;
}

.field label {
    display: block;
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
    width: 100%;
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--ink);
    background: #FFFFFF;
    border: 1px solid #878C93;
    border-radius: 0;
    padding: 0.75rem;
    min-height: 2.75rem;
}

.field input:focus-visible,
.field textarea:focus-visible {
    border-color: var(--accent);
}

.field ::placeholder {
    color: #9BA0A6;
    opacity: 1;
}

.field textarea {
    resize: vertical;
}

.field input[type="file"] {
    display: block;
    width: 100%;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink);
    border: 1px solid var(--ink-muted);
    background: #FFFFFF;
    padding: 0.6rem 0.75rem;
}

.candle-text {
    font-family: var(--sans);
    font-weight: 400;
    color: var(--ink-muted);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: var(--error);
}

.field-hint {
    font-family: var(--sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink-muted);
    margin-top: 0.5rem;
}

.field-error {
    font-family: var(--sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--error);
    margin-top: 0.5rem;
}

.field-check {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.75rem;
    align-items: start;
}

.field-check input[type="checkbox"] {
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.2rem;
    accent-color: var(--accent);
}

.field-check label {
    margin-bottom: 0;
}

.field-check .field-hint,
.field-check .field-error {
    grid-column: 2;
}

.field-consent label {
    font-size: 0.9375rem;
    color: var(--ink-muted);
}

.error-summary {
    font-family: var(--sans);
    font-size: 1rem;
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem 1.25rem;
    margin-bottom: 2.5rem;
}

.error-summary ul {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

.error-summary a {
    color: var(--error);
}

/* Honeypot: für Menschen unsichtbar, aber nicht display:none,
   damit Autofill es nicht fälschlich als reguläres Feld behandelt. */
.hp-field {
    position: absolute;
    left: -624.9375rem;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --- Verwaltungsseite des Verfassers (Fotos, Selbstlöschung) --------------- */

.entry-preview {
    border-left: 2px solid var(--rule);
    padding-left: 1.25rem;
    margin-bottom: 2.5rem;
}

.manage-photos,
.manage-delete {
    border-top: 1px solid var(--rule);
    padding-top: 2rem;
    margin-bottom: 3rem;
}

.manage-photos h2,
.manage-delete h2 {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 1.5rem;
}

.photo-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.photo-item {
    max-width: 13rem;
}

.photo-item img {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    filter: grayscale(0.85);
}

.photo-item form {
    margin-top: 0.5rem;
}

.linklike-danger {
    background: none;
    border: none;
    padding: 0.25rem 0;
    font-family: var(--sans);
    font-size: 0.9375rem;
    color: var(--error);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.photo-add {
    margin-bottom: 1.5rem;
}

.photo-add label {
    display: block;
    font-family: var(--sans);
    font-size: 1.0625rem;
    margin-bottom: 0.5rem;
}

.photo-add input[type="file"] {
    display: block;
    width: 100%;
    font-family: var(--sans);
    font-size: 1rem;
    border: 1px solid #878C93;
    background: #FFFFFF;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
}

.manage-delete .intro {
    margin-bottom: 1.5rem;
}

/* --- Fußzeile -------------------------------------------------------------- */

.back-wrap {
    margin-bottom: 4rem;
}

.footer {
    padding-top: 2rem;
    padding-bottom: 3.5rem;
}

.footer .rule {
    margin-bottom: 1.75rem;
}

.footer-contact {
    font-family: var(--sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--ink-muted);
    margin-bottom: 0.75rem;
}

.footer-nav {
    font-family: var(--sans);
    font-size: 0.9375rem;
    color: var(--ink-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.footer-nav a {
    color: var(--ink-muted);
    padding: 0.25rem 0;
}

.footer-nav a:hover {
    color: var(--ink);
}

/* --- Rechtstexte ----------------------------------------------------------- */

.legal h2 {
    font-family: var(--sans);
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.legal p,
.legal li {
    font-size: 1.0625rem;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.legal ul {
    padding-left: 1.4rem;
    margin-bottom: 1rem;
}

.legal {
    margin-bottom: 3rem;
}

/* --- Hilfsklassen ---------------------------------------------------------- */

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

/* --- Druck der öffentlichen Seite ------------------------------------------ */

@media print {
    body {
        background: #FFFFFF;
        color: #000000;
        font-size: 11pt;
    }

    .cta-block,
    .footer-nav,
    .condolence-form,
    .more-wrap,
    .back-wrap {
        display: none;
    }

    .entry {
        break-inside: avoid;
    }

    a {
        color: #000000;
        text-decoration: none;
    }
}
