/* ============================================
   Ndhiwa Agri Products and Services
   Core Styles — shared design tokens & components
   ============================================ */

/* === DESIGN TOKENS === */
:root {
  /* Color palette */
  --ink:              #152019;
  --ink-soft:         #20302A;
  --paper:            #F3EFE3;
  --paper-dim:        #E9E3D3;
  --clay:             #B54B24;
  --clay-deep:        #8F3A1B;
  --grain:            #D9A441;
  --leaf:             #3F6B4E;
  --text-ink:         #1C231D;
  --text-on-dark:     #EFEAE0;
  --text-on-dark-dim: #B9C2BA;
  --line-on-dark:     rgba(239,234,224,0.16);
  --line-on-light:    rgba(28,35,29,0.14);
  
  /* Spacing system (8px base unit) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;
  --space-12: 96px;
  
  /* Typography scale */
  --h1-size: 4.1rem;
  --h2-size: 2.4rem;
  --h3-size: 1.35rem;
  --body-size: 1rem;
  --small-size: 0.85rem;
}

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: var(--body-size);
  line-height: 1.6;
  color: var(--text-ink);
  background-color: var(--paper);
}

/* === TYPOGRAPHY === */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,300..700;1,300..700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  line-height: 1.15;
  color: inherit;
}

h1 {
  font-size: var(--h1-size);
  line-height: 1.06;
}

h2 {
  font-size: var(--h2-size);
  line-height: 1.15;
}

h3 {
  font-size: var(--h3-size);
  line-height: 1.3;
}

p {
  max-width: 60ch;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* === LAYOUT UTILITIES === */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

section {
  padding: var(--space-12) 0;
}

/* Small tag/eyebrow label */
.tag {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: var(--small-size);
  color: var(--clay);
  display: block;
  margin-bottom: var(--space-2);
}

.tag-light {
  color: var(--grain);
}

/* === BUTTONS === */
.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: var(--body-size);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--clay);
  color: #FBF3EA;
}

.btn-primary:hover {
  background-color: var(--clay-deep);
}

.btn-ghost {
  background-color: transparent;
  border: 1px solid var(--line-on-light);
  color: var(--text-ink);
}

.btn-ghost:hover {
  border-color: var(--text-ink);
}

.btn-ghost-dark {
  border-color: var(--line-on-dark);
  color: var(--text-on-dark);
}

.btn-ghost-dark:hover {
  border-color: var(--text-on-dark);
}

.btn:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* === HEADER & NAVIGATION === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(21, 32, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-on-dark);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.site-wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-on-dark);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.site-wordmark-sub {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: var(--small-size);
  font-weight: 400;
  color: var(--text-on-dark-dim);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.nav-links a {
  color: var(--text-on-dark);
  font-size: var(--body-size);
  padding-bottom: 6px;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-on-dark);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--grain);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

.nav-cta {
  margin-left: var(--space-2);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-on-dark);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-1);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* === FOOTER === */
.site-footer {
  background-color: var(--ink);
  color: var(--text-on-dark);
  padding-top: 72px;
  padding-bottom: var(--space-4);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.footer-col h3 {
  font-size: var(--h3-size);
  margin-bottom: var(--space-3);
  color: var(--text-on-dark);
}

.footer-description {
  color: var(--text-on-dark-dim);
  font-size: var(--body-size);
  line-height: 1.6;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-2);
}

.footer-links a {
  color: var(--text-on-dark-dim);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-on-dark);
}

.footer-links a:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

.footer-divider {
  height: 1px;
  background-color: var(--line-on-dark);
  margin-bottom: var(--space-4);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-on-dark-dim);
  font-size: var(--small-size);
}

/* === IMAGE PLACEHOLDER SYSTEM === */
.img-slot {
  position: relative;
  overflow: hidden;
  background-color: var(--paper-dim);
}

.img-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Special handling for specific images that need full view */
img[src*="gallery-4"] {
  object-fit: contain;
  background-color: var(--ink-soft);
}

.img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  border: 2px dashed var(--leaf);
  background-color: var(--paper-dim);
  text-align: center;
  gap: var(--space-1);
}

.img-placeholder span {
  display: block;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: var(--small-size);
  color: var(--text-ink);
}

.ph-file {
  font-weight: 600;
  color: var(--leaf);
}

.ph-dims {
  font-weight: 500;
  color: var(--text-ink);
}

.ph-alt {
  font-size: 0.75rem;
  color: var(--text-on-dark-dim);
  font-style: italic;
  margin-top: var(--space-1);
}

/* === SCROLL REVEAL ANIMATION === */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* === RESPONSIVE BREAKPOINTS === */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
  
  .footer-col:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --h1-size: 2.4rem;
    --h2-size: 1.7rem;
    --h3-size: 1.15rem;
  }
  
  section {
    padding: 56px 0;
  }
  
  .container {
    padding: 0 20px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
  
  /* Mobile nav */
  .nav-toggle {
    display: block;
  }
  
  .site-nav {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    background-color: var(--ink);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3);
    gap: var(--space-2);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  
  .site-nav.nav-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  
  .nav-links {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .nav-cta {
    margin-left: 0;
  }
  
  .nav-cta .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 20px;
  }
}
