/**
 * Dig Your Own Grave and Save
 * 1950s Happy Infomercial Aesthetic
 * "Gee whiz, what a deal!"
 */

/* Fonts loaded via <link> tags in HTML for better performance */

/* Skip to content link (accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--text-dark);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 100;
    font-size: 0.875rem;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* Reset button styles for carousel dots (dig/share styled via inline <style>) */
button.carousel-dot {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

:root {
    --bg-cream: #FDF6E3;
    --bg-white: #FFFFFF;
    --primary-red: #E63946;
    --primary-red-dark: #C1121F;
    --accent-teal: #2A9D8F;
    --accent-teal-dark: #1E7268;
    --accent-yellow: #F4A261;
    --accent-mustard: #E9C46A;
    --text-dark: #264653;
    --text-medium: #457B9D;
    --text-light: #6B8EA4;
    --border-brown: #8B4513;
    --shadow: rgba(38, 70, 83, 0.15);
}

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

body {
    font-family: 'Lexend', -apple-system, sans-serif;
    background-color: var(--bg-cream);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(244, 162, 97, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(42, 157, 143, 0.1) 0%, transparent 50%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== STARBURST DECORATION ===== */

.starburst {
    display: inline-block;
    background: var(--primary-red);
    color: white;
    padding: 1rem 1.5rem;
    font-family: 'Fredoka One', cursive;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    clip-path: polygon(
        50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
        50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%
    );
    transform: rotate(-5deg);
}

/* ===== PUBLIC PAGE ===== */

.site-header {
    text-align: center;
    padding: 0.5rem 1rem 1rem;
    background: linear-gradient(180deg, var(--bg-white) 0%, var(--bg-cream) 100%);
    border-bottom: 4px dashed var(--accent-mustard);
    position: relative;
}

.site-header::before {
    content: '★ ★ ★';
    display: block;
    color: var(--accent-yellow);
    font-size: 1rem;
    letter-spacing: 0.75rem;
    margin-bottom: 0.25rem;
}

.header-profile {
    position: absolute;
    left: calc(50% + 11rem);
    bottom: 0.25rem;
    cursor: default;
}

.header-profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}


.site-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.75rem, 8vw, 2.75rem);
    color: var(--primary-red);
    text-shadow: 2px 2px 0 var(--accent-mustard), 3px 3px 0 rgba(0,0,0,0.1);
    letter-spacing: 1px;
    line-height: 1.1;
}

.site-subtitle {
    font-family: 'Fredoka One', cursive;
    color: var(--accent-teal);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.site-tagline {
    color: var(--text-medium);
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 500px;
    margin: 0 auto;
}

.retro-badge {
    display: inline-block;
    background: var(--accent-teal);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
    box-shadow: 0 3px 0 var(--accent-teal-dark);
}

/* Featured Product */

.featured-section {
    max-width: 650px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.product-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg-white);
    border: 4px solid var(--text-dark);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 8px 8px 0 var(--accent-mustard), 12px 12px 0 rgba(0,0,0,0.1);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 10px 10px 0 var(--accent-mustard), 14px 14px 0 rgba(0,0,0,0.15);
}

.product-card::before {
    content: 'TODAY\'S FIND!';
    position: absolute;
    top: 20px;
    right: -35px;
    background: var(--primary-red);
    color: white;
    padding: 0.5rem 3rem;
    font-family: 'Fredoka One', cursive;
    font-size: 0.75rem;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.product-image-wrapper {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 4px solid var(--text-dark);
    position: relative;
}

.product-image {
    position: absolute;
    display: block;
    object-fit: contain;
}

.product-content {
    padding: 2rem;
    text-align: center;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(233, 196, 106, 0.1) 10px,
        rgba(233, 196, 106, 0.1) 20px
    );
}

.product-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.product-tagline {
    font-size: 1.2rem;
    color: var(--text-medium);
    font-style: italic;
    margin-bottom: 2rem;
    line-height: 1.5;
    padding: 0 1rem;
}

