/* ==========================================================================
   Alpaca Farms — site stylesheet
   --------------------------------------------------------------------------
   Palette is drawn from natural undyed alpaca fleece (white, beige, silver,
   brown, bay-black), plus one saturated indigo that sits outside that range
   on purpose — it reads as the dyed thread against undyed wool.

   Contents
     1.  Tokens
     2.  Reset & base
     3.  Layout
     4.  Header & navigation
     5.  Typography / page heads
     6.  Directory accordion   <- the signature element
     7.  Prose & note blocks
     8.  Footer
     9.  Utilities
     10. Reduced motion
   ========================================================================== */


/* 1. TOKENS
   ========================================================================== */
:root{
  /* Fleece */
  --fleece-white:#F2EFE9;   /* page background      */
  --fleece-card:#FBFAF7;    /* raised surfaces      */
  --fleece-beige:#DCD5C8;   /* borders, dividers    */
  --fleece-silver:#A8A29B;  /* muted text, closed rule */
  --fleece-brown:#6B5B4F;   /* body text, nav       */
  --fleece-bay:#2E2823;     /* headings, near-black */

  /* The dyed thread */
  --indigo:#1F5C6B;
  --indigo-deep:#164450;

  /* Scale */
  --wrap:68rem;
  --radius:3px;

  /* Type */
  --font-display:"Fraunces",Georgia,"Times New Roman",serif;
  --font-body:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;

  /* Depth */
  --shadow-sm:0 1px 2px rgba(46,40,35,.06);
  --shadow-md:0 4px 16px rgba(46,40,35,.08);

  /* Motion */
  --ease:cubic-bezier(.2,.7,.3,1);
}


/* 2. RESET & BASE
   ========================================================================== */
*,
*::before,
*::after{ box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  margin:0;
  background:var(--fleece-white);
  color:var(--fleece-bay);
  font-family:var(--font-body);
  font-size:1rem;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

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

a{
  color:var(--indigo);
  text-decoration-thickness:1px;
  text-underline-offset:2px;
}
a:hover{ color:var(--indigo-deep); }

:focus-visible{
  outline:2px solid var(--indigo);
  outline-offset:3px;
  border-radius:2px;
}

/* Skip link — visible only on keyboard focus. */
.skip-link{
  position:absolute;
  left:-9999px;
  top:0;
  z-index:100;
  padding:.75rem 1.25rem;
  background:var(--fleece-bay);
  color:var(--fleece-white);
  font-weight:500;
  text-decoration:none;
  border-radius:0 0 var(--radius) 0;
}
.skip-link:focus{
  left:0;
  color:var(--fleece-white);
}


/* 3. LAYOUT
   ========================================================================== */
.wrap{
  width:100%;
  max-width:var(--wrap);
  margin-inline:auto;
  padding-inline:1.5rem;
}

main{ padding-block:3.5rem 5rem; }


/* 4. HEADER & NAVIGATION
   ========================================================================== */
.site-header{
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(242,239,233,.88);
  backdrop-filter:blur(8px);
  border-bottom:1px solid transparent;
  transition:border-color .25s var(--ease), box-shadow .25s var(--ease);
}
/* Applied by JS once the page scrolls past ~8px. */
.site-header.is-stuck{
  border-bottom-color:var(--fleece-beige);
  box-shadow:var(--shadow-sm);
}

.nav-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  min-height:4.5rem;
}

/* --- Wordmark --- */
.wordmark{
  display:flex;
  align-items:baseline;
  gap:.55rem;
  font-family:var(--font-display);
  font-variation-settings:"SOFT" 60,"WONK" 1,"opsz" 40;
  font-size:1.375rem;
  font-weight:600;
  letter-spacing:-.01em;
  color:var(--fleece-bay);
  text-decoration:none;
}
.wordmark:hover{ color:var(--fleece-bay); }

.wordmark .mark{
  width:1.9rem;
  height:1.9rem;
  flex:none;
  align-self:center;
}
.wordmark .sub{
  font-family:var(--font-body);
  font-size:.6875rem;
  font-weight:500;
  letter-spacing:.1em;
  text-transform:uppercase;
  color:var(--fleece-silver);
}

/* --- Hamburger --- */
.nav-toggle{
  display:none;                      /* shown at the mobile breakpoint */
  padding:.5rem;
  background:none;
  border:1px solid var(--fleece-beige);
  border-radius:var(--radius);
  color:var(--fleece-bay);
  cursor:pointer;
}
.nav-toggle:hover{ border-color:var(--fleece-silver); }

.nav-toggle .bar{
  display:block;
  width:20px;
  height:1.5px;
  background:currentColor;
  border-radius:2px;
  transition:transform .3s var(--ease), opacity .2s var(--ease);
}
.nav-toggle .bar + .bar{ margin-top:5px; }

