/* ═══════════════════════════════════════════════════
   Ragged Glory Farm — main.css
   Mobile-first · Clean · Earthy · Groci-inspired
   ═══════════════════════════════════════════════════ */

:root {
  /* Pulled from the Ragged Glory logo:
     navy ring → --navy-*  |  field green → --green-*  |  warm gold → --gold */
  --navy:       #1e2d6b;   /* logo outer ring                */
  --navy-dk:    #141d4a;   /* deeper navy for header/footer  */
  --navy-lt:    #e8eaf6;   /* light tint for backgrounds     */
  --green:      #3a7d44;   /* field green accent             */
  --green-mid:  #4e9a5a;
  --green-lt:   #e6f4ea;
  --green-dk:   #2a5c32;
  --gold:       #c8922a;   /* logo yellow-gold               */
  --gold-lt:    #fdf3dc;
  --brown:      #6b4c3b;
  --cream:      #fafaf8;
  --white:      #ffffff;
  --text:       #1a1a2e;   /* near-navy for body text        */
  --muted:      #6b7280;
  --border:     #e2ddd4;
  --red:        #c62828;
  --amber:      #d97706;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { background: var(--cream); color: var(--text); font-family: Georgia, serif; line-height: 1.7; }


/* ── INTRO OVERLAY ────────────────────────────────── */
#intro-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--green-dk);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
  overflow-y: auto;
}
#intro-overlay.hiding { opacity: 0; pointer-events: none; }
#intro-overlay.gone   { display: none; }

#intro-inner {
  text-align: center; padding: 40px 28px; max-width: 500px; width: 100%;
}
#intro-logo {
  width: 170px; height: 170px; object-fit: contain; margin-bottom: 24px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.4));
}
#intro-overlay h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem); color: white; margin-bottom: 6px;
}
.intro-tagline {
  color: rgba(255,255,255,.7); font-size: 1rem; margin-bottom: 28px;
  font-family: system-ui, sans-serif; letter-spacing: .04em;
}
.intro-products {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 36px;
}
.intro-products span {
  background: rgba(255,255,255,.13); color: white;
  padding: 8px 16px; border-radius: 50px; font-size: .88rem;
  font-family: system-ui, sans-serif; letter-spacing: .02em;
  border: 1px solid rgba(255,255,255,.15);
}
.intro-enter {
  display: inline-block; padding: 18px 48px;
  background: white; color: var(--green-dk);
  border: none; border-radius: 50px; font-size: 1.1rem; font-weight: 700;
  cursor: pointer; font-family: system-ui, sans-serif; letter-spacing: .02em;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
  transition: transform .2s, box-shadow .2s;
}
.intro-enter:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,.3); }


/* ── ZOOM BAR ─────────────────────────────────────── */
#zoom-bar {
  position: fixed; bottom: 16px; right: 16px; z-index: 998; display: flex; gap: 6px;
}
#zoom-bar button {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--green);
  background: var(--white); color: var(--green); font-size: 14px; font-weight: bold;
  cursor: pointer; box-shadow: var(--shadow);
}
#theme-toggle { font-size: 18px; }


/* ── HEADER ───────────────────────────────────────── */
header {
  background: white; border-bottom: 1px solid var(--border);
  padding: 12px 28px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.header-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.header-logo  { width: 44px; height: 44px; object-fit: contain; }
.farm-name    { color: var(--navy-dk); font-size: 1.15rem; font-weight: bold; }
nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
nav a {
  color: var(--text); text-decoration: none; font-size: .9rem;
  font-family: system-ui, sans-serif; font-weight: 500;
  transition: color .15s;
}
nav a:hover { color: var(--green); }
nav a.nav-cta {
  background: var(--green); color: white;
  padding: 9px 18px; border-radius: 50px;
}
nav a.nav-cta:hover { background: var(--green-dk); color: white; }


/* ── MAIN (inner pages) ───────────────────────────── */
main.page-main {
  max-width: 860px; margin: 0 auto; padding: 28px 20px 80px;
}
/* Home page uses its own section layout — no constraint */
main.home-main { padding: 0 0 80px; }


/* ── HOME HERO ────────────────────────────────────── */
.home-hero {
  position: relative; min-height: 540px;
  background: url('../img/hero-bg.jpg') center center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
}
.home-hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(10,15,40,.28) 0%,
    rgba(10,15,40,.55) 45%,
    rgba(10,15,40,.78) 100%
  );
}
.hero-inner {
  position: relative; z-index: 1; text-align: center; color: white;
  padding: 64px 28px; max-width: 700px;
}
.hero-logo {
  width: 180px; height: 180px; object-fit: contain; margin-bottom: 20px;
  filter: drop-shadow(0 0 18px rgba(255,255,255,.45)) drop-shadow(0 4px 12px rgba(0,0,0,.5));
}
.hero-inner h1 {
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.15; margin-bottom: 14px;
  text-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.hero-inner > p {
  font-size: 1.1rem; opacity: .9; margin-bottom: 32px;
  max-width: 500px; margin-left: auto; margin-right: auto;
}
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }


