/* Photos école — design system. Self-hosted, no third-party requests. */

@font-face {
    font-family: "Inter Variable";
    src: url("/fonts/inter/inter-variable-latin.woff2") format("woff2-variations"),
         url("/fonts/inter/inter-variable-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;

    --paper: #f4f3ef;
    --paper-raised: #ffffff;
    --paper-sunken: #eae8e1;
    --ink: #1c1e22;
    --ink-soft: #5b5f66;
    --ink-faint: #8a8e94;
    --line: #e1ded5;
    --line-strong: #cfccc0;

    --accent: #2b4c7e;
    --accent-strong: #1d3a63;
    --accent-soft: #e6ecf5;
    --accent-ink: #ffffff;

    --danger: #a5382f;
    --danger-strong: #832c25;
    --danger-soft: #f8e8e5;

    --success: #3f7d58;
    --success-soft: #e6f1ea;

    --focus-ring: #2b4c7e;
    --radius-sm: 4px;
    --radius-md: 9px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(28, 30, 34, 0.05), 0 10px 26px -16px rgba(28, 30, 34, 0.35);
    --shadow-pop: 0 12px 40px -12px rgba(20, 22, 26, 0.35);

    --font-sans: "Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --topbar-height: 61px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #15171b;
    --paper-raised: #1d2025;
    --paper-sunken: #101215;
    --ink: #edebe6;
    --ink-soft: #a3a7ae;
    --ink-faint: #6c7078;
    --line: #2b2f36;
    --line-strong: #3a3f48;

    --accent: #82a8dd;
    --accent-strong: #aac4e8;
    --accent-soft: #1f2c3d;
    --accent-ink: #10151d;

    --danger: #e2847c;
    --danger-strong: #eda8a2;
    --danger-soft: #3a2323;

    --success: #83c99e;
    --success-soft: #1c2c22;

    --focus-ring: #82a8dd;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px -16px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 20px 50px -12px rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --paper: #15171b;
        --paper-raised: #1d2025;
        --paper-sunken: #101215;
        --ink: #edebe6;
        --ink-soft: #a3a7ae;
        --ink-faint: #6c7078;
        --line: #2b2f36;
        --line-strong: #3a3f48;

        --accent: #82a8dd;
        --accent-strong: #aac4e8;
        --accent-soft: #1f2c3d;
        --accent-ink: #10151d;

        --danger: #e2847c;
        --danger-strong: #eda8a2;
        --danger-soft: #3a2323;

        --success: #83c99e;
        --success-soft: #1c2c22;

        --focus-ring: #82a8dd;
        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px -16px rgba(0, 0, 0, 0.6);
        --shadow-pop: 0 20px 50px -12px rgba(0, 0, 0, 0.65);
    }
}

/* Reset */

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

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.has-lightbox,
body.has-dialog {
    overflow: hidden;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }

p { margin: 0; }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

small { color: var(--ink-soft); font-size: 0.8125rem; }

strong { font-weight: 600; }

img { max-width: 100%; display: block; }

svg { flex-shrink: 0; width: 20px; height: 20px; }

input, button, select, textarea {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; }

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 0;
}

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

/* Shell & topbar */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--topbar-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-weight: 650;
    font-size: 0.9375rem;
}

.topbar__logo { width: 26px; height: 26px; border-radius: 6px; }

.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink-soft);
}

.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }

.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle .icon-moon { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Public page shell */

.page {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2.5rem 4rem;
}

.page--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: none;
    padding: 2rem 1.5rem;
}

.card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.auth-card {
    width: min(100%, 420px);
    padding: 2.25rem 2rem;
}

.auth-card__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.auth-card__eyebrow svg { width: 16px; height: 16px; }

.auth-card h1 { margin-bottom: 0.4rem; }

.auth-card > p { color: var(--ink-soft); margin-bottom: 1.75rem; }

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.05rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover { text-decoration: none; }

.btn svg { width: 16px; height: 16px; }

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn--secondary {
    background: var(--paper-raised);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn--secondary:hover { border-color: var(--ink-faint); }

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-soft);
    padding: 0.6rem 0.75rem;
}

.btn--ghost:hover { color: var(--ink); background: var(--paper-sunken); }

.btn--danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.btn--danger:hover { background: var(--danger); color: #fff; }

.btn--whatsapp {
    background: #25d366;
    border-color: #25d366;
    color: #ffffff;
}

.btn--whatsapp:hover { background: #1ebc5a; border-color: #1ebc5a; }

.btn--sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }

.btn--icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
}

.btn--block { width: 100%; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    border: 1px solid transparent;
}

.icon-link svg { width: 17px; height: 17px; }

.icon-link:hover { color: var(--ink); background: var(--paper-sunken); text-decoration: none; }

.icon-link--danger:hover { color: var(--danger); background: var(--danger-soft); }

/* Forms */

.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }

.field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.field-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line-strong);
    background: var(--paper);
    color: var(--ink);
    width: 100%;
}

input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--accent);
}

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

.form-row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
}