/* Bars fold into an X. Driven off aria-expanded, so the
   accessible state and the visual state can't drift apart. */
.nav-toggle[aria-expanded="true"] .bar:nth-child(1){ transform:translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2){ opacity:0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3){ transform:translateY(-6.5px) rotate(-45deg); }

/* --- Links --- */
.nav-links{
  display:flex;
  align-items:center;
  gap:.25rem;
  margin:0;
  padding:0;
  list-style:none;
}
.nav-links a{
  display:block;
  padding:.5rem .875rem;
  font-size:.9375rem;
  font-weight:500;
  color:var(--fleece-brown);
  text-decoration:none;
  border-radius:var(--radius);
  transition:color .18s var(--ease), background .18s var(--ease);
}
.nav-links a:hover{
  color:var(--fleece-bay);
  background:var(--fleece-beige);
}
/* Add to the link matching the current page. */
.nav-links a.is-current{ color:var(--indigo); }

/* --- Mobile --- */
@media (max-width:52rem){
  .nav-toggle{ display:block; }

  .nav-links{
    position:absolute;
    inset-inline:0;
    top:100%;
    flex-direction:column;
    align-items:stretch;
    gap:0;
    padding:.5rem 1.5rem 1rem;
    background:var(--fleece-card);
    border-block:1px solid var(--fleece-beige);
    box-shadow:var(--shadow-md);

    /* Closed. visibility keeps it out of the tab order. */
    opacity:0;
    visibility:hidden;
    transform:translateY(-.5rem);
    transition:opacity .22s var(--ease),
               transform .22s var(--ease),
               visibility .22s;
  }
  .nav-links.is-open{
    opacity:1;
    visibility:visible;
    transform:none;
  }

  .nav-links a{
    padding:.75rem .25rem;
    border-radius:0;
  }
  .nav-links li + li a{ border-top:1px solid var(--fleece-beige); }

  .wordmark .sub{ display:none; }
}


/* 5. TYPOGRAPHY / PAGE HEADS
   ========================================================================== */
.page-head{
  max-width:44rem;
  margin-bottom:3rem;
}

.eyebrow{
  margin:0 0 .75rem;
  font-size:.6875rem;
  font-weight:600;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--fleece-silver);
}

h1{
  margin:0 0 1rem;
  font-family:var(--font-display);
  font-variation-settings:"SOFT" 80,"WONK" 1,"opsz" 120;
  font-size:clamp(2rem, 5vw, 3rem);
  font-weight:600;
  line-height:1.1;
  letter-spacing:-.02em;
}

h2{
  margin:2.75rem 0 .75rem;
  font-family:var(--font-display);
  font-variation-settings:"SOFT" 70,"opsz" 40;
  font-size:1.5rem;
  font-weight:600;
  letter-spacing:-.01em;
}

h3{
  margin:1.75rem 0 .5rem;
  font-size:1rem;
  font-weight:600;
}

p{ margin:0 0 1rem; }

.lede{
  max-width:38rem;
  margin:0;
  font-size:1.125rem;
  color:var(--fleece-brown);
}


/* 6. DIRECTORY ACCORDION
   --------------------------------------------------------------------------
   The signature element. Each row carries a 3px "fiber rule" on its left
   edge: silver when closed, indigo when open. It doubles as the affordance.
   ========================================================================== */
.directory{
  max-width:52rem;
  margin:0;
  padding:0;
  list-style:none;
}

.farm{
  position:relative;
  margin-bottom:.5rem;
  background:var(--fleece-card);
  border:1px solid var(--fleece-beige);
  border-left:none;                       /* the ::before rule replaces it */
  border-radius:0 var(--radius) var(--radius) 0;
  transition:box-shadow .25s var(--ease), transform .25s var(--ease);
}

/* The thread. */
.farm::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:3px;
  background:var(--fleece-silver);
  transition:background .3s var(--ease);
}

.farm:hover{ box-shadow:var(--shadow-sm); }

.farm.is-open{
  box-shadow:var(--shadow-md);
  transform:translateX(2px);
}
.farm.is-open::before{ background:var(--indigo); }

/* --- Trigger row --- */
.farm-trigger{
  display:flex;
  align-items:center;
  gap:1rem;
  width:100%;
  padding:1.125rem 1.25rem;
  background:none;
  border:none;
  font:inherit;
  color:inherit;
  text-align:left;
  cursor:pointer;
}

.farm-name{
  flex:1;
  font-size:1.0625rem;
  font-weight:600;
  letter-spacing:-.005em;
}

.farm-town{
  font-size:.8125rem;
  font-weight:500;
  color:var(--fleece-silver);
  white-space:nowrap;
}

