/* ============================================
   altIMHO Wishlist — Warm Editorial Style
   ============================================ */

:root {
    --color-bg: #FDF6EC;
    --color-bg-warm: #F8EDDB;
    --color-text: #2D2A26;
    --color-text-muted: #7A7067;
    --color-accent: #C4654A;
    --color-accent-hover: #A8503A;
    --color-star-filled: #D4A017;
    --color-star-empty: #D9CCBB;
    --color-card-bg: #FFFCF7;
    --color-card-shadow: rgba(45, 42, 38, 0.08);
    --color-card-shadow-hover: rgba(45, 42, 38, 0.16);
    --color-overlay: rgba(45, 42, 38, 0.6);
    --color-modal-bg: #FFFDF9;
    --color-border: #E8DFD2;
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ---- Reset & Base ---- */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- Subtle grain texture overlay ---- */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Header ---- */

.site-header {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.site-header::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--color-accent);
    border-radius: 2px;
    margin: 1.5rem auto 0;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
    line-height: 1.1;
}

.site-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    font-weight: 400;
    color: var(--color-text-muted);
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
}

/* ---- Container ---- */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

/* ---- Card Grid ---- */

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

/* ---- Card ---- */

.card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 12px var(--color-card-shadow);
    cursor: pointer;
    transition:
        transform var(--transition),
        box-shadow var(--transition);
    outline: none;
    position: relative;
}

.card:hover,
.card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--color-card-shadow-hover);
}

.card:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Staggered entrance animation */
.card {
    animation: cardIn 0.5s ease both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Card Image ---- */

.card-image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-bg-warm);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

/* ---- Card Body ---- */

.card-body {
    padding: 1rem 1.1rem 1.1rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 0.35rem;
}

/* ---- Category ---- */

.card-category {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.detail-category {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
    margin-bottom: 0.9rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ---- Stars ---- */

.card-stars,
.detail-stars {
    display: flex;
    gap: 2px;
}

.star {
    font-size: 1rem;
    color: var(--color-star-empty);
    line-height: 1;
    transition: color 0.15s ease;
}

.star.filled {
    color: var(--color-star-filled);
}

/* ---- Modal Overlay ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--color-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ---- Modal Content ---- */

.modal-content {
    background: var(--color-modal-bg);
    border-radius: var(--radius);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(45, 42, 38, 0.25);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: var(--color-text);
    color: var(--color-card-bg);
    border-color: var(--color-text);
}

/* ---- Modal Body / Detail ---- */

.modal-body {
    display: flex;
    flex-direction: column;
}

/* ---- Gallery ---- */

.gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--color-bg-warm);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.gallery-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.gallery-slide {
    min-width: 100%;
    flex-shrink: 0;
    height: 100%;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 0 2px 0;
}

.gallery-prev { left: 0.75rem; }
.gallery-next { right: 0.75rem; }

.gallery-prev:hover,
.gallery-next:hover {
    background: var(--color-text);
    color: #fff;
    border-color: var(--color-text);
}

.gallery-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.gallery-dot.active {
    background: #fff;
    transform: scale(1.25);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.detail-info {
    padding: 1.5rem 1.75rem 2rem;
}

.detail-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.detail-stars {
    margin-bottom: 1rem;
}

.detail-stars .star {
    font-size: 1.2rem;
}

.detail-description {
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.detail-description p {
    margin-bottom: 0.5rem;
}

.detail-description p:last-child {
    margin-bottom: 0;
}

/* ---- Detail Links ---- */

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

.detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-accent);
    background: transparent;
    border: 1.5px solid var(--color-accent);
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.detail-link svg {
    flex-shrink: 0;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .site-header {
        padding: 2rem 1rem 1.5rem;
    }

    .container {
        padding: 0.75rem 0.75rem 3rem;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .card-body {
        padding: 0.75rem 0.8rem 0.85rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .star {
        font-size: 0.85rem;
    }

    /* Full-screen modal on small screens */
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }

    .detail-image {
        border-radius: 0;
    }

    .detail-info {
        padding: 1.25rem 1.25rem 2rem;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1100px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- Scrollbar styling (webkit) ---- */

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

/* ---- Hidden utility ---- */

[hidden] {
    display: none !important;
}
