/* ============================================================
   Hochzeitsalbum — warmes Papier, Terrakotta-Tinte
   Palette: cremefarbenes Papier, sandige Linien, Terrakotta.
   Typo: Fraunces (Anzeige) · Instrument Sans (Fließtext) ·
         IBM Plex Mono (Daten).
   Signatur: die unbeschnittene Kontaktabzug-Wand; jedes Bild
             am Rand von Eckmarken (Passermarken) gefasst.
   ============================================================ */

:root {
    --paper: #f7f3ea;
    --card: #f0eada;
    --card-2: #e9e1cd;
    --sand: #c9c0ac;
    --caramel: #d89048;
    --caramel-soft: rgba(216, 144, 72, 0.22);
    --terracotta: #b9622a;
    --rust: #8a3e14;
    --ink: #3b2a1f;
    --muted: #7e6f5c;

    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Instrument Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;

    --page-width: 1400px;
    --page-pad: clamp(1rem, 4vw, 2.5rem);
    --gap: 8px;
    --bar-h: 52px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
}

::selection {
    background: var(--caramel-soft);
}

a,
button,
input,
[tabindex]:focus-visible {
    outline: 2px solid var(--rust);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--rust);
    outline-offset: 2px;
}

/* ---------- Top bar ---------- */

.site-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--bar-h);
    padding-inline: var(--page-pad);
    background: var(--card);
    border-bottom: 1px solid var(--sand);
    position: sticky;
    top: 0;
    z-index: 40;
}

.site-bar__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.site-bar__seal {
    font-family: var(--font-display);
    font-style: italic;
    font-variation-settings: "SOFT" 60, "WONK" 1;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--terracotta);
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid var(--terracotta);
    border-radius: 50%;
}

.site-bar__word {
    font-family: var(--font-display);
    font-weight: 540;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.site-bar__aside {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.site-bar__user {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.site-bar__aside > .btn-link,
.site-bar__logout {
    flex: 0 0 auto;
}

/* ---------- Buttons & links ---------- */

.btn-primary,
.btn-ghost,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.75rem 1.25rem;
    color: var(--ink);
    border: 1px solid var(--sand);
    background: transparent;
    border-radius: 2px;
    cursor: pointer;
    transition: color 0.18s var(--ease), background 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.btn-primary {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: var(--paper);
}

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

.btn-ghost {
    border-color: var(--sand);
    color: var(--muted);
}

.btn-ghost:hover {
    border-color: var(--rust);
    color: var(--rust);
}

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

.btn-link {
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--font-mono);
    color: var(--muted);
    letter-spacing: 0.08em;
    transition: color 0.18s var(--ease);
}

.btn-link:hover {
    color: var(--terracotta);
}

/* ---------- Page shell ---------- */

.page {
    max-width: var(--page-width);
    margin-inline: auto;
    padding: clamp(2rem, 4vw, 3.5rem) var(--page-pad);
}

.album__meta,
.album__description {
    max-width: 42rem;
}

/* ---------- Home / cover ---------- */

.cover {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1.25rem;
    min-height: calc(100vh - var(--bar-h) - 4rem);
    padding-block: 2rem;
}

.cover__eyebrow,
.album__eyebrow,
.album-index__eyebrow,
.index-sheet__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--terracotta);
    margin: 0;
}

.cover__title {
    font-family: var(--font-display);
    font-weight: 540;
    font-variation-settings: "SOFT" 40, "WONK" 0;
    font-size: clamp(2.5rem, 8.5vw, 5.5rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0;
}

.cover__and {
    font-style: italic;
    font-variation-settings: "SOFT" 60, "WONK" 1;
    color: var(--terracotta);
}

.cover__lede {
    margin: 0;
    color: var(--muted);
    max-width: 30rem;
    font-size: 1.05rem;
}

.cover__albums {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    width: 100%;
    margin-block: 1.5rem;
}

/* "Abzüge" — jedes Album als aufgezogener Abzug auf Papier,
   mit Passermarken an den Ecken. */

.cover-album {
    position: relative;
    display: block;
    background: var(--card);
    border: 1px solid var(--sand);
    padding: 6px 6px 0;
}

.cover-album__img {
    width: 100%;
    height: auto;
}

.cover-album__label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.6rem 0.35rem 0.75rem;
}

