/* index-shop.css — "Shop online, in stock now" on the homepage (index.html).
   Uses index-beta.css / common.css tokens: --font-display, --font-body, --primary,
   --primary-dark, --primary-light, --glass-bg, --bg-card, --border-light, --text-primary,
   --text-secondary, --radius-*, --shadow-*, --space-*. Dark theme = body.dark-mode. */

.i2-shop {
    min-width: 0;
    text-align: left;
    animation: heroFadeIn 0.8s ease-out 0.2s both;
}
.i2-shop[hidden] { display: none; }

/* Hero without the section (empty/failed): one centred column instead of a blank half. */
.hero-container.i2-no-shop { grid-template-columns: 1fr; }
.hero-container.i2-no-shop .hero-content { max-width: 720px; }

.i2-shop-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.35rem;
    color: var(--primary-dark);
    margin: 0;
}
body.dark-mode .i2-shop-title { color: var(--primary-light); }

.i2-shop-sub {
    margin: 4px 0 var(--space-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ---- Tabs ---- */
.i2-shop-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 6px;
    margin-bottom: var(--space-sm);
}
.i2-shop-tabs::-webkit-scrollbar { display: none; }

.i2-tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border-light);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
}
.i2-tab:hover { border-color: var(--primary); }
.i2-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.i2-tab.is-active {
    /* #007a29, not --primary: white on #00b83d is only 2.6:1 */
    background: #007a29;
    border-color: #007a29;
    color: #fff;
}
body.dark-mode .i2-tab.is-active { color: #0d1f12; background: var(--primary-light); border-color: var(--primary-light); }

/* ---- Panel + cards ---- */
.i2-shop-panel {
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
}
.i2-shop-panel:focus { outline: none; }

.i2-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
/* Desktop: 3 x 2. Extra cards exist for the phone row. */
.i2-shop-grid > .i2-card:nth-child(n + 7) { display: none; }

.i2-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-base);
}
a.i2-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
a.i2-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.i2-card-img {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-transparent) 0%, rgba(112, 255, 160, 0.1) 100%);
}
.i2-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.i2-card-img img.i2-img-fallback { object-fit: contain; padding: 18%; opacity: 0.5; }

.i2-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 10px;
    min-width: 0;
}
.i2-card-common {
    font-family: var(--font-body);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.i2-card-botanical {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.i2-card-stock {
    margin-top: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #007a29; /* 4.5:1+ on the card / glass panel */
}
body.dark-mode .i2-card-stock { color: var(--primary-light); }

.i2-shop-seeall {
    display: block;
    margin-top: var(--space-sm);
    text-align: right;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    color: #007a29; /* 4.5:1+ on the card / glass panel */
    text-decoration: none;
    padding: 8px 0;
}
.i2-shop-seeall:hover { text-decoration: underline; }
.i2-shop-seeall[hidden] { display: none; }
body.dark-mode .i2-shop-seeall { color: var(--primary-light); }

/* ---- Skeleton ---- */
.i2-skel { pointer-events: none; }
.i2-tab.i2-skel { width: 110px; background: var(--border-light); border-color: transparent; opacity: 0.6; }
.i2-card.i2-skel .i2-card-img,
.i2-skel-line {
    background: linear-gradient(90deg, rgba(128, 128, 128, 0.12) 25%, rgba(128, 128, 128, 0.22) 50%, rgba(128, 128, 128, 0.12) 75%);
    background-size: 200% 100%;
    animation: i2Shimmer 1.3s linear infinite;
}
.i2-skel-line { display: block; height: 10px; border-radius: 5px; margin: 4px 0; }
.i2-skel-short { width: 60%; }
@keyframes i2Shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    .i2-card.i2-skel .i2-card-img, .i2-skel-line { animation: none; }
}

/* ---- Phone: one swipeable row, next card peeks ---- */
@media (max-width: 640px) {
    .i2-shop-panel {
        background: none;
        box-shadow: none;
        padding: 0;
    }
    .i2-shop-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        /* bleed to the screen edges, keep a 16px gutter */
        /* hero-container padding + the 10px page padding around <main> */
        margin: 0 calc(-1 * (var(--container-padding) + 10px));
        padding: 2px 16px 6px;
        scroll-padding: 0 16px;
    }
    .i2-shop-grid::-webkit-scrollbar { display: none; }
    .i2-shop-grid > .i2-card:nth-child(n + 7) { display: flex; }
    .i2-card {
        flex: 0 0 43vw;
        scroll-snap-align: start;
    }
    .i2-shop-tabs { margin: 0 calc(-1 * (var(--container-padding) + 10px)) var(--space-sm); padding: 2px 16px 6px; }
    .i2-shop-seeall { text-align: right; }
}
