/* Start clock, for a landscape tablet read from a few metres away.
   Only what a starter needs: the time, who is next, and who follows.
   Sizes use vmin so the layout scales with the screen rather than breakpoints. */

html,
body {
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 2vh;
  padding: max(2.4vh, env(safe-area-inset-top)) max(3vw, env(safe-area-inset-right)) max(3vh, env(safe-area-inset-bottom)) max(3vw, env(safe-area-inset-left));
}

/* ---- top bar ---------------------------------------------------------- */

.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2vw;
}

.clock {
  grid-column: 2;
  font-size: 7.4vmin;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Only ever appear when something needs attention. */
.flags {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
  gap: 0.8vw;
}

.flag {
  font-size: 1.9vmin;
  font-weight: 650;
  padding: 0.35em 0.8em;
  border-radius: 999px;
}

.flag[hidden] {
  display: none;
}

.flag-rehearsal {
  background: var(--bg-raised-2);
  color: var(--text-2);
}

.flag-bad {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}

/* ---- next starter ----------------------------------------------------- */

.stage {
  position: relative;
  min-height: 0;
}

.hero {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  text-align: center;
}

.hero-category {
  display: flex;
  align-items: baseline;
  gap: 1em;
  font-size: 3.8vmin;
  font-weight: 600;
  color: var(--text-2);
}

.hero-category span:empty {
  display: none;
}

.hero-bib {
  font-size: 2em;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.hero-names {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 1vh;
  margin-top: 0.6vh;
}

.hero-name {
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.04;
  white-space: nowrap;
  overflow: hidden;
  /* room for descenders and the dot on İ */
  padding-block: 0.08em;
}

.hero-time {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.hero-count {
  font-size: 27vmin;
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 0.92;
}

.hero-count[data-long='true'] {
  font-size: 22vmin;
}

.hero-count[data-long='hours'] {
  font-size: 17vmin;
}

/* Green is the last three seconds and the start. Amber only ever means stop. */
.hero[data-state='final'] .hero-count,
.hero[data-state='go'] .hero-count {
  color: var(--go);
}

.hero-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2vh;
}

.hero-notice-title {
  font-size: 11vmin;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--hold);
}

.pause-icon {
  width: 19vmin;
  height: 19vmin;
  fill: var(--hold);
}

.hero-notice-sub {
  font-size: 3.4vmin;
  color: var(--text-2);
}

/* The wait between categories */

.hero-break {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5vh;
  text-align: center;
}

.break-count {
  font-size: 26vmin;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.break-label {
  font-size: 7vmin;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-2);
}

/* A soft wash of green marks the start. */
.flood {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--go);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

body[data-phase='go'] .flood {
  opacity: 0.16;
  transition-duration: 120ms;
}

/* Finished, or no list yet */

.finish {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5vh;
  text-align: center;
}

.finish-title {
  font-size: 11vmin;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.finish-sub {
  font-size: 3.4vmin;
  color: var(--text-2);
}

/* ---- next three ------------------------------------------------------- */

.upcoming {
  width: min(100%, 150vmin);
  margin-inline: auto;
  /* The width limit keeps the longest names whole on 4:3 tablets. */
  font-size: min(4.6vmin, 3.2vw);
}

/* Room for three rows is always kept, so the name doesn't shift near the end. */
.upcoming-list {
  display: grid;
  grid-auto-rows: 1.9em;
  min-height: 5.7em;
}

.next {
  display: grid;
  grid-template-columns: 3.4em 2.9em minmax(0, 1fr) 2.7em auto;
  align-items: center;
  gap: 0.75em;
  border-top: 1px solid var(--line);
}

.next-count {
  font-weight: 650;
  text-align: right;
  color: var(--text-2);
}

.next-count small {
  font-size: 0.62em;
  font-weight: 550;
  margin-left: 0.15em;
  color: var(--text-3);
}

.next-bib,
.next-order,
.next-start {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-2);
}

.next-bib,
.next-order {
  text-align: right;
}

.next-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- gate ------------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 320ms ease;
}

.gate[data-closing='true'] {
  opacity: 0;
  pointer-events: none;
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(88vw, 520px);
  padding: 34px;
  border-radius: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  text-align: center;
}

.gate-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.gate-card p {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 17px;
}

.gate-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-primary,
.btn-ghost {
  min-height: 56px;
  padding: 0 26px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 18px;
  font-weight: 650;
  cursor: pointer;
}

.btn-primary {
  background: var(--go);
  color: var(--go-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
