/* The clock widgets (spec 5.22, 6.11, 6.13; tasks 044 and 045): the punches of a day, the confirmation of a punch, the
   state panel of the own punches page, and the shared terminal. Colours come from theme roles, never literals. */

/* A day's punches and the sessions table cells (the day page and the own punches page) */
.clock-events { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.clock-events li { display: flex; gap: var(--space-3); padding: var(--space-1) 0; border-bottom: var(--border-w) solid var(--line); }
.clock-events time { font-variant-numeric: tabular-nums; font-weight: 600; }
.clock-pause { display: block; white-space: nowrap; }
.clock-fill { margin-top: var(--space-2); padding-top: var(--space-2); border-top: var(--border-w) solid var(--line); }

/* The confirmation of a punch: a success panel with the event and the time as the figure */
.clock-confirmation { margin: 0 0 var(--space-3); padding: var(--space-3); background: var(--ph-ok-bg); border: var(--border-w) solid var(--ph-ok-line); border-radius: var(--radius); color: var(--ok); }
.clock-confirmation > p { margin: 0; }
.clock-confirmation-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); font-size: var(--text-1); font-weight: 600; line-height: var(--leading-display); font-variant-numeric: tabular-nums; }
.clock-confirmation-text { margin-top: var(--space-1); font-size: var(--ph-text-md); }

/* Own punches, spec 6.11: today's state is the answer of the page, set large, with the one next punch as the primary */
.clock-now-label { margin: 0; color: var(--ink-2); font-size: var(--text--1); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.clock-now > .clock-now-state { margin: var(--ph-space-05) 0 var(--space-1); font-size: var(--text-2); line-height: var(--leading-display); letter-spacing: -0.02em; }
.clock-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-2); }
.clock-actions > button { min-width: 10rem; }

/* The shared terminal, spec 5.22: a 32rem centred column on the canvas, the kiosk panel a card like every panel, fields
   and the first row of events at the kiosk height, the second row at the touch height, the confirmation at the hero
   size. The brand line is set in the display face beside the brand mark (design-d-spec.md 3 and 10). */
.kiosk-page { min-height: 100svh; }
.kiosk-main { max-width: 32rem; margin: 0 auto; padding: var(--space-4) var(--space-2) var(--space-5); }
.kiosk-brand { display: flex; align-items: center; gap: var(--ph-space-15); margin: 0 0 var(--space-3); color: var(--ink); font-family: var(--font-display); font-weight: 600; }
.kiosk-mark { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); background: var(--ph-brand); color: var(--on-accent); font-family: var(--font-body); font-size: var(--text--1); letter-spacing: 0.05em; }
.kiosk-header { margin: 0 0 var(--space-3); }
.kiosk-header > h1, .kiosk-inactive > h1 { margin: 0 0 var(--space-1); font-size: var(--text-2); }
.kiosk-lead { margin: 0; color: var(--ink-2); }
.kiosk-panel { margin: 0 0 var(--space-3); }
.kiosk-panel > .alert { margin-bottom: var(--space-2); }
.kiosk-form { display: grid; gap: var(--space-2); }
.kiosk-form > .form-field { margin: 0; }
.kiosk-form > .form-field > label { font-size: var(--text-0); }
.kiosk-main .form-field > input { height: var(--ph-control-h-kiosk); font-size: var(--text-1); }
.kiosk-events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-1); }
.kiosk-events > .kiosk-event { min-height: var(--ph-control-h-touch); font-size: var(--text-0); }
.kiosk-events > .kiosk-event-main { min-height: var(--ph-control-h-kiosk); border: 2px solid var(--ink); font-weight: 600; }
.kiosk-reset { margin: var(--space-2) 0 0; color: var(--ink-2); }
.kiosk-page .clock-confirmation { padding: var(--space-4) var(--space-3); border-radius: var(--radius-l); box-shadow: var(--shadow-3); }
.kiosk-page .clock-confirmation-figure { font-size: var(--text-3); }
.kiosk-next { min-height: var(--ph-control-h-kiosk); font-size: var(--text-0); }
.kiosk-online { margin: 0; color: var(--ink-2); font-size: var(--ph-text-sm); line-height: var(--leading-body); }

/* The clock at one click (task 215, attendance/views/clock-bar.ejs). In the top bar: the state in words over the way
   to the clock page, then the acts the state allows as paper buttons. The bar then holds one control more, so the
   company's name stands over its caption instead of beside it. On the Panoramica the same control is the first card:
   the state set large as on the clock page, the next act filled. */
.app-clock { display: grid; flex: none; grid-template-columns: auto auto; grid-template-areas: "state acts" "more acts"; align-items: center; column-gap: var(--space-1); }
.app-clock-state { grid-area: state; color: var(--ink-2); font-size: var(--ph-text-sm); font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }
.app-clock-more { grid-area: more; justify-self: start; font-size: var(--ph-text-sm); line-height: 1.2; white-space: nowrap; }
.app-clock-form, .app-clock > .app-clock-act { grid-area: acts; }
.app-clock-form { display: flex; gap: var(--ph-space-05); margin: 0; }
.app-clock-act { gap: var(--ph-space-05); white-space: nowrap; }
.app-clock-act .app-icon { width: 1rem; height: 1rem; }
.app-clock-short { display: none; }
.app-topbar:has(.app-clock) .app-company { flex-direction: column; align-items: flex-start; gap: 0; overflow: hidden; }
.app-topbar:has(.app-clock) :is(.app-company-name, .app-role) { max-width: 100%; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; white-space: nowrap; }
/* Task 282: beside the clock the name keeps its one line, a word too wide cut by its own box (shell.css). */
.app-topbar:has(.app-clock) .app-company-name { --ph-name-lines: 1; }
.home-clock { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0 0 var(--space-3); }
.home-clock > .clock-now-label { flex-basis: 100%; }
.home-clock > .home-clock-state { flex: 1 1 12rem; margin: 0; font-size: var(--text-1); line-height: var(--leading-display); font-variant-numeric: tabular-nums; }
.home-clock-form { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; }
.home-clock-form > button, .home-clock > .button { gap: var(--ph-space-05); }
.home-clock > .panel-lead { flex-basis: 100%; margin: 0; }
/* A narrower desktop keeps the bar on one row: the buttons take their short verb below 90rem, and below 80rem the state
   and the way to the clock page leave the bar (the state stays in each button's name and tooltip). */
@media (max-width: 89.999rem) {
  .app-clock-long { display: none; }
  .app-clock-short { display: inline; }
}
@media (max-width: 79.999rem) {
  .app-clock-state, .app-clock-more { display: none; }
}
/* Task 285: from 64rem to 80rem the clock left the company's name some 25px, read «S…»; the sidebar names the company
   and the role whole there, so the bar beside the clock names neither. Its controls stand a step closer, so the two acts
   of a person at work («Pausa» and «Esci») still fit the bar at 1024 (it ran 30px past the screen's edge). */
@media (min-width: 64rem) and (max-width: 79.999rem) {
  .has-shell .app-topbar:has(.app-clock) { gap: var(--space-1); }
  .has-shell .app-topbar:has(.app-clock) .app-company { display: none; }
}
/* Below 64rem the bar is a grid of rows (shell.css): the clock takes the first row between the menu and the bell, and
   the brand with its caption the rows under it, as on a phone at 200 % zoom. The state stays the buttons' accessible
   name and tooltip; on a phone each button is its drawing and a short verb, and the menu its drawing, its name kept
   for the screen reader as the narrowest bar keeps it (shell.css). */
@media (max-width: 63.999rem) {
  .app-clock { grid-area: clock; justify-self: end; }
  .app-clock-state, .app-clock-more { display: none; }
  .app-topbar:has(.app-clock):has(.app-bell) { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "menu clock bell user" "brand brand brand brand" "company company company company"; row-gap: var(--ph-space-05); }
  .has-shell .app-topbar:has(.app-clock) .app-mobile-brand { grid-row: auto; }
  .app-topbar:has(.app-clock) .app-company { flex-direction: row; align-items: center; }
  .app-topbar:has(.app-clock):has(.assistant-button):has(.app-bell) { grid-template-areas: "menu clock bell user" "brand brand assistant assistant" "company company assistant assistant"; }
  .app-clock-act { min-height: var(--ph-control-h-touch); }
}
@media (max-width: 40rem) {
  .app-clock-act { padding-inline: var(--space-1); }
  .app-clock-long { display: none; }
  .app-clock-short { display: inline; }
  .app-topbar:has(.app-clock) .app-menu > summary { position: relative; justify-content: center; min-width: var(--ph-control-h-touch); }
  .app-topbar:has(.app-clock) .app-menu > summary > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* Task 285: at 320 the bar with the clock was five rows, 225px before the page. Narrower than 22.5rem the one act of the
   clock («Entra», «Rientra», «Timbra») stands in the first row between the menu and the bell, the account drawn by its
   icon as the menu is (its name kept for the screen reader); the company's name, on one line as on every phone bar,
   and the role stand beside the assistant, drawn by its icon with its name kept for the screen reader. The two acts of
   a person at work («Pausa» and «Esci») fit that row from 20rem with the controls a half step apart; narrower they take
   a row of their own. */
@media (max-width: 22.499rem) {
  .app-topbar:has(.app-clock):has(.app-bell) { column-gap: var(--ph-space-05); grid-template-areas: "menu clock bell user" "brand brand brand brand" "company company company company"; }
  .app-topbar:has(.app-clock):has(.assistant-button):has(.app-bell) { grid-template-areas: "menu clock bell user" "brand brand brand assistant" "company company company assistant"; }
  .app-clock-act { padding-inline: var(--ph-space-05); }
  .app-clock { justify-self: start; }
  .has-shell .app-topbar:has(.app-clock) .app-mobile-brand { align-self: end; --ph-name-lines: 1; }
  .app-topbar:has(.app-clock) .app-user-menu > summary { position: relative; justify-content: center; min-width: var(--ph-control-h-touch); }
  .app-topbar:has(.app-clock) :is(.app-user-menu > summary .app-user-short, .assistant-button-label) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app-topbar:has(.app-clock) .assistant-button { justify-self: end; min-width: var(--ph-control-h-touch); padding-inline: 0; }
}
@media (max-width: 19.999rem) {
  .app-topbar:has(.app-clock-act + .app-clock-act):has(.app-bell) { grid-template-areas: "menu . bell user" "clock clock clock clock" "brand brand brand brand" "company company company company"; }
  .app-topbar:has(.app-clock-act + .app-clock-act):has(.assistant-button):has(.app-bell) { grid-template-areas: "menu . bell user" "clock clock clock clock" "brand brand brand assistant" "company company company assistant"; }
}