.via-credit {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: left;
    margin-bottom: 1rem;
    padding: 0 1rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.via-credit .via-link {
    color: var(--accent-teal);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.via-credit:hover .via-link {
    color: var(--accent-teal-dark);
    text-decoration: underline;
}

.buy-button {
    display: inline-block;
    background: var(--primary-red);
    color: white;
    padding: 1rem 2.5rem;
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.2s ease;
    border: 3px solid var(--primary-red-dark);
    box-shadow: 0 4px 0 var(--primary-red-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--primary-red-dark);
}

.buy-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--primary-red-dark);
}

/* Archive Section */

.archive-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.section-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--accent-teal);
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-style: italic;
}

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

a.archive-card {
    text-decoration: none;
    color: inherit;
}

.archive-grid {
    align-items: stretch;
}

.archive-card {
    background: var(--bg-white);
    border: 3px solid var(--text-dark);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 4px 4px 0 var(--accent-mustard);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.archive-card:hover {
    transform: translateY(-4px) rotate(1deg);
    box-shadow: 6px 8px 0 var(--accent-mustard);
}

.archive-card .product-image-wrapper {
    aspect-ratio: 4/3;
    border-bottom: 3px solid var(--text-dark);
}

.archive-card .product-image {
    border-bottom: none;
}

.archive-card .product-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.archive-card .product-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.archive-card .product-tagline {
    font-size: 0.9rem;
    padding: 0;
    margin-bottom: 0.75rem;
}

.archive-card .via-credit {
    padding: 0;
    margin-bottom: 0.5rem;
}

.archive-card .buy-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    box-shadow: 0 3px 0 var(--primary-red-dark);
    align-self: center;
    max-width: 70%;
    margin-top: auto;
}

/* Empty State */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-medium);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Footer */

.site-footer {
    border-top: 4px dashed var(--accent-mustard);
    padding: 2rem 1rem;
    text-align: center;
    background: var(--bg-white);
}

.affiliate-disclosure {
    font-size: 0.8rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 1rem;
    line-height: 1.6;
    padding: 1rem;
    background: var(--bg-cream);
    border-radius: 8px;
    border: 2px dashed var(--accent-mustard);
}

.affiliate-disclosure-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 650px;
    margin: 0 auto;
    padding: 0.5rem;
    background: var(--bg-cream);
    border-radius: 12px;
    border: 2px dashed var(--accent-mustard);
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.6;
}

.affiliate-disclosure-hero .disclosure-profile {
    flex-shrink: 0;
    text-align: center;
    display: none;
}

.affiliate-disclosure-hero .disclosure-profile img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-mustard);
}

.affiliate-disclosure-hero .disclosure-profile span {
    display: block;
    font-size: 0.6rem;
    font-style: italic;
    color: var(--text-light);
    margin-top: 0.25rem;
    white-space: nowrap;
}

.footer-profile {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.footer-profile img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.footer-profile span {
    font-size: 0.65rem;
    font-style: italic;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.footer-links a {
    color: var(--accent-teal);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-red);
}

/* ===== ADMIN PAGE ===== */

.admin-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.admin-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 3px dashed var(--accent-mustard);
}

.admin-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.25rem;
    color: var(--primary-red);
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.admin-nav-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
}

.nav-link {
    color: var(--accent-teal);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--accent-teal);
    color: #fff;
}

.nav-link-primary {
    background: var(--accent-mustard);
    color: var(--dark-brown);
    font-weight: 700;
}

.nav-link-primary:hover {
    background: var(--accent-teal);
    color: #fff;
}

.nav-link-subtle {
    font-weight: 500;
    font-size: 0.75rem;
    color: #999;
}

.nav-link-subtle:hover {
    background: #eee;
    color: #666;
}

.nav-divider {
    width: 1px;
    height: 14px;
    background: #ddd;
    align-self: center;
}

/* Login Form */

.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2.5rem;
    background: var(--bg-white);
    border: 3px solid var(--text-dark);
    border-radius: 20px;
    box-shadow: 6px 6px 0 var(--accent-mustard);
}

.login-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-red);
}

/* Forms */

.form-card {
    background: var(--bg-white);
    border: 3px solid var(--text-dark);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 4px 4px 0 var(--accent-mustard);
}

