:root {
  --sa-green: #007a33;
  --sa-gold: #ffb81c;
  --us-blue: #002868;
  --us-red: #bf0a30;
  --us-white: #ffffff;
  --light-bg: #f4f6f9;
  --text-color: #333333;
  --dark-color: #1a1a1a;
}

/* Enable smooth scrolling across the site */
html {
  scroll-behavior: smooth;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--light-bg);
}

/* Splash Screen Overlay */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 99999; /* Corrected from z-shadow to ensure overlay is on top of all elements */
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

#splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  opacity: 0;
  transform: scale(0.5);
  animation: pop-in 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Clean, transparent logo sizing for the splash screen */
.splash-logo {
  width: 90vw;
  max-width: 700px; /* almost full-size as laptop/desktop permits */
  height: auto;
  display: block;
  object-fit: contain;
}

@keyframes pop-in {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Header & Navigation (SA Green) */
header {
  background-color: var(--sa-green);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.container {
  width: 95%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: white;
  display: inline-flex;
  align-items: center;
}

/* Transparent Header Logo styling (with white oval decoration removed) */
.header-logo {
  height: 50px;
  width: auto;
  margin-right: 12px;
  object-fit: contain;
}

nav {
  flex-grow: 1;
  display: flex;
  justify-content: flex-end;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  transition: background 0.3s;
  white-space: nowrap;
}

nav a:hover, nav a.active {
  background-color: rgba(255,255,255,0.2);
}

/* Hero Section (Vibrant Green Ribbon) - Optimized Compact Padding */
.hero {
  background: linear-gradient(135deg, var(--sa-green) 0%, #004d20 100%);
  color: white;
  padding: 1.5rem 0; /* Reduced from 4rem to make the ribbon less tall */
  text-align: center;
}

.hero h1 {
  font-size: 2rem; /* Adjusted down slightly for better balance */
  margin-bottom: 0.4rem;
}

.hero p {
  font-size: 1rem; /* Highly readable, compact sizing */
  max-width: 800px;
  margin: 0 auto;
  opacity: 0.9;
}

/* Interactive Hero Links for Sastuff Header */
.hero h1 a.hero-link {
  color: white;
  text-decoration: none;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.6);
  transition: border-bottom-color 0.2s, color 0.2s;
}

.hero h1 a.hero-link:hover {
  color: var(--sa-gold);
  border-bottom-color: var(--sa-gold);
}

/* Content Layout */
.main-content {
  padding: 3rem 0;
}

/* US Flag Themed Cards (Red, White, Blue) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background: var(--us-white);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-top: 5px solid var(--us-red);
  border-bottom: 5px solid var(--us-blue);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card h2 {
  margin-bottom: 1rem;
  font-size: 1.4rem;
  color: var(--us-blue);
}

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

/* Detailed Page Content Blocks (US Red, White, Blue) */
.content-block {
  background: var(--us-white);
  border-radius: 8px;
  padding: 2.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  margin-bottom: 2rem;
  border-left: 6px solid var(--us-blue);
  border-right: 6px solid var(--us-red);
}

.content-block h2 {
  margin-bottom: 1.2rem;
  color: var(--us-blue);
  font-size: 1.6rem;
}

.content-block h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--us-red);
}

.content-block p {
  margin-bottom: 1rem;
  color: #444;
}

ol, ul {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: #444;
}

li {
  margin-bottom: 0.5rem;
}

/* State Selection Menu Styling */
.selector-container {
  margin-top: 1.5rem;
  max-width: 400px;
}

.state-select {
  width: 100%;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--us-blue);
  border-radius: 6px;
  background-color: var(--us-white);
  color: var(--us-blue);
  font-weight: bold;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.state-select:focus {
  border-color: var(--us-red);
  box-shadow: 0 0 0 3px rgba(191, 10, 48, 0.15);
}

/* Back Home Essentials Gallery Grid */
.sastuff-intro {
  font-weight: 500;
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.sastuff-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.sastuff-item {
  display: block;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--us-white);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sastuff-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.sastuff-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  padding: 12px;
  display: block;
}

