/* mobile-views.css — full-screen Side views and 3D on phones.
   See the header in mobile-views.js. Everything here needs html.msheet-on
   (the phone layout, set by mobile-sheet.js) or a class mobile-views.js
   only sets while it is on, so desktop and tablets in the desktop layout
   are untouched. */

/* our buttons exist on desktop too, but only show on phones */
.mviews-expand, .mviews-x { display: none; }
.mviews-overlay[hidden] { display: none !important; }

/* ── shared: round 44 px buttons ─────────────────────────────── */
html.msheet-on .mviews-btn {
  flex: none; width: 44px; height: 44px; padding: 0; margin: 0;
  display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  transition: background-color .13s ease, color .13s ease;
}
html.msheet-on .mviews-btn svg { width: 20px; height: 20px; display: block; }
html.msheet-on .mviews-btn:hover { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
html.msheet-on .mviews-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the expand button in the Side views card header (in the sheet) */
html.msheet-on .msheet-body #sv-panel .mviews-expand { display: inline-grid; margin-left: auto; }

/* ── what the overlays cover ─────────────────────────────────── */
html.mviews-fs-on #topbar, html.mviews-fs-on #stats, html.mviews-fs-on .msheet,
html.mviews-fs-on .msheet-tabs, html.mviews-fs-on #legend-dock, html.mviews-fs-on #right,
html.mviews-fs-on .mtouch-fab { visibility: hidden !important; }
html.mviews-fs-on body { overflow: hidden; }

/* ── 3D full screen ──────────────────────────────────────────── */
html.msheet-on #v3d.mviews-fs {
  position: fixed !important; inset: 0 !important;
  left: 0 !important; right: 0 !important; top: 0 !important; bottom: 0 !important;
  width: auto !important; height: auto !important; min-height: 0 !important; max-height: none !important;
  min-width: 0 !important; max-width: none !important; margin: 0 !important; transform: none !important;
  z-index: 1000 !important;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(12px, env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 10px) max(12px, env(safe-area-inset-left, 0px));
  border: 0; border-radius: 0; box-shadow: none;
  background: var(--surface2); -webkit-backdrop-filter: none; backdrop-filter: none;
  overflow: hidden; gap: 8px;
  animation: mviews-in .18s ease-out;
}
html.msheet-on #v3d.mviews-fs .head #btn-3d-big,
html.msheet-on #v3d.mviews-fs .head #btn-3d-close { display: none; }
html.msheet-on #v3d.mviews-fs .head h3 { order: -2; flex: 1 1 auto; margin-right: 0; min-width: 0; }
html.msheet-on #v3d.mviews-fs .head .mviews-x { display: inline-grid; order: 99; margin-left: auto; }
@media (max-width: 640px) {
  /* portrait: ✕ on the title row, top-right */
  html.msheet-on #v3d.mviews-fs .head .mviews-x { order: -1; }
}
html.msheet-on #v3d.mviews-fs #cv-3d { flex: 1 1 0 !important; min-height: 0 !important; height: auto; }
html.msheet-on #v3d.mviews-fs #lab-3d { flex: none; }
@media (min-width: 641px) {
  /* landscape: one row of settings; room for "auto" in the Vert × field */
  html.msheet-on #v3d.mviews-fs .mini input { width: 76px; }
}

/* ── Side views full screen ──────────────────────────────────── */
html.msheet-on .mviews-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(12px, env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 10px) max(12px, env(safe-area-inset-left, 0px));
  background: var(--surface2); color: var(--fg); font-family: var(--font);
  animation: mviews-in .18s ease-out;
}
html.msheet-on .mviews-overlay > #sv-panel.mviews-fs {
  flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; max-width: none;
  margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  display: grid; gap: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head" "hint" "h1" "c1" "l1" "h2" "c2" "l2";
}
#sv-panel.mviews-fs > .card-head { grid-area: head; min-height: 44px; margin-bottom: 6px; }
#sv-panel.mviews-fs > .mviews-hint { grid-area: hint; margin-bottom: 8px; }
#sv-panel.mviews-fs > h3:nth-of-type(1) { grid-area: h1; margin: 0 0 6px; }
#sv-panel.mviews-fs > #sv-cross { grid-area: c1; }
#sv-panel.mviews-fs > #lab-cross { grid-area: l1; margin: 6px 0 12px; }
#sv-panel.mviews-fs > h3:nth-of-type(2) { grid-area: h2; margin: 0 0 6px; }
#sv-panel.mviews-fs > #sv-prof { grid-area: c2; }
#sv-panel.mviews-fs > #lab-prof { grid-area: l2; margin: 6px 0 0; }
#sv-panel.mviews-fs > .card-head h2 { font: 700 17px/1.2 var(--font); letter-spacing: -.02em; color: var(--fg); text-transform: none; }
#sv-panel.mviews-fs #sv-close, #sv-panel.mviews-fs .mviews-expand { display: none !important; }
#sv-panel.mviews-fs .mviews-x { display: inline-grid; margin-left: auto; }
#sv-panel.mviews-fs > canvas { width: 100% !important; height: 100% !important; min-height: 0; max-height: none; }
#sv-panel.mviews-fs .lab { min-height: 1.3em; }
@media (orientation: landscape) {
  /* landscape: the two charts side by side */
  html.msheet-on .mviews-overlay > #sv-panel.mviews-fs {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "head head" "hint hint" "h1 h2" "c1 c2" "l1 l2";
  }
  #sv-panel.mviews-fs > #lab-cross { margin: 6px 0 0; }
}

/* ── rotate hint (portrait only, until dismissed) ────────────── */
.mviews-hint { display: none; }
html.mviews-fs-on .mviews-hint {
  display: flex; align-items: center; gap: 8px; flex: none;
  min-height: 40px; padding: 0 0 0 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 30%, transparent);
  color: var(--fg); font: 500 12.5px/1.25 var(--font);
}
.mviews-hint-ic { flex: none; display: grid; place-items: center; color: var(--accent2); }
.mviews-hint-ic svg { width: 20px; height: 20px; display: block; }
.mviews-hint-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mviews-hint-x {
  flex: none; width: 44px; height: 44px; margin: -2px 0; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--fg2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mviews-hint-x svg { width: 16px; height: 16px; display: block; }
.mviews-hint-x:hover { color: var(--fg); }
.mviews-hint-x:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
html.mviews-hint-off .mviews-hint { display: none !important; }
@media (orientation: landscape) { .mviews-hint { display: none !important; } }

@keyframes mviews-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html.msheet-on #v3d.mviews-fs, html.msheet-on .mviews-overlay { animation: none; }
  html.msheet-on .mviews-btn { transition: none; }
}
