/* =====================================================
   pantry.css  —  Pantry as Medicine / Kitchen Apothecary
   ===================================================== */

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

.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(9,9,9,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(247,244,239,0.1);
}

.site-title {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.8;
}

.back-link {
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.back-link:hover { opacity: 1; }

/* ---- Main layout ---- */

.main-content {
    padding: 8rem 4rem 4rem;
    max-width: 1600px;
    margin: 0 auto;
}

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

.category-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.category-tab {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
    padding: 0;
    flex: 1;
    min-width: 80px;
    max-width: 140px;
}

.category-tab img { width: 100%; height: auto; display: block; transition: opacity 0.3s ease; }
.category-tab:hover { opacity: 0.8; }
.category-tab.active { opacity: 1; }

/* ---- Storage toggle / controls bar ---- */

.storage-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.storage-toggle {
    position: relative;
    width: 80px;
    height: 36px;
    background: #000000;
    border-radius: 18px;
    border: 1px solid rgba(247,244,239,0.3);
    cursor: pointer;
    transition: background 0.3s ease;
}

.storage-toggle.active { background: #404040; }

.toggle-circle {
    position: absolute;
    top: 4px; right: 4px;
    width: 26px; height: 26px;
    background: var(--text-light);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.storage-toggle.active .toggle-circle { transform: translateX(-46px); }

.snowflake-icon {
    position: absolute;
    left: 8px; top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    opacity: 0.6;
    stroke: var(--text-light);
    pointer-events: none;
    z-index: 1;
}

.storage-toggle.active .snowflake-icon { opacity: 0.9; }

.sort-select {
    background: rgba(10,10,10,0.8);
    border: 1px solid rgba(247,244,239,0.3);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    font-family: 'Cormorant Garamond', Georgia, serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-select:hover { border-color: rgba(247,244,239,0.6); background: rgba(247,244,239,0.05); }
.sort-select option { background: #090909; color: var(--text-light); }

.mute-button-main {
    background: rgba(247,244,239,0.1);
    border: 1px solid rgba(247,244,239,0.3);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

.mute-button-main:hover { background: rgba(247,244,239,0.15); border-color: rgba(247,244,239,0.5); }
.mute-button-main.muted { background: rgba(247,244,239,0.05); opacity: 0.5; }

/* ---- Cold storage badge on cards ---- */

.cold-storage-badge {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    width: 16px; height: 16px;
    opacity: 0.4;
}

.ingredient-card:hover .cold-storage-badge { opacity: 0.7; }

/* ---- Ingredient grid ---- */

.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
    justify-content: center;
    justify-items: center;
}

.ingredient-card {
    border: 1px solid var(--text-light);
    padding: 2rem;
    background: rgba(10,10,10,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    max-width: 300px;
    width: 100%;
}

.ingredient-card:hover {
    background: rgba(247,244,239,0.05);
    box-shadow: 0 0 20px rgba(247,244,239,0.1);
}

.ingredient-name {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: capitalize;
    margin-bottom: 1rem;
}

/* ---- Health score bar ---- */

.health-score-container { margin-top: 1rem; position: relative; }

.health-score-bar {
    width: 100%; height: 4px;
    background: rgba(247,244,239,0.2);
    position: relative; overflow: hidden;
    cursor: help;
}

.health-score-fill { height: 100%; background: var(--text-light); transition: width 0.5s ease; }

.health-score-tooltip {
    position: absolute;
    bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(247,244,239,0.95);
    color: #090909;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.health-score-container:hover .health-score-tooltip { opacity: 1; }

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

.category-section { display: none; }
.category-section.active { display: block; }

.category-title {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    opacity: 0.7;
    border-bottom: 1px solid rgba(247,244,239,0.2);
    padding-bottom: 1rem;
}

/* ---- Modal overlay ---- */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(9,9,9,0.98);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    overflow-y: auto;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content { max-width: 1200px; margin: 4rem auto; padding: 4rem; position: relative; }

.modal-close {
    position: fixed;
    top: 2rem; right: 4rem;
    font-size: 2rem;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.modal-close:hover { opacity: 1; }

.modal-title {
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: capitalize;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-score { text-align: center; font-size: 1.2rem; letter-spacing: 0.1em; margin-bottom: 2rem; opacity: 0.7; }

.modal-score-bar {
    width: 300px; height: 8px;
    background: rgba(247,244,239,0.2);
    margin: 1rem auto;
    position: relative; overflow: visible;
}

.modal-score-fill {
    height: 100%;
    background: var(--text-light);
    transition: width 0.8s ease;
    position: relative;
    transform-origin: left center;
}

.modal-score-fill.dancing { animation: organicPulse 0.4s ease-in-out infinite; }

.modal-score-fill.dancing::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(247,244,239,0.6), transparent);
    animation: sweepGradient 2.3s linear infinite;
}

.modal-score-fill.dancing::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: var(--text-light);
    opacity: 0;
    filter: blur(4px);
    animation: glowPulse 0.7s ease-in-out infinite;
    z-index: -1;
}

@keyframes organicPulse {
    0%   { transform: scaleY(1); }
    20%  { transform: scaleY(1.25); }
    45%  { transform: scaleY(0.9); }
    60%  { transform: scaleY(1.15); }
    80%  { transform: scaleY(1.05); }
    100% { transform: scaleY(1); }
}

@keyframes sweepGradient {
    0%   { left: -100%; }
    100% { left: 200%; }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0; }
    15%       { opacity: 0.3; }
    30%       { opacity: 0.1; }
    50%       { opacity: 0.4; }
    70%       { opacity: 0.05; }
}

/* ---- Modal info layout ---- */

.info-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }

.info-section { border: 1px solid rgba(247,244,239,0.2); padding: 2rem; }

.info-section-title {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.info-section ul { list-style: none; padding: 0; }

.info-section li {
    font-size: 0.95rem;
    line-height: 1.8;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
    opacity: 0.85;
}

.info-section li:before { content: "•"; position: absolute; left: 0; opacity: 0.5; }

.considerations-section { border: 1px solid rgba(247,244,239,0.3); padding: 2rem; background: rgba(247,244,239,0.02); }

.modal-placeholder { text-align: center; padding: 4rem 2rem; opacity: 0.6; }
.modal-placeholder p { font-size: 1.2rem; letter-spacing: 0.05em; line-height: 1.8; margin-bottom: 1rem; }

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

@media (max-width: 768px) {
    .header { padding: 1.5rem 2rem; }
    .main-content { padding: 6rem 2rem 2rem; }
    .category-tabs { gap: 0.5rem; }
    .category-tab { min-width: 60px; max-width: 100px; }
    .storage-toggle-container { gap: 1rem; margin-bottom: 2rem; }
    .storage-toggle { width: 70px; height: 32px; }
    .toggle-circle { width: 24px; height: 24px; top: 3px; right: 3px; }
    .storage-toggle.active .toggle-circle { transform: translateX(-40px); }
    .snowflake-icon { width: 16px; height: 16px; left: 6px; }
    .sort-select { font-size: 0.75rem; padding: 0.4rem 0.8rem; }
    .mute-button-main { font-size: 0.75rem; padding: 0.4rem 0.8rem; }
    .cold-storage-badge { width: 14px; height: 14px; top: 0.6rem; right: 0.6rem; }
    .ingredients-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
    .ingredient-card { padding: 1.5rem; }
    .modal-content { padding: 2rem; margin: 2rem 1rem; }
    .modal-close { right: 2rem; }
    .modal-title { font-size: 2rem; }
    .modal-score-bar { width: 250px; height: 6px; }
    .info-sections { grid-template-columns: 1fr; gap: 2rem; }
    .info-section, .considerations-section { padding: 1.5rem; }
}
