/*
 * What every modlit app shares, on top of its own colours. Each app sets --bg, --panel, --text,
 * --muted, --border and --accent (and may change them for a dark theme); this file only uses them.
 *
 * The layout every app follows:
 *   header     .app-head: the modlit mark (back to the site), the app's name, one line on what it does,
 *              and on the right anything app-wide (a theme switch).
 *   stage      the picture first, full width, with a short status line inside it.
 *   quick      .quick: the few things most people press, right under the picture.
 *   side       tabs (Controls, How it works, ...) holding everything else, advanced settings folded.
 * Wider screens put the side beside the stage; phones stack them in that order.
 */

.app-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}
.app-head .home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.app-head .home:hover { border-color: var(--muted); }
.app-head .home svg { width: 20px; height: 20px; flex: none; }
.app-head .name { font-size: 18px; font-weight: 600; }
.app-head .what { color: var(--muted); font-size: 13px; margin-right: auto; min-width: 0; }
.app-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.app-head .what + .end { margin-left: 0; }

/* The row of common actions under the picture. On a phone it scrolls sideways rather than
   wrapping into a wall of buttons. */
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; max-width: 100%; }

@media (max-width: 640px) {
  .app-head { padding: 8px 12px; gap: 10px; }
  .app-head .what { display: none; }
  .app-head .name { margin-right: auto; }
  .quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -12px;
    padding-inline: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .quick::-webkit-scrollbar { display: none; }
  .quick > * { flex: none; }
  /* Fingers need bigger targets than pointers. */
  .quick button, .quick select, .quick .file { min-height: 40px; }
}
/* Hints written for a mouse ("scroll to zoom") make no sense on a touch screen, and the other way round. */
@media (pointer: coarse) {
  .mouse-only { display: none !important; }
}
@media not (pointer: coarse) {
  .touch-only { display: none !important; }
}

/*
 * The site's typeface, so an app reads as part of modlit.io. Apps opt in with
 * font-family: var(--app-sans) (or by using the .app-type class on body).
 */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/shared/fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/shared/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root { --app-sans: "Schibsted Grotesk", Helvetica, Arial, sans-serif; }
.app-type { font-family: var(--app-sans); }

/*
 * How it works, behind a "?" button at the right of the header (shared/help.js).
 * Closed on load; it opens as a drawer from the right over the app and never squeezes the picture.
 *   <button class="help-btn" data-help-toggle aria-controls="help" aria-expanded="false" title="How it works">?</button>
 *   <aside class="help" id="help" hidden aria-labelledby="help-title"> <h2 id="help-title">How it works</h2> ... </aside>
 */
.help-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 600 17px/1 var(--app-sans);
  cursor: pointer;
}
.help-btn:hover { border-color: var(--muted); }
.help-btn[aria-expanded="true"] { background: var(--text); color: var(--panel); border-color: var(--text); }
.help-btn:focus-visible, .help-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.help {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 32px;
  background: var(--panel);
  color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 40px rgb(0 0 0 / 0.12);
  transform: translateX(0);
  transition: transform 0.22s ease;
}
.help[hidden] { display: block; transform: translateX(105%); visibility: hidden; transition: transform 0.22s ease, visibility 0s 0.22s; }
.help .help-close {
  float: right;
  width: 32px;
  height: 32px;
  margin: -4px -8px 0 8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 400 24px/1 var(--app-sans);
  cursor: pointer;
}
.help .help-close:hover { color: var(--text); }
.help h2 { margin: 0 0 12px; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.help h3 { margin: 20px 0 6px; font-size: 15px; font-weight: 600; }
.help p, .help li, .help dd { font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 62ch; }
.help a { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .help, .help[hidden] { transition: none; } }
