/**
 * Nookipedia-Next Main Styles
 * Design: ACNH Authentic, Mobile-First, Highly Polished
 */

/* --- 1. THEME & VARIABLES (Mobile First) --- */
:root {
    /* Authentic ACNH Palette - Light Mode */
    --ac-bg: #f4f1e1;          /* Soft cream background */
    --ac-surface: #ffffff;     /* Pure white cards */
    --ac-text: #5c4e3f;        /* Warm brown text */
    --ac-text-muted: #968a7c;  /* Softer brown for details */
    --ac-green: #59a683;       /* Nook leaf green */
    --ac-green-light: #e0f2ea; /* Soft green background */
    --ac-bell: #f2c046;        /* Bell coin gold */
    --ac-bell-bg: #fdf3d1;     /* Soft yellow background */
    --ac-blue-light: #e6f4f1;  /* Catchphrase background */
    --ac-shadow: 0 12px 32px rgba(92, 78, 63, 0.08);
    --ac-border: #e8e3d3;      /* Subtle dividers */
    
    /* Layout */
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --nav-height: 70px;
}

[data-theme='dark'] {
    /* Authentic ACNH Palette - Dark Mode */
    --ac-bg: #2b2926;
    --ac-surface: #383531;
    --ac-text: #e8e3d9;
    --ac-text-muted: #a69f95;
    --ac-green: #68c79f;
    --ac-green-light: #2c4a3d;
    --ac-bell: #f5cf66;
    --ac-bell-bg: #4a4022;
    --ac-blue-light: #2d3f3f;
    --ac-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    --ac-border: #4d4943;
}

/* --- 2. BASE & RESET --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    /* Use rounded, friendly fonts if available, fallback to sans-serif */
    font-family: 'Nunito', 'Quicksand', 'Inter', system-ui, sans-serif;
    background-color: var(--ac-bg);
    color: var(--ac-text);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    padding-bottom: 40px;
}

.container {
    width: 100%;
    padding: 0 1.25rem; /* 20px padding for mobile */
    margin: 0 auto;
}

/* --- 3. HEADER & NAVIGATION --- */
header {
    height: var(--nav-height);
    background: var(--ac-surface);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border-bottom: 2px solid var(--ac-green-light);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 900;
    font-size: 1.4rem;
    color: var(--ac-green);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

#theme-toggle {
    background: var(--ac-green-light);
    color: var(--ac-green);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#theme-toggle:active {
    transform: scale(0.85);
}

/* --- 4. HERO SECTION --- */
.hero {
    padding: 2.5rem 0 1.5rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--ac-text);
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.hero p {
    color: var(--ac-text-muted);
    font-size: 1.05rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- 5. CATEGORY SELECTION (HOME) --- */
.category-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cat-card {
    background: var(--ac-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--ac-shadow);
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.cat-card i {
    font-size: 2.5rem;
    background: var(--ac-bg);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.cat-card span {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--ac-text);
}

.cat-card:active {
    transform: scale(0.98);
}

.cat-card.insects { border-color: rgba(89, 166, 131, 0.2); }
.cat-card.fish { border-color: rgba(129, 212, 250, 0.2); }
.cat-card.sea { border-color: rgba(206, 147, 216, 0.2); }

/* --- 6. TAB NAVIGATION (HORIZONTAL SCROLL) --- */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--ac-surface);
    border-radius: 100px;
    margin: 1.5rem 0 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-item {
    flex: 1 0 auto;
    text-align: center;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    color: var(--ac-text-muted);
    font-weight: 800;
    font-size: 0.95rem;
    border-radius: 100px;
    scroll-snap-align: start;
    transition: all 0.2s;
}

.tab-item.active {
    background: var(--ac-green);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(89, 166, 131, 0.3);
}

/* --- 7. CREATURE CARDS (MOBILE FIRST) --- */
.creature-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.creature-card {
    background: var(--ac-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--ac-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    user-select: none;
    -webkit-user-select: none;
    border: 2px solid transparent;
}

/* Header inside Card: Image on left, Title & Price on right */
.creature-card .card-header {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    align-items: center;
}

.creature-card .img-container {
    background: var(--ac-bg);
    border-radius: 50%; /* Perfect circle for ACNH feel */
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px dashed var(--ac-border);
}

.creature-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.creature-card .title-price-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
}

.creature-card .name {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--ac-text);
    line-height: 1.1;
}

.creature-card .price-tag {
    background: var(--ac-bell-bg);
    color: var(--ac-bell);
    padding: 0.35rem 0.8rem;
    border-radius: 100px;
    font-weight: 900;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Soft text shadow to make the yellow pop on cream */
    text-shadow: 0 1px 2px rgba(0,0,0,0.05); 
}

/* Info Section (Time & Season) */
.creature-card .creature-info {
    padding-top: 1rem;
    border-top: 2px dotted var(--ac-border);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.creature-card .info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.creature-card .info-label {
    color: var(--ac-green);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.creature-card .info-value {
    color: var(--ac-text);
    font-weight: 600;
    text-align: right;
    word-wrap: break-word;
}

/* Catchphrase (Blathers' Style) */
.creature-card .catchphrase-box {
    margin-top: 0.5rem;
    padding: 1rem;
    background: var(--ac-blue-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 600;
    color: var(--ac-text-muted);
    text-align: center;
    line-height: 1.4;
}

/* --- 8. TABLET & DESKTOP ENHANCEMENTS --- */
/* Only apply these when there's actually enough space */

@media (min-width: 650px) {
    .container {
        max-width: 600px; /* Constrain width for a single column on tablet */
    }
    
    .category-selection {
        flex-direction: row;
        justify-content: center;
    }
    
    .cat-card {
        flex: 1;
        flex-direction: column;
        padding: 2rem 1rem;
    }
}

@media (min-width: 900px) {
    .container {
        max-width: 1100px;
    }

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

    /* On desktop, cards can hover up */
    .creature-card {
        transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .creature-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 16px 40px rgba(92, 78, 63, 0.12);
        border-color: var(--ac-green-light);
    }
}

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