/* =====================================================================
   CHEZ HADI — stylesheet
   1. DESIGN TOKENS  (change the look of the whole site here)
   2. Base           3. Layout shell      4. Gallery
   5. Post page      6. Recipe/text pages 7. Small screens
   ===================================================================== */

/* ---------- 1. DESIGN TOKENS ---------- */
@font-face { font-family: "Young Serif"; src: url(fonts/young-serif.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  /* Fonts: display = wordmark & titles, text = everything else */
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-text: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Colours: Hadi's kibbeh (Oct 2026). A pale pine-nut paper, dark-brown text, baked-honey links; the photos stay in front. */
  --paper: #f8f2e8;       /* page background (pine nut, much paler) */
  --ink: #2b1d12;         /* main text (contrast 15:1 on paper) */
  --muted: #6f5b49;       /* secondary text (6:1) */
  --line: #e8dcc9;        /* hairlines */
  --accent: #8a5428;      /* baked honey: links, focus, the piece in the H (5.6:1) */
  --accent-ink: #fff8ec;  /* text on accent */
  --badge-bg: #f3e3c3;    /* recipe badge on computers: pine-nut cream, baked-honey text (contrast 4.9:1) */
  --badge-ink: #8a5428;

  /* Gallery */
  --tile-min: 20rem;      /* smallest tile width: the grid fits as many columns as possible (smaller = more photos at a glance) */
  --gap: 4px;             /* space between tiles */
  --tile-ratio: 4 / 5;    /* crop of tiles in the grid: 1 / 1, 4 / 5, 3 / 4 … (photos are never cropped in the viewer) */
  --view-h: 88vh;         /* maximum height of the photo in the viewer overlay */

  /* Layout */
  --rail: 17rem;          /* width of the left column on desktop */
  --pad: clamp(1rem, 2.4vw, 2rem);
  --measure: 40rem;       /* max width of reading text */
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16100b; --ink: #f1e6d6; --muted: #b8a48e; --line: #33271d;
    --accent: #d9a36a; --accent-ink: #16100b;
  }
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; scrollbar-gutter: stable; }   /* the scroll bar's room is always kept: nothing shifts when it comes and goes (e.g. after the intro) */
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.65 var(--font-text); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 10; }
.skip:focus { top: .5rem; }
.button { display: inline-block; padding: .55rem 1rem; border: 1.5px solid var(--accent); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; }
.button:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- 3. LAYOUT SHELL ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; align-self: start; height: 100vh; padding: 2rem 1.5rem 1rem var(--pad); }
.wordmark { display: flex; flex-direction: column; font: 400 clamp(2.6rem, 4.2vw, 3.6rem)/.95 var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
/* The H of Hadi is drawn (tools/logo.py): Young Serif's H, its crossbar replaced by a piece of Hadi's kibbeh. Same size as the letters around it. */
.wordmark .h { width: .898em; height: .75em; vertical-align: baseline; fill: currentColor; }
.wordmark .h .piece { fill: var(--accent); }
.tagline { margin: 1rem 0 2rem; color: var(--muted); font-size: .98rem; max-width: 14rem; }
.nav { display: flex; flex-direction: column; gap: .15rem; font-weight: 600; }
.nav a { color: var(--ink); text-decoration: none; padding: .2rem 0; width: fit-content; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current] { border-bottom-color: var(--accent); }
.langs { display: flex; gap: .9rem; margin-top: 1.6rem; font-size: .85rem; font-weight: 700; letter-spacing: .08em; }
.langs a { color: var(--muted); text-decoration: none; padding: .15rem 0; border-bottom: 2px solid transparent; }
.langs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.foot { position: fixed; left: 0; bottom: 0; width: var(--rail); padding: 0 1.5rem 1.4rem var(--pad); font-size: .85rem; color: var(--muted); }
.foot ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem 1rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
main { padding: var(--pad) var(--pad) 4rem 0; min-width: 0; }
.pagehead { margin: .5rem 0 1.6rem; }
.pagehead h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.pagehead p { color: var(--muted); margin: .4rem 0 0; }
@media (max-height: 560px) { .foot { position: static; width: auto; } }

/* ---------- 4. GALLERY ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); gap: var(--gap); }
.tile { position: relative; display: block; aspect-ratio: var(--tile-ratio); overflow: hidden; background: var(--c, var(--line)); color: #fff; }
.tile > img { width: 100%; height: 100%; object-fit: cover; }
.tile__label { position: absolute; inset: auto 0 0 0; padding: 1.8rem .6rem .5rem; font: 400 .88rem/1.25 var(--font-display); pointer-events: none;
  background: linear-gradient(to top, rgb(22 14 8 / .78), transparent); opacity: 0; transition: opacity .18s ease; }
.tile--multi .tile__label { padding-bottom: 1.25rem; }
.tile:hover .tile__label, .tile:focus-within .tile__label { opacity: 1; }
/* badges on photos: white, no background, a soft shadow so they read on light photos too (recipe top-left, stack top-right) */
.tile__badge { position: absolute; top: .4rem; left: .4rem; display: flex; align-items: center; color: #fff; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .6)); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .15rem; line-height: 1.2; pointer-events: none; }
.tile__badge--multi { left: auto; right: .4rem; }
.tile__badge:not(.tile__badge--multi, .tile__badge--inline) { background: var(--badge-bg); color: var(--badge-ink); filter: none; padding: .16rem .4rem; border-radius: 3px; }   /* computers: the word on cream */
.tile__badge--inline { position: static; display: inline-block; }
.tile .tile__badge > svg { display: none; }                    /* computers: the word only; phones: the icon only (section 7) */
.legend { display: none; justify-content: flex-end; align-items: center; gap: .35rem; margin: 0 0 .4rem; color: var(--muted); font-size: .8rem; }
.legend .tile__badge { padding: 0; color: var(--muted); filter: none; }
.legend .tile__badge > svg { display: block; }   /* no empty line-space under the icon, so it centres on the words */
/* last tile: the close-up of Hadi's kibbeh tray (same picture as the Instagram profile), the text on a cream band */
.tile--ig { display: flex; align-items: flex-end; background: #a8692e url(motif.svg) center / cover; color: #3a2414; text-decoration: none; font: 400 clamp(.95rem, 1.3vw, 1.2rem)/1.2 var(--font-display); }
.tile--ig span { width: 100%; padding: .7rem .9rem; background: #f3e3c3; }
.tile--ig:hover { filter: brightness(1.06); }
.grid--captioned { --tile-min: 15rem; row-gap: 1.6rem; }
.cap { margin: .55rem 0 0; display: grid; line-height: 1.3; }
.cap a { color: var(--ink); text-decoration: none; font: 400 1.15rem/1.25 var(--font-display); }
.cap a:hover { text-decoration: underline; }
.cap span { color: var(--muted); font-size: .92rem; }
@media (hover: none) { .tile__label { display: none; } }

/* ---------- 4b. CAROUSEL (tiles, viewer, post page) ---------- */
.carousel { position: relative; }
.carousel__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.carousel__track::-webkit-scrollbar { display: none; }
.no-js .carousel__track { scrollbar-width: thin; }              /* without JS the arrows can't work: show a scrollbar instead */
.no-js .carousel__btn, .no-js .carousel__dots { display: none; }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: start; scroll-snap-stop: always; background: var(--c); }   /* tinted with the photo's own average colour, never black */
.slide a { display: block; height: 100%; }
.slide img { width: 100%; height: 100%; }
.carousel__btn { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 2.1rem; height: 2.1rem; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: rgb(255 255 255 / .9); color: #2b1d12; box-shadow: 0 1px 5px rgb(0 0 0 / .35); transition: opacity .15s ease; }
.carousel__btn--prev { left: .5rem; }
.carousel__btn--next { right: .5rem; }
.carousel__btn:hover { background: #fff; }
.carousel__btn.is-off { opacity: 0; pointer-events: none; }       /* no "previous" on the first photo, no "next" on the last */
.carousel__dots { position: absolute; left: 0; right: 0; bottom: .7rem; display: flex; justify-content: center; gap: .3rem; list-style: none; margin: 0; padding: 0; pointer-events: none; }
.carousel__dots li { width: .42rem; height: .42rem; border-radius: 50%; background: rgb(255 255 255 / .55); box-shadow: 0 0 3px rgb(0 0 0 / .55); }
.carousel__dots li.on { background: #fff; }

/* in a tile: photos cropped to the tile shape; arrows only on hover (always visible on touch screens) */
.tile--multi > .carousel { position: absolute; inset: 0; }
.carousel--tile .carousel__track, .carousel--tile .slide { height: 100%; }
.carousel--tile img { object-fit: cover; }
.carousel--tile .carousel__btn { width: 1.6rem; height: 1.6rem; opacity: 0; }
.carousel--tile .carousel__btn--prev { left: .3rem; }
.carousel--tile .carousel__btn--next { right: .3rem; }
.carousel--tile .carousel__dots { bottom: .4rem; gap: .22rem; }
.carousel--tile .carousel__dots li { width: .32rem; height: .32rem; }
.carousel--tile:hover .carousel__btn:not(.is-off), .carousel--tile:focus-within .carousel__btn:not(.is-off) { opacity: 1; }
@media (hover: none) { .carousel--tile .carousel__btn:not(.is-off) { opacity: .85; } }

/* in the viewer / post page: the whole photo (never cropped); box has the shape of the first photo */
.carousel--view { width: min(calc(var(--view-h) * var(--ar)), 100%); }
.carousel--view .slide { aspect-ratio: var(--ar); }
.carousel--view img { object-fit: contain; }
.carousel--view .slide--fill img { object-fit: cover; }          /* see _carousel.html */

/* ---------- 5. VIEWER CONTENT (.post) and parts shared with the dish pages ---------- */
.post__body :is(h1, h2) { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0 0 .6rem; }
.caption { font-size: 1.05rem; max-width: var(--measure); overflow-wrap: anywhere; }
.caption p { margin: 0 0 .9em; }
.note, .meta { color: var(--muted); font-size: .9rem; margin: .4rem 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1rem 0; }
.tags a { display: block; padding: .15rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.tags a:hover { border-color: var(--accent); color: var(--accent); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin: 1.2rem 0; }
.crumb { margin: 0 0 1.2rem; font-size: .92rem; }
.crumb a { color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager a { display: grid; max-width: 48%; color: var(--ink); text-decoration: none; font: 400 1.05rem/1.3 var(--font-display); }
.pager a[rel=next] { text-align: right; margin-left: auto; }
.pager small { font: 600 .72rem/1.6 var(--font-text); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pager a:hover { color: var(--accent); }

/* ---------- 5b. VIEWER (Instagram-style overlay) ---------- */
.has-viewer { overflow: hidden; }
.viewer { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: transparent; color: var(--ink); }
.viewer:focus, .viewer.by-pointer :focus-visible { outline: none; }   /* see openAt in site.js */
.viewer::backdrop { background: rgb(18 12 7 / .88); }          /* the gallery stays visible, dimmed, behind */
.viewer__body { width: 100%; height: 100%; display: grid; place-items: center; padding: 1.5rem 5rem; overflow: auto; }
/* Card = photo + text column. Safari draws the swipeable photo on its own layer and rounds it to whole pixels on its own,
   which showed either a 1px line of the card under the photo, or a text column 1px longer than the photo. So: the photo's
   height is a whole number of pixels, it overhangs the card by 1px top and bottom (rules just below), and
   the CARD alone paints the background and cuts everything (overflow: hidden): photo and text column end on the same edge.
   The photo alone sets the card height; the text column fits it and scrolls (contain: size). */
.viewer .post { --view-h: min(88vh, 62rem); --max-w: calc(100vw - 10rem - 22rem); display: flex; gap: 0; align-items: stretch; background: var(--paper); border-radius: 4px; overflow: hidden; box-shadow: 0 10px 50px rgb(0 0 0 / .5); max-width: 100%; }
.viewer .post--bare { --max-w: calc(100vw - 10rem); }
.viewer .post__media { flex: none; display: grid; align-items: center; }
.viewer .carousel--view { width: min(calc(var(--view-h) * var(--ar)), var(--max-w)); }
@media (min-width: 1000px) {
  @supports (height: round(down, 1.5px, 1px)) {
    .viewer .carousel--view { --ph: round(down, min(var(--view-h), var(--max-w) / var(--ar)), 1px); width: calc(var(--ph) * var(--ar)); }
    .viewer .carousel--view .slide { aspect-ratio: auto; height: var(--ph); }
  }
  .viewer .post__media { margin-block: -1px; }                  /* the 1px overhang, see above */
}
.viewer .post__body { position: static; contain: size; width: 22rem; max-height: var(--view-h); overflow-y: auto; padding: 1.4rem 1.4rem 1.6rem; border-left: 1px solid var(--line); }
.viewer .post--bare .post__body { display: none; }
.viewer .crumb, .viewer .pager { display: none; }
.viewer__btn { position: fixed; z-index: 5; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgb(255 255 255 / .14); color: #fff; }
.viewer__btn:hover:not(:disabled) { background: rgb(255 255 255 / .3); }
.viewer__btn:disabled { opacity: .25; cursor: default; }
.viewer__close { top: 1rem; right: 1rem; }
.viewer__nav { top: 50%; translate: 0 -50%; }
.viewer__nav--prev { left: 1.2rem; }
.viewer__nav--next { right: 1.2rem; }

/* ---------- 5c. INTRO (temporary, until site.yaml intro.until): the cut-to-logo animation over the home page (intro.js) ---------- */
/* <html class="intro-on"> is set in <head> before the page shows, so the site never flashes before the intro */
html.intro-on { overflow: hidden; }
html.intro-on .shell, html.intro-on .skip { visibility: hidden; }
.intro { position: fixed; inset: 0; z-index: 20; background: var(--paper); color: var(--ink); overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; }
.intro:focus { outline: none; }
.intro__art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.intro__name { fill: var(--ink); }
.intro__hole { fill: var(--paper); }
.intro__welcome { fill: var(--muted); font-family: var(--font-display); }   /* above the name: "Bienvenue / CHEZ / Hadi" */
.intro__line { position: absolute; left: 50%; width: min(90vw, 46rem); margin: 0; translate: -50% -100%; text-align: center;
  font: 400 clamp(1.15rem, 2.4vw, 1.6rem)/1.25 var(--font-display); color: var(--muted); opacity: 0; transition: opacity .6s .1s; }
.intro__line.is-on { opacity: 1; }
.intro__line.is-off { opacity: 0; transition: opacity .5s; }   /* when the tray goes: the end belongs to the name */
.intro__skip { position: absolute; top: max(.75rem, env(safe-area-inset-top)); right: .75rem; padding: .6rem .9rem; border: 0; background: none;
  font: 500 .95rem var(--font-text); color: var(--muted); cursor: pointer; }
.intro__skip:hover { color: var(--ink); }
.intro__cta { position: absolute; translate: -50% .5rem; padding: .85rem 1.5rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font: 400 1.2rem/1.2 var(--font-display); white-space: nowrap; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .5s, translate .5s; }
.intro__cta.is-on { opacity: 1; translate: -50% 0; pointer-events: auto; }
/* leaving: "Skip" fades; at the end the name flies to the wordmark while the page shows (intro.js) */
.intro--fade { opacity: 0; transition: opacity .35s; }
.intro--handoff { background-color: transparent; pointer-events: none; transition: background-color .45s .55s; }   /* the page shows as the name nears its place */
.intro--handoff .intro__line, .intro--handoff .intro__skip, .intro--handoff .intro__cta { opacity: 0; transition: opacity .2s; }
.intro--done { opacity: 0; transition: opacity .35s; }
html.intro-handoff { overflow: hidden; }
html.intro-handoff .wordmark > span { opacity: 0; }   /* "Hadi": back at once on landing, under the drawn one */
/* from mid-flight, "Chez" writes itself in at its place: a soft-edged mask slides from left to right */
html.intro-writing .wordmark > span:first-child { opacity: 1;
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%); mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: intro-write .65s .05s cubic-bezier(.33, 0, .2, 1) both; }
@keyframes intro-write { from { -webkit-mask-position: 100% 0; mask-position: 100% 0; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
#main:focus { outline: none; }   /* focused by intro.js after the intro, for keyboards; no ring for a whole area */
@media (prefers-reduced-motion: reduce) { .intro, .intro__cta, .intro__line { transition: none; } }

/* ---------- 6. DISH PAGES (posts and legacy recipes look the same) & TEXT PAGES ---------- */
.entry { --view-h: calc(100vh - 2 * var(--pad)); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.entry__media { margin: 0; position: sticky; top: var(--pad); }   /* the photo stays in view while you read */
.entry__media > img { width: auto; max-width: 100%; max-height: var(--view-h); margin: 0 auto; }
.entry__media .carousel { margin: 0 auto; }
.entry__text, .textpage { max-width: var(--measure); }
.entry h1, .textpage h1 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
.sub { font: 400 1.3rem/1.3 var(--font-display); color: var(--accent); margin: .5rem 0 0; }
.prose { margin-top: 1.4rem; }
.prose h2 { font-size: 1.7rem; margin: 2.2rem 0 .8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.prose h3 { font: 700 .82rem/1.3 var(--font-text); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 1.6rem 0 .5rem; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin: .3rem 0; padding-left: .2rem; }
.prose ol li::marker { font-weight: 700; color: var(--accent); }
.prose ul li::marker { color: var(--muted); }
.textpage { margin: 0; }
/* About: the story of the diamond in the H (the kibbeh photo next to the drawn tray) */
.story__pics { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: center; margin: .9rem 0 1rem; }
.story__pics img { width: 100%; height: auto; }                  /* both round: the photo is cut out (content/pages/welcome/kibbeh.webp) */
/* 404: the tray with one piece taken */
.textpage .nf { width: min(25rem, 86vw); height: auto; margin-bottom: 1.2rem; }

/* ---------- 7. SMALL SCREENS ---------- */
@media (max-width: 999px) {
  .shell { display: block; }
  .rail { position: static; height: auto; padding: 1.1rem var(--pad) .6rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.4rem; }
  .wordmark { flex-direction: row; gap: .35em; font-size: 2rem; }
  .tagline { order: 2; width: 100%; margin: -.3rem 0 .2rem; font-size: .95rem; }
  .nav { flex-direction: row; gap: 1.1rem; order: 3; width: 100%; }
  .langs { margin: 0 0 0 auto; }
  .foot { position: static; width: auto; padding: 1.5rem var(--pad) 2rem; }
  main { padding: .4rem var(--gap) 2rem; }
  .pagehead, .entry__text, .textpage { padding-inline: calc(var(--pad) - var(--gap)); }
  .entry { grid-template-columns: 1fr; gap: 1.2rem; }
  .entry__media { position: static; }
  .carousel--view { width: 100%; }
  .carousel--view .slide { aspect-ratio: auto; height: min(72vh, calc(100vw / var(--ar))); }
  .entry__media > img { max-height: 80vh; }
  .entry .carousel--view .slide { height: min(80vh, calc(100vw / var(--ar))); }
  /* viewer: full screen, photo on top, caption below, controls floating on the photo */
  .viewer__body { padding: 0; place-items: start center; }
  .viewer .post { flex-direction: column; width: 100%; min-height: 100%; border-radius: 0; box-shadow: none; }
  .viewer .post__media { display: block; }
  .viewer .carousel--view { width: 100%; }
  .viewer .post__body { contain: none; width: auto; max-height: none; border-left: 0; padding: 1rem var(--pad) 2rem; }
  .viewer .post--bare .post__body { display: none; }
  .viewer__btn { width: 2.4rem; height: 2.4rem; background: rgb(22 15 10 / .55); top: .7rem; translate: none; }
  .viewer__close { right: .7rem; }
  .viewer__nav--prev { left: .7rem; }
  .viewer__nav--next { left: 3.4rem; right: auto; }
}
/* phones: always 3 columns with hairline gaps (like Instagram); tiles keep in-tile swiping and dots, but no arrows;
   recipe badge = icon only, explained by the legend line above the gallery */
@media (max-width: 559px) {
  .tile--ig { font-size: .8rem; }
  .tile--ig span { padding: .45rem .55rem; }
  :root { --gap: 2px; --tile-ratio: 3 / 4; }
  .legend { display: flex; padding-inline: calc(var(--pad) - var(--gap)); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--captioned { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
  .carousel--tile .carousel__btn { display: none; }
  .tile .tile__badge { top: .3rem; left: .3rem; padding: .2rem; background: none; color: #fff; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .6)); }
  .tile .tile__badge > svg { display: block; }
  .tile .tile__badge-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tile .tile__badge--multi { left: auto; right: .3rem; padding: .1rem; }
}
