/* ──────────────────────────────────────────────────────────────
   Harvest Meter — Kota Natural Farm
   Owns all visual styling for harvest.html.
   Design tokens (colors) are duplicated in js/harvest/config.js
   so charts can match the page palette.
   ────────────────────────────────────────────────────────────── */

:root {
    --earth-dark: #2d3319;
    --earth-medium: #4a5a2f;
    --earth-light: #8b9862;
    --sand: #e8dcc4;
    --clay: #c4a572;
    --sprout: #a8c686;
    --water: #6b9080;
    --leaf: #5a7a3a;
    --bg: #f5f3ef;
    --card: #ffffff;
    --shadow-sm: 0 2px 10px rgba(45,51,25,0.06);
    --shadow-md: 0 4px 20px rgba(45,51,25,0.10);
    --quality-high: #5a7a3a;
    --quality-medium: #c4a572;
    --quality-low: #b06a4f;
}

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

html { scroll-behavior: smooth; overflow-x: clip; }
body {
    font-family: 'Work Sans', sans-serif;
    color: var(--earth-dark);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Top bar with back link ──────────────────────────── */
.hv-topbar {
    background: var(--earth-dark);
    padding: 0.85rem 1.5rem;
}
.hv-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.hv-back {
    color: var(--sand);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    margin-left: -0.7rem;
    border-radius: 8px;
    transition: background 0.18s ease;
}
.hv-back:hover { background: rgba(255,255,255,0.08); }
.hv-back-arrow {
    font-size: 1.05rem;
    transition: transform 0.18s ease;
}
.hv-back:hover .hv-back-arrow { transform: translateX(-3px); }
.hv-topbar-brand {
    color: var(--sprout);
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-decoration: none;
}
.hv-topbar-brand:hover { color: var(--sand); }

/* ── Page header (hero with farm photo) ──────────────── */
.hv-header {
    position: relative;
    min-height: 360px;
    padding: 5rem 1.5rem 4rem;
    text-align: center;
    color: var(--sand);
    background: linear-gradient(135deg, rgba(45,51,25,0.65) 0%, rgba(74,90,47,0.55) 100%),
                url('../site-images/hero-background.jpeg') center/cover no-repeat;
    border-bottom: 1px solid rgba(139,152,98,0.25);
    overflow: hidden;
}
@media (max-width: 600px) {
    .hv-header { padding: 3.5rem 1.2rem 2.8rem; min-height: 280px; }
}
.hv-header h1 {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 700;
    color: var(--sand);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 18px rgba(0,0,0,0.35);
}
.hv-header p {
    color: rgba(232,220,196,0.92);
    font-size: 1.05rem;
    font-weight: 300;
    max-width: 580px;
    margin: 0 auto;
    text-shadow: 0 1px 10px rgba(0,0,0,0.25);
}
.hv-live-dot {
    display: inline-block;
    position: relative;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--sprout);
    margin-right: 10px;
    vertical-align: middle;
    animation: liveCore 2.2s ease-in-out infinite;
}
.hv-live-dot::before,
.hv-live-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--sprout);
    animation: liveRipple 2.2s ease-out infinite;
    opacity: 0;
    pointer-events: none;
}
.hv-live-dot::after {
    animation-delay: 1.1s;
}
@keyframes liveCore {
    0%, 100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(168,198,134,0.55); }
    50%      { transform: scale(1.15); box-shadow: 0 0 8px 2px rgba(168,198,134,0.45); }
}
@keyframes liveRipple {
    0%   { transform: scale(1);   opacity: 0.65; }
    80%  { opacity: 0; }
    100% { transform: scale(4);   opacity: 0; }
}
.hv-live-label {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--sand);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
    opacity: 0.92;
}
.hv-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.4rem;
    padding: 0.7rem 1.3rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37,211,102,0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.hv-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(37,211,102,0.45);
}
.hv-share-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ── Site footer (crisp, no image) ───────────────────── */
.hv-site-footer {
    background: var(--earth-dark);
    color: var(--sand);
    padding: 2.4rem 1.5rem 2rem;
    text-align: center;
    margin-top: 3rem;
}
.hv-site-footer-name {
    font-family: 'Crimson Pro', serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.hv-site-footer-tagline {
    opacity: 0.7;
    font-size: 0.88rem;
    margin-bottom: 1.1rem;
}
.hv-site-footer-links {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.hv-site-footer-links a {
    color: var(--sprout);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}
.hv-site-footer-links a:hover { color: var(--sand); text-decoration: underline; }
.hv-site-footer-copyright {
    opacity: 0.5;
    font-size: 0.8rem;
}

/* ── Container ─────────────────────────────────────── */
.hv-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ── Filter bar ────────────────────────────────────── */
.hv-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    align-items: center;
}
.hv-filter-group {
    display: flex;
    gap: 0.4rem;
    background: var(--card);
    padding: 0.35rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.hv-filter-btn {
    border: none;
    background: transparent;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--earth-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}
.hv-filter-btn:hover { color: var(--earth-dark); background: var(--sand); }
.hv-filter-btn.active {
    background: var(--earth-dark);
    color: var(--sand);
}
.hv-crop-search-wrap {
    position: relative;
    min-width: 220px;
}
.hv-crop-search {
    border: none;
    background: var(--card);
    padding: 0.7rem 2.4rem 0.7rem 2.4rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--earth-dark);
    box-shadow: var(--shadow-sm);
    width: 100%;
}
.hv-crop-search:focus { outline: 2px solid var(--sprout); outline-offset: 2px; }
.hv-crop-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--earth-medium);
    pointer-events: none;
    font-size: 0.95rem;
}
.hv-crop-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--earth-medium);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.hv-crop-clear.visible { display: flex; }
.hv-crop-clear:hover { background: var(--sand); color: var(--earth-dark); }
.hv-crop-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--card);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    padding: 0.35rem 0;
}
.hv-crop-suggestions.open { display: block; }
.hv-crop-suggestion {
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--earth-dark);
    transition: background 0.12s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hv-crop-suggestion:hover,