.form-row .field { flex: 1; margin-bottom: 0; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.field-error {
    color: var(--danger);
    font-size: 0.8125rem;
    margin: 0;
}

/* Alerts & badges */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; margin-top: 0.1rem; }

.alert--success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert--error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 650;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge--active { background: var(--success-soft); color: var(--success); }
.badge--inactive { background: var(--paper-sunken); color: var(--ink-faint); }

/* Page header */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header > div:first-child { min-width: 0; }

.page-header h1 {
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header p {
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header__actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header__actions { flex-wrap: wrap; }
}

/* Admin layout */

.admin-layout {
    flex: 1;
}

.admin-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: 240px;
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--paper-raised);
    padding: 1.25rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.admin-nav__link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 550;
}

.admin-nav__link:hover { background: var(--paper-sunken); color: var(--ink); text-decoration: none; }

.admin-nav__link.is-active { background: var(--accent-soft); color: var(--accent-strong); }

.admin-nav__link svg { width: 18px; height: 18px; }

.admin-nav__logout {
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
}

.admin-content {
    margin-left: 240px;
    padding: 2rem 2.5rem 4rem;
}

@media (max-width: 860px) {
    .admin-sidebar {
        position: static;
        width: auto;
        height: auto;
        overflow-y: visible;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 0.6rem 1rem;
        overflow-x: auto;
    }

    .admin-nav { flex-direction: row; }
    .admin-nav__logout { border-top: none; padding-top: 0; margin-left: auto; }
    .admin-nav__link span { display: none; }
    .admin-nav__link { padding: 0.55rem; }

    .admin-content {
        margin-left: 0;
        padding: 1.5rem 1.25rem 3rem;
    }
}

/* Stat cards */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-card__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.stat-card strong {
    font-size: 2rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

@media (max-width: 960px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
}

.mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mini-stats strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.mini-stats .stat-card__label { display: block; margin-top: 0.15rem; }

/* Panels / sections */

.panel {
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.25rem;
}

.panel + .panel { margin-top: 1.25rem; }

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 780px) {
    .panel-grid { grid-template-columns: 1fr; }
}

.panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel h2 { margin-bottom: 0.25rem; }
.panel > p, .panel__header p { color: var(--ink-soft); font-size: 0.9rem; }

.panel--danger {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

.panel--danger h2 { color: var(--danger); }

.panel--narrow { max-width: 480px; }

/* Code display */

.code-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--paper-sunken);
    border-radius: var(--radius-md);
    margin: 0.5rem 0 0.75rem;
}

.code-display__label {
    font-size: 0.75rem;
    color: var(--ink-soft);
    font-weight: 600;
    display: block;
    margin-bottom: 0.2rem;
}

.code-display code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.code-display .btn { margin-left: auto; }

/* Section list */

.section-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-list a, .section-list .btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 550;
    font-size: 0.9rem;
    justify-content: flex-start;
}

.section-list a:hover { border-color: var(--line-strong); background: var(--paper-sunken); text-decoration: none; }
.section-list svg { color: var(--accent); width: 18px; height: 18px; }

/* Table */

.table-wrap {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}

th {
    font-size: 0.75rem;
    text-transform: none;
    color: var(--ink-soft);
    font-weight: 650;
    background: var(--paper-sunken);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--paper-sunken); }

td small { display: block; margin-top: 0.15rem; }

/* Empty state */

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--ink-soft);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
}

.empty-state svg { color: var(--ink-faint); width: 34px; height: 34px; margin: 0 auto 0.75rem; }
.empty-state h2 { color: var(--ink); margin-bottom: 0.35rem; }

/* Dropzone / upload */

.dropzone {
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.dropzone__header { margin-bottom: 1rem; }
.dropzone__header p { color: var(--ink-soft); font-size: 0.9rem; }

.dropzone__area {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-md);
    padding: 2.25rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    color: var(--ink-soft);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

.dropzone__area:hover, .dropzone__area.is-dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dropzone__area svg { color: var(--accent); margin-bottom: 0.4rem; width: 30px; height: 30px; }
.dropzone__area strong { color: var(--ink); font-size: 0.95rem; }

.dropzone__buttons {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1.1rem;
    flex-wrap: wrap;
}

#photo-files, #camera-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.upload-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--paper-sunken);
    border-radius: var(--radius-md);
    margin-top: 1.1rem;
    font-size: 0.875rem;
}

.upload-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.upload-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.upload-row__meta { display: flex; justify-content: space-between; gap: 1rem; }
.upload-row__meta span { color: var(--ink-soft); }

.upload-row progress {
    width: 100%;
    height: 5px;
    border-radius: 99px;
    overflow: hidden;
    border: none;
}

.upload-row progress::-webkit-progress-bar { background: var(--paper-sunken); border-radius: 99px; }
.upload-row progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.upload-row progress::-moz-progress-bar { background: var(--accent); }

#recent-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.6rem;
    margin-top: 1rem;
}

#recent-photos figure {
    margin: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--line);
}

#recent-photos img { aspect-ratio: 1; object-fit: cover; }

