@font-face {
  font-family: "TAY Misprint";
  src: url("assets/fonts/TAYMisprint.woff2") format("woff2"),
       url("assets/fonts/TAYMisprint.woff") format("woff");
  font-display: swap;
}

/* Uncle Gordy's: hand-drawn, Texas Panhandle sign-painter energy.
   TAY Misprint (the label font) for headings, IBM Plex Mono for everything else.
   Borders and color panels are pseudo-elements run through the #ink SVG
   filter, so their edges wobble while the text on top stays crisp. */

:root {
  --ink: #2a211c;
  --muted: #5e5147;
  --paper: #f4e9d2;
  --paper-2: #efe1c3;
  --card: #fbf4e4;
  --red: #d42a20;
  --verde: #3d6e36;
  --verde-dark: #2d5428;
  --wobble: 14px 9px 16px 8px / 9px 15px 8px 13px;
  --display: "TAY Misprint", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* Browser surfaces, themed from the palette. */
::selection { background: var(--red); color: var(--card); }
input, select { caret-color: var(--red); }
html { scrollbar-color: var(--ink) var(--paper); scrollbar-width: thin; }
a { color: inherit; text-underline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--paper);
  /* Paper grain. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.15; letter-spacing: 0; text-transform: uppercase; }
strong { font-weight: 600; }
button, input, select { font: inherit; color: inherit; }


/* Hand-drawn frame: a wobbly ink outline behind the element's content. */
.card, .cart { position: relative; isolation: isolate; }
.card::before, .cart::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  filter: url(#ink);
  pointer-events: none;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 52px;
}

/* ------------------------------------------------------------- nav -- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--paper);
  border-bottom: 2px dashed rgba(42, 33, 28, 0.35);
}
.nav__home { display: flex; padding: 6px; margin-left: -6px; color: var(--red); }
.nav__home svg { width: 38px; height: 38px; transform: rotate(-4deg); }
.nav__cart {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--display);
  font-size: 15px;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.nav__count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 50% 45% 55% 48%;
  background: var(--red);
  color: var(--card);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

/* ----------------------------------------------------------- intro -- */
.intro { max-width: 700px; display: flex; flex-direction: column; gap: 14px; }
.intro h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1; }
.intro__lede { font-size: 17px; font-weight: 500; max-width: 60ch; }
.intro__lede a { color: var(--red); font-weight: 600; }
.intro__sub { font-size: 16px; color: var(--muted); }

/* -------------------------------------------------------- products -- */
.products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}
.card { display: flex; flex-direction: column; padding: 14px; }
.card::before { background: var(--card); }
.card:nth-child(1) { transform: rotate(-0.6deg); }
.card:nth-child(2) { transform: rotate(0.5deg); }