/* E-Commerce Product Catalog Grid Styling - Optimized Compact Layout */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.catalog-card {
  background: var(--us-white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  border-top: 5px solid var(--us-blue);
  border-bottom: 5px solid var(--us-red);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.catalog-img-container {
  background: #fafbfc;
  height: 110px; /* Default height (e.g., for Finance page bank logos) */
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e1e8ed;
}

.catalog-img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.catalog-info {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.catalog-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--us-blue);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.catalog-desc {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 1.2rem;
  line-height: 1.4;
}

/* PAGE-SPECIFIC OVERRIDES: South African Products & Equivalents (Sastuff) Page [1] */
.sastuff-page .catalog-img-container {
  height: 190px; /* Taller image block specifically on Sastuff for detailed food product images [1] */
  padding: 0.6rem; /* Tighter padding allows the actual image to scale up and display larger [1] */
}

.sastuff-page .catalog-img {
  max-width: 90%; /* Allows product images to expand comfortably inside the container [1] */
  max-height: 90%;
}

/* Brand Comparison Table Layout */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
  background: var(--us-white);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  border-top: 5px solid var(--us-blue);
  border-bottom: 5px solid var(--us-red);
}

.equivalents-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.equivalents-table th {
  background-color: var(--us-blue);
  color: white;
  padding: 1rem 1.2rem;
  font-weight: bold;
}

.equivalents-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #e1e8ed;
  color: #444;
}

.equivalents-table tr:last-child td {
  border-bottom: none;
}

.equivalents-table tr:nth-child(even) {
  background-color: #fafbfc;
}

/* Color-coded Similarity Badges */
.similarity-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.similarity-badge.identical {
  background-color: #e2f9e9;
  color: #1a7f37;
}

.similarity-badge.almost-identical {
  background-color: #fff8c5;
  color: #9a6700;
}

.similarity-badge.close-to {
  background-color: #f1f8ff;
  color: #0366d6;
}

/* US Theme CTA Buttons */
.btn {
  display: inline-block;
  background-color: var(--us-blue);
  color: white;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-weight: bold;
  transition: background 0.3s, transform 0.2s;
  text-align: center;
  border: 1px solid var(--us-blue);
}

.btn:hover {
  background-color: var(--us-red);
  border-color: var(--us-red);
}

/* Affiliate Banners with US Colors */
.affiliate-banner {
  background-color: #f0f4f8;
  border: 2px dashed var(--us-blue);
  padding: 1.5rem;
  border-radius: 6px;
  margin-top: 2rem;
  position: relative;
}

.affiliate-banner::before {
  content: "RECOMMENDED SERVICE";
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--us-red);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.affiliate-banner strong {
  color: var(--us-blue);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.affiliate-link {
  display: inline-block;
  margin-top: 0.5rem;
  background-color: var(--us-red);
  color: white;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  font-weight: bold;
  border-radius: 4px;
  transition: background 0.2s;
}

.affiliate-link:hover {
  background-color: #900824;
}

/* Resource List Layout */
.resource-list {
  list-style: none;
  margin-left: 0;
}

.resource-list li {
  padding: 1.2rem;
  border: 1px solid #e1e8ed;
  background: #fafbfc;
  margin-bottom: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--us-blue);
}

.resource-title {
  font-weight: bold;
  color: var(--us-blue);
  text-decoration: none;
  font-size: 1.1rem;
  display: inline-block;
  margin-bottom: 0.3rem;
}

.resource-title:hover {
  color: var(--us-red);
  text-decoration: underline;
}

/* Partner Brand Logos & Containers */
.logo-wrapper {
  margin-bottom: 0.8rem;
  display: inline-block;
}

/* FoodFinder Specific Green Brand Background */
.logo-wrapper.foodfinder-bg {
  background-color: #10a142; /* FoodFinder Green */
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.logo-wrapper.foodfinder-bg:hover {
  background-color: #0d8435;
}

.partner-logo {
  height: 24px;
  max-width: 140px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* General Page Titles */
.page-title {
  margin-bottom: 2rem;
  color: var(--us-blue);
  border-bottom: 3px solid var(--us-red);
  padding-bottom: 0.5rem;
  font-size: 2.2rem;
}

/* Footer Section */
footer {
  background-color: var(--dark-color);
  color: #ccc;
  text-align: center;
  padding: 2.5rem 0;
  margin-top: 4rem;
  font-size: 0.9rem;
  border-top: 4px solid var(--us-blue);
}

footer a {
  color: var(--sa-gold);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.disclaimer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #888;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }
  nav {
    justify-content: center;
    width: 100%;
  }
  nav ul {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .page-title { 
    font-size: 1.8rem; 
  }
}
