:root {
    --paper: #F6F1E6;          /* sun-bleached canvas */
    --paper-raised: #FBF7EE;
    --ink: #2E2419;            /* dark leather */
    --ink-soft: #6E5F4C;
    --leather: #7A4A21;        /* saddle brown */
    --leather-deep: #5C3717;
    --gold: #B3862D;           /* brass buckle */
    --sage: #71805C;           /* prairie sage */
    --line: rgba(46, 36, 25, 0.16);
    --radius: 2px;
}

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Karla', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* sun-bleached paper grain */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 2; }

a { color: var(--leather); }

.mono {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* ---------- Landing ---------- */
.landing {
    min-height: calc(100dvh - 130px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8vh 6vw 4vh;
}

.landing-tag { color: var(--leather); display: block; margin-top: 1.9em; }

.hero-actions { display: flex; gap: 0.9em; margin-top: 2.4em; flex-wrap: wrap; justify-content: center; }

.hero-btn {
    font-family: 'Karla', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    padding: 0.85em 1.8em;
    border-radius: var(--radius);
    text-decoration: none;
    background: var(--leather);
    color: var(--paper);
    border: 1px solid var(--leather);
    transition: background 160ms ease, color 160ms ease;
}
.hero-btn:hover { background: var(--leather-deep); border-color: var(--leather-deep); }
.hero-btn-outline { background: transparent; color: var(--leather); }
.hero-btn-outline:hover { background: var(--leather); color: var(--paper); }

/* entrance animation */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade-up { opacity: 0; animation: fadeUp 0.75s ease forwards; animation-delay: calc(var(--d, 0) * 150ms); }

@keyframes sway { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-3px) rotate(0.3deg); } }
.landing .rope { animation: sway 6s ease-in-out infinite; margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
    .fade-up { animation: none; opacity: 1; }
    .landing .rope { animation: none; }
}

/* ---------- Tabs ---------- */
.tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    padding: 1.05em clamp(1.2rem, 5vw, 3rem);
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.tab-home { font-family: 'Besley', serif; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.tab-home .amp { color: #A9813C; font-style: italic; font-weight: 400; padding: 0 0.06em; }
.tab-links { display: flex; gap: 1.4em; }
.tab {
    font-family: 'Space Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    padding-bottom: 3px;
    border-bottom: 1.5px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--leather); border-bottom-color: var(--gold); }

/* ---------- Hero (shared bits) ---------- */
.hero-date { color: var(--ink-soft); display: block; }

h1 {
    font-family: 'Besley', serif;
    font-weight: 900;
    font-size: clamp(2.9rem, 10vw, 5.4rem);
    line-height: 1.02;
    margin: 0.35em 0 0.3em;
    letter-spacing: 0.005em;
}

h1 .amp {
    font-style: italic;
    font-weight: 400;
    color: #A9813C;
    font-size: 0.75em;
    padding: 0 0.1em;
}

.hero-sub { color: var(--ink-soft); max-width: 42ch; margin: 0 auto; }

.rope { width: min(340px, 70vw); margin: 2.6em auto 0; display: block; }
.rope path { stroke: var(--leather); stroke-width: 1.6; fill: none; stroke-dasharray: 8 5; stroke-linecap: round; }
.rope circle { fill: var(--gold); }

/* ---------- Upload ---------- */
.upload-section { max-width: 560px; margin: 0 auto; padding: 6vh 6vw 9vh; }

.upload-card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.2em 2em;
    position: relative;
}

/* double-rule frame, like an old poster border */
.upload-card::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid var(--line);
    border-radius: 1px;
    pointer-events: none;
}

.upload-card > .mono { color: var(--leather); display: block; margin-bottom: 1.6em; }

.field { margin-bottom: 1.4em; }
.field > label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.45em; }

.field input[type="text"] {
    width: 100%;
    padding: 0.8em 1em;
    font-family: 'Karla', sans-serif;
    font-size: 1rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
}
.field input[type="text"]:focus { outline: 2px solid var(--leather); outline-offset: 1px; }

.dropzone {
    display: block;
    border: 1.5px dashed rgba(122, 74, 33, 0.5);
    border-radius: var(--radius);
    padding: 2.4em 1.4em;
    text-align: center;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}
.dropzone:hover, .dropzone.is-dragover { background: rgba(122, 74, 33, 0.05); border-color: var(--leather); }

.dz-title { font-family: 'Besley', serif; font-style: italic; font-weight: 500; font-size: 1.2rem; color: var(--leather); }
.dz-hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.3em; }

