:root {
    --bg: #0f172a;
    --panel: #111827;
    --panel-2: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: #f8fafc;
}
.container {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}
.site-header {
    background: var(--bg);
    color: #fff;
    padding: 1rem 0;
}
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.logo {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    text-decoration: none;
}
.tagline {
    margin: .25rem 0 0;
    color: #cbd5e1;
}
nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 1rem;
}
.hero {
    padding: 2rem 0 1rem;
}
.refresh-note {
    color: var(--muted);
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* default = 3 */
    gap: 1rem;
    padding: 1rem 0 3rem;
    align-items: start;
}

/* Only go to 4 columns on very wide screens */
@media (min-width: 1300px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Tablet */
@media (max-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile */
@media (max-width: 520px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-top: 24px;
}
.image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 1rem;
    height: 280px; /* fixed image area */
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0; 
}
.image-wrap img,
.detail-image img {
    display: block;
    max-width: 100%;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
}
.card-body {
    padding: 1rem;
}
.rank {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: .5rem;
}
.card h2 {
    margin: 0 0 .5rem;
    font-size: 1rem;
    line-height: 1.4;
}
.card h2 a { color: inherit; text-decoration: none; }
.brand {
    color: var(--muted);
    margin: 0 0 .75rem;
}
.button {
    display: inline-block;
    text-decoration: none;
    background: var(--accent);
    color: #fff;
    padding: .75rem 1rem;
    border-radius: 10px;
    font-weight: 700;
}
.button:hover { background: var(--accent-dark); }
.button-large { padding: 1rem 1.25rem; }
.site-footer {
    padding: 1.5rem 0;
    border-top: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}
.detail-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 2rem;
    padding: 2rem 0 3rem;
}
.detail-image {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 1.5rem;
    min-height: 420px;
}
.description-box,
.content-page,
.empty-state {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1rem 0 2rem;
}
.price-large {
    font-size: 1.5rem;
    font-weight: 700;
}
.image-placeholder {
    width: 100%;
    height: 100%;
    background: #e5e7eb;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--muted);
}
@media (max-width: 840px) {
    .header-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem 1rem;
        width: 100%;
    }

    nav a {
        margin-left: 0;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }
}

