﻿@font-face {
    font-family: 'Crimson Text';
    src: url('/images/Crimson Text Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand-dark: #0f3054;
    --brand-medium: #2a6fa8;
    --brand-light: #3b8dcb;
    --brand-accent: #77d4fc;
    --warm-gold: #c49a1a;
    --cream: #f5f8fc;
}

body {
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    background-color: var(--cream);
    color: #333;
    position: relative;
    transition: background-color 60s linear;
}

.navbar, .btn, .badge, .form-control, .form-label, .table {
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.navbar-brand {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

/* Weather canvas overlay */
#weatherCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Weather darkness overlay */
#weatherOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 2s ease;
}

/* Ambient color temperature overlay (sun warmth / moon silver) */
#ambientOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9996;
    transition: background 60s linear;
    mix-blend-mode: multiply;
}

/* Celestial body (sun / moon) – moves across the sky */
#celestialBody {
    position: fixed;
    width: 180px;
    height: 180px;
    pointer-events: none;
    z-index: 9997;
    transition: left 60s linear, top 60s linear, opacity 2s ease;
}

/* Sun glow pulse */
@keyframes sunPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.15); opacity: 0.9; }
}

#celestialBody .sun-glow {
    animation: sunPulse 5s ease-in-out infinite;
    transform-origin: center;
}

/* 3D sun-tracking shadows on elements + ambient tint */
.card-farm,
.product-card,
.blog-card,
.about-img,
.card,
.blog-content img,
.table-responsive,
.hero-video-section,
.page-hero {
    box-shadow:
        var(--sun-shadow-x, 0px) var(--sun-shadow-y, 4px) var(--sun-shadow-blur, 15px)
        rgba(0, 0, 0, var(--sun-shadow-opacity, 0.08)),
        0 0 40px var(--ambient-shadow-color, transparent);
    transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 60s linear;
}

.card-farm:hover,
.product-card:hover,
.blog-card:hover,
.about-img:hover,
.blog-content img:hover {
    transform: translateY(-8px);
    box-shadow:
        var(--sun-shadow-x, 0px) calc(var(--sun-shadow-y, 4px) + 20px) calc(var(--sun-shadow-blur, 15px) + 30px)
        rgba(0, 0, 0, calc(var(--sun-shadow-opacity, 0.15) + 0.08)),
        0 8px 60px var(--ambient-shadow-color, transparent);
}

/* Blog content images styling */
.blog-content img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    cursor: default;
}

/* Navbar */
.bg-dark-green {
    background-color: var(--brand-dark) !important;
}

/* Transparent → solid navbar on scroll */
#mainNav {
    transition: background-color 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease;
}

#mainNav.navbar-transparent {
    background-color: transparent !important;
    box-shadow: none;
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
}

#mainNav.navbar-scrolled {
    background-color: var(--brand-dark) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

/* Logo sizing */
.nav-logo {
    transition: height 0.4s ease, filter 0.4s ease;
}

.navbar-transparent .nav-logo {
    height: 70px;
    filter: none;
}

.navbar-scrolled .nav-logo {
    height: 34px;
    filter: brightness(0) invert(1);
}

/* Pages without hero: logo always white */
.no-hero .nav-logo,
.no-hero .navbar-transparent .nav-logo {
    filter: brightness(0) invert(1);
}

/* Navbar brand text */
.navbar-transparent .navbar-brand {
    font-size: 1.8rem;
    transition: font-size 0.4s ease;
}
.navbar-scrolled .navbar-brand {
    font-size: 1.3rem;
    transition: font-size 0.4s ease;
}

/* Pages without hero: navbar is always solid */
.no-hero #mainNav,
.no-hero #mainNav.navbar-transparent {
    background-color: var(--brand-dark) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.no-hero #mainNav .nav-logo,
.no-hero #mainNav.navbar-transparent .nav-logo {
    height: 34px;
}

.no-hero #mainNav .navbar-brand,
.no-hero #mainNav.navbar-transparent .navbar-brand {
    font-size: 1.3rem;
}

h1, h2, h3, h4, h5, h6, .section-title, .display-3 {
    font-family: 'Crimson Text', Georgia, serif;
}


