/* restaurants.css
 *
 * Structure only. Every color, font, radius and size comes from a --rst-* token,
 * so applying your design system means editing the TOKENS block below (or
 * overriding it from your own stylesheet). Selectors are single-class and
 * prefixed with rst-, so they will not collide with site styles.
 */

/* ============================== TOKENS ==============================
 * Declared with :where() so they have zero specificity: any rule you write,
 * in any order, wins. Point each one at your design system's variable, e.g.
 *   .rst { --rst-surface: var(--color-surface); --rst-accent: var(--color-brand); }
 * If your tokens already switch for dark mode, the media query below is moot.
 */
:where(.rst) {
  /* typography */
  --rst-font-body: system-ui, sans-serif;
  --rst-font-heading: Georgia, "Times New Roman", serif;

  /* surfaces and text */
  --rst-surface: #ffffff;        /* card and control background */
  --rst-text: #231f1b;
  --rst-muted: #6f665d;          /* labels, secondary text */
  --rst-border: #e7e0d6;
  --rst-accent: #1f6f78;         /* links, active filter */
  --rst-on-accent: #ffffff;      /* text on an accent background */
  --rst-danger: #b3261e;
  --rst-chip-bg: #efe8dc;        /* neutral pill */

  /* shape and layout */
  --rst-radius-card: 14px;
  --rst-radius-field: 8px;
  --rst-radius-pill: 999px;
  --rst-gap: 24px;
  --rst-card-min: 320px;         /* minimum card width in the grid */
  --rst-photo-height: 200px;

  /* photo header: title and badges are drawn over the image */
  --rst-photo-fallback: linear-gradient(135deg, #1f6f78, #8ec5c9);
  --rst-photo-text: #ffffff;
  --rst-photo-text-shadow: 0 1px 3px rgba(0,0,0,.6), 0 0 12px rgba(0,0,0,.35);
  --rst-scrim: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.45) 38%, rgba(0,0,0,0) 70%);
  --rst-badge-text: #ffffff;
  --rst-badge-border: rgba(255,255,255,.35);
  --rst-badge-distance: rgba(20,20,20,.72);
  --rst-badge-default: rgba(20,82,90,.88);        /* any type without its own color */
  --rst-badge-restaurant: rgba(20,82,90,.88);
  --rst-badge-bar: rgba(88,48,120,.88);

  /* Petermeter stars */
  --rst-star-on: #ffb800;
  --rst-star-off: #d8cfc1;

  /* people pills, by role */
  --rst-owner-bg: #d6ecef;   --rst-owner-fg: #14525a;
  --rst-chef-bg: #fbe3c4;    --rst-chef-fg: #7a4a0c;
  --rst-server-bg: #dfe3f7;  --rst-server-fg: #2f3c85;
  --rst-regular-bg: #dcefd9; --rst-regular-fg: #2c5e25;
}

@media (prefers-color-scheme: dark) {
  :where(.rst) {
    --rst-surface: #211d17;
    --rst-text: #f1ebe2;
    --rst-muted: #a89f93;
    --rst-border: #342e25;
    --rst-accent: #6cc3cc;
    --rst-on-accent: #17140f;
    --rst-danger: #f2b8b5;
    --rst-chip-bg: #2c261e;
    --rst-star-on: #ffd426;
    --rst-star-off: #3d352a;
    --rst-owner-bg: #1c3d42;   --rst-owner-fg: #9fdde4;
    --rst-chef-bg: #4a3417;    --rst-chef-fg: #f3c98d;
    --rst-server-bg: #262c52;  --rst-server-fg: #b7c0f5;
    --rst-regular-bg: #243d21; --rst-regular-fg: #a9dba2;
  }
}

/* ============================== BASE ============================== */
.rst, .rst *, .rst *::before, .rst *::after { box-sizing: border-box; }
.rst { font-family: var(--rst-font-body); color: var(--rst-text); }
.rst a { color: var(--rst-accent); text-decoration: none; }
.rst a:hover { text-decoration: underline; }
.rst-label {
  display: block; font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--rst-muted);
}

/* ============================ CONTROLS ============================ */
.rst__controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: 10px 14px; margin: 0 0 20px; font-size: .9rem;
}
.rst__controls[hidden] { display: none; }

.rst-toggle {
  font: inherit; color: var(--rst-muted); background: var(--rst-surface);
  border: 1px solid var(--rst-border); border-radius: var(--rst-radius-pill);
  padding: 5px 14px; cursor: pointer;
}
.rst-toggle[aria-pressed="true"] {
  background: var(--rst-accent); border-color: var(--rst-accent); color: var(--rst-on-accent);
}

.rst-sort { display: inline-flex; align-items: center; gap: 8px; color: var(--rst-muted); }
.rst-sort select {
  font: inherit; color: var(--rst-text); background: var(--rst-surface);
  border: 1px solid var(--rst-border); border-radius: var(--rst-radius-field); padding: 5px 8px;
}
.rst-toggle:focus-visible, .rst-sort select:focus-visible {
  outline: 2px solid var(--rst-accent); outline-offset: 2px;
}

.rst-geomsg { color: var(--rst-muted); font-size: .82rem; }
.rst-geomsg:empty { display: none; }