/* Force both product card buttons to show */
.card-meta {
    margin-top: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.card-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.card-actions .button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.card-actions .button.secondary {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

.card-actions .button.secondary:hover {
    background: #e2e8f0 !important;
}

.card-actions .button.primary {
    background: #2563eb !important;
    color: #ffffff !important;
}

.card-actions .button.primary:hover {
    background: #1d4ed8 !important;
}

.button.primary {
    background: #2563eb;
    color: #fff;
}

.button.primary:hover {
    background: #1d4ed8;
}

.button.secondary {
    background: #f1f5f9;
    color: #1e293b;
}

.button.secondary:hover {
    background: #e2e8f0;
}


/* ===== Product Page ===== */

.product-page {
    max-width: 1200px;
    margin: 0 auto;
}

.back-link {
    margin-bottom: 1.5rem;
}

.back-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* TOP ROW ONLY */
.product-top {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 2rem;
    align-items: start; /* important */
    margin-bottom: 3rem;
}

.product-image-card,
.product-info-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.product-image-card {
    padding: 1.25rem;
    align-self: start; /* important */
}

.product-image-card img {
    width: 100%;
    display: block;
    border-radius: 14px;
    object-fit: contain;
    background: #fff;
}

.product-info-card {
    padding: 1.75rem;
}

.product-info-card h1 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 2rem;
    line-height: 1.2;
}

.brand {
    margin: 0 0 0.75rem;
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

.price-large {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

.description-box {
    padding: 1.25rem;
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.description-box h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.description-box p {
    margin: 0;
    line-height: 1.6;
    color: #334155;
}

.product-cta {
    margin: 0;
}

.buy-button {
    display: inline-block;
    padding: 0.9rem 1.4rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
}

/* RESEARCH BELOW */
.research-section {
    margin-top: 0;
    clear: both;
}

.research-title {
    margin: 0 0 1.25rem;
    font-size: 2rem;
    line-height: 1.2;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.research-block {
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.research-block:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.research-block h3 {
    margin: 0 0 0.6rem;
    font-size: 1.2rem;
    line-height: 1.3;
}

.research-block p {
    margin: 0 0 1rem;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.45;
}

.research-block ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.research-block li {
    margin: 0 0 0.6rem;
}

.research-block li:last-child {
    margin-bottom: 0;
}

.research-block a {
    display: inline-block;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.research-block a:hover {
    transform: translateY(-1px);
}

.reddit-block a {
    background: #fff1ed;
    color: #ea580c;
}

.reddit-block a:hover {
    background: #fed7aa;
    color: #c2410c;
}

.youtube-block a {
    background: #fef2f2;
    color: #dc2626;
}

.youtube-block a:hover {
    background: #fecaca;
    color: #b91c1c;
}

.google-block a {
    background: #eff6ff;
    color: #2563eb;
}

.google-block a:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.guides-block a {
    background: #f5f3ff;
    color: #7c3aed;
}

.guides-block a:hover {
    background: #e9d5ff;
    color: #6d28d9;
}

@media (max-width: 900px) {
    .product-top,
    .research-grid {
        grid-template-columns: 1fr;
    }

    .product-info-card h1,
    .research-title {
        font-size: 1.7rem;
    }

    .price-large {
        font-size: 1.5rem;
    }
}

/* =========================
   CARD ACTIONS (Index Page)
========================= */

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button.primary {
    background: #2563eb;
    color: #fff;
}

.button.secondary {
    background: #f1f5f9;
    color: #1e293b;
}

.button.secondary:hover {
    background: #e2e8f0;
}


/* =========================
   PRODUCT PAGE
========================= */

.product-page {
    max-width: 1200px;
    margin: 0 auto;
}

.back-link {
    margin-bottom: 1.5rem;
}

.back-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}


/* ===== TOP PRODUCT SECTION ===== */

.product-top {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    align-items: start; /* critical: prevents image stretching */
    margin-bottom: 3rem;
}

.product-image-card,
.product-info-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

/* Image */
.product-image-card {
    padding: 1.25rem;
    align-self: start; /* critical */
}

.product-image-card img {
    width: 100%;
    display: block;
    border-radius: 14px;
    object-fit: contain;
    background: #fff;
}

/* Info */
.product-info-card {
    padding: 1.75rem;
}

.product-info-card h1 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 2rem;
    line-height: 1.2;
}

.brand {
    margin: 0 0 0.75rem;
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

.price-large {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

/* Description */
.description-box {
    padding: 1.25rem;
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.description-box h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.description-box p {
    margin: 0;
    line-height: 1.6;
    color: #334155;
}

/* Button */
.product-cta {
    margin: 0;
}

.buy-button {
    display: inline-block;
    padding: 0.9rem 1.4rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.buy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
}


/* =========================
   RESEARCH SECTION
========================= */

.research-section {
    margin-top: 0;
}

.research-title {
    margin: 0 0 1.25rem;
    font-size: 2rem;
    line-height: 1.2;
}

/* Grid */
.research-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

/* Cards */
.research-block {
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
}

.research-block:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.research-block h3 {
    margin: 0 0 0.6rem;
    font-size: 1.2rem;
}

.research-block p {
    margin: 0 0 1rem;
    color: #475569;
    font-size: 0.95rem;
}

.research-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.research-block li {
    margin-bottom: 0.6rem;
}

/* Links */
.research-block a {
    display: inline-block;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.research-block a:hover {
    transform: translateY(-1px);
}

/* Colors */
.reddit-block a {
    background: #fff1ed;
    color: #ea580c;
}
.reddit-block a:hover {
    background: #fed7aa;
}

.youtube-block a {
    background: #fef2f2;
    color: #dc2626;
}
.youtube-block a:hover {
    background: #fecaca;
}

.google-block a {
    background: #eff6ff;
    color: #2563eb;
}
.google-block a:hover {
    background: #dbeafe;
}

.guides-block a {
    background: #f5f3ff;
    color: #7c3aed;
}
.guides-block a:hover {
    background: #e9d5ff;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 900px) {
    .product-top {
        grid-template-columns: 1fr;
    }

    .research-grid {
        grid-template-columns: 1fr;
    }

    .product-info-card h1,
    .research-title {
        font-size: 1.6rem;
    }

    .price-large {
        font-size: 1.4rem;
    }
}

/* ===== BADGES ===== */

.card {
    position: relative;
    overflow: visible;
}

.card-body {
    position: relative;
    padding-top: 3.2rem; /* makes room for the ribbon */
}

/* Ribbon wrapper */
.product-badge-ribbon {
    position: absolute;
    top: 12px;
    left: -60px;
    z-index: 5;
    transform: rotate(-35deg);
    transform-origin: center;
    pointer-events: none;
    transition: transform 0.25s ease, filter 0.25s ease;
}

/* Ribbon text */
.product-badge-ribbon span {
    display: inline-block;
    width: 210px;
    text-align: center;
    padding: 0.45rem 1rem;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
    background: linear-gradient(135deg, #eba625, #d8971d);
    white-space: nowrap;
}

/* Hover effect */
.card:hover .product-badge-ribbon {
    transform: rotate(-35deg) translateY(-2px) scale(1.04);
    filter: brightness(1.04);
}

/* Badge color themes */
.product-badge-ribbon.best-overall span {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.product-badge-ribbon.most-popular span {
    background: linear-gradient(135deg, #f5d33e, #d9b206);
}

.product-badge-ribbon.best-value span {
    background: linear-gradient(135deg, #10b981, #059669);
}

.product-badge-ribbon.best-for-gaming span {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.product-badge-ribbon.best-for-travel span {
    background: linear-gradient(135deg, #2d708f, #25607e);
}

.product-badge-ribbon.trending span {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

/* ORANGE BADGES */
.product-badge-ribbon.best-headphones span,
.product-badge-ribbon.best-budget-smart-cam span,
.product-badge-ribbon.best-budget-streaming span,
.product-badge-ribbon.best-tv-overall span,
.product-badge-ribbon.best-budget-lighting span {
    background: linear-gradient(135deg, #eba625, #d8971d);
    color: #fff;
}


/* ===== FILTERS ===== */
.filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin: 0 0 70px;
}

.filters select {
    min-width: 180px;
    padding: 10px 14px;
    border: 1px solid #d6dbe1;
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
}