.card__media {
  position: relative;
  isolation: isolate;
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--card);
}
.card__media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 10px 16px 9px 14px / 14px 8px 15px 10px;
  filter: url(#ink);
}
.card__media--red::before { background: var(--red); }
.card__media--verde::before { background: var(--verde); }
.card__media svg { width: 30%; max-width: 120px; aspect-ratio: 1; height: auto; }
.card__media span:not(.card__tag) {
  font-family: var(--display);
  font-size: clamp(30px, 4.4vw, 44px);
  letter-spacing: 0.06em;
  padding-left: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
/* Flip card: red panel turns over to show the recipe. */
.flip { position: relative; aspect-ratio: 4 / 3; perspective: 1400px; }
.flip__inner {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.flip__face { position: absolute; inset: 0; aspect-ratio: auto; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip__back { transform: rotateY(180deg); padding: 18px 28px 14px; justify-content: flex-start; }
@media (prefers-reduced-motion: reduce) { .flip__inner { transition: none; } }
.flip__btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  min-height: 36px;
  padding: 4px 14px;
  border: 0;
  border-radius: 40% 55% 45% 60% / 60% 45% 55% 40%;
  background: var(--card);
  color: var(--red);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  transform: rotate(3deg);
  cursor: pointer;
}
.flip__btn::after { content: ""; position: absolute; inset: -6px; } /* 44px+ tap area */

.recipe { width: 100%; border-collapse: collapse; color: var(--card); font-size: 14px; line-height: 1.3; }
.recipe caption {
  caption-side: top;
  line-height: 22px;
  padding-bottom: 16px;
  text-align: left;
  font-family: var(--display);
  font-size: 18px;
  text-transform: uppercase;
}
.recipe th { text-align: left; font-weight: 400; padding: 2px 0; }
.recipe td { text-align: right; font-weight: 600; padding: 2px 0; white-space: nowrap; }
.recipe tr + tr { border-top: 1px dashed rgba(251, 244, 228, 0.45); }

/* Hand-inked SOLD OUT stamp across a sold-out panel. */
.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 6px 18px;
  border: 4px solid var(--card);
  border-radius: 10px 6px 12px 5px / 6px 11px 5px 10px;
  background: var(--ink);
  color: var(--card);
  font-family: var(--display);
  font-size: clamp(22px, 3vw, 30px);
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-12deg);
  filter: url(#ink);
}
.card.is-sold-out .card__media > svg,
.card.is-sold-out .card__media > span:not(.stamp):not(.card__tag) { opacity: 0.35; }

.card__tag {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 12px;
  border-radius: 40% 55% 45% 60% / 60% 45% 55% 40%;
  background: var(--card);
  color: var(--verde);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  transform: rotate(3deg);
}

.card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 10px 8px;
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card__head h2 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.card__limited {
  padding: 0 8px;
  border: 2px solid var(--verde);
  border-radius: 45% 55% 50% 50% / 55% 45% 55% 45%;
  color: var(--verde);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  transform: rotate(-3deg);
}
.card__price { font-family: var(--display); font-size: 24px; }
.card__desc { color: var(--muted); }
.card__ingredients { font-size: 14px; color: var(--muted); font-style: italic; }
.card__stock { margin-top: auto; font-size: 14px; color: var(--muted); }
.card__stock.is-low { color: var(--red); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field select, .field input {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px 6px 12px 5px / 6px 11px 5px 10px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
}

/* ------------------------------------------------------------- buy -- */
.buy { display: flex; gap: 10px; }
.qty {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--ink);
  border-radius: 10px 6px 12px 5px / 6px 11px 5px 10px;
}
.qty button { width: 44px; border: 0; background: none; font-size: 24px; cursor: pointer; }
.qty output { display: grid; place-items: center; min-width: 24px; font-weight: 600; font-size: 16px; }

.btn {
  position: relative;
  isolation: isolate;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  background: none;
  color: var(--card);
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  border-radius: 12px 7px 14px 6px / 7px 13px 6px 12px;
  filter: url(#ink);
  transition: transform 0.12s;
}
.btn:hover::before { transform: rotate(-1deg) scale(1.02); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled::before { transform: none; }
.btn--block { width: 100%; flex: none; }
.btn--ghost { flex: none; align-self: flex-start; color: var(--ink); }
.btn--ghost::before { background: none; border: 2.5px solid var(--ink); }
.btn--verde::before { background: var(--verde); }
.card.is-sold-out .buy { opacity: 0.5; }

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px dashed var(--red);
  outline-offset: 3px;
}

/* ----------------------------------------------------------- batch -- */
.about { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.batch { display: flex; flex-direction: column; gap: 6px; }
.batch h2 { font-size: 19px; }
.batch p { color: var(--muted); }

/* ------------------------------------------------------------ cart -- */
.cart { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.cart::before { background: var(--paper-2); border-style: dashed; }
.cart h2 { font-size: 22px; }
.cart__empty { display: flex; flex-direction: column; gap: 14px; color: var(--muted); }
.cart__charity { display: flex; flex-direction: column; gap: 12px; }
.cart__rows { list-style: none; margin: 0; padding: 0; }
.cart__rows li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 2px dashed rgba(42, 33, 28, 0.3);
}
.cart__rows li span:first-child { flex: 1; }
.cart__remove {
  width: 44px;
  height: 44px;
  flex: none;
  border: 2px solid var(--ink);
  border-radius: 50% 45% 55% 48%;
  background: var(--card);
  cursor: pointer;
}
.cart__total { display: flex; justify-content: space-between; font-family: var(--display); font-size: 20px; }
.cart__note { font-size: 14px; color: var(--muted); }
.cart__hint { font-size: 14px; padding: 10px 14px; border: 2px dashed var(--ink); border-radius: var(--wobble); }

/* Post-purchase Story card */
.story { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.story__img {
  width: 60%;
  align-self: center;
  aspect-ratio: 9 / 16;
  border-radius: 10px 6px 12px 5px / 6px 11px 5px 10px;
  box-shadow: 0 6px 18px rgba(42, 33, 28, 0.25);
}
.cart__note a { color: var(--red); font-weight: 600; }

.banner { padding: 10px 16px; border-radius: var(--wobble); background: var(--paper-2); }
.banner--error { background: var(--red); color: var(--card); }

.foot { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.foot svg { width: 24px; height: 24px; color: var(--red); flex: none; }
.foot { flex-wrap: wrap; row-gap: 4px; }
.foot > span:first-of-type { flex: 1; min-width: 0; }
.foot__links, .foot__robots { flex-basis: 100%; padding-left: 34px; font-size: 14px; } /* lines up with the text, past the swan */
.foot__links a { color: inherit; }
.foot__robots code { font-family: var(--mono); font-weight: 600; color: var(--ink); }

/* ---------------------------------------------------------- dialog -- */
.dialog {
  max-width: 380px;
  width: calc(100% - 40px);
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  padding: 28px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
}
.dialog::backdrop { background: rgba(42, 33, 28, 0.55); }
.dialog form { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dialog h2 { font-size: 24px; }
.dialog p { color: var(--muted); }
.dialog__swan { width: 56px; height: 56px; color: var(--red); }

/* ------------------------------------------------- floating cart bar -- */
.cartbar {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  display: none;
}
.cartbar .btn { min-height: 56px; filter: drop-shadow(0 6px 14px rgba(42, 33, 28, 0.3)); }
body.has-cart .cartbar { display: block; }
body.cart-in-view .cartbar { display: none; }

/* ===================================================== breakpoints == */
/* Two cards side by side get too narrow for the recipe panel below 980px. */
@media (max-width: 980px) {
  .products { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
}

@media (max-width: 760px) {
  main { padding: 24px 16px 40px; gap: 40px; }
  body.has-cart main { padding-bottom: 100px; }
  .nav { padding: 6px 16px; }

  .intro h1 { font-size: 40px; }
  .intro__lede { font-size: 16px; }
  .intro__sub { font-size: 16px; }

  .products { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .card { padding: 12px; }
  .card__head h2 { font-size: 20px; }
  .card__price { font-size: 20px; }

  .cart { padding: 22px 18px; }
  /* Square panels on phones so the 10-row recipe fits; Verde matches. */
  .flip, .card__media { aspect-ratio: 1 / 1; }
  .flip__face { aspect-ratio: auto; }
  .flip__back { padding: 18px 18px 12px; }
  .recipe { font-size: 14px; line-height: 1.3; }
  /* Caption clears the Back tag so no row sits under it. */
  .recipe caption { font-size: 16px; line-height: 20px; padding-bottom: 16px; }
  .recipe th, .recipe td { padding: 2px 0; }

  .btn { font-size: 14px; padding: 0 16px; }
  .cartbar { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .cartbar .btn { width: 100%; justify-content: space-between; }
}

/* ---------------------------------------------------------- policies -- */
.policy { max-width: 720px; gap: 14px; }
.policy h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 0; }
.policy h2 { font-size: 18px; margin-top: 18px; }
.policy__date { color: var(--muted); font-size: 14px; }
.policy p, .policy li { max-width: 68ch; }
.policy ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.policy a { color: var(--red); }
.policy .foot { margin-top: 28px; }
.policy .foot a { color: inherit; }
