/* ==========================================================================
   Reusable components: loader, header, stamp button, floating WhatsApp,
   feed-sack stitches, chapter labels, ghost words and photo frames.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Loader — covers the page while the goat frames download.
   The logo animals are "drawn" as the frames arrive (see js/goat-sequence.js).
   A CSS fail-safe hides it after 8 s even if JavaScript never runs.
   -------------------------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--color-pasture);
  transition: opacity .7s ease, visibility .7s;
  animation: loader-failsafe 0s linear 8s forwards;
}
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader svg { width: min(340px, calc(70 * var(--vw))); overflow: visible; }
.loader path { fill: none; stroke: var(--color-straw); stroke-width: 2.2; }
.loader .mono { margin-top: 18px; text-align: center; color: var(--color-sprout); }

@keyframes loader-failsafe { to { opacity: 0; visibility: hidden; } }

/* --------------------------------------------------------------------------
   Site header — transparent over the hero, solid once the hero is left.
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) var(--gutter) 14px;
  transition: background .4s, transform .5s;
}
.site-header.is-solid { background: rgba(27, 51, 33, .92); backdrop-filter: blur(8px); }
.site-header__logo img { width: 52px; height: 52px; }
.site-header__actions { display: flex; align-items: center; gap: 12px; }
.site-nav { margin-left: auto; display: flex; gap: 22px; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: .85;
}
.site-nav a:hover {
  opacity: 1;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--color-red);
}
/* The nav needs room next to both header buttons; below this width the
   buttons stay and the chapters are reached by scrolling. */
@media (max-width: 1080px) {
  .site-nav { display: none; }
  .site-header__actions { margin-left: auto; }
}

/* "Seções" menu: replaces the nav below 1080px (js/extras.js → initMobileMenu). */
.menu-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 6px 12px 5px 10px;
  font: inherit;
  color: var(--color-straw);
  background: rgba(19, 23, 17, .25);
  border: 2px solid currentColor;
  cursor: pointer;
}
.menu-toggle__label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.menu-toggle__bars { display: grid; gap: 4px; width: 18px; }
.menu-toggle__bars i { display: block; height: 2px; background: currentColor; transition: transform .25s, opacity .2s; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars i:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 1080px) { .menu-toggle { display: inline-flex; } }

.site-header.menu-open { background: var(--color-pasture); }
.mobile-menu {
  position: absolute;
  top: 100%; left: 0; right: 0;
  padding: 6px var(--gutter) 26px;
  background: var(--color-pasture);
  border-bottom: 3px solid var(--color-red);
  box-shadow: 0 18px 30px rgba(19, 23, 17, .35);
  animation: menu-drop .25s ease-out;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu ol { margin: 0; padding: 0; list-style: none; }
.mobile-menu li + li { border-top: 1px dashed rgba(237, 227, 201, .3); }
.mobile-menu a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-paper);
}
.mobile-menu a .mono { font-size: 12px; font-weight: 400; color: var(--color-sprout); }
.mobile-menu a:hover, .mobile-menu a:focus-visible { color: #fff; }
@keyframes menu-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .mobile-menu { animation: none; } }
@media (max-width: 420px) {
  .site-header { gap: 10px; }
  .site-header__logo img { width: 44px; height: 44px; }
  .site-header__actions { gap: 8px; }
  .site-header .stamp-btn--small { gap: 6px; font-size: 13px; padding: 6px 9px 4px; }
  .site-header .stamp-btn--small svg { width: 13px; height: 13px; }
  .menu-toggle { min-height: 34px; padding: 6px 8px; }
  .menu-toggle__label { display: none; }
}

/* --------------------------------------------------------------------------
   Stamp button — red, slightly rotated, hard offset shadow (never a pill).
   -------------------------------------------------------------------------- */
.stamp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-paper);
  background: var(--color-red);
  border: 2px solid var(--color-ink);
  box-shadow: 5px 5px 0 var(--color-ink);
  transform: rotate(-1.5deg);
  transition: transform .2s, box-shadow .2s;
}
.stamp-btn:hover { transform: rotate(0) translate(-2px, -2px); box-shadow: 8px 8px 0 var(--color-ink); }
.stamp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.stamp-btn--small { font-size: 16px; padding: 8px 14px 6px; box-shadow: 3px 3px 0 var(--color-ink); }
.stamp-btn--small svg { width: 16px; height: 16px; }