/* ── HOME SECTIONS ────────────────────────────────── */
.home-section { padding: 60px 28px; }
.home-section.bg-white  { background: var(--white); }
.home-section.bg-lt     { background: var(--green-lt); }
.home-section.bg-dark   { background: var(--navy-dk); }
.home-section.bg-cream  { background: var(--cream); }

.section-heading {
  font-size: 1.75rem; color: var(--navy-dk); text-align: center; margin-bottom: 8px;
}
.section-heading.light { color: white; }
.section-sub {
  text-align: center; color: var(--muted); font-size: .95rem; margin-bottom: 36px;
  font-family: system-ui, sans-serif; max-width: 560px; margin-left: auto; margin-right: auto;
}
.section-sub.light { color: rgba(255,255,255,.65); }


/* ── CATEGORY CARDS ───────────────────────────────── */
.cat-grid {
  display: flex; gap: 16px; justify-content: center;
  flex-wrap: wrap; max-width: 900px; margin: 0 auto;
}
.cat-card {
  flex: 0 0 160px; background: white; border-radius: 18px;
  overflow: hidden; box-shadow: var(--shadow); text-align: center;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
}
.cat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.cat-card img   { width: 100%; height: 140px; object-fit: cover; display: block; }
.cat-card span  {
  display: block; padding: 11px 8px; font-size: .92rem; font-weight: 700;
  color: var(--brown); font-family: system-ui, sans-serif;
}


