:root {
  color-scheme: light;
  --page-bg: #fafafa;
  --ink: #454545;
  --ink-strong: #111;
  --ink-hover: #222;
  --ink-soft: #888;
  --ink-muted: #999;
  --ui-muted: #b5b5b5;
  --ui-faint: #d5d0c4;
  --rule: rgba(69, 69, 69, 0.15);
  --rule-soft: rgba(20, 20, 20, 0.08);
  --overlay-bg: rgba(245, 245, 247, 0.55);
  --placeholder: rgba(20, 20, 20, 0.18);
  --pill-bg: #fafafa;
  --pill-shadow: rgba(0, 0, 0, 0.12);
  --empty: #cfc8b8;
  --empty-hover: #b9b2a2;
  --skeleton-a: rgba(69, 69, 69, 0.05);
  --skeleton-b: rgba(69, 69, 69, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #11110f;
  --ink: #e7e0d4;
  --ink-strong: #fbf5ea;
  --ink-hover: #fff9ef;
  --ink-soft: #aaa297;
  --ink-muted: #8f887f;
  --ui-muted: #79736b;
  --ui-faint: #5d574f;
  --rule: rgba(231, 224, 212, 0.17);
  --rule-soft: rgba(231, 224, 212, 0.09);
  --overlay-bg: rgba(17, 17, 15, 0.72);
  --placeholder: rgba(231, 224, 212, 0.22);
  --pill-bg: #171713;
  --pill-shadow: rgba(0, 0, 0, 0.36);
  --empty: #686057;
  --empty-hover: #8b8276;
  --skeleton-a: rgba(231, 224, 212, 0.055);
  --skeleton-b: rgba(231, 224, 212, 0.12);
}

body {
  color: var(--ink);
  background-color: var(--page-bg);
  font-family: "EB Garamond", serif;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  body {
    font-size: 2em;
  }

  .page-title {
    font-size: 1.5em;
    line-height: 1.5em;
    margin-bottom: 4px;
    font-weight: 500;
  }
}

@media (max-width: 767px) {
  body {
    font-size: 1.8em;
  }

  .page-title {
    font-size: 1.2em;
    line-height: 1.2em;
    margin-bottom: 4px;
    font-weight: 500;
  }
}

@media (min-width: 600px) {
  .container {
    top: 10%;
    padding-bottom: 5%;
    max-width: 800px;
  }
}

@media (max-width: 599px) {
  .container {
    top: 3rem;
    max-width: 800px;
    padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px));
  }
}

.story-container {
  max-width: 30em;
}

/* ===================== product page ===================== */
#rec-product { animation: fadein 0.3s ease; }

.product-page {
  max-width: 30em;
}

#rec-product.grid-opening-view,
#rec-product.grid-opened {
  animation: none;
}

/* Exiting product pages animate out in this layer, above the index but never
   blocking it — the grid stays clickable while the old page flies home. */
.pp-exit-layer {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow: hidden;
  pointer-events: none;
}

.product-page.grid-open .pp-skel,
.pp-hero.from-grid .pp-skel {
  opacity: 0;
  animation: none;
  transition: none;
}

.product-page.grid-open .pp-back,
.product-page.grid-open .pp-eyebrow,
.product-page.grid-open .pp-title,
.product-page.grid-open .pp-desc,
.product-page.grid-open .pp-visit {
  animation: product-copy-rise 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

.product-page.grid-open .pp-title { animation-delay: 0.13s; }
.product-page.grid-open .pp-desc { animation-delay: 0.16s; }
.product-page.grid-open .pp-visit { animation-delay: 0.19s; }

@keyframes product-copy-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.pp-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.35rem;
  font-style: normal;
  color: var(--ink-muted);
  text-decoration: none;
  margin-bottom: 2rem;
}
/* The arrow is a two-glyph track inside a one-em window. On hover the track
   slides one glyph left: the arrow flies off to the left and its twin arrives
   from the right, so the link reads as "going back" instead of just lighting up.
   The window's line-height is 1 and the glyph carries no descender, so the
   clipping stays invisible; the nudge puts the shaft on the text's optical
   centre, level with the lowercase "back". */
