/*
Theme Name: AISF Market
Theme URI: https://aisustainablefoods.org
Author: AI Sustainable Foods
Author URI: https://aisustainablefoods.org
Description: Classic theme implementing the market.html design system. Wraps existing WordPress page content with a sticky cream header (Fraunces + Manrope), a forest-green announce bar, and a 3-column footer. Compatible with existing inline-style page content; doesn't fight Gutenberg or FSE.
Version: 2.1.0
Requires at least: 5.5
Tested up to: 6.6
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aisf-market
Tags: classic, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* =========================================================================
   DESIGN TOKENS
   ========================================================================= */
:root {
  --forest: #1a3a2a;
  --forest-deep: #0f2419;
  --moss: #3d5a3d;
  --cream: #f6f0e1;
  --cream-soft: #ede5d0;
  --terracotta: #c4613d;
  --terracotta-deep: #a34d2d;
  --ink: #1a1511;
  --stone: #8a8578;
  --line: rgba(26,21,17,0.12);
  --gold: #e8c68a;
  --f-display: 'Fraunces', Georgia, serif;
  --f-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================================================================
   GLOBAL CONTAINMENT (existing pages have width:100vw breakouts; clamp them)
   ========================================================================= */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
img, video, iframe { max-width: 100%; height: auto; }

/* =========================================================================
   BASE
   ========================================================================= */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--f-body);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--terracotta); text-decoration: none; }
a:hover { color: var(--terracotta-deep); }
h1, h2, h3, h4, h5 {
  font-family: var(--f-display);
  font-weight: 600;
  color: var(--forest-deep);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(36px, 5.5vw, 72px); }
h2 { font-size: clamp(30px, 4vw, 50px); }
h3 { font-size: clamp(22px, 2.5vw, 30px); }
p { margin: 0 0 1em; }

/* =========================================================================
   ANNOUNCE BAR
   ========================================================================= */
.aisf-announce {
  background: var(--forest-deep);
  color: var(--cream);
  text-align: center;
  padding: 10px 20px;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.aisf-announce strong { color: var(--gold); font-weight: 700; }

/* =========================================================================
   HEADER
   ========================================================================= */
.aisf-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246,240,225,0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.aisf-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
}
.aisf-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--forest);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 240px;
}
.aisf-logo:hover { color: var(--forest); }
.aisf-logo-img { display: flex; align-items: center; }
.aisf-logo-img .custom-logo-link { display: inline-block; line-height: 0; }
.aisf-logo-img .custom-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
.aisf-logo-mark {
  width: 36px; height: 36px;
  background: var(--forest);
  color: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
}
.aisf-logo-text { display: inline-block; }

/* Primary nav — fit all 10 items on one line */
.aisf-nav-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}
.aisf-nav {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 14px;
  align-items: center;
}
.aisf-nav li { margin: 0; padding: 0; flex-shrink: 0; }
.aisf-nav a {
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.005em;
  padding: 6px 0;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s;
}
.aisf-nav a::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 2px;
  width: 0; height: 2px;
  background: var(--terracotta);
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(-50%);
}
.aisf-nav a:hover { color: var(--forest); }
.aisf-nav a:hover::after,
.aisf-nav .current-menu-item > a::after {
  width: 22px;
}

/* Donate ghost button */
.aisf-donate {
  display: inline-block;
  padding: 9px 20px;
  border: 1.5px solid var(--forest);
  border-radius: 999px;
  color: var(--forest);
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.aisf-donate:hover {
  background: var(--forest);
  color: var(--cream);
}

/* Mobile menu toggle */
.aisf-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.aisf-mobile-toggle span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--forest-deep);
  transition: all 0.25s;
}

/* =========================================================================
   MAIN CONTENT
   ========================================================================= */
.aisf-main {
  width: 100%;
}
.aisf-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 28px;
}
.aisf-content > h1:first-child {
  margin-top: 0;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.aisf-footer {
  background: var(--cream-soft);
  border-top: 1px solid var(--line);
  padding: 60px 0 40px;
  margin-top: 60px;
}
.aisf-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}
.aisf-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 36px;
}
.aisf-footer h5 {
  font-family: var(--f-display);
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--forest-deep);
}
.aisf-footer p, .aisf-footer a {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.7;
  text-decoration: none;
}
.aisf-footer a:hover { color: var(--terracotta); }
.aisf-footer-fine {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 12px;
  color: var(--stone);
  line-height: 1.6;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1240px) {
  .aisf-nav { gap: 10px; }
  .aisf-nav a { font-size: 12px; }
  .aisf-logo-text { display: none; }
}
@media (max-width: 1024px) {
  .aisf-nav { gap: 8px; }
  .aisf-nav a { font-size: 11.5px; }
}
@media (max-width: 900px) {
  .aisf-nav-wrap { display: none; }
  .aisf-mobile-toggle { display: flex; }
  .aisf-donate { display: none; }
  .aisf-footer-grid { grid-template-columns: 1fr; gap: 30px; }

  /* Mobile menu drawer */
  .aisf-nav-wrap.is-open {
    display: block;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--cream);
    border-top: 1px solid var(--line);
    padding: 20px 28px 30px;
    z-index: 49;
  }
  .aisf-nav-wrap.is-open .aisf-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex-wrap: wrap;
  }
  .aisf-nav-wrap.is-open .aisf-nav li {
    border-bottom: 1px solid var(--line);
  }
  .aisf-nav-wrap.is-open .aisf-nav li:last-child { border-bottom: none; }
  .aisf-nav-wrap.is-open .aisf-nav a {
    display: block;
    padding: 14px 0;
    font-size: 16px;
  }
}

/* =========================================================================
   PATTERN UTILITIES (for use inside page content)
   ========================================================================= */
.aisf-eyebrow {
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terracotta);
  display: block;
  margin-bottom: 12px;
}
.aisf-display {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.aisf-display em, .aisf-display i {
  font-style: italic;
  color: var(--terracotta);
}
.aisf-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: var(--terracotta);
  color: var(--cream) !important;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: all 0.2s;
}
.aisf-btn:hover {
  background: var(--terracotta-deep);
  transform: translateY(-1px);
  color: var(--cream) !important;
}
.aisf-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--forest);
  color: var(--forest) !important;
}
.aisf-btn-ghost:hover {
  background: var(--forest);
  color: var(--cream) !important;
}