#recent-photos figcaption {
    font-size: 0.7rem;
    color: var(--ink-soft);
    padding: 0.3rem 0.45rem;
}

/* Photo management grid */

.photo-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.photo-toolbar__actions { display: flex; gap: 0.6rem; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.photo-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--paper-raised);
}

.photo-card__thumb { display: block; position: relative; aspect-ratio: 1; overflow: hidden; }
.photo-card__thumb img { width: 100%; height: 100%; object-fit: cover; }

.photo-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--paper-sunken);
    color: var(--ink-faint);
}

.photo-card__placeholder svg { width: 28px; height: 28px; }

.photo-card__badge {
    position: absolute;
    bottom: 0.4rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 650;
    color: #fff;
    background: rgba(15, 17, 20, 0.6);
    padding: 0.15rem 0.4rem;
    border-radius: 99px;
}

.photo-card__badge svg { width: 12px; height: 12px; }

.photo-card__select {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}

.photo-card__select input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--accent);
}

.photo-card__select span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.photo-card__meta {
    padding: 0.55rem 0.65rem 0.15rem;
    font-size: 0.75rem;
}

.photo-card__meta strong { display: block; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card__meta span { color: var(--ink-soft); }

.photo-card__actions {
    display: flex;
    gap: 0.15rem;
    padding: 0.25rem 0.35rem 0.5rem;
}

.photo-card__actions form { margin: 0; }

/* Dialog */

dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0;
    width: min(90vw, 460px);
    background: var(--paper-raised);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
}

dialog::backdrop { background: rgba(15, 17, 20, 0.55); }

dialog form { padding: 1.5rem 1.6rem; }

.dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

dialog p { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1rem; }

.dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

/* Gallery (parent-facing) */

.gallery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.gallery-header p { color: var(--ink-soft); }

.gallery-header__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sort-nav { display: flex; gap: 0.3rem; padding: 0.2rem; background: var(--paper-sunken); border-radius: var(--radius-md); }

.sort-nav a {
    padding: 0.4rem 0.75rem;
    border-radius: calc(var(--radius-md) - 3px);
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.sort-nav a:hover { text-decoration: none; color: var(--ink); }
.sort-nav a.is-active { background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-card); }

.gallery-group { margin-bottom: 2.25rem; }

.gallery-group__header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.gallery-group__header span { color: var(--ink-soft); font-size: 0.85rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.65rem;
}

.gallery-grid button {
    position: relative;
    border: none;
    padding: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--paper-sunken);
}

.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.gallery-grid button:hover img { transform: scale(1.04); }

.gallery-grid button span {
    position: absolute;
    bottom: 0.4rem;
    right: 0.5rem;
    font-size: 0.7rem;
    font-weight: 650;
    color: #fff;
    background: rgba(15, 17, 20, 0.55);
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
}

.gallery-grid__video-badge { display: inline-flex; align-items: center; }
.gallery-grid__video-badge svg { width: 12px; height: 12px; }

#lightbox-video { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); }

#lightbox-filmstrip .photo-card__placeholder { width: 100%; height: 100%; }
#lightbox-filmstrip .photo-card__placeholder svg { width: 18px; height: 18px; }

/* Lightbox */

#gallery-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    background: rgba(10, 11, 13, 0.94);
    color: #f2f1ee;
    z-index: 100;
    padding: 1rem;
}

#gallery-lightbox[data-open="true"] { display: flex; }

.lightbox__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #d8d7d3;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.lightbox__top-actions { display: flex; gap: 0.5rem; }

.lightbox__top-actions a, .lightbox__top-actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #f2f1ee;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.45rem 0.7rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.lightbox__top-actions a:hover, .lightbox__top-actions button:hover { background: rgba(255, 255, 255, 0.18); text-decoration: none; }

.lightbox__top-actions svg { width: 16px; height: 16px; }

#gallery-lightbox figure {
    flex: 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    gap: 0.5rem;
    position: relative;
}

#lightbox-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-sm); }

#lightbox-caption { color: #b9b8b4; font-size: 0.8125rem; }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav svg { width: 20px; height: 20px; }
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
[data-lightbox-prev] { left: 0.25rem; }
[data-lightbox-next] { right: 0.25rem; }

#lightbox-filmstrip {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.75rem 0.1rem 0.1rem;
}

#lightbox-filmstrip button {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    opacity: 0.55;
}

#lightbox-filmstrip button[aria-selected="true"] { opacity: 1; border-color: var(--accent); }
#lightbox-filmstrip img { width: 100%; height: 100%; object-fit: cover; }

/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Error pages */

.error-page {
    text-align: center;
    max-width: 440px;
}

.error-page__code {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-weight: 650;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.error-page__code svg { width: 16px; height: 16px; }

.error-page h1 { margin-bottom: 0.6rem; }
.error-page p { color: var(--ink-soft); margin-bottom: 1.75rem; }
.error-page .btn { margin: 0 auto; }

/* Utility */

.mt-3 { margin-top: 1.1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

.divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.25rem 0;
}

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