.pp-back-arrow {
  display: inline-block;
  width: 1em;
  overflow: hidden;
  line-height: 1;
  transform: translateY(0.06em);
}
.pp-back-arrow-track {
  display: flex;
  /* The gap keeps the window empty for a beat mid-swap, so the two arrows never
     crowd each other inside one em. */
  gap: 0.45em;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.pp-back-arrow-track > span {
  flex: 0 0 1em;
  text-align: center;
}
.pp-back-label {
  display: inline-block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.pp-back { transition: color 0.35s ease; }

@media (hover: hover) {
  .pp-back:hover .pp-back-arrow-track,
  .pp-back:focus-visible .pp-back-arrow-track { transform: translateX(-1.45em); }
  /* The label drifts a hair after the arrow — enough to feel pulled along,
     not enough to notice as movement. */
  .pp-back:hover .pp-back-label,
  .pp-back:focus-visible .pp-back-label { transform: translateX(-0.12em); }
}
.pp-back:hover, .pp-back:focus-visible { color: var(--ink); }
.pp-back:active .pp-back-arrow-track { transition-duration: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  .pp-back-arrow-track,
  .pp-back-label { transition: none; }
  .pp-back:hover .pp-back-arrow-track,
  .pp-back:focus-visible .pp-back-arrow-track,
  .pp-back:hover .pp-back-label,
  .pp-back:focus-visible .pp-back-label { transform: none; }
}

.pp-hero {
  position: relative;
  max-width: 22em;
  aspect-ratio: 1 / 1; /* illustrations are square — reserve the space up front */
  margin: 0 0 1.5rem;
  backface-visibility: hidden;
}
.pp-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.pp-hero.is-loaded img { opacity: 1; }

/* Skeleton shimmer while the illustration loads — a faint sweep of light over
   warm paper, gone the moment the image fades in. */
.pp-skel {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    var(--skeleton-a) 40%,
    var(--skeleton-b) 50%,
    var(--skeleton-a) 60%
  );
  background-size: 200% 100%;
  animation: skel-sweep 1.4s ease-in-out infinite;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 1, 1);
}
.pp-hero.is-loaded .pp-skel {
  opacity: 0;
  animation: none;
}