/* Secondary stamp (phone orders): paper instead of red, tilted the other way. */
.stamp-btn--paper { color: var(--color-ink); background: var(--color-paper); transform: rotate(1.5deg); }
.stamp-btn--paper svg { fill: var(--color-red); }

/* Header phone button: "Disk entrega (11) 4022-4117" on wide screens,
   "Disk entrega" on tablets/phones, only the icon on very narrow phones. */
.stamp-btn__number { padding-left: 8px; margin-left: 2px; border-left: 2px solid currentColor; }
@media (max-width: 1180px) { .stamp-btn__number { display: none; } }
@media (max-width: 350px)  { .stamp-btn__label { display: none; } }

/* Floating WhatsApp button, shown after the hero. */
.whatsapp-float {
  position: fixed;
  right: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) rotate(-3deg);
  transition: opacity .4s, transform .4s;
}
.whatsapp-float.is-visible { opacity: 1; pointer-events: auto; transform: rotate(-3deg); }
/* Near the end of the page the button stops ('docks') in the gap between the
   storefront photo and the footer instead of covering the footer. */
.whatsapp-float { translate: 0 var(--dock, 0px); }
/* Phones: a square icon-only stamp, so it never covers headlines or captions. */
@media (max-width: 600px) {
  .whatsapp-float {
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    box-shadow: 4px 4px 0 var(--color-ink);
  }
  .whatsapp-float svg { width: 28px; height: 28px; }
  .whatsapp-float__label { display: none; }
}

/* --------------------------------------------------------------------------
   Feed-sack stitches — zig-zag cut between sections.
   Set --stitch-color to the colour of the section the zig-zag belongs to.
   -------------------------------------------------------------------------- */
.stitch {
  position: relative;
  z-index: 2;
  height: 22px;
  margin-top: -21px;
  background:
    linear-gradient(135deg, var(--stitch-color) 50%, transparent 50%) 0 11px / 22px 22px repeat-x,
    linear-gradient(225deg, var(--stitch-color) 50%, transparent 50%) 0 11px / 22px 22px repeat-x;
}
.stitch--bottom { transform: scaleY(-1); margin-top: 0; margin-bottom: -21px; }

/* Dashed "sewing" line. */
.stitch-line { height: 0; margin: 0 var(--gutter); border-top: 2px dashed currentColor; opacity: .45; }

/* --------------------------------------------------------------------------
   Chapter scaffolding
   -------------------------------------------------------------------------- */
/* Vertical rhythm between chapters: kept tight so the story flows. */
.chapter { position: relative; overflow: hidden; padding-block: clamp(48px, calc(6 * var(--vw)), 80px) clamp(56px, calc(6.5 * var(--vw)), 90px); }
.chapter__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px;
  padding-inline: var(--gutter);
}

/* Huge outlined word that slides sideways behind each chapter (js: data-ghost). */
.chapter__ghost {
  position: absolute;
  top: 36px;
  left: 0;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(160px, calc(30 * var(--vw)), 460px);
  line-height: .8;
  color: transparent;
  -webkit-text-stroke: 1.5px currentColor;
  opacity: .16;
  pointer-events: none;
  will-change: transform;
}

/* Rotated outlined label, e.g. "Cap. 1 · Campo e grande porte". */
.label-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 5px;
  border: 1.5px solid currentColor;
  transform: rotate(-3deg);
}
.label-tag b { font-weight: 600; }

/* --------------------------------------------------------------------------
   Photos — the <img> is taller than its frame so js can parallax it
   (data-parallax). Optional handwritten caption sits on a paper sticker.
   -------------------------------------------------------------------------- */
.photo { position: relative; margin: 0; overflow: hidden; max-width: 100%; background: var(--color-pasture-light); }
.photo img {
  position: absolute;
  inset: -6% 0;
  width: 100%;
  height: 112%;
  object-fit: cover;
  will-change: transform;
}
.photo figcaption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px 2px;
  font-family: var(--font-hand);
  font-size: 28px;
  line-height: 1;
  color: var(--color-red);
  background: var(--color-paper);
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .25);
}
@media (max-width: 600px) { .photo figcaption { left: 10px; bottom: 10px; font-size: 22px; } }
/* Polaroid-like paper border. */
.photo--framed { border: 10px solid var(--color-paper); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); }