.cover-album__name {
    font-family: var(--font-display);
    font-weight: 520;
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.cover-album__count {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Passermarken (Angular Ecken) */
.cropmark {
    position: absolute;
    width: 13px;
    height: 13px;
    pointer-events: none;
    z-index: 2;
    transition: transform 0.2s var(--ease);
}

.cropmark--tl {
    top: 5px;
    left: 5px;
    border-top: 2px solid var(--terracotta);
    border-left: 2px solid var(--terracotta);
}

.cropmark--tr {
    top: 5px;
    right: 5px;
    border-top: 2px solid var(--terracotta);
    border-right: 2px solid var(--terracotta);
}

.cropmark--bl {
    bottom: 5px;
    left: 5px;
    border-bottom: 2px solid var(--terracotta);
    border-left: 2px solid var(--terracotta);
}

.cropmark--br {
    bottom: 5px;
    right: 5px;
    border-bottom: 2px solid var(--terracotta);
    border-right: 2px solid var(--terracotta);
}

.cover-album:hover .cropmark--tl {
    transform: translate(-2px, -2px);
}

.cover-album:hover .cropmark--tr {
    transform: translate(2px, -2px);
}

.cover-album:hover .cropmark--bl {
    transform: translate(-2px, 2px);
}

.cover-album:hover .cropmark--br {
    transform: translate(2px, 2px);
}

.cover__links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---------- Album / index headers ---------- */

.album__head,
.album-index__head,
.index-sheet__head {
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.album__title,
.album-index__title,
.index-sheet__title {
    font-family: var(--font-display);
    font-weight: 520;
    font-variation-settings: "SOFT" 30, "WONK" 0;
    font-size: clamp(1.7rem, 5vw, 2.9rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 0;
}

.album__date,
.album-index__meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.album__description p {
    margin: 0;
}

.album__foot,
.index-sheet__foot {
    margin-top: clamp(2rem, 4vw, 3rem);
}

/* ---------- Contact sheet (justified, uncropped) ---------- */

.contact-sheet {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--gap);
    position: relative;
}

/* Geometry is applied by the local justified-layout adapter. Keeping the
   flex rules above provides a usable fallback if scripting is unavailable. */
.contact-sheet.is-laid-out {
    display: block;
}

.contact-sheet__cell {
    display: block;
    flex: 0 0 auto;
    width: clamp(150px, 22vw, 240px);
    opacity: 0.96;
    transition: opacity 0.2s var(--ease);
}

.contact-sheet__cell:hover {
    opacity: 1;
}

.contact-sheet__img {
    width: 100%;
    height: auto;
}

.contact-sheet.is-laid-out .contact-sheet__cell {
    position: absolute;
    flex: none;
    width: auto;
    height: auto;
}

.contact-sheet.is-laid-out .contact-sheet__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- Loading placeholders (shimmer + fade-in) ---------- */

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.contact-sheet__cell,
.cover-album,
.album-row__thumb {
    background-image: linear-gradient(
        105deg,
        var(--card) 40%,
        rgba(216, 144, 72, 0.14) 50%,
        var(--card) 60%
    );
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: skeleton-shimmer 1.8s var(--ease) infinite;
}

/* Fade photos in over their placeholder once loaded. Scoped to .js so
   nothing ever hides an image when scripting is unavailable. */
.js .contact-sheet__img,
.js .cover-album__img,
.js .album-row__img,
.js .stage__image {
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.js .contact-sheet__img.is-loaded,
.js .cover-album__img.is-loaded,
.js .album-row__img.is-loaded,
.js .stage__image.is-loaded {
    opacity: 1;
}

.js .contact-sheet__img.is-error,
.js .cover-album__img.is-error,
.js .album-row__img.is-error,
.js .stage__image.is-error {
    opacity: 0;
}

/* Stage swaps are quick controlled dips between frames, not the wall's
   slower 0.3s crossfade. */
.js .stage__image {
    transition: opacity 0.2s var(--ease);
}

/* ---------- Stage (photo detail & overlay) ---------- */

.page--stage .page {
    max-width: none;
    padding: 0;
}

.stage-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--paper);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

.stage-overlay.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.stage-overlay .stage {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    width: 100%;
}

.stage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.stage__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--bar-h);
    padding-inline: var(--page-pad);
    background: var(--card);
    border-bottom: 1px solid var(--sand);
    position: sticky;
    top: 0;
    z-index: 30;
}

.stage__back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.18s var(--ease);
}

.stage__back:hover {
    color: var(--terracotta);
}

.stage__back-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.stage__counter {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--muted);
    white-space: nowrap;
}

.stage__index {
    color: var(--terracotta);
}

.stage__slash {
    opacity: 0.5;
}

.stage__actions {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
}

.stage__download {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.18s var(--ease);
}

.stage__download:hover {
    color: var(--terracotta);
}

.stage__frame {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: var(--paper);
}

.stage__slider {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.stage__track {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.stage__track.is-animating {
    transition: transform 0.28s var(--ease);
}

.stage__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 2.5vw, 1.5rem);
    pointer-events: none;
}

.stage__slide--curr {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
}

.stage__slide--prev {
    transform: translate3d(calc(-100% - 24px), 0, 0);
}

.stage__slide--next {
    transform: translate3d(calc(100% + 24px), 0, 0);
}

