/* ═══════════════════════════════════════════════
   eNatureFilms — Design System
   Pixel-perfect match to NatureSoul mockup
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --color-primary: #2D5A27;
    --color-primary-dark: #1E3D1A;
    --color-primary-light: #E8F0E6;
    --color-bg: #F5F0E8;
    --color-card: #FFFFFF;
    --color-text: #1A1A1A;
    --color-text-secondary: #6B6B6B;
    --color-text-on-dark: #FFFFFF;
    --color-border: #E5E0D8;
    --color-shadow: rgba(0,0,0,0.08);
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;
    --shadow-card: 0 2px 12px var(--color-shadow);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --transition: 0.25s ease;
    /* Gallery thumbnail width; the detail hero is sized at 1.5x this. */
    --gallery-thumb: 104px;
}

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

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Top Bar ─────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--color-bg);
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo .logo-icon {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

.topbar-logo .logo-text {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}

.topbar-logo .logo-tagline {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-primary);
    opacity: 0.8;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-bell {
    font-size: 20px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.topbar-user-info {
    font-size: 12px;
    line-height: 1.3;
}

.topbar-user-info .welcome { color: var(--color-text-secondary); }
.topbar-user-info .name { font-weight: 600; color: var(--color-text); }

/* User menu dropdown */
.topbar-menu { position: relative; }

.topbar-menu .topbar-user {
    background: none;
    border: none;
    padding: 6px 8px;
    margin: 0;
    border-radius: var(--radius-md, 8px);
    font-family: inherit;
    text-align: left;
    transition: background 0.15s ease;
}

.topbar-menu .topbar-user:hover { background: rgba(0, 0, 0, 0.04); }

.topbar-caret {
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.topbar-menu.open .topbar-caret { transform: rotate(180deg); }

.topbar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.topbar-menu.open .topbar-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.topbar-dropdown a {
    display: block;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
}

.topbar-dropdown a:hover { background: var(--color-primary-light, rgba(0, 0, 0, 0.05)); }

.topbar-dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 4px;
}

.topbar-dropdown-danger { color: #dc2626 !important; }
.topbar-dropdown-danger:hover { background: rgba(220, 38, 38, 0.08) !important; }

/* ─── Search Bar ──────────────────────────── */
.search-bar {
    padding: 0 20px 16px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-card);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-text);
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.search-input::placeholder { color: var(--color-text-secondary); }

/* ─── Hero Section ────────────────────────── */
.hero {
    position: relative;
    padding: 60px 24px 40px;
    background-size: cover;
    background-position: center;
    background-image: linear-gradient(rgba(0,0,0,0.25), rgba(0,0,0,0.4)), url('/media/heroes/hero-main.jpg');
    color: var(--color-text-on-dark);
    border-radius: 0;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hero-headline {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 12px;
    white-space: pre-line;
}

.hero-headline .leaf { font-style: normal; }

/* Brand logo replacement for 🌿 — inline (within text) and block (standalone) variants */
/* `display: inline-block` and `max-height: 1em` are required to overcome the global
   `img { display: block; max-width: 100% }` rule above. */
.brand-mark-inline {
    display: inline-block !important;
    height: 1em !important;
    width: auto !important;
    max-height: 1em !important;
    max-width: 1.6em !important;
    vertical-align: -0.18em;
    margin-right: 0.25em;
    object-fit: contain;
}
.brand-mark-block-md {
    width: 48px; height: 48px;
    max-width: 48px; max-height: 48px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}
.brand-mark-block-lg {
    width: 64px; height: 64px;
    max-width: 64px; max-height: 64px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}
.brand-mark-avatar {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 8px;
    box-sizing: border-box;
}

.hero-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 24px;
    line-height: 1.5;
    max-width: 400px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--color-primary);
    color: var(--color-text-on-dark);
    border: none;
    border-radius: var(--radius-xl);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.btn-primary:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: transparent;
    color: var(--color-text-on-dark);
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: var(--radius-xl);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-outline:hover { border-color: white; background: rgba(255,255,255,0.1); }

/* ─── Five Pillars ────────────────────────── */
.pillars {
    display: flex;
    justify-content: space-between;
    padding: 32px 20px;
    gap: 8px;
    overflow-x: auto;
}

.pillar {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 100px;
    flex: 1;
}

.pillar-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    color: var(--color-primary);
}

.pillar-icon svg { width: 28px; height: 28px; }

.pillar-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.pillar-desc {
    font-size: 10px;
    color: var(--color-text-secondary);
    line-height: 1.3;
}

/* ─── Section Headers ─────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    margin-bottom: 16px;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-bar {
    width: 3px;
    height: 28px;
    background: var(--color-primary);
    border-radius: 2px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.section-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.view-all {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    transition: all var(--transition);
}

.view-all:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ─── Category Cards Grid ─────────────────── */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 0 20px;
    margin-bottom: 32px;
}

.category-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 3/4;
    cursor: pointer;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(var(--cat-scale, 1));
    transition: transform 0.4s ease;
}

.category-card:hover img { transform: scale(calc(var(--cat-scale, 1) * 1.08)); }

