/* ==========================================================
   Sparrow & Bramble General Store — Maynard, MA
   Kraft #EFE6D8 · Ink #2B2318 · Forest #3F5B45 · Rust #C97A3D
   Dense, warm, hand-arranged. The opposite of the Velvet &
   Vine demo's quiet restraint — but equally deliberate.
   ========================================================== */

:root {
  --paper: #EFE6D8;
  --ink: #2B2318;
  --green: #3F5B45;
  --green-deep: #33492F;
  --rust: #C97A3D;      /* fills, borders, rules — never body text */
  --rust-ink: #92501E;  /* the text-safe rust (AA on light grounds) */
  --tag: #FBF6EC;
  --serif: "Fraunces", Georgia, serif;
  --mono: "Courier Prime", "Courier New", monospace;
  --sans: "Karla", "Segoe UI", sans-serif;
  --script: "Caveat", cursive;
  --ease: cubic-bezier(0.25, 0.9, 0.35, 1);   /* livelier than the spa demo */
  --pad: clamp(1.25rem, 5vw, 5rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.015em;
}

em { font-style: italic; }

/* ---- kraft grain ---- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='k'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23k)'/%3E%3C/svg%3E");
}

/* ---- text links ---- */
.text-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  padding-bottom: 3px;
}
.text-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: currentColor;
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.text-link:hover::after { transform: scaleX(0); transform-origin: left; }
.text-link .arrow { display: inline-block; transition: transform 0.4s var(--ease); }
.text-link:hover .arrow { transform: translateX(5px); }
.text-link.quiet { color: var(--ink); font-weight: 400; opacity: 0.7; }

/* ==========================================================
   HEADER
   ========================================================== */
.site-header {
  display: flex;
  align-items: baseline;
  gap: 2.5rem;
  padding: 1.6rem var(--pad);
  border-bottom: 2px solid var(--green);
}

.brand {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.amp { color: var(--rust-ink); font-style: italic; }

.main-nav { display: flex; gap: 1.6rem; margin-left: auto; }
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.78;
  transition: opacity 0.35s var(--ease), color 0.35s var(--ease);
}
.main-nav a:hover { opacity: 1; color: var(--green); }

.header-note {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  border: 1.5px solid var(--green);
  padding: 0.2rem 0.6rem;
}

/* hamburger — mobile only */
.menu-toggle {
  display: none;
  background: none;
  border: 0;
  width: 44px; height: 44px;
  margin-left: auto;
  cursor: pointer;
  position: relative;
  z-index: 80;
}
.menu-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--ink);
  margin: 5px auto;
  transition: transform 0.4s var(--ease), opacity 0.25s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

.overlay-menu {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--paper);
  display: flex;
  align-items: center;
  padding: var(--pad);
}
.overlay-menu[hidden] { display: none; }
.overlay-menu nav { display: flex; flex-direction: column; gap: 1.1rem; }
.overlay-menu a {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.9rem, 8vw, 2.75rem);
  color: var(--ink);
  text-decoration: none;
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  transition-delay: calc(var(--i) * 70ms);
}
.overlay-menu.is-open a { opacity: 1; transform: none; }

/* ==========================================================
   HERO
   ========================================================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(3rem, 7vh, 6rem) var(--pad) clamp(3rem, 6vh, 5rem);
}

.hero-kicker {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust-ink);
  margin-bottom: 1.4rem;
}

.hero-title {
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
  font-weight: 900;
  margin-bottom: 1.6rem;
}
.hero-title em { color: var(--green); }

.line-mask { display: block; overflow: hidden; padding-bottom: 0.08em; }
.line {
  display: block;
  transform: translateY(110%);
  transition: transform 0.75s var(--ease);
}
.lines-in .line { transform: translateY(0); }
.line-mask:nth-child(2) .line { transition-delay: 100ms; }

.hero-sub { max-width: 40ch; margin-bottom: 2rem; }

.hero-links { display: flex; gap: 2rem; align-items: baseline; flex-wrap: wrap; }

/* Photo pinned like a corkboard snapshot.
   Angle lives in --rot so the reveal rule below restores it, not flattens it. */
.hero-photo {
  --rot: -2deg;
  transform: rotate(var(--rot));
  background: var(--tag);
  padding: 0.75rem 0.75rem 0;
  border: 1px solid rgba(43, 35, 24, 0.18);
  box-shadow: 0 18px 40px -22px rgba(43, 35, 24, 0.55);
}
.hero-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.hero-photo figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.6rem 0.1rem 0.7rem;
  color: rgba(43, 35, 24, 0.7);
}

/* ==========================================================
   WHAT'S INSIDE — ledger labels
   ========================================================== */
