/* ==========================================================================
   C-Ewe Farmstead — Design System
   Fulton, Missouri. Est. 2021. Stephanie & Ryan Copeland.
   ========================================================================== */

:root {
  /* Brand palette — creams, sage, tan, black. Never orange. */
  --cream: #FAF6EC;
  --cream-deep: #F1EAD9;
  --paper: #FFFFFF;
  --sage: #7C8B6F;
  --sage-dark: #4F5B43;
  --sage-tint: #E4E9DD;
  --tan: #C9A876;
  --tan-tint: #EFE2C9;
  --mustard: #C8930F;
  --ink: #2B2A22;
  --ink-soft: #5B5A4E;
  --line: #DED2B8;
  --barn: #8B3A2E; /* used only inside real photography, never UI chrome */

  /* Footer band: a fixed brand-color anchor, intentionally the same in both
     themes (never redefined in the dark-mode blocks below) — it's a solid
     dark green band with cream text regardless of light/dark preference. */
  --footer-bg: #4F5B43;
  --footer-text: #F1EAD9;
  --footer-text-soft: #EFE2C9;
  --footer-line: rgba(250, 246, 236, 0.18);

  --shadow-sm: 0 1px 2px rgba(43, 42, 34, 0.08);
  --shadow-md: 0 8px 24px rgba(43, 42, 34, 0.12);
  --shadow-lg: 0 20px 48px rgba(43, 42, 34, 0.18);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #23241E;
    --cream-deep: #1B1C17;
    --paper: #2C2D25;
    --sage: #A9BC98;
    --sage-dark: #C7D6BA;
    --sage-tint: #33392C;
    --tan: #D8BD8E;
    --tan-tint: #3A3323;
    --mustard: #E0AD3D;
    --ink: #F3EFE2;
    --ink-soft: #C7C2AF;
    --line: #464735;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --cream: #23241E;
  --cream-deep: #1B1C17;
  --paper: #2C2D25;
  --sage: #A9BC98;
  --sage-dark: #C7D6BA;
  --sage-tint: #33392C;
  --tan: #D8BD8E;
  --tan-tint: #3A3323;
  --mustard: #E0AD3D;
  --ink: #F3EFE2;
  --ink-soft: #C7C2AF;
  --line: #464735;
  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

img { max-width: 100%; display: block; }
a { color: var(--sage-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--sage-dark);
  line-height: 1.15;
  text-wrap: balance;
  margin: 0 0 0.5em;
  font-weight: 600;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
p { margin: 0 0 1em; max-width: 65ch; }
.center p { margin-left: auto; margin-right: auto; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tan);
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 20px;
}
section { padding-block: clamp(48px, 8vw, 96px); }
.tight { padding-block: clamp(28px, 5vw, 56px); }

/* sprig divider — a small hand-drawn-feel wheat motif tying to the subject */
.sprig { display: block; margin: 0 auto; opacity: 0.75; }
.sprig path, .sprig line { stroke: var(--tan); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.85em 1.6em;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  min-height: 44px;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--sage-dark); color: var(--cream); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--sage); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--mustard); color: #241D08; box-shadow: var(--shadow-sm); }
.btn-accent:hover { box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; border-color: var(--sage-dark); color: var(--sage-dark); }
.btn-ghost:hover { background: var(--sage-tint); }
.btn-block { width: 100%; }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(250, 246, 236, 0.97);
  border-bottom: 1px solid var(--line);
}
/* Note: intentionally no backdrop-filter here — it would make this sticky
   header the containing block for its position:fixed mobile nav descendant,
   collapsing the off-canvas menu's height to its own (~68px). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { background: rgba(35, 36, 30, 0.94); }
}
:root[data-theme="dark"] .site-header { background: rgba(35, 36, 30, 0.94); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  max-width: 1280px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 48px; width: 48px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--sage-dark); }
.brand-text span { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tan); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 2px solid var(--sage-dark);
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--sage-dark); margin: 4px auto; transition: transform 0.2s ease, opacity 0.2s ease; }

.main-nav { display: flex; }
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; align-items: center; }
.main-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--sage-tint); color: var(--sage-dark); }
.main-nav .btn { margin-left: 6px; text-transform: none; letter-spacing: 0.02em; }

@media (max-width: 1120px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: block;
    position: fixed;
    top: 68px;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 84vw);
    background: var(--paper);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }
  .main-nav.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 6px; }
  .main-nav a { padding: 14px 16px; text-align: left; }
  .main-nav .btn { margin: 10px 0 0; text-align: center; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 62vh;
  color: #FBF8EF;
  overflow: hidden;
}
.hero img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(43,42,34,0.15) 0%, rgba(43,42,34,0.65) 100%);
  z-index: 1;
}
.hero-content { position: relative; z-index: 2; padding-block: 48px; }
.hero-content .eyebrow { color: var(--tan-tint); }
.hero-content h1 { color: #FFFDF7; }
.hero-content p { color: #F1EAD9; font-size: 1.1rem; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

.page-hero {
  min-height: 38vh;
}

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 880px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.card-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--sage-tint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin-bottom: 0; }
.tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--sage-tint);
  color: var(--sage-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.section-head { max-width: 640px; margin-bottom: 36px; }
.section-head.center { margin-inline: auto; text-align: center; }

/* Sections that alternate background for rhythm */
.section-sage { background: var(--sage-tint); }
.section-paper { background: var(--paper); }

