/* Chamaps — Record tab (live GPS recording, activities, photo pins, flyover photo cards).
   Reuses tokens and classes from style.css / community.css / routes.css. */

.panel--record { display: flex; flex-direction: column; gap: 14px; }

/* Live stats ------------------------------------------------------------- */
.rec-live { display: flex; flex-direction: column; gap: 12px; }
.rec-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rec-hero__c { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.rec-hero__v { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--text); }
.rec-hero__l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.rec-live[data-status="recording"] .rec-hero__c:first-child { border-color: color-mix(in srgb, var(--rec-c, var(--accent)) 55%, transparent); }
.rec-live[data-status="paused"] .rec-hero__v { color: var(--text-2); }
.rec-stats { grid-template-columns: repeat(3, 1fr); }
.rec-stats .stat__v { font-size: 18px; font-variant-numeric: tabular-nums; }
.rec-acts .chip { cursor: pointer; }
.rec-live[data-status="recording"] .rec-acts, .rec-live[data-status="paused"] .rec-acts { opacity: .55; pointer-events: none; }

.rec-follow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--c, var(--accent)); border-radius: var(--r-md); font-size: 12.5px; background: var(--bg-2); }
.rec-follow__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-follow__left { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-follow .linkbtn { color: var(--muted); font-size: 12px; }

.rec-ctl { align-items: center; flex-wrap: wrap; }
.rec-ctl .btn { flex: 1 1 auto; }
.rec-ctl .iconbtn { flex: none; }
.btn--stop { background: var(--danger); color: #fff; border-color: transparent; }
.btn--stop:hover { background: #ff7676; }
.rec-cam[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.rec-live[data-status="recording"] .rec-hero__c:first-child .rec-hero__l::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 1px; animation: rec-blink 1.2s ease-in-out infinite; }
@keyframes rec-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Current position marker (pulsing) */
.rec-pos { width: 16px; height: 16px; border-radius: 50%; background: var(--rec-c, var(--accent)); border: 2.5px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.35); position: relative; }
.rec-pos::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--rec-c, var(--accent)); animation: rec-pulse 1.6s var(--ease) infinite; }
.rec-pos.is-paused::before { animation: none; opacity: .4; }
@keyframes rec-pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }

/* Summary card ----------------------------------------------------------- */
.rec-summary { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--bg-1); animation: rise .3s var(--ease); }
.rec-summary__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec-summary__h .h3 { margin: 0; }
.rec-summary .stats { grid-template-columns: repeat(3, 1fr); }
.rec-summary .profile { height: 90px; }
.rec-summary .profile canvas { width: 100%; height: 100%; display: block; }
.rec-summary__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.rec-summary .btnrow .btn--primary { flex: 1; }
.rec-summary .hint--warn { color: var(--accent-hover); }

/* Photos block (post-save + detail) --------------------------------------- */
.rec-photos { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); }
.rec-photos__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec-photos__h .h3 { margin: 0; font-size: 14px; }
.rec-add { position: relative; overflow: hidden; }
.rec-add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.rec-ph { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); padding: 0; cursor: pointer; }
.rec-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-ph__t { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 5px; font-size: 10px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; text-align: left; font-variant-numeric: tabular-nums; }
.rec-ph.is-unplaced { opacity: .7; }
.rec-ph.is-hot { outline: 2px solid var(--accent); outline-offset: 1px; }
.rec-eye[aria-pressed="false"] { color: var(--muted); }
.rec-eye[aria-pressed="false"] svg { opacity: .55; }
.rec-eye[aria-pressed="false"]::after { content: ''; position: absolute; width: 2px; height: 22px; background: currentColor; transform: rotate(45deg); border-radius: 1px; }
.rec-eye { position: relative; }
.rec-progress { height: 3px; border-radius: 2px; background: var(--bg-3); overflow: hidden; }
.rec-progress > i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); transition: width .3s var(--ease); }