.stage__figure {
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.stage__image {
    max-width: 100%;
    max-height: calc(100vh - var(--bar-h) - 3rem);
    max-height: calc(100dvh - var(--bar-h) - 3rem);
    height: auto;
    width: auto;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e3dcc7;
    box-shadow: 0 1px 2px rgba(59, 42, 31, 0.06), 0 6px 18px rgba(59, 42, 31, 0.08);
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    transform-origin: center center;
    will-change: transform;
}

.stage__image.is-zoomed {
    cursor: grab;
}

.stage__image.is-zoomed:active {
    cursor: grabbing;
}

.stage__caption {
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-align: center;
    max-width: 60ch;
}

.stage__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--sand);
    background: var(--card);
    color: var(--ink);
    font-size: 1.4rem;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s var(--ease), background 0.2s var(--ease),
        color 0.2s var(--ease);
    z-index: 5;
}

.stage__nav--prev {
    left: clamp(6px, 2vw, 24px);
}

.stage__nav--next {
    right: clamp(6px, 2vw, 24px);
}

.stage:hover .stage__nav,
.stage__nav:focus-visible {
    opacity: 1;
}

.stage__nav:hover {
    background: var(--card-2);
    color: var(--terracotta);
}

.stage__nav.is-disabled {
    opacity: 0;
    pointer-events: none;
}

@media (hover: none) {
    .stage__nav {
        opacity: 0.65;
    }
}

/* View-transition crossfade for in-page photo changes */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.22s;
    }
}

/* ---------- Album index rows ---------- */

.album-index__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.album-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-block: 0.9rem;
    border-top: 1px solid var(--sand);
    transition: background 0.18s var(--ease);
}

.album-row:hover {
    background: var(--card);
}

.album-row__thumb {
    flex: 0 0 auto;
    width: clamp(64px, 10vw, 110px);
    border: 1px solid var(--sand);
}

.album-row__img {
    width: 100%;
    height: auto;
}

.album-row__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.album-row__name {
    font-family: var(--font-display);
    font-weight: 520;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.album-row__meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.album-row__arrow {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 1.2rem;
    transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}

.album-row:hover .album-row__arrow {
    color: var(--terracotta);
    transform: translateX(3px);
}

/* ---------- Year navigation ---------- */

.year-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.year-nav__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.year-nav__list {
    display: flex;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.year-nav__list a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--sand);
    border-radius: 2px;
    color: var(--muted);
    transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.year-nav__list a:hover {
    color: var(--terracotta);
    border-color: var(--terracotta);
}

/* ---------- Pagination ---------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
}

.pager__link {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.18s var(--ease);
}

.pager__link:hover {
    color: var(--terracotta);
}

.pager__link.is-disabled {
    opacity: 0.4;
}

.pager__status {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

/* ---------- Empty states ---------- */

.empty {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* ---------- Auth ---------- */

.auth {
    max-width: 24rem;
    margin: 0 auto;
    padding-block: clamp(2rem, 6vh, 4rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth__title {
    font-family: var(--font-display);
    font-weight: 520;
    font-variation-settings: "SOFT" 40, "WONK" 0;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: -0.02em;
    margin: 0;
    text-align: center;
}

.auth__greeting {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin: -0.75rem 0 0;
    text-align: center;
}

.auth__greeting strong {
    color: var(--terracotta);
    font-weight: 600;
}

.auth__steps {
    margin: -0.75rem 0 0;
    padding-left: 1.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.auth__steps li + li {
    margin-top: 0.45rem;
}

.auth__steps strong {
    color: var(--terracotta);
    font-weight: 600;
}

.auth__error {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--rust);
    margin: 0;
    text-align: center;
}

.auth__message {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--terracotta);
    margin: 0;
    text-align: center;
}

.auth__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.field__input {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.7rem 0.85rem;
    background: var(--card);
    border: 1px solid var(--sand);
    border-radius: 2px;
    color: var(--ink);
    transition: border-color 0.18s var(--ease);
}

.field__input:focus {
    border-color: var(--terracotta);
    outline: none;
}

.auth__hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
    text-align: center;
}

/* ---------- Reduced motion ---------- */

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

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
    .site-bar {
        height: auto;
        min-height: var(--bar-h);
        flex-wrap: wrap;
        row-gap: 0.35rem;
        padding-block: 0.5rem;
    }

    .site-bar__aside {
        flex: 1 1 100%;
        justify-content: flex-end;
        gap: 0.5rem 0.75rem;
    }

    .stage__bar {
        gap: 0.5rem;
        padding-inline: 0.75rem;
    }

    .stage__back-text {
        display: none;
    }

    .stage__back-icon {
        font-size: 1.4rem;
    }

    .stage__actions {
        gap: 0.75rem;
    }

    .stage__caption {
        display: none;
    }

    .cover__albums {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .cropmark {
        width: 9px;
        height: 9px;
    }

    .stage__nav {
        display: none;
    }
}
