/* Beer Mats. Hub-and-spoke: a wooden table laid with kraft beer mats
   (drinks, whiskey) and white plates (food). Tap one
   and the category opens out of it; no long scroll through everything. */
:root {
  /* the table: dark oak, light lettering */
  --bg: #5a3722; --ink: #f4ead7; --muted: #d9c4a6; --line: rgb(244 234 215 / .25);
  --accent: #d3de9b; --on-accent: #2a1608; --surface: #f8f9ee; --lime: #d3de9b; --ruby: #f0b7a4; --tag-ink: #2a1608;
  --green: #12301f;
  --sheet-bg: #3a2113; --sheet-ink: #f4ead7; --sheet-muted: #d9c4a6;
}
body { min-height: 100vh; min-height: 100dvh; background-color: var(--bg); }
/* the table top: one layer pinned to the screen, so it always fills it exactly
   (never tiles on a short page, and works where background-attachment: fixed doesn't) */
body::before {
  content: ""; position: fixed; z-index: -1; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 9.9rem, rgb(0 0 0 / .32) 9.9rem 10rem),            /* plank seams */
    repeating-linear-gradient(91deg, transparent 0 5px, rgb(0 0 0 / .07) 5px 6px, transparent 6px 17px, rgb(255 255 255 / .035) 17px 18px, transparent 18px 29px, rgb(0 0 0 / .05) 29px 31px), /* grain */
    linear-gradient(180deg, rgb(255 255 255 / .06), transparent 30rem) no-repeat,
    radial-gradient(120% 80% at 50% 30%, transparent 40%, rgb(0 0 0 / .35)) no-repeat;
}
.hm-tag--new { background: var(--ruby); color: var(--tag-ink); }
/* an item opens in the colours of the mat or plate it came from */
.hm-sheet, .hm-legal { --sheet-line: rgb(244 234 215 / .25); --sheet-field: #4d2e1c; --sheet-danger: #f0b7a4; --sheet-on-danger: #2a160b; --line: var(--sheet-line); color-scheme: dark; }
.hm-sheet[data-kind="drinks"] { --sheet-bg: #b98a5c; --sheet-ink: #2c180c; --sheet-muted: #4a2e1a; --sheet-line: rgb(44 24 12 / .3); --sheet-field: #dcb88c; --sheet-danger: #6f1420; --sheet-on-danger: #fff; color-scheme: light; }
.hm-sheet[data-kind="food"] { --sheet-bg: #eaf0d2; --sheet-ink: #12301f; --sheet-muted: #53684f; --sheet-line: rgb(18 48 31 / .22); --sheet-field: #f8f9ee; --sheet-danger: #8a2233; --sheet-on-danger: #fff; color-scheme: light; }
.hm-sheet[data-kind="whiskey"] { --sheet-bg: #2a160b; --sheet-ink: #f6e3bf; --sheet-muted: #c9a878; --sheet-line: rgb(246 227 191 / .25); --sheet-field: #3b2112; --sheet-danger: #f0b7a4; --sheet-on-danger: #2a160b; color-scheme: dark; }
.hm-sheet .hm-tag--new { background: var(--sheet-danger); color: var(--sheet-on-danger); }

.top { padding: 2rem 1.25rem .5rem; display: grid; gap: 1.1rem; justify-items: center; text-align: center; max-width: 40rem; margin: 0 auto; }
.logo { display: block; width: min(56vw, 15rem); aspect-ratio: 2000 / 580; background: var(--ink);
  -webkit-mask: url(/shared/logo.webp) center / contain no-repeat; mask: url(/shared/logo.webp) center / contain no-repeat; }
.top__title { font: 500 italic clamp(1.375rem, 5.6vw, 1.875rem)/1.15 var(--display); max-width: 18ch; text-wrap: balance; }

main { max-width: 40rem; margin: 0 auto; padding: 0 1.25rem; }
.world__title { font: 600 clamp(3rem, 15vw, 5rem)/1 var(--display); letter-spacing: -.035em; margin: 2.5rem 0 1.25rem; display: flex; align-items: baseline; gap: .75rem; }
.world__title small { font: 500 .8125rem/1 var(--body); letter-spacing: 0; color: var(--muted); }
.mats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding-bottom: 3rem; }
.mats > :nth-child(even) { translate: 0 2.75rem; }
.mat {
  /* drinks: a kraft-brown beer mat, printed in espresso, close to the table's own colour */
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; display: block;
  background: #b98a5c; color: #2c180c; --disc: #d0a777;
  box-shadow: inset 0 0 0 1px rgb(44 24 12 / .3), 0 8px 0 -4px rgb(0 0 0 / .35), 0 18px 24px -8px rgb(0 0 0 / .6);
  transition: transform .5s var(--spring);
}
/* food: a plate with a wide rim and a shallow well, the colour of the food menu it opens */
.mat--food {
  background: #eaf0d2; color: #12301f; --disc: #dde6bd;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08), inset 0 -6px 10px -4px rgb(0 0 0 / .12), 0 10px 0 -4px rgb(0 0 0 / .3), 0 22px 28px -8px rgb(0 0 0 / .65);
}
/* whiskey: a dark mat, the colour of the whiskey menu it opens */
.mat--whiskey {
  background: #2a160b; color: #f6e3bf; --disc: #3b2112;
  box-shadow: inset 0 0 0 1px rgb(246 227 191 / .22), 0 8px 0 -4px rgb(0 0 0 / .4), 0 18px 24px -8px rgb(0 0 0 / .65);
}
.matw { position: relative; }
.matw:nth-child(even) .mat { --s: -1; }
.mat:active { transform: scale(.94); }
/* the printed rim: capitals set on the curve, turning a little as the page scrolls */
.mat__ring { position: absolute; inset: 0; width: 100%; height: 100%; rotate: calc((var(--p, .5) - .5) * var(--s, 1) * 26deg); }
.mat__disc { fill: var(--disc); stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: .1 6.2; stroke-opacity: .8; }   /* dotted inner border */
.mat--food .mat__disc { stroke: rgb(0 0 0 / .16); stroke-width: 1.2; stroke-dasharray: none; stroke-opacity: 1; }
.mat__ring text { fill: currentColor; font-family: var(--body); font-weight: 700; text-transform: uppercase; }
.mat__name { letter-spacing: .09em; }
.mat__count { letter-spacing: .2em; opacity: .85; }
.mat__photo { position: absolute; inset: 15%; display: block; filter: drop-shadow(0 5px 5px rgb(0 0 0 / .35)); transition: transform .5s var(--spring); pointer-events: none; }
.mat--food .mat__photo { inset: 20%; }
.mat:active .mat__photo { transform: scale(1.12); }
.mat.hm-reveal { transform: scale(.4) rotate(-40deg); }
.mat.hm-reveal.is-in { transform: none; }

/* rows in the category panel */
.rows { list-style: none; margin: 0; padding: 0; }
.rowb { display: grid; grid-template-columns: 4.25rem 1fr; gap: 1rem; align-items: center; width: 100%; text-align: left; padding: .7rem 0; border-bottom: 1px solid var(--line); min-height: 5.5rem; }
.rowb__ph { display: block; height: 5.25rem; transition: transform .45s var(--spring); }
.rowb:active .rowb__ph { transform: scale(1.15) rotate(-6deg); }
.rowb__name { display: block; font: 600 1.25rem/1.15 var(--display); letter-spacing: -.01em; }
.rowb__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .875rem; line-height: 1.4; color: var(--muted); margin-top: .2rem; }
.rowb .hm-tags { margin-top: .4rem; }
.group { font: 600 italic 1.25rem/1.2 var(--display); margin: 1.75rem 0 .25rem; }

/* the category opens out of the mat that was tapped */
.panel { --bg: #eaf0d2; --ink: #12301f; --muted: #53684f; --line: rgb(18 48 31 / .2); --accent: #12301f; --on-accent: #eaf0d2; --ruby: #8a2233; --tag-ink: #fff;
  position: fixed; inset: 0; z-index: 6; overflow: hidden; color: var(--ink); }
/* The opening is a round disc scaled up from the mat, with the content fading
   in on top. (It used to be a clip-path circle; Safari on iPhone does not
   animate that over a scrolling area, so the page just appeared.) */
.panel::before {
  content: ""; position: absolute; width: var(--d, 300vmax); height: var(--d, 300vmax);
  left: calc(var(--x, 50%) - var(--d, 300vmax) / 2); top: calc(var(--y, 50%) - var(--d, 300vmax) / 2);
  border-radius: 50%; background: var(--bg); transform: scale(0); transition: transform .5s var(--glide);
}
.panel.is-open::before { transform: scale(1); transition-duration: .65s; }
.panel[hidden] { display: none; }
.panel.is-open.is-done { background: var(--bg); }
.panel__in { position: relative; opacity: 0; transition: opacity .2s ease; }
.panel.is-open .panel__in { opacity: 1; transition: opacity .35s ease .18s; }
/* drinks: the menu takes the kraft colour of its beer mat */
.panel--drinks { --bg: #b98a5c; --ink: #2c180c; --muted: #4a2e1a; --line: rgb(44 24 12 / .28); --accent: #2c180c; --on-accent: #f4ead7; --ruby: #7a1d27; --tag-ink: #fff; }
.panel--whiskey { --bg: #2a160b; --ink: #f6e3bf; --muted: #c9a878; --line: rgb(246 227 191 / .2); --accent: #e0a44a; --on-accent: #2a160b; --ruby: #f0b7a4; --tag-ink: #2a160b; }
.panel__in { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 1.25rem 3rem; }
.panel__body { max-width: 40rem; margin: 0 auto; }
.panel__back { position: sticky; top: .75rem; z-index: 2; margin: .75rem 0 0; padding: .7rem 1rem .7rem .8rem; --tk-fill: var(--ink); --tk-line: var(--ink); color: var(--bg); font-size: .875rem; font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; }
.panel__back::before { content: "‹"; font-size: 1.2rem; line-height: .8; }
.panel__title { font: 600 clamp(2.8rem, 14vw, 5rem)/.93 var(--display); letter-spacing: -.035em; margin-top: 1.5rem; text-wrap: balance; }
.panel__note { font: 500 italic 1.0625rem/1.3 var(--display); color: var(--muted); margin: .6rem 0 1rem; }
.panel__title + .group, .panel__title + .rows { margin-top: 1.25rem; }
.panel.is-open .rowb { animation: row-in .6s var(--spring) both; animation-delay: calc(.18s + min(var(--i), 10) * 45ms); }
@keyframes row-in { from { opacity: 0; transform: translateX(34px) rotate(1.5deg); } }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 2.5rem; }
.pager__b { display: flex; align-items: center; gap: .6rem; min-width: 0; min-height: 4.25rem; padding: .8rem 1.1rem; --tk-line: var(--ink); text-align: left; }
.pager__b > span { min-width: 0; flex: 1; }
.pager__b small { display: block; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager__b b { display: block; font: 600 1.125rem/1.15 var(--display); overflow-wrap: anywhere; }
.pager__b--prev::before { content: "‹"; font-size: 1.75rem; line-height: 1; }
.pager__b--next { text-align: right; }
.pager__b--next::after { content: "›"; font-size: 1.75rem; line-height: 1; }
.pager__b:only-child { grid-column: 1 / -1; }

@media (min-width: 720px) {
  .mats { grid-template-columns: repeat(4, 1fr); }
  .mats > :nth-child(even) { translate: 0 2rem; }
  main, .top { max-width: 56rem; }
}

/* Nothing may make the page wider than the screen: phones answer that by widening the whole
   layout (popups cut off at the side, the page can be zoomed out). Body alone is not enough. */
html { overflow-x: clip; }