.chev{
  flex:none;
  width:.75rem;
  height:.75rem;
  border-right:1.5px solid var(--fleece-silver);
  border-bottom:1.5px solid var(--fleece-silver);
  transform:rotate(45deg) translateY(-2px);
  transition:transform .3s var(--ease), border-color .3s var(--ease);
}
.farm.is-open .chev{
  transform:rotate(225deg) translateY(-2px);
  border-color:var(--indigo);
}

/* --- Panel ---
   Height animates via grid-template-rows 0fr -> 1fr. This is the modern
   approach: it animates to the content's true height with no JS measuring
   and no max-height guess (which ruins the easing curve).

   The inner <div> with overflow:hidden is REQUIRED for this to work —
   don't remove it. The grid track collapses, the div clips.              */
.farm-panel{
  display:grid;
  grid-template-rows:0fr;
  transition:grid-template-rows .32s var(--ease);
}
.farm.is-open .farm-panel{ grid-template-rows:1fr; }

.farm-panel > div{ overflow:hidden; }

.farm-body{
  padding:1.125rem 1.25rem 1.375rem;
  border-top:1px solid var(--fleece-beige);
}
.farm-body > p{
  max-width:44rem;
  margin:0 0 1rem;
  font-size:.9375rem;
  color:var(--fleece-brown);
}
.farm-body > p:last-child{ margin-bottom:0; }

/* --- Meta grid ---
   auto-fit + minmax reflows from 4 columns to 1 with no extra media
   queries. Each dt/dd pair is wrapped in a div so they track together. */
.farm-meta{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  gap:1rem 1.5rem;
  margin:0;
}

.farm-meta a{
  overflow-wrap:anywhere;
}

.farm-meta dt{
  margin-bottom:.2rem;
  font-size:.6875rem;
  font-weight:600;
  letter-spacing:.09em;
  text-transform:uppercase;
  color:var(--fleece-silver);
}
.farm-meta dd{
  margin:0;
  font-size:.9375rem;
  color:var(--fleece-bay);
}

/* Empty-state, for a state page with no farms yet. */
.directory-empty{
  max-width:40rem;
  padding:2rem 1.25rem;
  background:var(--fleece-card);
  border:1px dashed var(--fleece-beige);
  border-radius:var(--radius);
  color:var(--fleece-brown);
}


/* 7. PROSE & NOTE BLOCKS
   ========================================================================== */
.prose{ max-width:40rem; }

.prose ul,
.prose ol{
  margin:0 0 1rem;
  padding-left:1.1rem;
}
.prose li{ margin-bottom:.4rem; }
.prose li::marker{ color:var(--fleece-silver); }

/* Pulled-out statement. Used for the privacy declaration. */
.note{
  max-width:40rem;
  margin:1.5rem 0;
  padding:1.125rem 1.25rem;
  background:var(--fleece-card);
  border-left:3px solid var(--indigo);
}
.note p:last-child{ margin-bottom:0; }
.note strong{ font-weight:600; }


/* 8. FOOTER
   ========================================================================== */
.site-footer{
  padding-block:2.5rem;
  border-top:1px solid var(--fleece-beige);
  font-size:.875rem;
  color:var(--fleece-silver);
}

.footer-inner{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:1rem 2rem;
}
.footer-inner p{ margin:0; }

.footer-links{
  display:flex;
  flex-wrap:wrap;
  gap:1.25rem;
  margin:0;
  padding:0;
  list-style:none;
}
.footer-links a{
  color:var(--fleece-brown);
  text-decoration:none;
}
.footer-links a:hover{
  color:var(--indigo);
  text-decoration:underline;
}


/* 9. UTILITIES
   ========================================================================== */
.visually-hidden{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
  border:0;
}

.section-rule{
  margin-top:5rem;
  padding-top:3rem;
  border-top:1px solid var(--fleece-beige);
}


/* 10. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion:reduce){
  *,
  *::before,
  *::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
    scroll-behavior:auto !important;
  }
}

/* --- Contact --- */
.contact-address{
  margin:0 0 1.5rem;
  padding:1.25rem 1.5rem;
  background:var(--fleece-card);
  border:1px solid var(--fleece-beige);
  border-left:3px solid var(--indigo);
  border-radius:0 var(--radius) var(--radius) 0;
  font-family:var(--font-display);
  font-variation-settings:"SOFT" 70,"opsz" 40;
  font-size:clamp(1.125rem,3vw,1.5rem);
  font-weight:600;
  letter-spacing:-.01em;
  word-break:break-word;          /* long address, narrow phone */
}
.contact-address a{ text-decoration:none; }
.contact-address a:hover{ text-decoration:underline; }
