/* ==========================================
   1. CSS VARIABLES & THEming
   ========================================== */
:root {
  --primary: #2c4c38;
  --primary-hover: #1e3527;
  --accent: #e77f51;
  --bg: #faf7f2;
  --card-bg: #ffffff;
  --text: #2b2b2b;
  --border: #e2ddd5;
}

/* ==========================================
   2. GLOBAL RESETS & LAYOUT
   ========================================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;

  /* Full-width edge-to-edge background sizing */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;

  /* Fallback color */
  background-color: var(--bg);
}

/* Add a semi-transparent beige or dark overlay tint to the body background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Adjust the last value (0.35) to make it more or less tinted */
  background: rgba(250, 247, 242, 0.45);
  pointer-events: none;
  z-index: -1;
}

/* Default / Produce Tab Background */
body,
body.bg-produce {
  background-image: url("img/produce-bg.png");
}

/* Markets Tab Background */
body.bg-markets {
  background-image: url("img/markets-bg.png");
}

/* Farm Stand Tab Background */
body.bg-farmstand {
  background-image: url("img/stand-bg.png");
}

/* About Us Tab Background */
body.bg-about {
  background-image: url("img/about-bg.png");
}

/* ==========================================
   3. HEADER & NAVIGATION (Sticky Top)
   ========================================== */