/* Hero section (fallback, used if no video) */
.hero {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-medium) 50%, var(--brand-light) 100%);
    color: white;
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Page hero (inner pages) */
.page-hero {
    position: relative;
    height: 320px;
    margin-top: -100px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(15, 48, 84, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

.page-hero-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    padding-top: 80px;
}

.page-hero-content h1 {
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}

.page-hero-content .lead {
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
    max-width: 600px;
    margin: 0 auto;
}

/* Video hero */
.hero-video-section {
    position: relative;
    height: 100vh;
    min-height: 500px;
    overflow: hidden;
    margin-top: -100px; /* slide under transparent navbar */
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
}

.hero-video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(15, 48, 84, 0.55) 0%,
        rgba(0, 0, 0, 0.4) 100%
    );
    z-index: 1;
}

.hero-video-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.hero-video-content h1 {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-video-content .lead {
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
    max-width: 700px;
}

/* Video banner (mid-page) */
.video-banner {
    position: relative;
    overflow: hidden;
}

.video-banner-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-banner-overlay h2 {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Cards */
.card-farm {
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.card-farm .card-img-top {
    height: 220px;
    object-fit: cover;
}

/* Product cards */
.product-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.product-card:hover {
    border-color: var(--brand-medium);
}

.product-card .price {
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 1.3rem;
}

/* Blog cards */
.blog-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.blog-card .card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn-farm {
    background-color: var(--brand-dark);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    transition: background-color 0.3s;
}

.btn-farm:hover {
    background-color: var(--brand-medium);
    color: white;
}

.btn-outline-farm {
    color: var(--brand-dark);
    border: 2px solid var(--brand-dark);
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    transition: all 0.3s;
}

.btn-outline-farm:hover {
    background-color: var(--brand-dark);
    color: white;
}

/* Section styling */
.section-title {
    color: var(--brand-dark);
    font-weight: 700;
    margin-bottom: 1rem;
}

.section-divider {
    width: 60px;
    height: 3px;
    background-color: var(--brand-accent);
    margin-bottom: 2rem;
    transition: background-color 60s linear;
}

/* About page images */
.about-img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Footer */
footer a:hover {
    color: white !important;
}

/* Badge */
.badge-farm {
background-color: var(--brand-light);
color: white;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* Admin sidebar */
.admin-sidebar {
background-color: var(--brand-dark);
    min-height: calc(100vh - 56px);
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ── WYSIWYG Editor ── */
.wysiwyg-editor {
    border: 1px solid #ced4da;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.wysiwyg-btn-group {
    display: flex;
    gap: 1px;
    margin-right: 6px;
    padding-right: 8px;
    border-right: 1px solid #dee2e6;
}

.wysiwyg-btn-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.wysiwyg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #495057;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.wysiwyg-btn:hover {
    background: #e2e6ea;
    color: #212529;
}

.wysiwyg-btn.active {
    background: var(--brand-dark);
    color: #fff;
}

.wysiwyg-content {
    min-height: 280px;
    max-height: 600px;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #333;
    outline: none;
}

.wysiwyg-content:focus {
    box-shadow: inset 0 0 0 2px rgba(59, 141, 203, 0.15);
}

.wysiwyg-content h2 {
    font-size: 1.5rem;
    margin-top: 1.2rem;
    color: var(--brand-dark);
}

.wysiwyg-content h3 {
    font-size: 1.25rem;
    margin-top: 1rem;
    color: var(--brand-medium);
}

.wysiwyg-content blockquote {
    border-left: 4px solid var(--brand-accent);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: #f5f8fc;
    color: #555;
}

.wysiwyg-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.wysiwyg-content a {
    color: var(--brand-medium);
}

.wysiwyg-source {
    width: 100%;
    min-height: 280px;
    max-height: 600px;
    padding: 12px 16px;
    border: none;
    resize: vertical;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #c7254e;
    background: #1e1e2e;
    color: #cdd6f4;
    outline: none;
}

/* ── Media Library ── */
.media-dropzone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.media-dropzone:hover,
.media-dropzone.drag-over {
    border-color: var(--brand-light);
    background: rgba(59, 141, 203, 0.04);
}

.media-thumb {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    background: #fff;
}

.media-thumb:hover {
    border-color: var(--brand-light);
    transform: translateY(-2px);
}

.media-thumb img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}

.media-thumb-name {
    padding: 6px 8px;
    font-size: 0.72rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Media picker modal (used inside WYSIWYG) */
.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.media-picker-item {
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.media-picker-item:hover,
.media-picker-item.selected {
    border-color: var(--brand-light);
}

.media-picker-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}