.form-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    color: var(--accent-teal);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px dashed var(--accent-mustard);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-cream);
    border: 2px solid var(--text-light);
    border-radius: 8px;
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.2);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Fredoka One', cursive;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-red);
    color: white;
    border: 2px solid var(--primary-red-dark);
    box-shadow: 0 3px 0 var(--primary-red-dark);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 0 var(--primary-red-dark);
}

.btn-secondary {
    background: var(--bg-cream);
    color: var(--text-dark);
    border: 2px solid var(--text-light);
    box-shadow: 0 3px 0 var(--text-light);
}

.btn-secondary:hover {
    background: var(--accent-mustard);
    border-color: var(--border-brown);
}

.btn-danger {
    background: #D62828;
    color: white;
    border: 2px solid #9D0208;
    box-shadow: 0 3px 0 #9D0208;
}

.btn-danger:hover {
    background: #9D0208;
}

.btn-small {
    padding: 0.4rem 0.875rem;
    font-size: 0.7rem;
}

/* Items Table */

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

.items-table th,
.items-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 2px dashed var(--accent-mustard);
}

.items-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-family: 'Fredoka One', cursive;
}

.items-table tr:hover {
    background: rgba(233, 196, 106, 0.1);
}

.item-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--text-dark);
}

.item-title {
    font-weight: 600;
    color: var(--text-dark);
}

.item-tagline {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
}

.item-date {
    font-size: 0.875rem;
    color: var(--text-medium);
    font-weight: 500;
}

.item-featured {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--accent-teal);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    font-family: 'Fredoka One', cursive;
}

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

/* Messages */

.message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid;
}

.message-success {
    background: #D4EDDA;
    color: #155724;
    border-color: #28A745;
}

.message-error {
    background: #F8D7DA;
    color: #721C24;
    border-color: #DC3545;
}

.message-warning {
    background: #FFF3CD;
    color: #856404;
    border-color: #FFC107;
}

/* Responsive Table */

@media (max-width: 768px) {
    .site-header {
        padding: 0.35rem 0.75rem 0.75rem;
    }

    .site-header::before {
        font-size: 0.8rem;
        letter-spacing: 0.5rem;
        margin-bottom: 0.15rem;
    }

    .header-profile {
        display: none;
    }

    .affiliate-disclosure-hero .disclosure-profile {
        display: block;
    }

    .site-title {
        font-size: clamp(1.5rem, 7vw, 2rem);
        white-space: nowrap;
    }

    .site-subtitle {
        font-size: 0.95rem;
        white-space: nowrap;
        margin-bottom: 0.15rem;
    }

    .site-tagline {
        font-size: 0.8rem;
    }

    .retro-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.65rem;
        margin-top: 0.35rem;
    }

    .section-title {
        font-size: 1.4rem;
        white-space: nowrap;
    }

    .product-title {
        font-size: 1.3rem;
    }

    .archive-card .product-title {
        font-size: 1rem;
    }

    .items-table thead {
        display: none;
    }

    .items-table tr {
        display: grid;
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.5rem;
        padding: 1rem 0;
        border-bottom: 2px dashed var(--accent-mustard);
        align-items: start;
    }

    .items-table td {
        padding: 0;
        border: none;
    }

    .items-table td::before {
        display: none;
    }

    .items-table td[data-label="Image"] {
        grid-row: 1 / 4;
        grid-column: 1;
    }

    .items-table td[data-label="Title"] {
        grid-row: 1;
        grid-column: 2;
    }

    .items-table td[data-label="Date"] {
        grid-row: 2;
        grid-column: 2;
    }

    .items-table td[data-label="Actions"] {
        grid-row: 3;
        grid-column: 2;
    }

    .item-thumb {
        width: 60px;
        height: 60px;
    }

    .item-actions {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .item-actions .btn-small {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .item-title {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .item-tagline {
        font-size: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .admin-header {
        text-align: center;
    }

    .admin-title {
        font-size: 1.75rem;
    }

    .admin-nav-tools {
        gap: 0.15rem;
    }
}
