/* ============================================================
   Gluto restaurant page — full per-restaurant detail page.
   Served at /r/{public_id}; hydrates from /api/place-by-public-id,
   /api/report, /api/place-photos, /api/chain-research, /api/reviews.
   ============================================================ */

:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e6eaef;
  --bg: #f6f8f9;
  --card: #ffffff;

  --teal: #0d9488;
  --teal-dark: #0f766e;
  --emerald: #059669;

  --safe-bg: #ecfdf5;   --safe-fg: #047857;
  --risk-bg: #fffbeb;   --risk-fg: #b45309;
  --unsafe-bg: #fef2f2; --unsafe-fg: #b91c1c;
  --gray-bg: #f1f5f9;   --gray-fg: #475569;

  --score-emerald-a: #34d399; --score-emerald-b: #059669;
  --score-amber-a: #fbbf24;   --score-amber-b: #d97706;
  --score-rose-a: #fb7185;    --score-rose-b: #f43f5e;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-dark); }

/* ---- Nav ---- */
.rp-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.rp-nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; gap: 22px;
}
.rp-logo { font-weight: 700; font-size: 20px; text-decoration: none; color: var(--ink); }
.rp-logo-accent { color: var(--teal); }
.rp-nav-links { display: flex; gap: 20px; margin-left: 10px; }
.rp-nav-links a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 15px; }
.rp-nav-links a:hover { color: var(--teal-dark); }
.rp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: .15s;
}
.rp-btn-ghost { margin-left: auto; border-color: var(--line); color: var(--ink-soft); background: #fff; }
.rp-btn-ghost:hover { border-color: var(--teal); color: var(--teal-dark); }
.rp-btn-primary { background: var(--teal); color: #fff; }
.rp-btn-primary:hover { background: var(--teal-dark); }
.rp-btn-light { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.32); backdrop-filter: blur(4px); }
.rp-btn-light:hover { background: rgba(255,255,255,.26); }

/* Mobile drawer nav (injected by mobile-nav.js). Desktop = no visual change. */
.rp-nav-toggle { display: none; }
.rp-nav-drawer { display: contents; }
.lp-nav-backdrop { display: none; }

/* ---- Sticky mini verdict ---- */
.rp-sticky-verdict {
  position: sticky; top: 57px; z-index: 35;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px; background: #fff; border-bottom: 1px solid var(--line);
  max-width: 1180px; margin: 0 auto;
}
.rp-sticky-verdict[hidden] { display: none; }
.rp-sticky-name { font-weight: 700; }

/* ---- Hero ---- */
.rp-main { max-width: 1180px; margin: 0 auto; padding: 0 22px 60px; }
.rp-hero {
  position: relative; margin-top: 18px; border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow-lg); isolation: isolate;
}
.rp-hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0f766e, #115e59 55%, #134e4a);
  background-size: cover; background-position: center;
  transform: scale(1.05); filter: saturate(1.05);
}
.rp-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,30,28,.35), rgba(8,30,28,.78));
}
.rp-hero-content {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr 340px; gap: 28px;
  padding: 40px 40px 36px; align-items: end;
}
.rp-kicker {
  text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 600;
  color: #99f6e4; margin: 0 0 10px;
}
.rp-title { color: #fff; font-size: 42px; line-height: 1.05; margin: 0 0 12px; font-weight: 700; }
.rp-subline { color: #d1fae5; margin: 0 0 6px; font-weight: 500; }
.rp-address { color: rgba(255,255,255,.82); margin: 0 0 16px; font-size: 15px; }
.rp-hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.rp-openchip, .rp-metaitem {
  font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  padding: 6px 12px; border-radius: 999px;
}
.rp-openchip.is-open { background: rgba(16,185,129,.28); border-color: rgba(110,231,183,.5); }
.rp-openchip.is-closed { background: rgba(244,63,94,.24); border-color: rgba(253,164,175,.5); }
.rp-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Verdict card */
.rp-verdict-card {
  background: rgba(255,255,255,.97); border-radius: 20px; padding: 22px;
  display: flex; gap: 18px; align-items: center; box-shadow: var(--shadow-lg);
}
.rp-ring-wrap { position: relative; width: 104px; height: 104px; flex: 0 0 auto; }
.rp-ring { width: 104px; height: 104px; transform: rotate(-90deg); }
.rp-ring-track { fill: none; stroke: #eef2f4; stroke-width: 11; }
.rp-ring-fill { fill: none; stroke: var(--emerald); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 1s ease; }
.rp-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rp-ring-score { font-size: 30px; font-weight: 700; line-height: 1; color: var(--ink); }
.rp-ring-outof { font-size: 12px; color: var(--muted); font-weight: 600; }
.rp-verdict-text { display: flex; flex-direction: column; gap: 6px; }
.rp-verdict-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.rp-verdict-badge {
  align-self: flex-start; font-weight: 700; font-size: 14px;
  padding: 5px 12px; border-radius: 999px;
}
.rp-verdict-summary { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; line-height: 1.4; }

.badge-safe { background: var(--safe-bg); color: var(--safe-fg); }
.badge-risky { background: var(--risk-bg); color: var(--risk-fg); }
.badge-unsafe { background: var(--unsafe-bg); color: var(--unsafe-fg); }
.badge-default { background: var(--gray-bg); color: var(--gray-fg); }

/* ---- Glance chips ---- */
.rp-glance { margin: 18px 0 4px; }
.rp-glance-inner { display: flex; flex-wrap: wrap; gap: 12px; }
.rp-glance-chip {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); min-width: 180px;
}
.rp-glance-emoji { font-size: 20px; }
.rp-glance-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.rp-glance-v { font-weight: 700; font-size: 14px; }
.rp-glance-v.tone-good { color: var(--safe-fg); }
.rp-glance-v.tone-warn { color: var(--risk-fg); }
.rp-glance-v.tone-bad { color: var(--unsafe-fg); }

/* ---- Body grid ---- */
.rp-body { display: grid; grid-template-columns: 1fr 340px; gap: 26px; margin-top: 22px; }
.rp-col-main { display: flex; flex-direction: column; gap: 22px; }
.rp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.rp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-h2 { font-size: 20px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.rp-h2-icon { font-size: 20px; }
.rp-h2-sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.rp-source-pill { font-size: 11px; font-weight: 700; color: var(--teal-dark); background: #f0fdfa; border: 1px solid #99f6e4; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.rp-source-sample { color: #92400e; background: #fffbeb; border-color: #fcd34d; }

/* What you can eat */
.rp-eat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rp-eat-col { border-radius: 14px; padding: 16px; }
.rp-eat-safe { background: var(--safe-bg); border: 1px solid #a7f3d0; }
.rp-eat-risk { background: var(--risk-bg); border: 1px solid #fde68a; }
.rp-eat-title { font-size: 14px; margin: 0 0 10px; font-weight: 700; }
.rp-eat-list { margin: 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rp-eat-list li { font-size: 14px; line-height: 1.45; color: var(--ink-soft); padding-left: 22px; position: relative; }
.rp-eat-safe .rp-eat-list li::before { content: "✓"; position: absolute; left: 0; color: var(--safe-fg); font-weight: 700; }
.rp-eat-risk .rp-eat-list li::before { content: "!"; position: absolute; left: 4px; color: var(--risk-fg); font-weight: 700; }

/* Scores */
.rp-scores { display: flex; flex-direction: column; gap: 14px; }
.rp-score-row { }
.rp-score-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.rp-score-label { font-weight: 600; font-size: 14px; }
.rp-score-label small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.rp-score-val { font-weight: 700; font-size: 14px; }
.rp-score-track { height: 9px; background: #eef2f4; border-radius: 999px; overflow: hidden; }
.rp-score-bar { height: 100%; border-radius: 999px; width: 0; transition: width .9s ease; }
.grad-emerald { background: linear-gradient(90deg, var(--score-emerald-a), var(--score-emerald-b)); }
.grad-amber { background: linear-gradient(90deg, var(--score-amber-a), var(--score-amber-b)); }
.grad-rose { background: linear-gradient(90deg, var(--score-rose-a), var(--score-rose-b)); }
.val-emerald { color: var(--safe-fg); } .val-amber { color: var(--risk-fg); } .val-rose { color: var(--unsafe-fg); }

/* Photos */
.rp-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rp-photo {
  aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; cursor: pointer; position: relative;
  background: linear-gradient(135deg, #cbd5e1, #e2e8f0); border: 1px solid var(--line);
}
.rp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-photo-ph { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; text-align: center; padding: 8px; font-weight: 600; }
.rp-attr { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* Report / markdown */
.rp-report { font-size: 14.5px; line-height: 1.65; color: var(--ink-soft); }
.rp-report h3 { font-size: 15px; color: var(--ink); margin: 20px 0 8px; }
.rp-report h2 { font-size: 17px; color: var(--ink); margin: 22px 0 8px; }
.rp-report p { margin: 0 0 12px; }
.rp-report ul { margin: 0 0 14px; padding-left: 20px; }
.rp-report li { margin-bottom: 7px; }
.rp-report a { color: var(--teal-dark); word-break: break-word; }

/* Instagram */
.rp-ig-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.rp-ig-grid .instagram-media { margin: 0 !important; min-width: 0 !important; width: 100% !important; }

/* Chain */
.rp-chain { background: linear-gradient(180deg, #f8fafc, #fff); }
.rp-chain-verdict {
  display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-top: 6px;
}
.rp-chain-score { font-size: 28px; font-weight: 700; }
.rp-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rp-chip { background: #f0fdfa; border: 1px solid #99f6e4; color: var(--teal-dark); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.rp-tabs { display: flex; gap: 8px; margin: 20px 0 14px; border-bottom: 1px solid var(--line); }
.rp-tab { border: none; background: none; padding: 10px 4px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.rp-tab.is-active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* Reviews */
.rp-reviews-list { margin-bottom: 18px; }
.rp-empty { color: var(--muted); font-size: 14px; background: var(--gray-bg); border-radius: 12px; padding: 16px; text-align: center; }
.rp-review { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.rp-review p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.rp-review-form { border-top: 1px solid var(--line); padding-top: 18px; }
.rp-stars-input { font-size: 26px; color: #cbd5e1; cursor: pointer; user-select: none; margin: 6px 0 10px; }
.rp-stars-input span:hover, .rp-stars-input span.on { color: #f59e0b; }
.rp-textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; resize: vertical; margin-bottom: 12px; }

/* Good to know */
.rp-extras { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.rp-extra-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.rp-extra-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-extra-tag { background: var(--gray-bg); color: var(--gray-fg); font-size: 12.5px; padding: 4px 10px; border-radius: 8px; }

/* Sidebar */
.rp-col-side { }
.rp-side-sticky { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 18px; }
.rp-side-card { padding: 0; overflow: hidden; }
.rp-side-card h3.rp-side-title { padding: 0; }
.rp-side-title { font-size: 15px; margin: 0; padding: 18px 18px 0; }
.rp-minimap { height: 180px; width: 100%; background: #e2e8f0; }
.rp-side-facts { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.rp-fact { display: flex; gap: 10px; font-size: 14px; }
.rp-fact .k { color: var(--muted); min-width: 78px; }
.rp-fact .v { color: var(--ink); font-weight: 500; }
.rp-fact .v a { word-break: break-word; }
.rp-confidence { margin: 14px 18px 0; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.conf-high { background: var(--safe-bg); color: var(--safe-fg); }
.conf-med { background: var(--risk-bg); color: var(--risk-fg); }
.conf-low { background: var(--gray-bg); color: var(--gray-fg); }
.rp-sources { padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.rp-source-group h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.rp-source-group a { display: block; font-size: 13px; margin-bottom: 4px; word-break: break-word; }

/* Footer */
.rp-footer { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
.rp-footer-id { font-family: ui-monospace, monospace; font-size: 12px; margin-top: 8px; }

/* Lightbox */
.rp-lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,15,20,.92); display: flex; align-items: center; justify-content: center; padding: 30px; }
.rp-lightbox[hidden] { display: none; }
.rp-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; }
.rp-lightbox-close { position: absolute; top: 18px; right: 24px; font-size: 34px; line-height: 1; color: #fff; background: none; border: none; cursor: pointer; }

/* ---- Ordering guides (internal links to Eatout) ---- */
.rp-guides { border-color: #ccfbf1; background: linear-gradient(180deg, #f0fdfa 0%, #fff 120px); }
.rp-guides-group + .rp-guides-group { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.rp-guide-list { display: grid; gap: 10px; }
.rp-guide-link {
  display: block; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.rp-guide-link:hover { border-color: #99f6e4; box-shadow: 0 4px 16px rgba(13,148,136,.08); }
.rp-guide-link-title { display: block; font-weight: 600; font-size: 15px; color: var(--teal-dark); margin-bottom: 4px; }
.rp-guide-link-sub { display: block; font-size: 13px; line-height: 1.45; color: var(--muted); }
.rp-guide-link-meta { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 500; color: var(--teal); }
.rp-guides-more { margin: 18px 0 0; font-size: 14px; font-weight: 600; }

/* Loading / error states */
.rp-status { max-width: 680px; margin: 80px auto; text-align: center; color: var(--muted); }
.rp-status h2 { color: var(--ink); margin-bottom: 8px; }
.rp-spinner { width: 34px; height: 34px; border: 3px solid #d1fae5; border-top-color: var(--teal); border-radius: 50%; margin: 0 auto 18px; animation: rp-spin 0.9s linear infinite; }
@keyframes rp-spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .rp-hero-content { grid-template-columns: 1fr; }
  .rp-body { grid-template-columns: 1fr; }
  .rp-col-side { order: -1; }
  .rp-side-sticky { position: static; }
  .rp-title { font-size: 32px; }
  .rp-eat-grid, .rp-extras, .rp-ig-grid { grid-template-columns: 1fr; }
  .rp-photos { grid-template-columns: repeat(3, 1fr); }

  /* Drop backdrop-filter on mobile: it makes .rp-nav the containing block for
     the position:fixed drawer, trapping it inside the nav bar. */
  .rp-nav { backdrop-filter: none; -webkit-backdrop-filter: none; }

  /* Lift nav above the body-level backdrop so the drawer is not covered. */
  .rp-nav.lp-nav-open { z-index: 1300; }

  .rp-nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 11px 9px;
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    flex: 0 0 auto;
  }
  .rp-nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .rp-nav.lp-nav-open .rp-nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .rp-nav.lp-nav-open .rp-nav-toggle span:nth-child(2) { opacity: 0; }
  .rp-nav.lp-nav-open .rp-nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .rp-nav-drawer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(82vw, 320px);
    padding: 5rem 1.5rem 2rem;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    z-index: 1200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rp-nav.lp-nav-open .rp-nav-drawer { transform: translateX(0); }
  .rp-nav-drawer .rp-nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
    width: 100%;
  }
  .rp-nav-drawer .rp-nav-links a {
    display: block;
    width: 100%;
    padding: 14px 4px;
    font-size: 17px;
    border-bottom: 1px solid var(--line);
  }
  .rp-nav-drawer .rp-btn-ghost { margin-left: 0; width: 100%; }

  .lp-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 1150;
  }
  .lp-nav-backdrop.is-visible { opacity: 1; visibility: visible; }
  body.lp-nav-lock { overflow: hidden; }
}