@keyframes skel-sweep {
  from { background-position: 120% 0; }
  to   { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pp-skel { animation: none; }
  .pp-hero img { transition: none; }
}

.pp-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border: 1px dashed var(--rule);
  border-radius: 6px;
  color: var(--empty);
}
.pp-placeholder svg { width: 30%; height: auto; opacity: 0.6; }
.pp-placeholder span {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.pp-eyebrow {
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.pp-title {
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.pp-desc p { line-height: 1.5; margin: 0 0 0.8em; }
.pp-desc .pp-pull {
  font-style: italic;
  color: var(--ink-soft);
  border-left: 2px solid var(--rule);
  padding-left: 0.8em;
}

.pp-visit {
  display: inline-block;
  margin-top: 1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
}

@media (max-width: 767px) {
  .pp-back { font-size: 1.35rem; }
  .pp-eyebrow { font-size: 0.7rem; }
}

.story-container h2[id] {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 3rem;
  margin-bottom: 1.2rem;
  line-height: 1.25;
}

@media (max-width: 767px) {
  .story-container h2[id] {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    margin-top: 2.25rem;
    margin-bottom: 0.9rem;
  }
}

.menu-container {
  max-width: 30em;
  margin-top: 25em;
}

.by {
  color: var(--ink-muted);
}

a {
  color: var(--ink);
}

.subtitle {
  font-size: 0.8em;
}

p {
}

@keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Firefox < 16 */
@-moz-keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Safari, Chrome and Opera > 12.1 */
@-webkit-keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Internet Explorer */
@-ms-keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Opera < 12.1 */
@-o-keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* page entrance: slow blur-to-sharp dissolve */
.container{animation:page-enter 1.4s cubic-bezier(.2,.6,.2,1) backwards}
@keyframes page-enter{from{opacity:0;filter:blur(4px);transform:translateY(6px)}}

@media (prefers-reduced-motion: reduce) {
  .container{animation:none}
}

.recommendation-item-list {
  display: flex;
  flex-direction: column;
}

/* Floating Navigation */
.floating-nav {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: calc(512px + 2rem);
  max-width: 1024px;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.floating-nav:hover {
  opacity: 1;
}

.floating-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.floating-nav li {
  margin: 0;
  padding: 0;
}

.floating-nav a {
  display: block;
  padding: 0.4rem 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 2rem;
  font-weight: 500;
  margin: 0;
  transition: all 0.2s ease;
  position: relative;
}

.floating-nav a:hover {
  color: var(--ink-hover);
  transform: translateX(-3px);
}

.floating-nav a::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--ink);
  border-radius: 1px;
  transition: height 0.2s ease;
}

.floating-nav a:hover::before,
.floating-nav a.active::before {
  height: 60%;
}

.floating-nav a.active {
  color: var(--ink-hover);
  font-weight: 600;
}

/* Hide on smaller screens */
@media (max-width: 1100px) {
  .floating-nav {
    display: none;
  }
}

/* Smooth scrolling for the whole page */
html {
  scroll-behavior: smooth;
}

/* Search trigger — a quiet mono word, mirroring the list/grid toggle opposite it. */
#search-trigger {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0 0 2px;
  height: auto;
  line-height: inherit;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--ui-muted);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1), color 0.2s cubic-bezier(0.2, 0, 0, 1);
  z-index: 1001;
}

#search-trigger:hover,
#search-trigger:focus-visible {
  opacity: 1;
  color: var(--ink);
  outline: none;
}

#search-trigger .st-kbd {
  color: var(--ui-faint);
  letter-spacing: 0.1em;
}

body.product-route #search-trigger {
  display: none;
}

/* Theme toggle — global preference: auto follows the OS, light/dark pin it. */
#theme-toggle {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  z-index: 1001;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  transform: translateX(-50%);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.7;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
}

#theme-toggle:hover {
  opacity: 1;
}

#theme-toggle button {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  margin: 0;
  padding: 0 0 2px;
  height: auto;
  line-height: inherit;
  font: inherit;
  font-weight: 500;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ui-muted);
  cursor: pointer;
  transition: color 0.15s cubic-bezier(0.2, 0, 0, 1), border-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

#theme-toggle button:hover,
#theme-toggle button:focus-visible {
  color: var(--ink);
  outline: none;
}

:root[data-theme-preference="auto"] #theme-toggle button[data-theme-mode="auto"],
:root[data-theme-preference="light"] #theme-toggle button[data-theme-mode="light"],
:root[data-theme-preference="dark"] #theme-toggle button[data-theme-mode="dark"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.tt-sep {
  color: var(--ui-faint);
}

/* Search overlay */
#search-overlay[hidden] {
  display: none;
}

#search-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  z-index: 2000;
}

#search-modal {
  width: min(94vw, 68rem);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  font-family: "EB Garamond", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

#search-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  padding: 0 0.25rem 0.85rem;
}

.search-label {
  font-weight: 500;
}

.search-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.search-count:empty::before {
  content: "—";
  color: var(--ui-faint);
}

.search-count:not(:empty)::after {
  content: " results";
  color: var(--ink-muted);
}

#search-input-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 0.25rem 0.6rem;
  color: var(--ink-strong);
  border-bottom: 2px solid var(--ink-strong);
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 5rem;
  line-height: 1.25;
  color: var(--ink-strong);
  padding: 0;
  margin: 0;
  height: auto;
  letter-spacing: -0.025em;
  font-weight: 400;
  font-style: italic;
  min-width: 0;
}

#search-input::placeholder {
  color: var(--placeholder);
  font-style: italic;
}

#search-esc {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.3rem 0.55rem;
  font-weight: 500;
}

#search-results {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  max-height: 42vh;
  overflow-y: auto;
}

#search-results li {
  padding: 0.65rem 0.25rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: baseline;
  gap: 1.25rem;
  border-radius: 0;
  border-bottom: 1px solid var(--rule-soft);
  transition: padding-left 0.12s ease;
}

#search-results li.active {
  padding-left: 0.85rem;
}

#search-results li.active .search-title {
  font-weight: 500;
}

.search-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ui-muted);
  font-variant-numeric: tabular-nums;
  align-self: center;
}

#search-results li.active .search-num {
  color: var(--ink-strong);
}

.search-body {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.search-title {
  font-size: 1.7rem;
  color: var(--ink-strong);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.15;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-title mark {
  background: transparent;
  color: inherit;
  border-bottom: 2px solid var(--ink-strong);
  padding: 0;
  border-radius: 0;
}

.search-meta {
  font-size: 0.7rem;
  color: var(--ink-muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.search-synonym {
  font-size: 0.55rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.15rem 0.4rem;
  font-weight: 500;
  align-self: center;
}

.search-type {
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ui-muted);
  align-self: center;
  white-space: nowrap;
}

#search-empty {
  padding: 2.5rem 0.25rem;
  color: var(--ink-muted);
  font-style: italic;
  text-align: left;
  font-size: 1.4rem;
  font-family: "EB Garamond", serif;
}

@media (max-width: 599px) {
  #theme-toggle {
    top: 1.1rem;
    right: 1.4rem;
    left: auto;
    gap: 0.55rem;
    transform: none;
    font-size: 0.68rem;
    opacity: 0.85;
  }

  /* On touch, the word becomes a small floating pill (no keyboard hint). */
  #search-trigger {
    top: auto;
    bottom: 2rem;
    right: 2rem;
    padding: 1.1rem 1.7rem;
    font-size: 0.8rem;
    opacity: 0.92;
    color: var(--ink);
    background: var(--pill-bg);
    border: 1px solid var(--rule);
    border-radius: 999px;
    box-shadow: 0 6px 18px var(--pill-shadow);
  }
  #search-trigger .st-kbd {
    display: none;
  }
  #search-overlay {
    padding: 1rem;
  }
  #search-modal {
    width: 94vw;
    border-radius: 0;
  }
  #search-header {
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    padding-bottom: 0.6rem;
  }
  #search-input-row {
    gap: 0.75rem;
    padding: 0.35rem 0.1rem 0.4rem;
  }
  #search-input {
    font-size: 2.4rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
  }
  #search-esc {
    display: none;
  }
  #search-results {
    margin-top: 1rem;
  }
  #search-results li {
    grid-template-columns: 1.8rem 1fr;
    gap: 0.85rem;
    padding: 0.55rem 0.1rem;
  }
  #search-results li.active {
    padding-left: 0.4rem;
  }
  .search-num {
    font-size: 0.6rem;
  }
  .search-title {
    font-size: 1.15rem;
  }
  .search-meta {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }
  .search-type {
    display: none;
  }
  .search-synonym {
    font-size: 0.5rem;
  }
  #search-empty {
    font-size: 1.05rem;
    padding: 1.5rem 0.1rem;
  }
}

/* ===================== view toggle (list / grid) ===================== */
#view-toggle {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 1001;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.7;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
}

#view-toggle[hidden],
body.product-route #view-toggle {
  display: none;
}

#view-toggle:hover {
  opacity: 1;
}

#view-toggle button {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  margin: 0;
  padding: 0 0 2px;
  height: auto;
  line-height: inherit;
  font: inherit;
  font-weight: 500;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ui-muted);
  cursor: pointer;
  transition: color 0.15s cubic-bezier(0.2, 0, 0, 1), border-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

#view-toggle button:hover,
#view-toggle button:focus-visible {
  color: var(--ink);
  outline: none;
}

