/* Self-hosted fonts */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/static/fonts/dm-sans-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/static/fonts/lora-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Pacifico';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/pacifico-400.woff2') format('woff2');
}

/* stash.the-drey.uk — earthy woodland theme from the-drey */
:root {
    --bark: #4a3728;
    --amber: #c48f3f;
    --moss: #5a7247;
    --cream: #faf6f0;
    --text: #3a2e24;
    --light-bark: #6b5344;
    --shadow: rgba(74, 55, 40, 0.1);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--cream);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 960px;
    padding: 2rem;
    text-align: center;
}

h1 {
    font-family: 'Pacifico', cursive;
    font-size: 3rem;
    color: var(--bark);
    margin-bottom: 0.25rem;
}

h2 {
    font-family: 'Lora', serif;
    font-size: 1.4rem;
    color: var(--bark);
    margin-bottom: 1rem;
}

.tagline {
    color: var(--light-bark);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 1rem;
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0d8d0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background: var(--cream);
    transition: border-color 0.2s;
    margin-bottom: 0.75rem;
}

input:focus {
    outline: none;
    border-color: var(--amber);
}

input[readonly] {
    background: #f5f0e8;
    cursor: text;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
}

#login-btn {
    background-color: var(--moss);
    color: white;
    width: 100%;
}

#login-btn:hover {
    background-color: #4d6340;
}

.copy-btn {
    background-color: var(--amber);
    color: white;
    flex-shrink: 0;
    padding: 0.6rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background-color: #b0802e;
}

.secondary {
    background-color: #e0d8d0;
    color: var(--text);
}

.secondary:hover {
    background-color: #d0c8c0;
}

.result-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.result-row input {
    margin-bottom: 0;
    flex: 1;
}

.label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--light-bark);
    text-align: left;
}

.feedback {
    color: var(--moss);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.error {
    border-left: 4px solid #c44;
}

.error-text {
    color: #c44;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.hidden {
    display: none !important;
}

/* Upload */
.upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #e0d8d0;
    border-radius: 8px;
    cursor: pointer;
    color: var(--light-bark);
    transition: border-color 0.2s, color 0.2s;
}

.upload-label:hover,
.drag-over .upload-label {
    border-color: var(--amber);
    color: var(--amber);
}

.drag-over {
    background: #f5f0e8;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0d8d0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: var(--moss);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #e0d8d0;
    display: block;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-bark);
}

.video-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item.expired {
    opacity: 0.4;
}

.gallery-item.expired:hover {
    opacity: 0.7;
}

.empty-state {
    color: var(--light-bark);
    margin-top: 2rem;
    font-size: 1.1rem;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    width: 100%;
    max-width: 380px;
    margin: 1rem;
}

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

.modal-actions button {
    flex: 1;
}

/* Viewer modal */
.viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.viewer-content img,
.viewer-content video {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

.viewer-toolbar {
    position: absolute;
    top: -2.5rem;
    right: 0;
    display: flex;
    gap: 0.5rem;
}

.viewer-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.viewer-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    color: var(--amber);
}

/* Owner controls */
.owner-controls {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.expiry-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--light-bark);
}

.expiry-input {
    padding: 0.4rem 0.6rem;
    border: 2px solid #e0d8d0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background: var(--cream);
}

.expiry-input:focus {
    outline: none;
    border-color: var(--amber);
}

.expiry-clear {
    background: none;
    border: none;
    color: var(--light-bark);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
}

.expiry-clear:hover {
    color: #c44;
}

/* Visibility toggle */

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--light-bark);
    min-width: 3.5rem;
    text-align: right;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: #d0c8c0;
    border-radius: 12px;
    position: relative;
    transition: background-color 0.2s;
    cursor: pointer;
}

.toggle-switch.active {
    background: var(--moss);
}

.toggle-knob {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-knob {
    transform: translateX(20px);
}

/* Share page */
.share-container {
    max-width: 800px;
}

.share-viewer {
    padding: 0;
    overflow: hidden;
}

.share-media {
    width: 100%;
    display: block;
    border-radius: 12px;
}

.share-info {
    color: var(--light-bark);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Footer */
footer {
    margin-top: auto;
    padding: 1.5rem;
    font-size: 0.85rem;
    color: var(--light-bark);
}

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

footer a:hover {
    text-decoration: underline;
}

/* Mobile */
@media (max-width: 600px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.5rem;
    }

    h1 {
        font-size: 2.2rem;
    }
}