.inside {
  padding: clamp(3.5rem, 8vh, 6rem) var(--pad);
  border-top: 1px solid rgba(43, 35, 24, 0.18);
}
.inside-head { max-width: 58rem; margin-bottom: 2.75rem; }
.inside-head h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.9rem; }
.inside-head p { max-width: 46ch; opacity: 0.8; }

.label-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
}
.ledger-label {
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--tag);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 0.55rem 1.1rem;
  transform: rotate(var(--rot, 0deg));
  box-shadow: 3px 4px 0 rgba(43, 35, 24, 0.12);
  transition: transform 0.35s var(--ease);
}
.ledger-label:hover { transform: rotate(0deg) translateY(-3px); }

/* ==========================================================
   FEATURED FINDS — the shelf (signature section)
   ========================================================== */
.finds {
  padding: clamp(3.5rem, 8vh, 6rem) var(--pad) clamp(4rem, 9vh, 7rem);
  background:
    linear-gradient(180deg, rgba(63, 91, 69, 0.05), transparent 40%);
  border-top: 1px solid rgba(43, 35, 24, 0.18);
}
.finds-head { max-width: 58rem; margin-bottom: clamp(2.5rem, 5vh, 4rem); }
.finds-head h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.9rem; }
.finds-head p { max-width: 48ch; opacity: 0.8; }

.shelf {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem 2rem;
  max-width: 76rem;
  /* Each item keeps its natural height — otherwise stretching flattens the
     mixed aspect ratios the whole "shelf, not grid" idea depends on. */
  align-items: start;
}

.find {
  position: relative;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.4s var(--ease), filter 0.4s var(--ease);
  background: var(--tag);
  padding: 0.7rem;
  border: 1px solid rgba(43, 35, 24, 0.16);
  box-shadow: 0 14px 30px -20px rgba(43, 35, 24, 0.5);
  will-change: transform;
}
.find img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.find--tall img { aspect-ratio: 3 / 4; }
.find--wide img { aspect-ratio: 4 / 3; }

/* Pick it up off the shelf */
.find:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 26px 44px -22px rgba(43, 35, 24, 0.6);
  z-index: 3;
}

/* kraft price tag */
.tag {
  position: absolute;
  right: -0.75rem;
  bottom: -1.1rem;
  display: grid;
  gap: 0.1rem;
  background: var(--tag);
  border: 1.5px solid var(--ink);
  padding: 0.5rem 0.85rem;
  transform: rotate(var(--tag-rot, 0deg));
  box-shadow: 2px 3px 0 rgba(43, 35, 24, 0.16);
  transition: background-color 0.35s var(--ease), transform 0.35s var(--ease);
  max-width: 78%;
}
.find:hover .tag { background: #fff; transform: rotate(0deg); }
.tag-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.25;
}
.tag-price {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--rust-ink);
}
.string {
  position: absolute;
  top: -18px;
  left: 10px;
  width: 26px;
  height: 20px;
  color: rgba(43, 35, 24, 0.5);
}

.shelf-note {
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-top: 3rem;
  color: rgba(43, 35, 24, 0.72);
}

/* ==========================================================
   PENNY CANDY COUNTER
   ========================================================== */
.candy {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding: clamp(3.5rem, 8vh, 6rem) var(--pad);
  background: rgba(201, 122, 61, 0.1);
  border-block: 1px solid rgba(43, 35, 24, 0.18);
}
.candy-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(43, 35, 24, 0.2);
}
.candy-text h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  margin-bottom: 1rem;
}
.candy-text p { max-width: 46ch; }
.candy-fine {
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-top: 1.25rem;
  color: var(--rust-ink);
}

/* ==========================================================
   ABOUT
   ========================================================== */
.about {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
  padding: clamp(3.5rem, 8vh, 6.5rem) var(--pad);
}
.about-photo {
  --rot: 1.5deg;
  background: var(--tag);
  padding: 0.75rem;
  border: 1px solid rgba(43, 35, 24, 0.18);
  transform: rotate(var(--rot));
  box-shadow: 0 18px 38px -24px rgba(43, 35, 24, 0.55);
}
.about-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.about-text h2 {
  font-size: clamp(1.9rem, 3.8vw, 2.9rem);
  margin-bottom: 1.4rem;
  max-width: 20ch;
}
.about-text p { margin-bottom: 1.2rem; max-width: 50ch; }
.signature {
  font-family: var(--script);
  font-size: 2.1rem;
  color: var(--green);
  line-height: 1;
  margin-top: 1.75rem;
}

/* ==========================================================
   REVIEWS — clipped index cards
   ========================================================== */
