/* RKMV Gallery components. Tokens only, flat, mobile-first; breakpoint 860px matches base.css. */
[hidden] { display: none !important; }
ul.plain, ol.plain { list-style: none; margin: 0; padding: 0; }
#view h1:focus { outline: none; }
.empty { padding: 32px 0; }
.stack { display: grid; gap: var(--gap); }
.section-title { margin: 32px 0 12px; }

/* ---- Shared controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-height); padding: 0 14px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); font-weight: 500; line-height: 1.2;
  transition: background var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:disabled { color: var(--muted); cursor: default; background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent); opacity: 0.9; }
.btn-quiet { border-color: transparent; background: transparent; }
.input {
  height: var(--control-height); min-width: 0; padding: 0 12px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text);
}
.input::placeholder { color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  transition: background var(--dur-fast) var(--ease);
}
.chip:hover { background: var(--raised); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip .chip-n { font-size: var(--fs-small); }
.chip[aria-pressed="true"] .chip-n { color: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap;
}
.pill-positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill-warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.avatar { width: 48px; height: 48px; flex: none; object-fit: cover; border-radius: var(--radius-control); background: var(--raised); }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 96px; height: 96px; border-radius: var(--radius-card); }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--raised); border-radius: var(--radius-control); }
.seg button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 4px; background: transparent; }
.seg button[aria-pressed="true"] { background: var(--surface); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.rows { max-width: 720px; }
.rows > li { border-top: 1px solid var(--rule); }
.rows > li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; width: 100%; border-radius: var(--radius-control); }
a.row:hover, button.row:hover { background: var(--raised); }
button.row { border: 0; background: none; text-align: left; }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-name { font-weight: 500; overflow-wrap: anywhere; }
.row-n { white-space: nowrap; }
.disclosure { margin-top: 32px; max-width: 720px; }
.disclosure summary { cursor: pointer; min-height: var(--hit); display: flex; align-items: center; font-weight: 600; }
@media (pointer: coarse) {
  .btn, .chip, .input, .seg button, .check, .nav a, .nav button { min-height: var(--hit); }
}

/* ---- Shell additions ---- */
.nav .pill { margin-left: auto; }
.side-foot .btn { width: 100%; justify-content: flex-start; }
.topbar .btn { padding: 0 12px; }
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.menu-head .brand { padding: 0; }
.menu-sheet .nav a, .menu-sheet .nav button { min-height: var(--hit); }
@media (min-width: 861px) { .menu-sheet { display: none; } }

/* ---- Gallery ---- */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.toolbar-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-top .search { flex: 1 1 240px; max-width: 480px; }
.fgroups { display: grid; gap: 10px; }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fgroup-label { color: var(--muted); font-size: var(--fs-small); flex: 0 0 100%; }
.fgroup .input { width: 220px; max-width: 100%; }
.filters-toggle .pill { margin-left: 2px; }
@media (max-width: 860px) {
  .fgroups { display: none; }
  .fgroups.open { display: grid; }
}
@media (min-width: 861px) {
  .filters-toggle { display: none; }
  .fgroup-label { flex: 0 0 76px; }
}
.grid { display: flex; flex-direction: column; gap: var(--row-gap); }
.grid-row { display: flex; gap: var(--row-gap); }
.tile { display: block; flex: none; overflow: hidden; border-radius: 4px; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--dur-fast) var(--ease); }
.tile:hover img { opacity: 0.9; }

/* ---- Lightbox ---- */
.lb { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: var(--overlay); }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; }
.lb-frame { position: relative; flex: none; background-size: cover; background-position: center; }
.lb-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: var(--hit); height: var(--hit); padding: 0; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-panel { background: var(--surface); color: var(--text); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lb-close { width: var(--hit); padding: 0; }
.lb-title { font-size: 28px; }
.lb-title a:hover { text-decoration: underline; }
.lb-panel h2 { margin-bottom: 8px; }
.lb-panel .row { min-height: var(--hit); padding: 4px; }
.lb-fix summary { cursor: pointer; min-height: var(--hit); display: flex; align-items: center; color: var(--muted); }
.lb-fix-body { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 8px; }
.lb-fix-body .input { flex: 1 1 160px; }
.lb-fix-body p { flex: 0 0 100%; }
.faces { position: absolute; inset: 0; }
.face { position: absolute; border: 2px solid var(--accent); border-radius: 2px; }
.face-cand { border-style: dashed; }
a.face:hover, a.face:focus-visible { background: var(--accent-soft); opacity: 0.85; }
.face-label {
  position: absolute; left: -2px; top: 100%; margin-top: 4px; padding: 1px 6px; border-radius: 3px;
  background: var(--accent); color: var(--on-accent); font-size: var(--fs-small); font-weight: 500; white-space: nowrap;
}
.face-label.above { top: auto; bottom: 100%; margin: 0 0 4px; }
@media (max-width: 860px) {
  .lb { display: block; overflow-y: auto; }
  .lb-stage { height: 62dvh; }
  .lb-panel { overflow: visible; min-height: 38dvh; }
}

/* ---- People ---- */
.people-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.people-tools .input { flex: 1 1 220px; max-width: 360px; }

/* ---- Person ---- */
.person-head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.person-head p { margin-top: 6px; color: var(--muted); }
.friend-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.friend-row .row { width: auto; flex: 1 1 220px; }
.friend-row .together { white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 860px) { .person-head { align-items: flex-start; } .avatar-lg { width: 72px; height: 72px; } }

/* ---- Friends ---- */
.fr-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 8px; }
.fr-range { display: inline-flex; align-items: center; gap: 10px; min-height: var(--hit); }
.fr-range input { width: 160px; accent-color: var(--accent); }
.friends-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-top: 12px; }
.graph-box {
  position: relative; height: 62vh; min-height: 320px; max-height: 680px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
}
.graph-box canvas { width: 100%; height: 100%; cursor: grab; touch-action: none; }
.fr-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; }
.fr-list { max-width: 720px; }
.fr-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; align-self: start; }
.fr-panel h2 { margin-bottom: 4px; }
.fr-panel ul { margin-top: 12px; }
.fr-panel li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--rule); }
.fr-panel li > .row-btn { flex: 1 1 140px; }
.fr-panel-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.row-btn {
  display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 4px; width: 100%;
  border: 0; border-radius: var(--radius-control); background: none; text-align: left;
}
.row-btn:hover { background: var(--raised); }
.row-btn[aria-pressed="true"] { background: var(--raised); font-weight: 600; }
@media (min-width: 1100px) { .friends-wrap { grid-template-columns: minmax(0, 1fr) 300px; } }

/* ---- Places ---- */
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.place { display: block; }
.place img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-card); background: var(--raised); }
.place-cap { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px 0; }
.place:hover .place-name { text-decoration: underline; }
.place-name { font-weight: 500; }
.tl-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.tl-tools h2 { margin: 0; }
.tl-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--rule); border-radius: 0; }
.tl-row:hover { background: var(--raised); }
.tl-date { display: flex; flex-direction: column; }
.tl-date b { font-weight: 600; }
.tl-strip { display: flex; gap: var(--row-gap); overflow: hidden; }
.tl-strip img { height: 64px; width: auto; flex: none; border-radius: 3px; background: var(--raised); }
@media (max-width: 860px) { .tl-row { grid-template-columns: 1fr; gap: 8px; } }

/* ---- Review ---- */
.rv-card { max-width: 760px; margin-top: 12px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); display: grid; gap: 16px; }
.rv-card h2 { font: 500 24px/1.2 var(--font-display); }
.rv-card h2:focus { outline: none; }
.rv-msg { min-height: 20px; margin-top: 8px; color: var(--muted); }
.crops { display: flex; flex-wrap: wrap; gap: var(--row-gap); }
.crop { flex: none; background-repeat: no-repeat; background-color: var(--raised); border-radius: var(--radius-control); }
.rv-face { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.rv-thumb { position: relative; display: inline-block; line-height: 0; }
.rv-thumb img { max-height: 240px; max-width: 100%; width: auto; height: auto; border-radius: var(--radius-control); background: var(--raised); }
.rv-photo { width: auto; height: auto; max-width: 100%; max-height: 60vh; border-radius: var(--radius-control); background: var(--raised); }
.rv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rv-cands { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cand {
  display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 6px 10px;
  border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); text-align: left;
}
.cand:hover { background: var(--raised); }
.cand .hint { margin-left: auto; }
.scene-options { display: flex; flex-wrap: wrap; gap: 8px; }
.picker { display: grid; gap: 6px; max-width: 360px; }
.pick-list li { border-top: 1px solid var(--rule); }
.pick-list .row-btn small { margin-left: auto; }

/* ---- Small fixes ---- */
.search .input { width: 100%; }
.place img { height: auto; }