.hv-crop-suggestion.active {
    background: var(--sand);
}
.hv-crop-suggestion-count {
    font-size: 0.78rem;
    color: var(--earth-medium);
    font-weight: 500;
}
.hv-crop-suggestion-empty {
    padding: 0.8rem 1rem;
    color: var(--earth-medium);
    font-size: 0.85rem;
    font-style: italic;
}
.hv-crop-suggestion-match {
    font-weight: 600;
    color: var(--leaf);
}

/* ── Hero metric tiles ─────────────────────────────── */
.hv-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.hv-tile {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hv-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hv-tile-icon {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    display: block;
}
.hv-tile-label {
    font-size: 0.78rem;
    color: var(--earth-medium);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 500;
    margin-bottom: 0.3rem;
}
.hv-tile-value {
    font-family: 'Crimson Pro', serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--earth-dark);
    line-height: 1;
}
.hv-tile-unit {
    font-size: 1rem;
    color: var(--earth-medium);
    font-weight: 400;
    margin-left: 4px;
}
.hv-tile-sub {
    font-size: 0.85rem;
    color: var(--earth-medium);
    margin-top: 0.4rem;
}
.hv-tile-accent::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--sprout);
}

/* ── Chart row ─────────────────────────────────────── */
.hv-chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}
@media (max-width: 800px) {
    .hv-chart-row { grid-template-columns: 1fr; }
}
.hv-chart-card {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.hv-chart-card h3 {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--earth-dark);
    margin-bottom: 1rem;
}
.hv-chart-wrap {
    position: relative;
    height: 280px;
}
.hv-chart-wrap.tall { height: 320px; }

/* ── Trend chart (full width) ──────────────────────── */
.hv-trend {
    margin-bottom: 2rem;
}

/* ── Recent harvest grid ───────────────────────────── */
.hv-section-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--earth-dark);
    margin-bottom: 1rem;
}
.hv-carousel-wrap {
    position: relative;
    margin-bottom: 2rem;
}
.hv-grid {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0.5rem;
    padding: 0.25rem 0.25rem 0.75rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--clay) transparent;
    -webkit-overflow-scrolling: touch;
}
.hv-grid::-webkit-scrollbar { height: 6px; }
.hv-grid::-webkit-scrollbar-thumb {
    background: var(--clay);
    border-radius: 3px;
}
.hv-grid::-webkit-scrollbar-track { background: transparent; }
.hv-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: linear-gradient(135deg, var(--sand), var(--sprout));
    flex: 0 0 auto;
    width: 220px;
    aspect-ratio: 4 / 3;
    scroll-snap-align: start;
}
@media (max-width: 600px) {
    .hv-card { width: 180px; }
}
.hv-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hv-card:focus { outline: 2px solid var(--leaf); outline-offset: 3px; }
.hv-card img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.hv-card-month {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--sand);
    background: rgba(45,51,25,0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
}
.hv-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(45,51,25,0.85);
    color: var(--sand);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    z-index: 2;
}
.hv-carousel-nav:hover { background: var(--earth-dark); }
.hv-carousel-wrap:hover .hv-carousel-nav { opacity: 1; }
.hv-carousel-nav.prev { left: -8px; }
.hv-carousel-nav.next { right: -8px; }
.hv-carousel-nav[disabled] {
    opacity: 0 !important;
    pointer-events: none;
}
@media (hover: none) {
    .hv-carousel-nav { display: none; }
}

/* ── Empty state ───────────────────────────────────── */
.hv-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--earth-medium);
    background: var(--card);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.hv-empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.8rem;
    opacity: 0.5;
}

/* ── Footer note ───────────────────────────────────── */
.hv-footer-note {
    text-align: center;
    color: var(--earth-medium);
    font-size: 0.85rem;
    margin-top: 2rem;
    padding: 1rem;
}
.hv-footer-note a { color: var(--leaf); text-decoration: none; }
.hv-footer-note a:hover { text-decoration: underline; }

/* ── Modal ─────────────────────────────────────────── */
.hv-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45,51,25,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.hv-modal-overlay.open { display: flex; }
.hv-modal {
    background: var(--card);
    border-radius: 18px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.hv-modal-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--sand);
}
.hv-modal-body {
    padding: 1.5rem;
}
.hv-modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--earth-medium);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