/* ============================== GRID ============================== */
.rst__grid {
  display: grid; gap: var(--rst-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--rst-card-min)), 1fr));
}
.rst-empty, .rst-status { color: var(--rst-muted); }
.rst-error { color: var(--rst-danger); }

/* ============================== CARD ============================== */
.rst-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--rst-surface); border: 1px solid var(--rst-border);
  border-radius: var(--rst-radius-card);
}

/* photo header: image, then a scrim so white text reads on any photo */
.rst-photo { position: relative; height: var(--rst-photo-height); background: var(--rst-photo-fallback); }
.rst-photo::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--rst-scrim); }
.rst-photo__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rst-photo__title {
  position: absolute; left: 20px; right: 20px; bottom: 14px; z-index: 1; margin: 0;
  font-family: var(--rst-font-heading); font-size: 1.4rem; line-height: 1.2; color: var(--rst-photo-text);
  text-shadow: var(--rst-photo-text-shadow);
}

.rst-badge {
  position: absolute; top: 12px; z-index: 1; padding: 3px 12px;
  border-radius: var(--rst-radius-pill); color: var(--rst-badge-text);
  border: 1px solid var(--rst-badge-border); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  font-weight: 600; line-height: 1.4;
}
.rst-badge--type {
  left: 12px; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  background: var(--rst-badge-default);
}
.rst-badge--restaurant { background: var(--rst-badge-restaurant); }
.rst-badge--bar { background: var(--rst-badge-bar); }
.rst-badge--distance {
  right: 12px; font-size: .78rem; font-variant-numeric: tabular-nums;
  background: var(--rst-badge-distance); border-color: rgba(255,255,255,.3);
}

.rst-body { padding: 18px 20px 20px; }
.rst-tagline { margin: 0 0 14px; font-size: .92rem; color: var(--rst-muted); }
.rst-credit { margin: -8px 0 12px; font-size: .7rem; text-align: right; color: var(--rst-muted); }
.rst-credit a { color: inherit; text-decoration: underline; }
.rst-row { margin: 8px 0; font-size: .95rem; }
.rst-note { margin: 14px 0 0; font-size: .8rem; color: var(--rst-muted); }

.rst-info { list-style: none; margin: 4px 0 0; padding: 0; }
.rst-info li { margin: 3px 0; }

/* ============================ ACCORDIONS ============================ */
.rst-acc__summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; cursor: pointer; list-style: none;
}
.rst-acc__summary::-webkit-details-marker { display: none; }
.rst-acc__summary .rst-label { display: inline; }
.rst-chev { font-size: .8rem; color: var(--rst-muted); transition: transform .15s; }
.rst-acc[open] > .rst-acc__summary .rst-chev { transform: rotate(180deg); }
.rst-acc__summary:focus-visible { outline: 2px solid var(--rst-accent); outline-offset: 3px; }

.rst-today { flex-basis: 100%; display: flex; gap: 10px; align-items: baseline; margin-top: 2px; }
.rst-today__label { font-size: .85rem; color: var(--rst-muted); }
.rst-closed { color: var(--rst-muted); }

.rst-hours { width: 100%; margin-top: 4px; border-collapse: collapse; font-size: .88rem; }
.rst-hours td { padding: 3px 0; border-bottom: 1px solid var(--rst-border); }
.rst-hours td:first-child { width: 38%; color: var(--rst-muted); }
.rst-hours .is-today td { font-weight: 600; }
.rst-hours .is-today td:first-child { color: var(--rst-text); }

.rst-people__collapsed { flex-basis: 100%; margin-top: 4px; }
.rst-acc[open] > .rst-acc__summary .rst-people__collapsed { display: none; }
.rst-people__group { margin-top: 8px; }

/* ============================== CHIPS ============================== */
.rst-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rst-chip {
  padding: 2px 10px; border-radius: var(--rst-radius-pill); font-size: .85rem;
  background: var(--rst-chip-bg);
}
.rst-chip--owner { background: var(--rst-owner-bg); color: var(--rst-owner-fg); }
.rst-chip--chef { background: var(--rst-chef-bg); color: var(--rst-chef-fg); }
.rst-chip--server { background: var(--rst-server-bg); color: var(--rst-server-fg); }
.rst-chip--regular { background: var(--rst-regular-bg); color: var(--rst-regular-fg); }

/* ============================ PETERMETER ============================
 * CSS-only stars. --r on .rst-meter is 0 to 5 in half steps. Each star works out
 * its own fill (--p) from --r and its index (--i), so 3.5 fills three stars and
 * half of the fourth.
 */
.rst-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin: 0 0 12px; }
.rst-meter .rst-label { font-weight: 600; }
.rst-stars { display: inline-flex; font-size: 22px; line-height: 1.1; user-select: none; }
.rst-star {
  --p: clamp(0%, calc((var(--r) - var(--i)) * 100%), 100%);
  display: inline-block; width: 1.2em; text-align: center; color: transparent;
  background: linear-gradient(90deg, var(--rst-star-on) var(--p), var(--rst-star-off) var(--p));
  -webkit-background-clip: text; background-clip: text;
}
.rst-star::before { content: "\2605"; }
.rst-star:nth-child(1) { --i: 0; } .rst-star:nth-child(2) { --i: 1; } .rst-star:nth-child(3) { --i: 2; }
.rst-star:nth-child(4) { --i: 3; } .rst-star:nth-child(5) { --i: 4; }
