:root {
    color-scheme: light;
    --page: #f4f5f1;
    --surface: #fff;
    --surface-soft: #e7eee8;
    --ink: #222a24;
    --muted: #737d75;
    --line: #e6e9e4;
    --accent: #4e735d;
    --accent-soft: #dce8df;
    --shadow: 0 14px 38px rgb(34 42 36 / 6%);
}

body[data-theme="lavender"] {
    --page: #f5f3f8;
    --surface-soft: #ece6f4;
    --accent: #726092;
    --accent-soft: #e7e0f0;
}

body[data-theme="rose"] {
    --page: #f8f3f1;
    --surface-soft: #f3e5e1;
    --accent: #a86468;
    --accent-soft: #f0e0dd;
}

body[data-theme="sand"] {
    --page: #f6f3ec;
    --surface-soft: #eee8db;
    --accent: #8b704d;
    --accent-soft: #eee6d8;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.site-shell {
    width: min(100% - 48px, 1120px);
    margin: 0 auto;
}

.topbar {
    min-height: 88px;
    display: flex;
    align-items: center;
    gap: 44px;
    border-bottom: 1px solid var(--line);
}

.brand,
.main-nav,
.theme-control {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--accent);
    color: white;
    font-family: Georgia, serif;
    font-size: 22px;
    font-style: italic;
}

.main-nav {
    height: 88px;
    gap: 28px;
    flex: 1;
}

.nav-link {
    height: 100%;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.nav-link.active,
.nav-link:hover {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.theme-control {
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.theme-control select {
    padding: 9px 30px 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}

main {
    padding: 70px 0 44px;
}

.welcome {
    max-width: 720px;
    padding: 0 0 68px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 6vw, 62px);
    font-weight: 400;
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.welcome-dot {
    color: var(--accent);
}

.welcome-copy {
    max-width: 500px;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.section-heading .eyebrow {
    margin-bottom: 8px;
}

h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 27px;
    font-weight: 400;
    letter-spacing: -0.035em;
}

.section-note {
    padding-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.app-card {
    min-height: 215px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 23px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
    box-shadow: 0 18px 42px rgb(34 42 36 / 9%);
}

.app-card:focus-visible,
.memory-links a:focus-visible,
.brand:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.app-icon {
    width: 41px;
    height: 41px;
    display: grid;
    place-items: center;
    margin-bottom: 24px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 19px;
}

.app-title {
    margin: 0 0 7px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.app-description {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.app-open {
    margin-top: auto;
    padding-top: 17px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
}

.memories {
    margin-top: 70px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.memories summary {
    min-height: 88px;
    display: flex;
    align-items: center;
    gap: 15px;
    list-style: none;
    cursor: pointer;
}

.memories summary::-webkit-details-marker {
    display: none;
}

.memory-icon {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--accent);
    font-size: 20px;
}

.memories summary strong,
.memories summary small {
    display: block;
}

.memories summary strong {
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
}

.memories summary small {
    color: var(--muted);
    font-size: 12px;
}

.memory-arrow {
    margin-left: auto;
    color: var(--muted);
    transition: transform 160ms ease;
}

.memories[open] .memory-arrow {
    transform: rotate(90deg);
}

.memory-links {
    padding: 0 0 20px 54px;
}

.memory-links a {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font-size: 13px;
    text-decoration: none;
}

.memory-links a:hover {
    border-color: var(--accent);
}

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

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 25px 0 34px;
    color: var(--muted);
    font-size: 11px;
}

.footer span:last-child span {
    color: var(--accent);
}

.placeholder {
    max-width: 700px;
    margin: 30px auto 100px;
    padding: clamp(28px, 6vw, 54px);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.placeholder .app-icon {
    width: 52px;
    height: 52px;
    font-size: 23px;
}

.placeholder h1 {
    font-size: clamp(34px, 5vw, 48px);
}

.placeholder-copy {
    margin-bottom: 28px;
    color: var(--muted);
    line-height: 1.7;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .site-shell {
        width: min(100% - 36px, 540px);
    }

    .topbar {
        min-height: 72px;
        flex-wrap: wrap;
        gap: 16px;
        padding: 13px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        height: auto;
        flex: auto;
        flex-wrap: wrap;
        gap: 0 20px;
    }

    .nav-link {
        height: 35px;
    }

    .theme-control {
        margin-left: auto;
    }

    main {
        padding-top: 48px;
    }

    .welcome {
        padding-bottom: 48px;
    }

    .app-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .app-card {
        min-height: 170px;
    }

    .section-note {
        display: none;
    }

    .memories {
        margin-top: 50px;
    }

    .footer {
        flex-direction: column;
        gap: 8px;
    }
}

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

@media (max-width: 1000px) {
    .topbar {
        flex-wrap: wrap;
        gap: 4px 16px;
        padding: 13px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        height: auto;
        flex: auto;
        flex-wrap: wrap;
        gap: 0 20px;
    }

    .nav-link {
        height: 35px;
    }

    .theme-control {
        margin-left: auto;
    }
}

/* Pop-up-Fenster für Formulare und Details */
dialog.modal {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 70px rgb(20 24 21 / 28%);
    overflow: auto;
}

dialog.modal::backdrop {
    background: rgb(20 24 21 / 45%);
}

body:has(dialog.modal[open]) {
    overflow: hidden;
}

.modal-box {
    padding: 24px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-head h2 {
    font-size: 24px;
    overflow-wrap: anywhere;
}

.modal-x {
    flex: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.modal-x:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.head-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal .add-form,
.modal .add-extra {
    margin-bottom: 0;
}

@media (max-width: 700px) {
    dialog.modal {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }

    .modal-box {
        padding: 18px;
    }
}

.footer-link {
    color: inherit;
    text-decoration: none;
}

.footer-link:hover {
    color: var(--accent);
}