.category-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.category-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.category-card-name {
    color: white;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.category-play {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.25);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-play svg { width: 12px; color: white; }

/* ─── Eco Banner ──────────────────────────── */
.eco-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 8px 20px 24px;
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.eco-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: var(--color-primary-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.eco-text { flex: 1; }
.eco-title { font-size: 14px; font-weight: 600; }
.eco-desc { font-size: 11px; color: var(--color-text-secondary); }

.eco-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* ─── Trending / Video Cards Row ──────────── */
.video-row {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 32px;
    scrollbar-width: none;
}

.video-row::-webkit-scrollbar { display: none; }

.video-card {
    flex: 0 0 170px;
    scroll-snap-align: start;
    cursor: pointer;
}

.video-card-thumb {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/10;
    margin-bottom: 8px;
}

.video-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.video-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
}

/* ─── Featured Creators ───────────────────── */
.creators-row {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    overflow-x: auto;
    margin-bottom: 32px;
    scrollbar-width: none;
}

.creators-row::-webkit-scrollbar { display: none; }

.creator-card {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 10px;
    background: var(--color-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

.creator-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.creator-info { line-height: 1.3; }
.creator-name { font-size: 13px; font-weight: 600; }
.creator-followers { font-size: 11px; color: var(--color-text-secondary); }

.btn-follow {
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-follow:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ─── Articles Row ────────────────────────── */
.articles-row {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    overflow-x: auto;
    margin-bottom: 100px;
    scrollbar-width: none;
}

.articles-row::-webkit-scrollbar { display: none; }

.article-card {
    flex: 0 0 200px;
    display: flex;
    gap: 10px;
    cursor: pointer;
}

.article-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.article-info { flex: 1; }
.article-title { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.article-meta { font-size: 11px; color: var(--color-text-secondary); display: flex; align-items: center; gap: 4px; }

/* ─── Bottom Nav ──────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    z-index: 1000;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--color-text-secondary);
    transition: color var(--transition);
    padding: 4px 12px;
}

.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a svg { width: 22px; height: 22px; }

.bottom-nav .watch-btn {
    width: 52px;
    height: 52px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 12px rgba(45,90,39,0.3);
}

.bottom-nav .watch-btn svg { width: 24px; height: 24px; color: white; }

/* ─── Purchase & Auth Forms ───────────────── */
.form-container {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 20px;
}

.form-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-card);
}

.form-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border var(--transition);
}

.form-input:focus { border-color: var(--color-primary); }

.form-error {
    background: #FEF2F2;
    color: #B91C1C;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.form-success {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.form-submit {
    width: 100%;
    padding: 14px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.form-submit:hover { background: var(--color-primary-dark); }

.form-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.form-link a { color: var(--color-primary); font-weight: 600; }

/* ─── Pricing Tiers ───────────────────────── */
.pricing-tiers {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.pricing-tier {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.pricing-tier:hover, .pricing-tier.active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.pricing-tier .price {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
}

.pricing-tier .duration {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* ─── Video Detail Page ───────────────────── */
.video-detail-hero {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    /* Keep the poster ~50% larger than a gallery thumb so the low-res
       source isn't stretched to full width. */
    width: 100%;
    max-width: calc(var(--gallery-thumb) * 1.5);
    margin: 16px auto 0;
    border-radius: var(--radius-md);
}

.video-detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

/* Gallery: responsive grid that wraps instead of scrolling off-screen.
   Fixed-width columns (auto-fill) keep thumbs a consistent size at every
   viewport, and the grid is centered so it never overflows on a phone. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--gallery-thumb));
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    margin-bottom: 32px;
}

.gallery-grid > div {
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/10;
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Category listing: same poster scale as the detail page (1.5x a gallery
   thumb) in a centered, wrapping grid, so low-res thumbnails aren't stretched
   across the full width. */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, calc(var(--gallery-thumb) * 1.5));
    justify-content: center;
    gap: 16px;
    padding: 0 20px;
    margin-bottom: 32px;
}

.video-grid .video-card {
    flex: none;
    width: 100%;
}

.video-detail-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-detail-info { padding: 24px 20px; }

.video-detail-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.video-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

/* ─── Responsive Desktop ──────────────────── */
@media (min-width: 768px) {
    .topbar { padding: 16px 40px; }
    .search-bar { padding: 0 40px 20px; }
    .hero { padding: 80px 40px 60px; min-height: 400px; }
    .hero-headline { font-size: 48px; }
    .categories-grid { padding: 0 40px; }
    .video-row, .creators-row, .articles-row { padding: 0 40px; }
    .gallery-grid { padding: 0 40px; }
    .video-grid { padding: 0 40px; }
    .section-header { padding: 0 40px; }
    .eco-banner { margin: 8px 40px 24px; }
    .bottom-nav { display: none; }
    .form-container { padding: 0; }
    /* Larger thumbs (and a proportionally larger hero) on wider screens. */
    :root { --gallery-thumb: 150px; }
}

@media (min-width: 1024px) {
    .hero-headline { font-size: 56px; }
    .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .video-card { flex: 0 0 220px; }
    :root { --gallery-thumb: 190px; }
}

/* ─── Utility ─────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-32 { margin-bottom: 32px; }
.pb-safe { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