.btn {
    width: 100%;
    margin-top: 1.6em;
    padding: 1em;
    font-family: 'Karla', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--paper);
    background: var(--leather);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 160ms ease;
}
.btn:hover { background: var(--leather-deep); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* upload progress list */
.upload-list { list-style: none; margin: 1.4em 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55em; }
.upload-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25em 0.75em;
    align-items: center;
    padding: 0.55em 0.75em;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.85rem;
}
.upload-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-status { justify-self: end; font-family: 'Space Mono', monospace; font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.upload-item.is-done .upload-item-status { color: var(--sage); }
.upload-item.is-error .upload-item-status { color: #A23B2B; }
.upload-bar { grid-column: 1 / -1; height: 3px; background: var(--line); border-radius: 999px; overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--leather); transition: width 0.2s ease; }
.upload-item.is-done .upload-bar span { background: var(--sage); }
.upload-item.is-error .upload-bar span { background: #A23B2B; }

.upload-done { margin-top: 1.4em; text-align: center; color: var(--leather); }

/* ---------- Gallery ---------- */
.gallery-section { max-width: 1080px; margin: 0 auto; padding: 5vh 5vw 12vh; }

.gallery-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid var(--line);
    padding-top: 2.2em;
    margin-bottom: 2em;
    gap: 1em;
    flex-wrap: wrap;
    position: relative;
}
.gallery-head::before {
    content: '✶';
    position: absolute;
    top: -0.72em;
    left: 50%;
    transform: translateX(-50%);
    color: var(--gold);
    background: var(--paper);
    padding: 0 0.7em;
    font-size: 0.85rem;
    line-height: 1;
}
.gallery-head h2 { font-family: 'Besley', serif; font-weight: 700; font-size: 1.7rem; }
.gallery-head .mono { color: var(--ink-soft); }

.grid { columns: 3 260px; column-gap: 14px; }

.card {
    break-inside: avoid;
    margin-bottom: 14px;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
}

.ph { width: 100%; display: block; position: relative; background: #D8CBB2; }
.ph img { width: 100%; display: block; }

/* video affordance */
.play-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.play-badge::before {
    content: '';
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(46, 36, 25, 0.55);
    border: 1.5px solid rgba(246, 241, 230, 0.9);
    position: absolute;
}
.play-badge::after {
    content: '';
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent var(--paper);
    position: relative;
    left: 2px;
}

.caption { display: flex; justify-content: space-between; align-items: baseline; padding: 0.65em 0.85em; gap: 0.6em; }
.who { font-family: 'Besley', serif; font-style: italic; font-weight: 500; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { font-family: 'Space Mono', monospace; font-size: 0.6rem; letter-spacing: 0.08em; color: var(--ink-soft); white-space: nowrap; }

.empty-state { text-align: center; padding: 3.5em 1em; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 1.5em; margin-top: 2.5em; }
.pager a { color: var(--leather); text-decoration: none; }
.pager-status { color: var(--ink-soft); }

/* ---------- Footer ---------- */
footer { text-align: center; padding: 0 6vw 7vh; color: var(--ink-soft); }
footer .mono { letter-spacing: 0.24em; }
.brand-mark { display: block; width: 58px; height: 58px; margin: 0 auto 1.4em; color: var(--leather); opacity: 0.85; }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(28, 22, 16, 0.94);
}
.lightbox[hidden] { display: none; }
.lightbox-content { max-width: 100%; max-height: 90vh; max-height: 90dvh; display: grid; place-items: center; }
.lightbox-content img, .lightbox-content video { max-width: 100%; max-height: 90vh; max-height: 90dvh; border-radius: var(--radius); }
.lightbox-close {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    right: 1rem;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(246, 241, 230, 0.5);
    background: rgba(46, 36, 25, 0.55);
    color: var(--paper);
    font-size: 1.1rem;
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(46, 36, 25, 0.8); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid rgba(246, 241, 230, 0.4);
    background: rgba(46, 36, 25, 0.5);
    color: var(--paper);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
    z-index: 2;
}
.lightbox-nav:hover { background: rgba(46, 36, 25, 0.8); }
.lightbox-prev { left: max(0.75rem, env(safe-area-inset-left)); }
.lightbox-next { right: max(0.75rem, env(safe-area-inset-right)); }
.lightbox-nav[hidden] { display: none; }

@media (max-width: 600px) {
    /* On phones swipe is primary; keep arrows but smaller and less obtrusive. */
    .lightbox-nav { width: 40px; height: 40px; font-size: 1.5rem; opacity: 0.75; }
}

@media (max-width: 600px) {
    header { padding-top: 9vh; }
    .upload-card { padding: 1.6em 1.3em; }
}
