/* Base resets + body + typography defaults. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  /* Block pinch-zoom gesture on touch devices. The viewport meta already
     sets user-scalable=no, this is the CSS-level backup. */
  touch-action: manipulation;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-normal), color var(--t-normal);
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  padding: 0;
}

input,
textarea {
  width: 100%;
}

input::placeholder,
textarea::placeholder {
  color: var(--fg-muted);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Root app container — fills viewport; content inside sets its own
   max-width where readable line-length matters. */
#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Screen-switching primitive: absolute positioning + opacity fade */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity var(--t-normal);
}

/* Utility-class for hiding. !important is required (and is the standard
   pattern for utility classes — see Tailwind, Bootstrap) because any
   element with its own display rule defined in a later-loaded stylesheet
   would otherwise win the cascade on equal specificity + source order
   and quietly defeat the hide. .screen.hidden below is the one place
   that intentionally overrides this — it keeps display: flex so the
   opacity transition can play, also marked !important to win the cascade. */
.hidden {
  display: none !important;
}

/* Intra-section navigation (sub-screen → sub-screen, e.g. browse → review):
   skip the opacity fade so it feels like a content swap, not a screen
   jump. router.js sets this body attribute synchronously before swapping
   .hidden classes and clears it on the next animation frame, so other
   transitions (bubble fade-in, sidebar slide, etc.) are unaffected. */
body[data-skip-screen-transition] .screen,
body[data-skip-screen-transition] .screen.hidden {
  transition: none;
}

/* Screens use opacity-fade instead of display-none so transitions play.
   visibility: hidden is inherited (unlike pointer-events: none), so it
   reliably disables hit-testing on every descendant — even fixed/absolute
   children like .pp-header or .rv-title-group that would otherwise overlay
   the active screen's toolbar. The delayed visibility transition keeps the
   element visible during the opacity fade-out, then snaps it to hidden. */
.screen.hidden {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t-normal), visibility 0s linear var(--t-normal);
}
