/* Launcher: the tablet's home screen, composed like a nobox cover (brand book 07).
   Eyebrow top-left, one dominant element (the label, in Tiempos), the logo in
   the bottom-left corner, and one brand shape bled off the opposite corner.
   Flat colour on paper grey; square blocks, round buttons. Always light, so
   every tablet in a room looks the same whatever its system theme.
   Brand tokens: ../brand/tokens.css */

:root {
  --margin: 48px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --bg: var(--nobox-gray);
  --card: var(--nobox-white);
  --text: var(--nobox-navy);
  --text-2: var(--nobox-navy-1);
  --line: var(--nobox-navy-3);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 18px; line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; }

.eyebrow { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 14px; line-height: 1.3; text-transform: uppercase; color: var(--text); }
.eyebrow > span + span::before { content: "·"; margin-right: 12px; }

/* ---- Brand shape -------------------------------------------------------- */

.mass { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.mass img {
  position: absolute; display: block; height: auto;
  opacity: 0; transform: translate(14%, 14%);
  transition: opacity .5s ease, transform .9s var(--ease-out);
}
/* Each shape bleeds off the bottom-right corner and stays clear of the text column. */
.mass [data-for="assigned"]    { width: 58vw; right: -14vw; bottom: -20vh; }
.mass [data-for="idle"]        { width: 52vw; right: -16vw; bottom: -26vh; }
.mass [data-for="unpaired"]    { width: 56vw; right: -16vw; bottom: -18vh; }
.mass [data-for="unavailable"] { width: 60vw; right: -18vw; bottom: -14vh; }
body[data-view="assigned"] .mass [data-for="assigned"],
body[data-view="idle"] .mass [data-for="idle"],
body[data-view="unpaired"] .mass [data-for="unpaired"],
body[data-view="unavailable"] .mass [data-for="unavailable"],
body[data-view="control"] .mass [data-for="idle"] { opacity: 1; transform: none; }

/* ---- Top bar ------------------------------------------------------------ */

.l-bar, .l-banner, .l-main, .l-foot { position: relative; z-index: 1; }
.l-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 40px var(--margin) 0; }
.l-right { display: flex; align-items: center; gap: 24px; font-size: 16px; color: var(--text-2); }
.net { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--nobox-navy-2); }
[data-state="online"] .dot { background: var(--nobox-turquoise); }
[data-state="offline"] .dot { background: var(--nobox-red); }
#battery.low { color: var(--text); font-weight: 700; }
#battery.low::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--nobox-red); }

/* ---- Warning banner (low battery, no connection): a square white block ---- */

.l-banner {
  display: flex; align-items: center; gap: 14px; align-self: flex-start;
  margin: 24px var(--margin) 0; padding: 16px 24px;
  background: var(--card); font-size: 20px;
  animation: fade-up .45s var(--ease-out);
}
.l-banner .dot { background: var(--nobox-red); }
.l-banner.is-offline .dot { background: var(--nobox-navy-2); }

/* ---- Main column -------------------------------------------------------- */

.l-main {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 16px;
  padding: 24px var(--margin); max-width: 62vw;
}
.l-label {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(96px, 15vw, 200px); line-height: 1; letter-spacing: 0;
  margin-left: -0.04em;  /* optical: the serif's side bearing */
  user-select: none; -webkit-user-select: none;
  animation: fade-up .7s var(--ease-out) both;
}
body[data-view="unpaired"] .l-label,
body[data-view="unavailable"] .l-label { display: none; }

.l-view { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; animation: fade-up .5s var(--ease-out) .08s both; }
.l-team { font-size: 40px; font-weight: 700; line-height: 1.15; }
.l-sub { font-size: 21px; color: var(--text-2); max-width: 40ch; }
#view-assigned .l-sub { color: var(--text); font-size: 20px; }

.l-go {
  display: inline-flex; align-items: center; gap: 16px;
  margin-top: 24px; min-height: 84px; padding: 0 48px;
  border: 0; border-radius: var(--radius-pill); background: var(--nobox-navy); color: var(--nobox-white);
  font-size: 28px; font-weight: 700; cursor: pointer;
  transition: transform .14s var(--ease-out), opacity .2s ease;
  touch-action: manipulation;
}
.l-go span { transition: transform .2s var(--ease-out); }
.l-go:active { transform: scale(.97); }
.l-go:active span { transform: translateX(6px); }
.l-go:disabled { opacity: .35; }

@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }

/* ---- Pairing card (square, white) --------------------------------------- */

.l-card { width: min(600px, 100%); padding: 40px; background: var(--card); gap: 16px; align-items: stretch; }
.l-card h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--text-display-4); line-height: var(--leading-display); }
.l-card .l-sub { font-size: 18px; }
.l-btn {
  min-height: 56px; padding: 0 28px; border: 2px solid var(--nobox-navy); border-radius: var(--radius-pill);
  background: transparent; color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer;
  transition: transform .14s var(--ease-out);
  touch-action: manipulation;
}
.l-btn:active { transform: scale(.97); }
.l-btn.primary { background: var(--nobox-navy); color: var(--nobox-white); }
.l-btn.danger { border-color: var(--nobox-red); }
.l-btn.danger-fill { background: var(--nobox-red); border-color: var(--nobox-red); color: var(--nobox-navy); }
.camera { width: 100%; background: var(--nobox-navy); }
.pair-form { display: grid; gap: 8px; margin-top: 8px; }
.pair-form label { font-size: 12px; text-transform: uppercase; color: var(--text-2); }
.pair-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.pair-row input {
  min-height: 56px; padding: 0 16px; border: 2px solid var(--line); border-radius: 0;
  background: var(--bg); font-size: 16px; -webkit-user-select: text; user-select: text;
}
.pair-row input:focus { border-color: var(--nobox-navy); outline: none; }
.error { display: flex; gap: 12px; align-items: baseline; padding: 12px 0 0; }
.error::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--nobox-red); }

/* ---- Footer: the logo lives in the bottom-left corner -------------------- */

.l-foot { padding: 0 var(--margin) 40px; }
.logo { height: 34px; width: auto; display: block; }

/* ---- Staff panel (3 s long press on the label) ---------------------------- */

.staff { width: min(640px, calc(100% - 32px)); padding: 40px; border: 0; border-radius: 0; background: var(--card); color: var(--text); }
.staff[open] { animation: fade-up .3s var(--ease-out); }
.staff::backdrop { background: rgb(16 28 56 / .6); }
.staff h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--text-display-3); line-height: var(--leading-display); margin: 8px 0 24px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin: 0 0 32px; }
.facts dt { font-size: 12px; color: var(--text-2); text-transform: uppercase; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.confirm { display: grid; gap: 16px; padding-top: 24px; border-top: 2px solid var(--nobox-navy); }
.confirm p { font-size: 20px; }
.pin-row { display: grid; gap: 8px; font-size: 14px; text-transform: uppercase; color: var(--text-2, #565F74); }
.pin-row input { width: 12ch; min-height: 56px; padding: 0 16px; border: 2px solid rgb(16 28 56 / .18); border-radius: 0; background: var(--nobox-white); font-size: 28px; letter-spacing: .3em; text-transform: none; }
.pin-row input:focus { border-color: var(--nobox-navy); outline: none; }
.confirm p.pin-error { color: #C8402A; font-size: 16px; font-weight: 700; animation: pin-shake .35s ease; }
@keyframes pin-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 900px), (orientation: portrait) {
  :root { --margin: 24px; }
  .l-main { max-width: none; }
  .mass img[data-for] { width: 90vw; right: -30vw; bottom: -12vh; }
  .l-team { font-size: 30px; }
  .pair-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