/* ---------- Product cards ---------- */
.product-card .price { font-family: var(--font-display); font-size: 1.4rem; color: var(--sage-dark); }
.product-card .btn { margin-top: auto; }
.stock-note { font-size: 0.8rem; color: var(--ink-soft); }
.product-card.is-sold { opacity: 0.6; }

/* ---------- Empty state (e.g. no livestock currently listed) ---------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 6vw, 56px) 24px;
}
.empty-state h3 { margin-bottom: 10px; }
.empty-state p { max-width: 46ch; margin-inline: auto; margin-bottom: 20px; color: var(--ink-soft); }

/* ---------- Animal bio cards ---------- */
.animal-card .species { color: var(--tan); font-weight: 700; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.08em; }

/* ---------- Meet the Animals: per-animal mini gallery ---------- */
.animal-photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 620px) { .animal-photo-grid { grid-template-columns: repeat(2, 1fr); max-width: 420px; margin-inline: auto; } }

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 880px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: zoom-in;
  border: 0; padding: 0; background: var(--sage-tint);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.gallery-item:hover img { transform: scale(1.06); }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 20, 16, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(92vw, 1100px); max-height: 84vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.lightbox-close {
  position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--cream); border: none; color: var(--ink); font-size: 1.3rem; cursor: pointer;
}
.lightbox-caption { position: absolute; bottom: max(20px, env(safe-area-inset-bottom, 0px)); color: #F1EAD9; font-size: 0.9rem; text-align: center; width: 100%; left: 0; padding-inline: 20px; }

/* ---------- Blog ---------- */
.post-list { display: flex; flex-direction: column; gap: 0; }
.post-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding-block: 28px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.post-row:first-child { padding-top: 0; }
.post-row .thumb { aspect-ratio: 4/3; border-radius: var(--radius-md); overflow: hidden; background: var(--sage-tint); }
.post-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-row h2 { margin-bottom: 6px; font-size: 1.4rem; }
.post-meta { font-size: 0.8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.post-row p { color: var(--ink-soft); margin-bottom: 0; }
@media (max-width: 640px) { .post-row { grid-template-columns: 1fr; } }

article.post-body { max-width: 720px; margin-inline: auto; }
article.post-body h2 { margin-top: 1.6em; }
article.post-body p { max-width: none; }
.post-hero-figure { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 32px; box-shadow: var(--shadow-md); }
.post-disclaimer { background: var(--tan-tint); border-radius: var(--radius-md); padding: 16px 20px; font-size: 0.9rem; color: var(--ink-soft); margin-top: 2em; }
.byline { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 28px; }
.byline img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 700; font-size: 0.9rem; }
.field input, .field textarea, .field select {
  font: inherit;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  min-height: 44px;
}
.field textarea { min-height: 140px; resize: vertical; }
.form-note { font-size: 0.85rem; color: var(--ink-soft); }
.form-success { display: flex; gap: 10px; align-items: flex-start; background: var(--sage-tint); color: var(--sage-dark); padding: 16px 18px; border-radius: var(--radius-md); font-weight: 600; }

/* ---------- Contact info blocks ---------- */
.contact-block { display: flex; flex-direction: column; gap: 18px; }
.contact-line { display: flex; gap: 12px; align-items: flex-start; }
.contact-line strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--tan); margin-bottom: 2px; }
.copy-btn { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; cursor: pointer; margin-left: 8px; color: var(--sage-dark); }

