/* css/verrouillage.css
   The lock screen of a service device (js/device-lock.js, in login.html),
   rewritten with lot R6d (rewrite plan 27.10.2026). Until then the screen
   loaded seventeen of the old sheets on a device; its look is theirs, kept
   to the pixel: the brand's night whatever the theme (Greg, 01.10.2026;
   data-nuit on <html>), the logo and its rule, the restaurant and the
   device, the tiles (the floor team, the Direction and the Gestion), the
   keypad of 96 x 72 px keys, a tile's password, the device's wait, the
   server out of reach, the languages, the footer's band. Its colours are
   the night's own (--cs-lock-* in css/tokens.css) and its face Roboto, as
   before. The e-mail form a device opens is the sign-in page's, in the
   theme; only its way back to the tiles is drawn here.
   Layer pages, declared in css/tokens.css; values only through its
   variables. */

@layer pages {

  /* ---- The night of the brand: near-black, a warm glow behind the logo,
     the brushed texture ---- */
  :root:has(> body.tl-mode) {
    background:
      radial-gradient(ellipse 900px 520px at 50% 21%, var(--cs-lock-glow), transparent 70%),
      var(--cs-night-texture),
      var(--cs-night-vignette),
      var(--cs-night);
    background-attachment: fixed;
  }

  /* ---- The page ---- */
  .tl-page {
    min-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px 16px;
    color: var(--cs-lock-fg);
    font-family: var(--cs-lock-sans);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* ---- The head: the brand (decorative), the restaurant, the device ---- */
  .tl-head {
    text-align: center;
    min-height: 56px;
  }
  .tl-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
  }
  .tl-brand-logo {
    height: 64px;
    width: auto;
  }
  .tl-brand-rule {
    display: block;
    width: 140px;
    height: 1px;
    background: var(--cs-lock-rule-line);
  }
  /* The restaurant reads like the line under the logo of the wallpaper
     (light, a little spaced, gold), the device like its small spaced
     capitals. */
  .tl-restaurant {
    font: 300 28px/36px var(--cs-lock-sans);
    letter-spacing: .04em;
    color: var(--cs-lock-gold);
  }
  .tl-tablet {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font: 500 12px/20px var(--cs-lock-sans);
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--cs-lock-fg-muted);
  }
  .tl-tablet .ro-icon {
    font-size: 16px;
    letter-spacing: 0;
  }

  /* ---- The message, the main part ---- */
  .tl-msg {
    margin: 0;
    min-height: 24px;
    font: 400 16px/24px var(--cs-lock-sans);
    color: var(--cs-lock-fg-2);
    text-align: center;
  }
  .tl-msg.is-error { color: var(--cs-lock-crit); }
  .tl-main {
    flex: 1 1 auto;
    width: min(960px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .tl-who,
  .tl-empty {
    margin: 0 0 16px;
    max-width: 560px;
    font: 400 16px/24px var(--cs-lock-sans);
    color: var(--cs-lock-fg-2);
    text-align: center;
  }

  /* ---- The tiles: who it is, what it is, how it opens; read from across
     a counter, centred under the question whatever their number ---- */
  .tl-people {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 208px));
    justify-content: center;
    gap: 16px;
  }
  .tl-person {
    min-height: 148px;
    padding: 12px;
    border: 0;
    border-radius: 16px;
    background: var(--cs-lock-key);
    box-shadow: inset 0 0 0 1px var(--cs-lock-key-line);
    color: var(--cs-lock-fg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--cs-lock-sans);
    cursor: pointer;
    touch-action: manipulation;
  }
  .tl-initial {
    width: 44px;
    height: 44px;
    border-radius: var(--cs-r-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cs-lock-initial);
    color: var(--cs-lock-initial-ink);
    font: 500 20px/1 var(--cs-lock-sans);
  }
  .tl-person .tl-initial { margin-bottom: 4px; }
  .dl-initial--team {
    background: var(--cs-lock-team);
    color: var(--cs-lock-team-ink);
  }
  .dl-initial--team .ro-icon { font-size: 26px; }
  .tl-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 500 18px/24px var(--cs-lock-sans);
  }
  .dl-role {
    font: 500 12px/16px var(--cs-lock-sans);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--cs-lock-fg-muted);
  }
  .dl-sign {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: 400 12px/16px var(--cs-lock-sans);
    color: var(--cs-lock-fg-2);
  }
  .tl-person-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: 500 12px/16px var(--cs-lock-sans);
    color: var(--cs-lock-crit);
  }
  :is(.dl-sign, .tl-person-state) .ro-icon { font-size: 16px; }
  .dl-state--muted { color: var(--cs-lock-fg-2); }
  .dl-state--wait {
    color: var(--cs-lock-gold);
    font-variant-numeric: tabular-nums;
  }
  .dl-no-team {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 20px 0 0;
    text-align: left;
  }
  .dl-no-team .ro-icon {
    flex: none;
    font-size: 20px;
    color: var(--cs-lock-fg-muted);
  }

  /* ---- The keypad: 3 x 4 keys of 96 x 72 px, 16 px apart; buttons, so a
     tablet's own keyboard never comes up ---- */
  .tl-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .tl-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px 0 12px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--cs-lock-gold);
    font: 500 14px/20px var(--cs-lock-sans);
  }
  .tl-pad-name {
    font: 400 24px/32px var(--cs-lock-sans);
    text-align: center;
  }
  .tl-dots {
    display: flex;
    gap: 20px;
    padding: 6px 0;
  }
  .tl-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--cs-lock-line);
  }
  .tl-dot.on {
    background: var(--cs-lock-gold);
    border-color: var(--cs-lock-gold);
  }
  .tl-dots.tl-shake { animation: tl-shake .4s ease-in-out; }
  @keyframes tl-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
  }
  .tl-keys {
    display: grid;
    grid-template-columns: repeat(3, 96px);
    grid-auto-rows: 72px;
    gap: 16px;
  }
  .tl-key {
    border: 0;
    border-radius: 36px;
    background: var(--cs-lock-key);
    box-shadow: inset 0 0 0 1px var(--cs-lock-key-line);
    color: var(--cs-lock-fg);
    font: 400 32px/1 var(--cs-lock-sans);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }
  .tl-key:disabled {
    opacity: .5;
    cursor: default;
  }
  .tl-key--icon .ro-icon { font-size: 28px; }
  .tl-pad.is-waiting .tl-keys { opacity: .45; }

  /* ---- The ways out of the keypad, each with its line under it (no
     tooltips on a public page, a finger) ---- */
  .tl-password {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--cs-lock-gold);
    font: 500 14px/20px var(--cs-lock-sans);
  }
  .tl-hinted {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
  }
  .tl-hint {
    margin: 0;
    max-width: 320px;
    padding: 0 16px;
    color: var(--cs-lock-fg-2);
    font: 400 12px/16px var(--cs-lock-sans);
    text-align: center;
  }
  .dl-wait-line {
    min-height: 16px;
    font-variant-numeric: tabular-nums;
    color: var(--cs-lock-gold);
  }

  /* ---- A team locked, or without its PIN yet ---- */
  .tl-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 420px;
    text-align: center;
  }
  .tl-locked > .ro-icon {
    font-size: 40px;
    color: var(--cs-lock-crit);
  }
  .dl-to-define > .ro-icon { color: var(--cs-lock-fg-muted); }
  .tl-locked p {
    margin: 0;
    font: 400 16px/24px var(--cs-lock-sans);
  }

  /* ---- The main button: try again, sign in ---- */
  .tl-retry {
    height: 48px;
    padding: 0 28px;
    border: 0;
    border-radius: 24px;
    background: var(--cs-lock-gold);
    color: var(--cs-lock-gold-ink);
    font: 500 16px/20px var(--cs-lock-sans);
  }

  /* ---- A tile's password: the brand gives its height to the field and
     the button, which a tablet's keyboard would otherwise cover ---- */
  .dl-signin {
    width: min(380px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .dl-signin-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 0;
  }
  .dl-label {
    font: 500 12px/16px var(--cs-lock-sans);
    letter-spacing: .04em;
    color: var(--cs-lock-fg-2);
  }
  .dl-input {
    width: 100%;
    min-height: 52px;
    padding: 10px 12px;
    border: 1px solid var(--cs-lock-field-line);
    border-radius: 10px;
    outline: none;
    background: var(--cs-lock-field);
    color: var(--cs-lock-field-fg);
    font: 400 15px/1 var(--cs-lock-sans);
    -webkit-user-select: text;
    user-select: text;
    transition: border-color .2s ease, box-shadow .2s ease;
  }
  .dl-input:focus {
    border-color: var(--cs-logo-gold);
    box-shadow: 0 0 0 3px var(--cs-lock-field-ring);
  }
  .dl-submit {
    margin-top: 8px;
    width: 100%;
  }
  .dl-submit:disabled {
    opacity: .6;
    cursor: default;
  }

  /* ---- The server out of reach (js/net-status.js): said, counted down,
     back by itself ---- */
  .dl-offline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .dl-offline .ro-icon {
    font-size: 40px;
    color: var(--cs-lock-fg-muted);
  }
  .dl-offline p { margin: 0; }
  .dl-offline-next {
    color: var(--cs-lock-gold);
    font-variant-numeric: tabular-nums;
  }
  .dl-offline-retry { margin-top: 8px; }

  /* ---- The foot: the e-mail way, the languages ---- */
  .tl-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 24px;
  }
  .tl-langs {
    display: inline-flex;
    gap: 4px;
  }
  .tl-lang {
    min-width: 40px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--cs-lock-line-2);
    border-radius: 16px;
    background: transparent;
    color: var(--cs-lock-fg-2);
    font: 500 12px/1 var(--cs-lock-sans);
  }
  .tl-lang.on {
    background: var(--cs-lock-pressed);
    color: var(--cs-lock-pressed-ink);
    border-color: transparent;
  }

  /* ---- The e-mail form a device opens (js/device-lock.js, showForm): the
     sign-in card of the theme, and under it the way back to the tiles ---- */
  .tl-back-to-pad {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    margin: 12px auto 0;
    padding: 0 16px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: var(--cs-gold);
    font: 500 14px/20px var(--cs-sans);
  }
  .tl-back-to-pad:hover { background: color-mix(in srgb, var(--cs-gold) 8%, transparent); }

  /* ---- The band at the bottom (css/composants.css), in the screen's face
     and colours ---- */
  body.tl-mode .ro-footer.ro-footer-public {
    color: var(--cs-lock-fg-2);
    font-family: var(--cs-lock-sans);
    font-size: 11px;
  }
  body.tl-mode .ro-footer .ro-footer-legal:hover { color: var(--cs-lock-fg); }

  /* ---- Touched: the tiles and the keys lift, pressed they take the tonal
     colour, so a touch is seen ---- */
  :is(.tl-person, .tl-key):hover,
  .tl-person:focus-visible { background: var(--cs-lock-key-hover); }
  :is(.tl-person, .tl-key):focus-visible {
    outline: 2px solid var(--cs-lock-gold);
    outline-offset: 2px;
  }
  :is(.tl-person, .tl-key):active { background: var(--cs-lock-pressed); }
  .tl-key:active { color: var(--cs-lock-pressed-ink); }
  :is(.tl-back, .tl-password):hover { background: var(--cs-lock-gold-faint); }

  /* ---- A low screen (a tablet with its browser's bars): the keypad
     tightens, the brand gives way to it ---- */
  @media (max-height: 760px) {
    .tl-page { gap: 8px; padding-top: 12px; }
    .tl-keys { grid-auto-rows: 64px; gap: 12px; }
    .tl-pad { gap: 10px; }
    .tl-brand-logo { height: 52px; }
  }
  /* Lower still, held landscape (about 960 x 600): the keys go to the
     right in their full size, the way back, the name, the dots and the
     wait stand to their left, centred on them. A locked team keeps the
     column. */
  @media (orientation: landscape) and (max-height: 700px) {
    .tl-pad:not(.is-locked) {
      display: grid;
      grid-template-columns: minmax(0, auto) auto;
      grid-template-rows: auto 1fr auto auto auto 1fr;
      column-gap: 56px;
      row-gap: 10px;
      align-items: center;
      justify-items: center;
    }
    .tl-pad:not(.is-locked) > .tl-back { grid-area: 1 / 1; justify-self: start; }
    .tl-pad:not(.is-locked) > .tl-pad-name { grid-area: 3 / 1; }
    .tl-pad:not(.is-locked) > .tl-dots { grid-area: 4 / 1; }
    .tl-pad:not(.is-locked) > .dl-wait-line { grid-area: 5 / 1; }
    .tl-pad:not(.is-locked) > .tl-keys { grid-area: 1 / 2 / 7 / 3; }
  }
  /* A phone held upright (390 px): two tiles a row, the keypad a little
     tighter, nothing wider than the screen. */
  @media (max-width: 480px) {
    .tl-people {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }
    .tl-person {
      min-height: 136px;
      padding: 10px 6px;
    }
    .tl-name { font-size: 16px; }
    .tl-keys {
      grid-template-columns: repeat(3, 84px);
      gap: 14px;
    }
    .tl-restaurant {
      font-size: 24px;
      line-height: 32px;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .tl-dots.tl-shake { animation: none; }
  }
}

@layer utilitaires {
  /* The lock screen takes the page; its e-mail form brings the card back. */
  body.tl-mode .auth-page { display: none; }
  body:not(.tl-mode) .tl-page { display: none; }
  /* The keypad needs the height of a low screen, the password the height a
     tablet's keyboard leaves: the brand gives way. */
  @media (max-height: 760px) {
    .tl-page:has(.tl-pad) .tl-brand { display: none; }
  }
  .tl-page[data-view="signin"] .tl-brand { display: none; }
}