header {
  background: var(--primary);
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
  gap: 1rem;

  /* Keeps header pinned to the top as you scroll */
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

.brand p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

/* ==========================================
   4. MAIN CONTENT & TABS
   ========================================== */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
  width: 100%;
  padding: 1.5rem 0;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   5. GRID SYSTEMS
   ========================================== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

/* ==========================================
   6. CARDS & PRODUCE LAYOUT
   ========================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.card-body {
  padding: 1.25rem;
  flex: 1;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  color: #555;
  line-height: 1.5;
}

.img-placeholder {
  width: 100%;
  height: 180px;
  background: #e8ece9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #728277;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.produce-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.produce-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  position: relative;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
  z-index: 1;
}

.produce-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
  z-index: 10;
}

.produce-card .img-placeholder {
  height: 130px;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.produce-card .market-availability {
  pointer-events: auto;
}

.produce-card:hover .market-availability,
.produce-card .market-availability:hover {
  display: block;
}

.produce-info {
  padding: 0.8rem;
}

.produce-info h4 {
  margin: 0 0 0.25rem 0;
  color: var(--primary);
}

.price-tag {
  font-weight: bold;
  color: var(--accent);
  font-size: 1.1rem;
}

.season-tag {
  font-size: 0.75rem;
  color: #777;
  margin-top: 0.25rem;
}

.market-availability {
  position: absolute;
  top: 0;
  width: 220px;
  background: rgba(44, 76, 56, 0.97);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  text-align: left;
}

.market-availability {
  left: 100%;
  margin-left: 0;
  transform: translateX(-10px);
}

.produce-card:hover .market-availability {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.produce-card.flyout-left .market-availability {
  left: auto;
  right: 100%;
  margin-right: 0;
  transform: translateX(10px);
}

.produce-card.flyout-left:hover .market-availability {
  transform: translateX(0);
}

.market-availability strong {
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.market-list-target {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.market-list-target li {
  font-size: 0.9rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.market-list-target li:last-child {
  border-bottom: none;
}

/* ==========================================
   7. MARKET LIST STYLES
   ========================================== */
.market-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.market-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.market-item:last-child {
  border-bottom: none;
}

/* ==========================================
   8. FOOTER
   ========================================== */
footer {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.85rem;
  margin-top: auto;
}

/* ==========================================
   9. MOBILE RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding: 0.5rem 0.8rem;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  main {
    padding: 1rem;
  }
}

/* ==========================================
   10. COMPONENT SPECIFIC STYLES
   ========================================== */
.filter-container {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-container label {
  font-weight: bold;
}

.filter-container select {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.market-map-layout {
  display: flex;
  flex-direction: column;
}

.market-map-header {
  flex: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.market-map-title {
  margin-bottom: 0.25rem;
}

.market-map-address {
  margin-bottom: 0.25rem;
}

.map-produce-text {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 1rem;
  display: none;
}

.map-meta-group {
  margin-bottom: 0.75rem;
}

.map-season-text {
  font-size: 0.85rem;
  color: #777;
  font-weight: 600;
  text-transform: uppercase;
  display: none;
}

.map-hours-text {
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--primary);
  display: none;
}

.map-website-link {
  display: none;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.map-iframe-wrapper {
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  background: #e8ece9;
}

.map-iframe {
  border: 0;
  min-height: 320px;
  display: none;
  width: 100%;
  height: 100%;
}

.map-iframe-wrapper iframe + a,
.map-address-action-btn,
.farmstand-banner + div a {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: #f1f3f2;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
}

.map-iframe-wrapper iframe + a:hover,
.map-address-action-btn:hover {
  background: var(--border);
  color: var(--primary);
}

.farmstand-banner {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.farmstand-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.farmstand-divider {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.farmstand-note {
  margin-top: 0.5rem;
  font-style: italic;
  color: #444;
}

.bio-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
}

.bio-title-margin {
  margin-top: 0.5rem;
}

@keyframes borderPulse {
  0%,
  100% {
    border-color: var(--border);
    box-shadow:
      0 4px 6px -1px rgba(0, 0, 0, 0.05),
      0 0 0 0 rgba(231, 127, 81, 0);
  }
  50% {
    border-color: var(--accent);
    box-shadow:
      0 4px 15px rgba(231, 127, 81, 0.4),
      0 0 0 8px rgba(231, 127, 81, 0.4);
  }
}

.pulse-card {
  animation: borderPulse 1s ease-in-out 3;
}

/* ==========================================
   11. PRODUCE DETAIL OVERLAY
   ========================================== */
.produce-card .img-placeholder {
  position: relative;
  overflow: hidden;
}

.produce-card .img-placeholder img {
  transition:
    filter 0.3s ease,
    transform 0.3s ease;
}

.produce-card.detail-open .img-placeholder img {
  filter: blur(6px) brightness(0.85);
  transform: scale(1.05);
}

.produce-card.detail-open .img-placeholder .in-season-badge {
  opacity: 0.2;
}

.produce-detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 30, 24, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  z-index: 6;
  pointer-events: none;
}

.produce-card.detail-open .produce-detail-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.produce-detail-overlay h5 {
  margin: 0 0 0.3rem 0;
  color: var(--accent);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.8),
    0 0 8px rgba(0, 0, 0, 0.5);
}

.produce-detail-overlay p {
  margin: 0;
  font-size: 0.78rem;
  color: #ffffff;
  line-height: 1.35;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.8),
    0 0 8px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   CAROUSEL STYLES
   ========================================== */
.carousel-container {
  position: relative;
  height: 450px;
  width: 100%;
  margin: 0 auto 2rem auto;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.carousel-track-container {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
  height: 100%;
  transition: transform 400ms ease-in-out;
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
}

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

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  cursor: pointer;
  padding: 12px 18px;
  font-size: 1.8rem;
  z-index: 10;
  transition: background 0.2s;
  border-radius: 4px;
}
.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}
.prev-btn {
  left: 10px;
}
.next-btn {
  right: 10px;
}

.carousel-nav {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}
.carousel-indicator {
  border: none;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}
.carousel-indicator.current-indicator {
  background: rgba(255, 255, 255, 1);
}

/* ==========================================
   MARKET LINK CARDS (Produce & Markets Pages)
   ========================================== */
a.market-link-card {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  background-color: #ffffff !important;
  color: var(--primary) !important;
  border: 1px solid var(--border) !important;
  border-left: 6px solid var(--primary) !important;
  padding: 0.1rem 0.5rem !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06) !important;
  transition: all 0.2s ease !important;
}

a.market-link-card:hover {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  border-left-color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12) !important;
  text-decoration: none !important;
}

.market-list-item:hover {
  background-color: #f0f4f1 !important;
}

#market-website-link {
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
  text-decoration: underline;
  text-decoration-color: transparent;
}

#market-website-link:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
}

.market-list-item[data-active="true"]:hover {
  background-color: #f4f7f5 !important;
}