/* ---------- Tiers (Sponsor a Lamb) ---------- */
.tier-card { position: relative; border-radius: var(--radius-lg); }
.tier-card.featured { border-color: var(--mustard); border-width: 2px; }
.tier-badge { position: absolute; top: -14px; left: 24px; background: var(--mustard); color: #241D08; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 14px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.tier-price { font-family: var(--font-display); font-size: 2.2rem; color: var(--sage-dark); }
.tier-price span { font-family: var(--font-body); font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
.tier-list { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.tier-list li { padding-left: 1.6em; position: relative; }
.tier-list li::before { content: "✓"; position: absolute; left: 0; color: var(--sage); font-weight: 800; }

/* ---------- Adopt a Lamb: lamb cards ---------- */
.lamb-card .card-body { gap: 10px; }
.lamb-card .blurb { color: var(--ink-soft); min-height: 2.6em; }
.lamb-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.lamb-buttons .btn { font-size: 0.85rem; padding: 0.7em 1.2em; }
.lamb-buttons .btn small { display: block; font-weight: 400; opacity: 0.85; font-size: 0.78em; }
.photo-pending {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--ink-soft); font-size: 0.85rem; text-align: center; padding: 16px;
  background: repeating-linear-gradient(135deg, var(--sage-tint), var(--sage-tint) 10px, var(--tan-tint) 10px, var(--tan-tint) 20px);
}

/* ---------- Adopt a Lamb: private update portal ---------- */
.portal-section { background: var(--tan-tint); border-radius: var(--radius-lg); padding: clamp(28px, 4vw, 48px); text-align: center; }
.portal-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0 0; }
.portal-form input {
  font: inherit; padding: 12px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink); min-height: 44px; width: 260px; max-width: 100%;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.portal-result { margin-top: 24px; text-align: left; max-width: 640px; margin-inline: auto; }
.secret-bio { background: var(--paper); border-left: 4px solid var(--sage); border-radius: var(--radius-md); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.secret-bio h3 { margin-bottom: 8px; }
.secret-bio p { margin-bottom: 0; max-width: none; }
.portal-error { color: var(--barn); font-weight: 600; margin-top: 16px; }
.portal-note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 14px; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 20px 4px;
  font-family: var(--font-display); font-size: 1.1rem; color: var(--sage-dark);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.4rem; color: var(--tan); flex-shrink: 0; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { padding: 0 4px 20px; color: var(--ink-soft); }

/* ---------- Footer ----------
   Fixed brand band — uses --footer-* tokens only, which are never
   redefined in the dark-mode blocks, so this stays the same dark green
   band with cream text in both themes instead of inverting. */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding-block: 56px 28px; }
.site-footer a { color: var(--footer-text-soft); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; margin-bottom: 40px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }
.footer-grid h4 { color: var(--footer-text-soft); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.footer-brand img { height: 44px; width: 44px; border-radius: 50%; object-fit: cover; }
.footer-brand strong { font-family: var(--font-display); font-size: 1.2rem; color: var(--footer-text); }
.footer-bottom { border-top: 1px solid var(--footer-line); padding-top: 20px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; font-size: 0.82rem; color: var(--footer-text-soft); }
.social-row { display: flex; gap: 10px; }
.social-row a { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(250,246,236,0.3); display: flex; align-items: center; justify-content: center; }
.social-row a:hover { background: rgba(250,246,236,0.12); }

/* ---------- Utility ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.center { text-align: center; }
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--sage-dark); color: var(--cream); padding: 12px 18px; border-radius: 8px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.badge-row span { background: rgba(255,255,255,0.15); color: #FBF8EF; padding: 6px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; }

[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
code { background: var(--sage-tint); color: var(--sage-dark); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }
