/* ================================================================ TABLET (761-1100px)
   Tablet layout under the six new themes (portal/docs/themes.md, "Tablets").

   761-1100px is every tablet held upright (768, 810, 820, 834 and 1024 wide) and most held
   sideways. Until this file the shared stylesheet treated that range as a narrow desktop:
   aperture.css stacks the whole sidebar ABOVE the page there, so on an upright tablet the
   menu filled the first screen (about 840px of it) and every page's content started below
   the fold. Tapping a menu item loaded the page and still showed only the menu
   (a user's screen recording, 2026-11-03).

   Every rule is scoped to NL - an <html> that has a data-theme and it is not "legacy" - so
   legacy draws exactly what it drew before. Theme flavour lives in a marked "tablet"
   section at the end of each theme file.

   1. The shell. The phone's app bar and drawer, at tablet widths too: the page gets the
      full width and the menu is one tap away. Win2000 is left out: it has its own
      explorer layout here (a narrow "Folders" pane beside the page, closable), which
      already works, and its script scrolls the page inside its window above 760px.
      effects.js builds the bar and drawer on every page and its open/close does not
      depend on width; only the edge-swipe stays phone-only.
   2. The review viewer, upright tablets only. Beside one side column the stage is
      100vw - 300px wide, so a landscape render was drawn 456px wide on a 768px tablet.
      Here the decision and information sit in a strip UNDER the picture, side by side,
      whenever that makes the picture larger - decided per picture by
      static/js/viewer_tablet.js from the real geometry, so a tall full-body shot that
      would shrink keeps the side column. The picture is never smaller than before.
   3. Touch. With a coarse pointer every control here is at least 44px tall - the phone's
      floor - because a tablet is a touch screen of the same fingers. */