#view-toggle button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.vt-sep {
  color: var(--ui-faint);
}

/* ===================== grid view ===================== */
#rec-grid {
  padding-bottom: 4rem;
}

.grid-eyebrow {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 500;
  color: var(--ink-soft);
  margin: 3rem 0 1.4rem;
  line-height: 1.25;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 2.6rem 2rem;
}

.grid-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  color: var(--ink);
}

.gc-tile {
  position: relative; /* anchors the glitch layers */
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

:root[data-theme="dark"] .grid-card.is-food .gc-tile {
  box-sizing: border-box;
  padding: 7%;
  background: #f4f1e8;
  border: 1px solid rgba(244, 241, 232, 0.16);
  border-radius: 4px;
}

.gc-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* A slight lift-and-tilt on hover — the hand-drawn things wobble like paper. */
.grid-card:hover .gc-tile img {
  transform: scale(1.045) rotate(-1.2deg);
}

/* ===================== glitch reveal ===================== */
/* The illustration briefly loses signal and scrambles into the original
   product photo: random tears flicker in, the full photo holds for a beat,
   then it shreds back. Layers are painted via background-image so the
   .pp-hero img rules never touch them; the keyframes themselves are generated
   per-pass in playGlitch() (markdown-parser.js) so every glitch is different. */
.glitch-layer {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0;
  pointer-events: none;
}

/* Chromatic fringes — tinted copies whose tears fly wider than the plain ones. */
.glitch-fringe--r { filter: sepia(1) saturate(6) hue-rotate(-50deg) contrast(1.05); }
.glitch-fringe--c { filter: sepia(1) saturate(6) hue-rotate(160deg) contrast(1.05); }

:root[data-theme="dark"] .product-page.is-food .pp-hero {
  box-sizing: border-box;
  padding: 7%;
  background: #f4f1e8;
  border: 1px solid rgba(244, 241, 232, 0.16);
  border-radius: 4px;
}

:root[data-theme="dark"] .product-page.is-food .pp-hero img {
  inset: auto;
  top: 7%;
  left: 7%;
  width: 86%;
  height: 86%;
}

/* Missing illustration: a quiet dashed tile — map pin for places, frame for products. */
.gc-tile--empty {
  border: 1px dashed var(--rule);
  border-radius: 6px;
  color: var(--empty);
  transition: color 0.2s cubic-bezier(0.2, 0, 0, 1), border-color 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.gc-tile--empty svg {
  width: 26%;
  height: auto;
  opacity: 0.7;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.grid-card:hover .gc-tile--empty {
  border-color: var(--ink-muted);
  color: var(--empty-hover);
}

.grid-card:hover .gc-tile--empty svg {
  transform: scale(1.08) rotate(-2deg);
}

.gc-name {
  font-size: 1.6rem;
  line-height: 1.25;
  transition: color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.grid-card:hover .gc-name {
  color: var(--ink-strong);
}

.gc-meta {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
}

/* ===================== view switch animation ===================== */
.view-in {
  animation: view-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* The grid arrives as a stagger of cards rather than one block. */
#rec-grid.view-in {
  animation: none;
}

#rec-grid.view-in .grid-card {
  animation: view-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: min(calc(var(--i) * 18ms), 0.35s);
}

@media (prefers-reduced-motion: reduce) {
  .view-in,
  #rec-grid.view-in .grid-card {
    animation: none !important;
  }
  .gc-tile img,
  .gc-tile--empty svg {
    transition: none !important;
  }
  .glitch-layer {
    display: none !important;
  }
}

@media (max-width: 599px) {
  #view-toggle {
    top: 1.1rem;
    left: 1.4rem;
    font-size: 0.8rem;
    gap: 0.7rem;
    opacity: 0.85;
  }
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.2rem 1.4rem;
  }
  .gc-name {
    font-size: 1.4rem;
  }
  .grid-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    margin: 2.25rem 0 1.1rem;
  }
}