/* Detail extras (inside #detailExtras) */
.rec-dsec { display: flex; flex-direction: column; gap: 8px; }
.rec-dsec .rec-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.rec-dsec__meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.rec-dsec__meta b { color: var(--text-2); font-weight: 600; }

/* Activities list --------------------------------------------------------- */
.rec-listhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rec-listhead .h3 { margin: 0; }
.route--activity .route__bar { background: var(--c, var(--accent)); grid-row: 1 / -1; }
.route--activity .route__txt { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; cursor: pointer; }
.route--activity .route__txt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.route--activity .route__meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.route--activity .badge { font-size: 9.5px; padding: 2px 6px; }
.badge--photos { background: var(--bg-3); color: var(--text-2); }
.badge--local { background: var(--bg-3); color: var(--accent); }
.rec-vis { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 11px; padding: 3px 8px; }
.rec-vis:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Map popup for photo pins */
.rec-pop .maplibregl-popup-content { background: rgba(14,19,24,.94); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 6px; box-shadow: var(--shadow); width: 168px; }
.rec-pop .maplibregl-popup-tip { border-top-color: rgba(14,19,24,.94); border-bottom-color: rgba(14,19,24,.94); }
.rec-pop img { width: 100%; height: 112px; object-fit: cover; border-radius: var(--r-sm); display: block; cursor: zoom-in; }
.rec-pop__cap { font-size: 12px; margin-top: 6px; line-height: 1.35; }
.rec-pop__t { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.rec-pop .maplibregl-popup-close-button { color: var(--text-2); font-size: 18px; padding: 0 6px; }

/* Flyover photo card ------------------------------------------------------ */
.flyhud { flex-wrap: nowrap; }
.rec-flycard { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); width: 260px; display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 8px; background: rgba(14,19,24,.92); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow); font-weight: 400; animation: rec-card .35s var(--ease) both; }
.rec-flycard img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.rec-flycard__cap { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-flycard__t { font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.rec-flycard__n { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
@keyframes rec-card { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Mobile pill ------------------------------------------------------------- */
.rec-pill { position: absolute; z-index: 19; left: 50%; transform: translateX(-50%); top: calc(var(--topbar-h) + 12px); display: none; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; background: rgba(14,19,24,.92); backdrop-filter: blur(14px); border: 1px solid var(--line-strong); border-radius: 999px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.rec-pill__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s ease-in-out infinite; }
.rec-pill.is-paused .rec-pill__dot { animation: none; background: var(--muted); }
.rec-pill__v { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; }
.rec-pill__sep { color: var(--muted); }
.rec-pill .iconbtn { width: 34px; height: 34px; }
.rec-pill__stop { color: var(--danger); }

@media (max-width: 860px) {
  .rec-pill:not([hidden]) { display: flex; top: 120px; }
  /* the pill is for the collapsed sheet (or no sheet): hide it while the Record panel itself is visible */
  body.has-sidebar:has(.sidebar:not(.is-collapsed)) .rec-pill:not([hidden]) { display: none; }
  .rec-hero__v { font-size: 30px; }
  .rec-flycard { width: min(260px, calc(100vw - 24px)); }
  .flyhud { top: 68px; left: 8px; transform: none; max-width: calc(100vw - 72px); } /* leave room for the tool rail */
  .rec-flycard { left: 0; transform: none; }
  @keyframes rec-card { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .flyhud #flyLabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
  body.is-recording .flyhud { top: 170px; }
  /* keep the bottom-anchored detail card clear of the recording pill / flyover HUD + photo card */
  /* (!important: routes.css' body.has-sidebar:has(.sidebar.is-collapsed) .detail rule is more specific) */
  body.is-recording .detail { max-height: calc(100vh - 250px) !important; }
  body:has(.flyhud:not([hidden])) .detail { max-height: calc(100vh - 290px) !important; }
  body.is-recording:has(.flyhud:not([hidden])) .detail { max-height: calc(100vh - 340px) !important; }
}
