:root {
    color-scheme: light;
    --color-background: #f5f4f0;
    --color-surface: #fffefa;
    --color-text: #26352e;
    --color-muted: #788078;
    --color-accent: #52705c;
    --color-accent-dark: #3e5947;
    --color-border: #e7e7df;
    --shadow-card: 0 24px 70px rgb(38 53 46 / 9%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    font-family: inherit;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background-color: var(--color-background);
    background-image:
        linear-gradient(rgb(255 255 255 / 46%), rgb(255 255 255 / 46%)),
        url("fond-accueil.png");
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

button,
input {
    font: inherit;
}

.welcome-page {
    position: relative;
    display: grid;
    min-height: 100vh;
    padding: 112px clamp(20px, 6vw, 88px) clamp(34px, 6vh, 64px);
    align-items: end;
    justify-items: start;
}

.site-header {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px clamp(20px, 5vw, 64px);
}

.site-brand {
    color: var(--color-text);
    font-family: inherit;
    font-size: 1.15rem;
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: clamp(14px, 3vw, 30px);
}

.language-picker {
    position: fixed;
    z-index: 8;
    top: 20px;
    left: clamp(20px, 5vw, 64px);
}

.language-picker select {
    min-height: 42px;
    padding: 0 34px 0 14px;
    color: var(--color-text);
    font-size: 0.9rem;
    background: rgb(255 254 250 / 88%);
    border: 1px solid rgb(38 53 46 / 18%);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgb(38 53 46 / 8%);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.language-picker select:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

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

.guest-link {
    color: var(--color-text);
    font-size: 0.9rem;
    text-decoration: none;
}

.guest-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.family-login-button,
.guest-login-button {
    min-height: 42px;
    padding: 0 17px;
    color: var(--color-text);
    font-size: 0.88rem;
    font-weight: 600;
    background: rgb(255 254 250 / 78%);
    border: 1px solid rgb(38 53 46 / 16%);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgb(38 53 46 / 8%);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 160ms ease, transform 160ms ease;
}

.family-login-button[hidden],
.guest-login-button[hidden] {
    display: none;
}

.family-login-button:hover,
.guest-login-button:hover {
    transform: translateY(-1px);
    background: var(--color-surface);
}

.site-brand:focus-visible,
.guest-link:focus-visible,
.family-login-button:focus-visible,
.guest-login-button:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 4px;
}

.family-space[hidden] {
    display: none;
}

.family-space {
    position: fixed;
    z-index: 5;
    inset: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: auto;
    color: var(--color-text);
    background: #f7f7f3;
}

.space-header {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) auto minmax(240px, 1fr);
    min-height: 82px;
    align-items: center;
    gap: 24px;
    padding: 12px clamp(20px, 5vw, 64px);
    background: rgb(255 254 250 / 94%);
    border-bottom: 1px solid var(--color-border);
}

.space-brand {
    margin: 0;
    color: var(--color-text);
    font-family: inherit;
    font-size: 1.15rem;
}

.media-tabs {
    display: flex;
    align-self: stretch;
    align-items: center;
    gap: 6px;
}

.media-tab {
    position: relative;
    min-height: 46px;
    padding: 0 15px;
    color: var(--color-muted);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease;
}

.media-tab:hover {
    color: var(--color-text);
    background: #f1f2ed;
}

.media-tab[aria-selected="true"] {
    color: var(--color-accent-dark);
    background: #edf1e9;
}

.media-tab:focus-visible,
.logout-button:focus-visible,
.media-panel:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

.space-account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.space-account .connected-email {
    max-width: 220px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.space-account .logout-button {
    min-height: 40px;
    margin: 0;
    padding: 0 13px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.space-content {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: clamp(36px, 7vh, 72px) clamp(20px, 5vw, 64px);
}

.space-intro {
    margin-bottom: 34px;
}

.space-intro h1 {
    margin-bottom: 10px;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
}

.space-intro > p:last-child {
    margin-bottom: 0;
    color: var(--color-muted);
    line-height: 1.6;
}

.media-panel {
    display: grid;
    min-height: 280px;
    padding: clamp(28px, 6vw, 56px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 22px;
    box-shadow: 0 12px 36px rgb(38 53 46 / 6%);
    align-content: start;
    gap: 20px;
}

.home-dashboard {
    display: grid;
    padding: clamp(24px, 5vw, 48px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 22px;
    box-shadow: 0 12px 36px rgb(38 53 46 / 6%);
    gap: 20px;
}

.home-dashboard[hidden],
.media-panel[hidden] {
    display: none !important;
}

.home-dashboard-heading h2 {
    margin: 0 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.home-dashboard-heading > p:last-child {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.6;
}

.home-dashboard-feedback {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.88rem;
}

.home-dashboard-feedback:empty {
    display: none;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.overview-card {
    display: grid;
    min-height: 150px;
    padding: 18px;
    color: var(--color-text);
    text-align: left;
    background: #f7f8f3;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    cursor: pointer;
    gap: 8px;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.overview-card:hover {
    transform: translateY(-2px);
    background: #f0f3eb;
    border-color: #b9c9b8;
}

.overview-card:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

.overview-card-label {
    color: var(--color-accent-dark);
    font-size: 1rem;
    font-weight: 700;
}

.overview-card-count {
    font-size: 1.35rem;
    font-weight: 700;
}

.overview-card-description {
    color: var(--color-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.media-toolbar,
.media-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.media-toolbar {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
}

.media-toolbar h2 {
    margin: 0 0 6px;
}

.media-toolbar p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.media-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.media-actions .submit-button,
.media-actions .subtle-button {
    min-height: 40px;
    margin: 0;
    padding: 0 14px;
    font-size: 0.84rem;
    white-space: nowrap;
}

.subtle-button {
    color: var(--color-accent-dark);
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 160ms ease;
}

.subtle-button:hover {
    background: #f1f2ed;
}

.media-upload-form {
    display: grid;
    max-width: 720px;
    padding: 22px;
    background: #f8f8f4;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    gap: 10px;
}

.media-upload-form[hidden] {
    display: none;
}

.media-upload-form > label:not(.guest-access-option) {
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.media-upload-form input[type="text"],
.media-upload-form input[type="file"],
.media-upload-form select {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

.guest-access-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    color: var(--color-text);
    font-size: 0.88rem;
    line-height: 1.5;
}

.guest-access-option input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin: 1px 0 0;
    accent-color: var(--color-accent);
}

.media-feedback {
    margin: 0;
    color: var(--color-accent-dark);
    font-size: 0.9rem;
    line-height: 1.5;
}

.media-feedback:empty {
    display: none;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 18px;
}

.media-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 14px;
}

.media-card > img,
.media-card > video {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #eceee8;
}

.media-card-details {
    display: grid;
    padding: 14px;
    gap: 8px;
}

.media-card-details h3 {
    margin: 0;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.media-card-details time,
.media-access-note {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.78rem;
}

.media-delete-button {
    justify-self: start;
    padding: 5px 0;
    color: #9b4138;
    font-size: 0.82rem;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.media-delete-button:hover {
    text-decoration: underline;
}

.media-document-link {
    display: grid;
    min-height: 130px;
    padding: 20px;
    color: var(--color-accent-dark);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    background: #edf1e9;
    place-items: center;
}

.media-panel .media-empty-message {
    margin: 20px 0;
    color: var(--color-muted);
    font-size: 0.9rem;
    text-align: center;
}

.media-empty-message[hidden] {
    display: none;
}

.login-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
    padding: 4px;
    background: #f1f2ed;
    border-radius: 12px;
}

.login-mode-button {
    min-height: 40px;
    color: var(--color-muted);
    font-weight: 600;
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.login-mode-button[aria-selected="true"] {
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: 0 2px 6px rgb(38 53 46 / 8%);
}

.login-mode-button:focus-visible,
.subtle-button:focus-visible,
.media-delete-button:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

.connected-status {
    margin: 16px 0 0;
    color: #9b4138;
    font-size: 0.9rem;
    line-height: 1.5;
}

.connected-status:empty {
    display: none;
}

.eyebrow {
    margin: 0 0 18px;
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

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

h1 {
    margin-bottom: 14px;
    font-family: inherit;
    font-size: clamp(2.4rem, 8vw, 3.5rem);
    font-weight: 400;
    letter-spacing: -0.045em;
    line-height: 1.08;
}

.intro,
.dialog-intro {
    color: var(--color-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.intro {
    max-width: 340px;
    margin: 0 auto 34px;
}

.choices {
    display: grid;
    gap: 12px;
}

.choice {
    display: flex;
    width: 100%;
    min-height: 76px;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    color: var(--color-text);
    text-align: left;
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.choice:hover {
    transform: translateY(-2px);
    border-color: #b7c5b8;
    box-shadow: 0 8px 20px rgb(38 53 46 / 7%);
}

.choice:focus-visible,
.dialog-close:focus-visible,
.submit-button:focus-visible,
.back-link:focus-visible,
.logout-button:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

.choice-icon {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    color: var(--color-accent);
    font-size: 1.35rem;
    background: #edf1e9;
    border-radius: 13px;
    place-items: center;
}

.choice-copy {
    display: grid;
    flex: 1;
    gap: 4px;
}

.choice-copy strong {
    font-size: 0.96rem;
    font-weight: 650;
}

.choice-copy > span {
    color: var(--color-muted);
    font-size: 0.83rem;
}

.choice-arrow {
    color: var(--color-muted);
    font-size: 1.2rem;
}

.choice-primary {
    color: #fff;
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.choice-primary:hover {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
}

.choice-primary .choice-icon {
    color: #fff;
    background: rgb(255 255 255 / 14%);
}

.choice-primary .choice-copy > span,
.choice-primary .choice-arrow {
    color: rgb(255 255 255 / 76%);
}

.footer-note {
    margin: 28px 0 0;
    color: #a0a59e;
    font-size: 0.8rem;
}

.login-dialog {
    width: min(calc(100% - 32px), 440px);
    max-width: none;
    padding: 0;
    color: var(--color-text);
    background: var(--color-surface);
    border: 0;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgb(0 0 0 / 22%);
}

.login-dialog::backdrop {
    background: rgb(25 35 29 / 48%);
    backdrop-filter: blur(4px);
}

.dialog-content {
    position: relative;
    padding: clamp(28px, 7vw, 42px);
}

.dialog-close {
    position: absolute;
    top: 16px;
    right: 18px;
    display: grid;
    width: 36px;
    height: 36px;
    color: var(--color-muted);
    font-size: 1.55rem;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    place-items: center;
}

.dialog-close:hover {
    color: var(--color-text);
    background: #f1f2ed;
}

h2 {
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.03em;
}

.dialog-intro {
    margin-bottom: 24px;
    font-size: 0.92rem;
}

.login-form {
    display: grid;
    gap: 9px;
}

.login-form[hidden] {
    display: none;
}

.login-form label {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 11px;
}

.login-form input:focus {
    border-color: var(--color-accent);
    outline: 3px solid rgb(82 112 92 / 15%);
}

.submit-button {
    min-height: 50px;
    margin-top: 15px;
    color: #fff;
    font-weight: 650;
    background: var(--color-accent);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

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

.submit-button:disabled,
.logout-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.auth-message {
    margin: 18px 0 0;
    color: var(--color-accent-dark);
    font-size: 0.9rem;
    line-height: 1.55;
}

.auth-message:empty {
    display: none;
}

.logout-button {
    min-height: 44px;
    margin-top: 20px;
    padding: 0 16px;
    color: var(--color-accent-dark);
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.logout-button:hover {
    background: #f1f2ed;
}

.invite-card {
    display: grid;
    width: min(100%, 640px);
    min-height: 350px;
    padding: 36px;
    text-align: center;
    background: var(--color-surface);
    border-radius: 28px;
    box-shadow: var(--shadow-card);
    place-content: center;
    justify-items: center;
}

.invite-page {
    display: grid;
    min-height: 100vh;
    padding: 32px 20px;
    place-items: center;
}

.invite-card h1 {
    margin-bottom: 28px;
    font-size: clamp(4rem, 14vw, 7rem);
}

.back-link {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    padding: 0 20px;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--color-accent);
    border-radius: 12px;
    transition: background 160ms ease;
}

.back-link:hover {
    background: var(--color-accent-dark);
}

@media (max-width: 420px) {
    .welcome-page {
        padding: 18px 14px;
    }

    .site-header {
        min-height: 70px;
        padding: 12px 16px;
    }

    .language-picker {
        top: 14px;
        left: 14px;
    }

    .language-picker select {
        min-height: 38px;
        padding-inline: 12px 28px;
        font-size: 0.82rem;
    }

    .site-brand {
        font-size: 1rem;
    }

    .site-nav {
        gap: 12px;
    }

    .family-login-button,
    .guest-login-button {
        min-height: 38px;
        padding: 0 13px;
    }

    .invite-page {
        padding: 18px 14px;
    }
}

@media (max-width: 900px) {
    .space-header {
        grid-template-columns: 1fr auto;
        gap: 8px 16px;
        padding-inline: 20px;
    }

    .space-brand {
        grid-column: 1;
        grid-row: 1;
    }

    .space-account {
        grid-column: 2;
        grid-row: 1;
    }

    .media-tabs {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        overflow-x: auto;
        border-top: 1px solid var(--color-border);
    }

    .media-tab {
        flex: 0 0 auto;
    }

    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .space-content {
        padding-top: 36px;
    }
}

@media (max-width: 600px) {
    .space-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 12px 14px 0;
    }

    .space-brand {
        display: none;
    }

    .space-account {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    .space-account .connected-email {
        max-width: min(52vw, 220px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .media-tabs {
        grid-column: 1;
        grid-row: 2;
        margin-inline: -14px;
        padding-inline: 8px;
    }

    .media-tab {
        padding-inline: 12px;
        font-size: 0.84rem;
    }

    .space-content {
        padding: 28px 14px;
    }

    .space-intro {
        margin-bottom: 22px;
    }

    .media-panel {
        padding: 18px 14px;
        gap: 16px;
    }

    .home-dashboard {
        padding: 20px 14px;
        gap: 16px;
    }

    .overview-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    .overview-card {
        min-height: 0;
        padding: 16px;
    }

    .media-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .media-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .media-upload-form {
        padding: 16px 12px;
    }
}

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

.welcome-content {
    width: min(100%, 560px);
    margin: 0;
    padding: 0;
    color: var(--color-text);
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.welcome-content h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4.6vw, 3.8rem);
    line-height: 1.08;
    text-shadow: 0 1px 12px rgb(255 255 255 / 80%);
}

.family-space {
    grid-template-rows: auto 1fr;
}

.space-header {
    position: sticky;
    top: 0;
    z-index: 20;
}

.space-content {
    padding-bottom: 96px;
}

.space-intro h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
}

.family-section-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -10px 0 28px;
}

.family-section-links a {
    padding: 9px 13px;
    color: var(--color-accent-dark);
    font-size: 0.84rem;
    font-weight: 650;
    text-decoration: none;
    background: #edf1e9;
    border-radius: 999px;
    transition: background 160ms ease, transform 160ms ease;
}

.family-section-links a:hover {
    transform: translateY(-1px);
    background: #dfe8dc;
}

.family-section-links a:focus-visible,
.map-open-link:focus-visible,
.family-card a:focus-visible {
    outline: 3px solid #a9bea9;
    outline-offset: 3px;
}

.family-only-section[hidden],
.family-panel[hidden],
.photo-map[hidden] {
    display: none !important;
}

.family-panel {
    display: grid;
    margin-top: 26px;
    padding: clamp(24px, 5vw, 44px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 22px;
    box-shadow: 0 12px 36px rgb(38 53 46 / 5%);
    align-content: start;
    gap: 20px;
    scroll-margin-top: 125px;
}

.family-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.family-panel-heading .eyebrow {
    margin-bottom: 10px;
}

.family-panel-heading h2 {
    margin-bottom: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.family-panel-heading p:last-child {
    margin-bottom: 0;
    color: var(--color-muted);
    line-height: 1.6;
}

.section-add-button {
    flex: 0 0 auto;
    min-height: 44px;
    margin: 0;
    padding: 0 16px;
    font-size: 0.88rem;
}

.family-form {
    display: grid;
    max-width: 760px;
    padding: 22px;
    background: #f8f8f4;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    gap: 10px;
}

.family-form[hidden] {
    display: none;
}

.family-form label,
.media-search-label,
.coordinate-fields label {
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 650;
}

.family-form input:not([type="checkbox"]),
.family-form textarea,
.media-upload-form textarea,
.coordinate-fields input,
.media-filter-row input,
.media-filter-row select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--color-text);
    background: #fff;
    border: 1px solid #dfe2d9;
    border-radius: 10px;
}

.family-form textarea,
.media-upload-form textarea {
    min-height: 96px;
    resize: vertical;
}

.family-form input:focus,
.family-form textarea:focus,
.media-search:focus,
.coordinate-fields input:focus {
    border-color: var(--color-accent);
    outline: 3px solid rgb(82 112 92 / 15%);
}

.family-form-row,
.coordinate-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.family-form-row input {
    min-width: 0;
}

.check-option {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 6px 0;
}

.check-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
}

.media-upload-form .coordinate-fields {
    margin: 4px 0;
}

.coordinate-fields label {
    display: grid;
    gap: 7px;
}

.location-button {
    justify-self: start;
    min-height: 40px;
    padding: 0 13px;
}

.location-picker {
    height: 260px;
    min-height: 260px;
    margin: 4px 0;
}

.location-picker[hidden] {
    display: none;
}

.form-hint {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.media-filter-row {
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1.2fr) minmax(160px, 0.8fr);
    align-items: end;
    gap: 10px;
}

.media-filter-row .media-search-label {
    align-self: center;
}

.media-filter-row .media-search {
    min-height: 42px;
}

.media-filter-row select[hidden] {
    display: none;
}

.family-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 14px;
}

.family-card {
    min-width: 0;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
}

.family-card h3 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.family-card a {
    display: block;
    width: fit-content;
    max-width: 100%;
    color: var(--color-accent-dark);
    overflow-wrap: anywhere;
}

.family-card-body {
    margin: 12px 0 0;
    color: #59645d;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.family-card-meta,
.family-card-place {
    margin: 8px 0 0;
    color: var(--color-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.family-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.family-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    color: var(--color-accent-dark);
    font-size: 0.72rem;
    font-weight: 700;
    background: #edf1e9;
    border-radius: 999px;
}

.family-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f0f0eb;
}

.family-card-actions .subtle-button,
.family-delete-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
}

.family-delete-button {
    color: #9b4138;
    background: transparent;
    border: 1px solid #efdedb;
    border-radius: 10px;
    cursor: pointer;
}

.family-delete-button:hover {
    background: #fbf1ef;
}

.family-empty {
    margin: 0;
    padding: 20px;
    color: var(--color-muted);
    text-align: center;
    background: #f8f8f4;
    border-radius: 12px;
}

.family-empty[hidden] {
    display: none;
}

.family-feedback {
    margin: 0;
    color: var(--color-accent-dark);
    font-size: 0.88rem;
    line-height: 1.5;
}

.family-feedback:empty {
    display: none;
}

.event-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
}

.event-date {
    display: grid;
    width: 58px;
    height: 64px;
    align-content: center;
    justify-items: center;
    color: var(--color-accent-dark);
    background: #edf1e9;
    border-radius: 12px;
}

.event-month {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.event-day {
    font-size: 1.45rem;
    line-height: 1.1;
}

.event-details {
    min-width: 0;
}

.event-card .family-card-actions {
    grid-column: 1 / -1;
}

.birthday-today {
    margin: 8px 0 0;
    color: #945f22;
    font-size: 0.82rem;
    font-weight: 650;
}

.photo-map {
    width: 100%;
    min-height: 390px;
    overflow: hidden;
    background: #e8eee5;
    border: 1px solid var(--color-border);
    border-radius: 16px;
}

.map-attribution {
    margin: -12px 0 0;
    color: var(--color-muted);
    font-size: 0.74rem;
    text-align: right;
}

.map-attribution a {
    color: var(--color-accent-dark);
}

.map-fallback-list {
    display: grid;
    margin: 0;
    padding-left: 20px;
    gap: 7px;
}

.map-fallback-list:empty {
    display: none;
}

.map-place-list summary {
    width: fit-content;
    color: var(--color-accent-dark);
    font-size: 0.88rem;
    font-weight: 650;
    cursor: pointer;
}

.map-place-list[hidden],
.load-more-media[hidden] {
    display: none;
}

.map-place-list .map-fallback-list {
    margin-top: 12px;
}

.map-fallback-list a {
    color: var(--color-accent-dark);
}

.map-open-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    text-decoration: none;
}

.map-privacy-note {
    margin: -8px 0 0;
    color: var(--color-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.media-edit-button {
    min-height: 34px;
    margin: 4px 0;
    padding: 0 10px;
    font-size: 0.78rem;
}

.load-more-media {
    min-height: 42px;
    justify-self: center;
    padding: 0 18px;
}

.family-card a:hover,
.map-fallback-list a:hover,
.map-attribution a:hover {
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

button:disabled {
    cursor: wait !important;
    opacity: 0.62;
}

@media (max-width: 700px) {
    .welcome-page {
        padding: 88px 20px 34px;
    }

    .family-panel-heading {
        flex-direction: column;
    }

    .section-add-button {
        width: 100%;
    }

    .media-filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .media-filter-row .media-search-label {
        margin-bottom: -4px;
    }

    .photo-map {
        min-height: 320px;
    }
}

@media (max-width: 420px) {
    .family-section-links {
        gap: 6px;
    }

    .family-section-links a {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .family-panel {
        padding: 20px 14px;
    }

    .family-form {
        padding: 16px 12px;
    }

    .family-form-row,
    .coordinate-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}