/* ---------------------------------------------------------------- 1. the shell */
@media (min-width: 761px) and (max-width: 1100px) {
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar {
    display: flex; align-items: center; gap: 6px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 70;
    height: calc(var(--appbar-h) + var(--safe-t));
    padding: var(--safe-t) calc(14px + var(--safe-r)) 0 calc(14px + var(--safe-l));
    background: var(--surface-appbar);
    backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--line);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-btn {
    flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
    background: transparent; border: 0; border-radius: 12px; cursor: pointer;
    color: var(--text); padding: 0;
    transition: background var(--speed), transform var(--speed) var(--ease);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-btn:active { background: var(--panel-2); transform: scale(.92); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .burger { width: 20px; height: 14px; position: relative; display: block; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .burger i {
    position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px;
    background: currentColor;
    transition: transform 280ms var(--ease), opacity 180ms var(--ease);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .burger i:nth-child(1) { top: 0; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .burger i:nth-child(2) { top: 6px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .burger i:nth-child(3) { top: 12px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open .burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open .burger i:nth-child(2) { opacity: 0; transform: scaleX(.4); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open .burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-title {
    flex: 1 1 auto; min-width: 0;
    font-weight: 700; font-size: 16px; letter-spacing: -.2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-brand {
    margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-brand svg { width: 28px; height: 28px; }

  /* The sidebar becomes the drawer: as wide as a desktop sidebar, never more than 86% of
     the window, so the page still shows beside it. */
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .shell { grid-template-columns: 1fr; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80;
    width: min(86vw, 340px); height: 100vh; height: 100dvh;
    padding: calc(var(--appbar-h) + var(--safe-t) + 16px) 18px calc(20px + var(--safe-b));
    overflow-y: auto; overscroll-behavior: contain;
    border-right: 1px solid var(--line);
    transform: translate3d(-102%, 0, 0);
    transition: transform 320ms var(--ease);
    box-shadow: none;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open .sidebar {
    transform: translate3d(0, 0, 0);
    box-shadow: 0 0 60px 0 var(--shadow-drawer);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 75;
    background: var(--scrim-nav);
    opacity: 0; pointer-events: none;
    transition: opacity 300ms var(--ease);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.nav-open { overflow: hidden; }

  /* Nothing for the bar to do over a full-screen layer with its own close: the review
     viewer, gameplay, sync, an artist's submission results viewer (.rv, render_submit.css
     hides the bar there on a phone too) and the Post Processing picture viewer. Each sits
     at z-index 60-70, under the bar, which would cover its top controls. */
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.viewer-open .appbar,
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.gameplay-open .appbar,
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.sync-open .appbar,
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body:has(.rv.open) .appbar,
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body:has(#pfx-viewer:not([hidden])) .appbar { display: none; }

  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .shell > .main {
    padding: calc(var(--appbar-h) + var(--safe-t) + 20px) calc(24px + var(--safe-r)) 48px calc(24px + var(--safe-l));
  }
  /* The bar carries the page title; the h1 goes only when it says exactly the same. */
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.title-in-bar .main h1 { display: none; }

  /* Inside the drawer, as on a phone: the app bar has the one Theme button and the list
     opens as part of the drawer (a fixed panel inside a transformed drawer would be pinned
     off-screen with it). The drawer's own button goes, so there is one Theme control. */
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar:has(.theme-picker[open]) { z-index: 80; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .theme-picker:not([open]),
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .theme-picker > .theme-toggle { display: none; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .theme-panel {
    position: static; left: auto; top: auto; width: auto; max-height: none;
    margin-top: 0; padding: 10px; box-shadow: none;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-theme {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    height: 44px; padding: 0 14px;
    border-radius: 12px; border: 1px solid var(--accent);
    background: transparent; color: var(--text-primary);
    font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-theme + .appbar-brand { margin-left: 8px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .appbar-theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) body.viewer-open .appbar-theme { display: none; }

  /* No hover tooltip in a drawer: the phone's "Show details" switch instead
     (static/js/nav_menu.js reads --nav-tip). */
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar { --nav-tip: 0; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .nav-item {
    padding-top: 9px; padding-bottom: 9px; min-height: 44px; box-sizing: border-box;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .nav-desc-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
    margin: 0 0 8px; padding: 6px 10px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius-sm, 6px);
    background: transparent; color: var(--text-secondary, var(--text-primary));
    font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar .nav-desc-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .nav-desc-switch {
    flex: none; position: relative; width: 30px; height: 18px; border-radius: 9px;
    border: 1px solid var(--border-hover, var(--border)); background: var(--surface-raised);
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .nav-desc-switch::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--text-muted, var(--muted));
  }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .nav-desc-toggle[aria-pressed="true"] .nav-desc-switch { border-color: var(--accent); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .nav-desc-toggle[aria-pressed="true"] .nav-desc-switch::after { left: 14px; background: var(--accent); }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar.nav-show-desc .nav-item > span:not(.emoji) { flex-wrap: wrap; row-gap: 1px; }
  :root[data-theme]:not([data-theme="legacy"]):not([data-theme="win2000"]) .sidebar.nav-show-desc .nav-item:not(.disabled) small {
    position: static; display: block; flex-basis: 100%; width: auto; height: auto; margin: 0; padding: 0;
    overflow: visible; clip: auto; clip-path: none; white-space: normal;
    color: var(--text-muted, var(--muted)); font-size: 11.5px; line-height: 1.35;
  }
}

/* ---------------------------------------------------------------- 2. the viewer, upright
   viewer_tablet.js puts `tp-below` on #viewer when the strip below gives this picture
   (each of the two, when comparing) more room than the side column does. The strip is
   decision | information, each scrolling on its own; I hides the information and the
   decision takes the strip; Wide hides both and the stage takes the window.

   Between the stage and the strip is an empty 14px row (`--tp-gap`), painted by #viewer's
   own background, which every theme keeps neutral grey. It does what the top bar's empty
   band under its controls does (aperture.css, "the top bar"): with the stage's 6px band,
   nothing coloured comes within 20px of a picture that fills the stage's height, so the
   surround the UI harness samples at 6, 12 and 18px (`viewer_grey_band`) stays neutral.
   Without it, Blueprint's blue columns and Riso's divider sat 6px under the picture. */
@media (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  :root[data-theme]:not([data-theme="legacy"]) #viewer { --tp-strip: clamp(220px, 27vh, 340px); --tp-gap: 14px; --tp-arrange: 1; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.open.tp-below {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) var(--tp-gap) var(--tp-strip);
  }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.open.tp-below.is-wide { grid-template-rows: auto minmax(0, 1fr) 0px 0px; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.tp-below .viewer-stage { grid-column: 1 / -1; grid-row: 2; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.tp-below #viewer-right { grid-column: 1; grid-row: 4; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.tp-below #viewer-left { grid-column: 2; grid-row: 4; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.open.tp-below.no-info #viewer-right { grid-column: 1 / -1; grid-row: 4; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.tp-below :is(#viewer-left, #viewer-right) {
    min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    border-left: 0; border-top: 1px solid var(--rv-rule, var(--border));
  }
  :root[data-theme]:not([data-theme="legacy"]) #viewer.tp-below:not(.no-info) #viewer-left { border-left: 1px solid var(--rv-rule, var(--border)); }
}

/* ---------------------------------------------------------------- 3. touch */
@media (min-width: 761px) and (max-width: 1100px) and (pointer: coarse) {
  /* The viewer's top bar: 44px controls in a bar that keeps the same 14px of empty bar
     under them (aperture.css, "the top bar"), so the stage's band is unchanged. */
  :root[data-theme]:not([data-theme="legacy"]) #viewer { --rv-topbar-h: 72px; --rv-control-h: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer .viewer-top :is(button, select, a) { min-height: 44px; min-width: 44px; }
  /* The decision, status and scene-specs controls in the columns (38px and less there). */
  :root[data-theme]:not([data-theme="legacy"]) #viewer :is(#viewer-left, #viewer-right) :is(button, .btn, select, summary) { min-height: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer :is(#viewer-left, #viewer-right) summary { box-sizing: border-box; padding-top: 10px; padding-bottom: 10px; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer .spec-pen { min-width: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) .sidebar .brand { min-height: 44px; }

  :root[data-theme]:not([data-theme="legacy"]) :is(.btn, .btn.small, .lang-option, .cat-chip, .st-chip,
      .rsearch-value, .vt-chip, .pass-btn, .variant-btn, .mini) { min-height: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) summary.rsearch-facet-head { min-height: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) .main :is(select, input[type="text"], input[type="search"], input:not([type])) { min-height: 44px; }
  :root[data-theme]:not([data-theme="legacy"]) .main input[type="checkbox"] { width: 22px; height: 22px; }
  /* Height only, so a summary keeps its disclosure marker. */
  :root[data-theme]:not([data-theme="legacy"]) .main details > summary { min-height: 44px; box-sizing: border-box; padding-top: 10px; padding-bottom: 10px; }
  :root[data-theme]:not([data-theme="legacy"]) .main select { min-width: 44px; }
}

/* One-finger drags on the picture are viewer_tablet.js's swipe, on any touch screen above
   the phone (a tablet held sideways is wider than 1100px); pinch-zoom stays. */
@media (min-width: 761px) and (pointer: coarse) {
  :root[data-theme]:not([data-theme="legacy"]) #viewer { --tp-swipe: 1; }
  :root[data-theme]:not([data-theme="legacy"]) #viewer .viewer-stage { touch-action: pinch-zoom; }
}