/* ── MARKET CARD ──────────────────────────────────── */
.market-card {
  max-width: 600px; margin: 0 auto; background: white; border-radius: 18px;
  padding: 28px 32px; box-shadow: var(--shadow-lg);
  border-left: 6px solid var(--green);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.market-badge {
  display: inline-block; background: var(--green); color: white;
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 50px; margin-bottom: 10px;
  font-family: system-ui, sans-serif;
}
.market-card h2 { font-size: 1.5rem; color: var(--navy-dk); margin-bottom: 4px; }
.market-card p  { color: var(--muted); font-size: .9rem; font-family: system-ui, sans-serif; }


/* ── FOUNDERS SECTION ─────────────────────────────── */
.founders-inner {
  max-width: 860px; margin: 0 auto;
  display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: center;
}
.founders-photo-wrap { position: relative; }
.founders-photo {
  width: 100%; border-radius: 18px; object-fit: cover; aspect-ratio: 4/5;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
  border: 4px solid rgba(255,255,255,.18);
  display: block;
}
.founders-text h2 { font-size: 1.9rem; color: white; margin-bottom: 6px; }
.founders-sub {
  color: rgba(255,255,255,.55); font-size: .88rem; margin-bottom: 20px;
  font-family: system-ui, sans-serif; letter-spacing: .05em; text-transform: uppercase;
}
.founders-text p { color: rgba(255,255,255,.82); line-height: 1.75; }
.founders-contact {
  display: flex; gap: 24px; flex-wrap: wrap; margin-top: 22px;
  color: rgba(255,255,255,.65); font-size: .9rem; font-family: system-ui, sans-serif;
}


/* ── BLOG STRIP ───────────────────────────────────── */
.blog-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px; max-width: 960px; margin: 0 auto 8px;
}
.blog-card {
  background: white; border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.blog-card-img   { width: 100%; height: 190px; object-fit: cover; display: block; }
.blog-card-body  { padding: 20px; }
.blog-card-date  {
  font-size: .78rem; color: var(--muted); margin-bottom: 6px;
  font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em;
}
.blog-card h3    { font-size: 1.1rem; margin-bottom: 8px; line-height: 1.4; }
.blog-card h3 a  { color: var(--brown); text-decoration: none; }
.blog-card h3 a:hover { color: var(--green); }
.blog-card p     { font-size: .9rem; color: var(--muted); line-height: 1.55; margin-bottom: 12px; }
.read-more       { color: var(--green); font-size: .9rem; font-weight: 700; text-decoration: none; font-family: system-ui, sans-serif; }


/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  display: inline-block; padding: 13px 28px; border-radius: 50px;
  font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none;
  border: 2px solid transparent; text-align: center;
  font-family: system-ui, sans-serif; letter-spacing: .01em;
  transition: filter .15s, transform .15s, background .15s, color .15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary       { background: var(--green); color: white; border-color: var(--green); }
.btn-lg            { padding: 17px 36px; font-size: 1.05rem; }
.btn-outline-white {
  background: transparent; color: white; border-color: white;
}
.btn-outline-white:hover { background: white; color: var(--green-dk); filter: none; }
.btn-outline-green {
  background: transparent; color: var(--green); border-color: var(--green);
}
.btn-outline-green:hover { background: var(--green); color: white; filter: none; }
.btn-hold  { background: var(--amber); color: white; border-color: var(--amber); }
.btn-block { display: block; width: 100%; }


/* ── MESSAGES ─────────────────────────────────────── */
.messages { margin: 16px 0; }
.msg { padding: 13px 16px; border-radius: var(--radius); margin-bottom: 8px; font-family: system-ui, sans-serif; }
.msg-success { background: var(--green-lt); border-left: 4px solid var(--green); }
.msg-error   { background: #ffebee; border-left: 4px solid var(--red); }
.msg-info    { background: #fff8e1; border-left: 4px solid var(--amber); }


/* ── MENU CARDS ───────────────────────────────────── */
.menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-top: 20px;
}
.menu-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.menu-card h3     { font-size: 1.1rem; color: var(--brown); margin-bottom: 4px; }
.menu-card .price { font-size: 1.3rem; font-weight: bold; color: var(--green); }
.menu-card .avail { font-size: .85rem; color: var(--muted); margin-top: 4px; font-family: system-ui, sans-serif; }
.menu-card.sold-out { opacity: .55; }
.menu-card .wiki-blip {
  font-size: .8rem; color: var(--muted); margin-top: 8px;
  border-top: 1px solid var(--border); padding-top: 8px; font-style: italic;
}


/* ── EDITOR (Dad's view) ──────────────────────────── */
.editor-entry {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.editor-entry h3 { font-size: 1rem; color: var(--brown); }
.qty-control { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.qty-btn {
  width: 48px; height: 48px; font-size: 1.5rem; border-radius: 50%;
  border: 2px solid var(--green); background: white; color: var(--green); cursor: pointer;
}
.qty-val { font-size: 1.4rem; font-weight: bold; min-width: 2rem; text-align: center; }

input[type="number"], input[type="text"], input[type="email"], textarea, select {
  width: 100%; padding: 12px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; background: white;
}


/* ── MAP ──────────────────────────────────────────── */
.map-block { margin-top: 32px; }
.map-block iframe { width: 100%; height: 260px; border: 0; border-radius: var(--radius); }
.map-wrap { border-radius: var(--radius); overflow: hidden; margin: 16px auto 0; max-width: 720px; }
.map-wrap iframe { width: 100%; height: 300px; border: 0; display: block; }
.directions-btn {
  display: block; max-width: 720px; margin: 12px auto 0;
  text-align: center; padding: 15px;
  background: var(--green); color: white;
  border-radius: var(--radius); text-decoration: none; font-size: 1rem;
  font-family: system-ui, sans-serif; font-weight: 600;
}


/* ── BLOG LIST/DETAIL (inner pages) ──────────────── */
.post-list { display: flex; flex-direction: column; gap: 20px; margin-top: 16px; }
.post-card  { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.post-card h2 { font-size: 1.2rem; color: var(--brown); }
.post-card .post-date { font-size: .8rem; color: var(--muted); margin-bottom: 8px; font-family: system-ui, sans-serif; }


/* ── TIMER ────────────────────────────────────────── */
.timer-badge {
  display: inline-block; padding: 10px 16px; border-radius: 8px;
  font-size: .95rem; font-weight: bold; font-family: system-ui, sans-serif;
}
.timer-idle    { background: #f5f5f5; color: var(--muted); border: 1px solid var(--border); }
.timer-pending { background: #fff8e1; color: var(--amber); border: 1px solid #ffe082; }
.timer-sent    { background: var(--green-lt); color: var(--green); border: 1px solid #a5d6a7; }


/* ── FOOTER ───────────────────────────────────────── */
footer {
  background: var(--navy-dk); color: rgba(255,255,255,.75);
  padding: 40px 28px; text-align: center;
}
footer a { color: rgba(255,255,255,.75); }
.footer-logo    { width: 72px; margin-bottom: 12px; opacity: .9; }
.footer-name    { font-size: 1.05rem; font-weight: bold; color: white; margin-bottom: 4px; }
.footer-address {
  font-size: .85rem; color: rgba(255,255,255,.55); margin-bottom: 20px;
  font-family: system-ui, sans-serif;
}
.footer-links {
  display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px;
}
.footer-links a {
  color: rgba(255,255,255,.75); text-decoration: none;
  font-size: .88rem; font-family: system-ui, sans-serif;
  transition: color .15s;
}
.footer-links a:hover { color: white; }
.map-link { font-size: .95rem; margin-bottom: 8px; }
.footer-sub { font-size: .78rem; margin-top: 8px; font-family: system-ui, sans-serif; }


/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 700px) {
  .founders-inner { grid-template-columns: 1fr; }
  .founders-photo-wrap { text-align: center; }
  .founders-photo { width: 200px; border-radius: 50%; aspect-ratio: 1; }
  .home-hero { min-height: 420px; }
  .hero-logo { width: 130px; height: 130px; }
  .hero-inner h1 { font-size: 1.9rem; }
  .market-card { flex-direction: column; align-items: flex-start; }
  header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cat-card { flex: 0 0 140px; }
  .blog-strip { grid-template-columns: 1fr; }
  .menu-grid  { grid-template-columns: 1fr; }
  .home-section { padding: 44px 20px; }
}


/* ══════════════════════════════════════════════════════
   DARK THEME
   Applied via:  <html data-theme="dark">
   Toggled by:   toggleTheme() in base.html
   ══════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --cream:    #0f1117;
  --white:    #1c1f26;
  --text:     #e8e9ec;
  --muted:    #9ca3af;
  --border:   #2e3340;
  --navy-dk:  #c5caf5;   /* lightened for dark bg headings  */
  --brown:    #d4a98a;
  --green-lt: #0d2410;
  --gold-lt:  #1f1800;
}

[data-theme="dark"] body {
  background: var(--cream);
  color: var(--text);
}

/* Cards / surfaces */
[data-theme="dark"] .market-card,
[data-theme="dark"] .menu-card,
[data-theme="dark"] .blog-card,
[data-theme="dark"] .cat-card,
[data-theme="dark"] .editor-entry {
  background: var(--white);
  border-color: var(--border);
  color: var(--text);
}

/* Sections */
[data-theme="dark"] .bg-white  { background: #14161d; }
[data-theme="dark"] .bg-lt     { background: #0f1117; }
[data-theme="dark"] .bg-cream  { background: #13151b; }

/* Inputs */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #1c1f26;
  color: var(--text);
  border-color: var(--border);
}

/* Header */
[data-theme="dark"] header {
  background: #0b0d14;
  border-bottom-color: var(--border);
}
[data-theme="dark"] header nav a { color: rgba(255,255,255,.75); }
[data-theme="dark"] header nav a:hover { color: #fff; }

/* Footer stays dark regardless — already dark-bg */

/* Zoom bar buttons on dark */
[data-theme="dark"] #zoom-bar button {
  background: #1c1f26;
  border-color: var(--green);
  color: var(--green);
}

/* Intro overlay — stays green */
/* Hero — stays photo */

/* Btn secondary on dark */
[data-theme="dark"] .btn-secondary {
  background: #1c1f26;
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .btn-secondary:hover {
  background: var(--green-lt);
  border-color: var(--green);
}

/* Page main */
[data-theme="dark"] .page-main { background: var(--cream); }