.reviews {
  padding: clamp(3.5rem, 8vh, 6rem) var(--pad);
  border-top: 1px solid rgba(43, 35, 24, 0.18);
}
.reviews h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  margin-bottom: clamp(2rem, 4vh, 3rem);
  max-width: 24ch;
}
.clippings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  max-width: 74rem;
}
.clip {
  background: var(--tag);
  border: 1px solid rgba(43, 35, 24, 0.22);
  padding: 1.5rem 1.4rem 1.2rem;
  transform: rotate(var(--rot, 0deg));
  box-shadow: 0 12px 26px -20px rgba(43, 35, 24, 0.5);
  transition: transform 0.35s var(--ease);
  /* ruled-card feel */
  background-image: linear-gradient(rgba(63, 91, 69, 0.09) 1px, transparent 1px);
  background-size: 100% 1.9rem;
  background-position: 0 1.1rem;
}
.clip:hover { transform: rotate(0deg) translateY(-4px); }
.clip p { font-size: 1rem; margin-bottom: 0.9rem; }
.clip cite {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.82rem;
  color: var(--rust-ink);
}

/* ==========================================================
   VISIT — index card
   ========================================================== */
.visit { padding: clamp(2rem, 5vh, 4rem) var(--pad) clamp(4rem, 8vh, 6rem); }
.index-card {
  background: var(--tag);
  border: 1.5px solid var(--ink);
  padding: clamp(1.75rem, 4vw, 3rem);
  max-width: 74rem;
  box-shadow: 5px 6px 0 rgba(43, 35, 24, 0.14);
}
.index-card h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1.5px solid var(--rust);
}
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.card-col h3 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.75rem;
}
.card-col p { font-size: 0.96rem; margin-bottom: 0.75rem; max-width: 32ch; }
address { font-style: normal; line-height: 1.7; margin-bottom: 0.6rem; }
.visit-phone {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--rust);
  padding-bottom: 1px;
}
.hours { border-collapse: collapse; font-family: var(--mono); font-size: 0.92rem; }
.hours td { padding: 0.25rem 0; }
.hours td:first-child { padding-right: 2rem; opacity: 0.65; }

/* ==========================================================
   FOOTER
   ========================================================== */
.site-footer {
  background: var(--green-deep);
  color: var(--paper);
  padding: clamp(3rem, 7vh, 4.5rem) var(--pad) 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}
.footer-brand {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}
.footer-brand .amp { color: #E5B382; }
.footer-line { opacity: 0.85; font-size: 0.98rem; }
.footer-phone {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid rgba(239, 230, 216, 0.5);
}
.footer-cta {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 2px solid #E5B382;
  padding-bottom: 3px;
  transition: color 0.35s var(--ease);
}
.footer-cta:hover { color: #E5B382; }
.footer-fine {
  border-top: 1px solid rgba(239, 230, 216, 0.22);
  padding-top: 1.75rem;
  font-size: 0.84rem;
  opacity: 0.72;
  max-width: 72ch;
}
.footer-fine a { color: var(--paper); }

/* ==========================================================
   SCROLL REVEALS
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(1.75rem);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0) rotate(var(--rot, 0deg));
}
/* rotated elements keep their resting angle once revealed */
.find.in-view, .clip.in-view, .ledger-label.in-view {
  transform: rotate(var(--rot, 0deg));
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (min-width: 620px) {
  .shelf { grid-template-columns: repeat(2, 1fr); }
  .clippings { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .shelf { grid-template-columns: repeat(3, 1fr); }
  /* break the grid — shelf logic, not grid logic */
  .find:nth-child(2) { margin-top: 3rem; }
  .find:nth-child(3) { margin-top: -1rem; }
  .find:nth-child(4) { margin-top: -2.5rem; }
  .find:nth-child(5) { margin-top: 1.5rem; }
  .find:nth-child(6) { margin-top: -3rem; }

  .candy { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2.5rem, 5vw, 4.5rem); }
  .about { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: clamp(2.5rem, 5vw, 5rem); }
  .about-photo { margin-top: -1.5rem; }
  .clippings { grid-template-columns: repeat(3, 1fr); }
  .clip:nth-child(2) { margin-top: 1.75rem; }
  .clip:nth-child(3) { margin-top: -0.75rem; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; }
}

@media (max-width: 860px) {
  .main-nav, .header-note { display: none; }
  .menu-toggle { display: block; }
  .hero { grid-template-columns: 1fr; }
  .hero-photo { max-width: 82%; }
}

/* ==========================================================
   REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .line, .find, .clip, .tag, .ledger-label, .overlay-menu a {
    transition: none !important;
  }
  .reveal { opacity: 1; transform: rotate(var(--rot, 0deg)); }
  .line { transform: none; }
}
