/* Hour ($HOUR). Built to the reference picture in art/ref/ref-www.jpg:
   two colours on pure black, every object a stroke, one circular object, no bar and no footer. */

:root {
  --ink: #000000;
  --blue: #2191f5;
  --blue-dim: #0d2a52;
  --pale: #9dc0e6;
  --pale-soft: #6f90b4;

  --display: "Pixelify Sans", ui-monospace, monospace;
  --ui: "Gabarito", ui-sans-serif, system-ui, sans-serif;
  --joke: "Chewy", "Gabarito", cursive;

  --stage: 1560px;
  --gutter: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--pale);
  font-family: var(--ui);
  font-size: 20px;
  line-height: 1.5;
  font-synthesis: none;
  overflow-x: hidden;
}

body { position: relative; min-height: 100vh; }

/* ---------- the one object: the dial ---------- */

.dial {
  position: fixed;
  left: 50%;
  top: 54%;
  width: min(1180px, 108vh, 150vw);
  filter: brightness(1.22) contrast(1.06);
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.hand {
  position: fixed;
  left: 50%;
  top: 50%;
  height: min(520px, 48vh, 62vw);
  width: auto;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
  mix-blend-mode: screen;
  z-index: 1;
  pointer-events: none;
  transition: transform 900ms cubic-bezier(.2, .8, .2, 1);
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  z-index: 2;
  max-width: var(--stage);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  grid-template-rows: auto auto auto auto 1fr;
  align-content: start;
  row-gap: 12px;
  padding-top: 1.1vh;
  padding-bottom: 0;
  padding-bottom: 48px;
}

/* ---------- the arced premise ---------- */

.arc {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 700;
  color: var(--blue);
  font-size: clamp(30px, 3.6vw, 68px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-align: center;
  min-height: calc(2.2 * clamp(30px, 3.6vw, 68px));
}

.arc-flat { display: inline-block; }

.arc.is-arced { position: relative; display: block; }
.arc.is-arced .arc-flat { display: none; }

.arc-glyph {
  position: absolute;
  left: 50%;
  top: 0;
  transform-origin: 50% 0;
  white-space: pre;
}

/* ---------- the hour panel ---------- */

.panel {
  grid-column: 1;
  grid-row: 2;
  border-style: solid;
  border-width: 34px;
  border-image: url("/img/panel.webp") 48 fill / 34px / 0 stretch;
  padding: 12px 14px;
  min-width: 0;
}

.field {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 30px 16px;
  border-bottom: 1px solid var(--blue-dim);
  flex-wrap: nowrap;
}

.glyph {
  width: 30px;
  height: 30px;
  flex: none;
  mix-blend-mode: screen;
}

.field-label {
  font-size: 19px;
  white-space: nowrap;
  color: var(--pale-soft);
}

.field-value {
  font-family: var(--display);
  font-size: 34px;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  padding: 8px 22px;
  white-space: nowrap;
}

.field-sep {
  flex: 1 1 auto;
  min-width: 10px;
}

.field-right {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-left: auto;
}

.book {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
}

.book li {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 14px;
  min-width: 0;
}

.book .who {
  font-size: 25px;
  color: var(--pale-soft);
  overflow-wrap: anywhere;
  min-width: 0;
}

.book .amount {
  font-size: 25px;
  color: var(--pale);
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
}

.book .rank {
  font-family: var(--display);
  font-size: 22px;
  color: #3f6286;
  width: 1.6em;
  flex: none;
}

.book li.empty .who { color: #3f6286; }
.book li.empty .amount { color: var(--blue-dim); font-weight: 400; }

.state {
  margin: 14px 14px 0;
  font-size: 17px;
  color: var(--pale-soft);
  text-align: right;
}

/* ---------- the two keys ---------- */

.keys {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  gap: 24px;
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
  margin-left: 7%;
  margin-top: 4px;
}

.key {
  white-space: nowrap;
  appearance: none;
  background: transparent;
  color: var(--pale);
  font-family: var(--ui);
  font-size: 26px;
  line-height: 1;
  min-height: 68px;
  min-width: 290px;
  padding: 20px 34px;
  cursor: pointer;
  border-style: solid;
  border-width: 14px;
  border-image: url("/img/key.webp") 26 fill / 14px / 0 stretch;
  transition: transform 90ms ease;
}

.key:hover { color: #ffffff; }
.key:active { transform: translateY(2px); }

.key:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

.key[disabled] {
  color: #5b7a99;
  cursor: default;
}

.key.is-primary {
  color: #00111f;
  border-image: url("/img/key-primary.webp") 26 fill / 14px / 0 stretch;
}

.bounce {
  font-family: var(--joke);
  font-size: 1.22em;
  color: var(--blue);
  letter-spacing: .02em;
}

/* ---------- the address line: the only place with marks ---------- */

.address {
  grid-column: 1 / -1;
  grid-row: 4;
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
  margin-left: 2.5%;
  margin-top: 4px;
  min-width: 0;
  padding: 6px 22px;
  border-style: solid;
  border-width: 12px;
  border-image: url("/img/key.webp") 26 fill / 12px / 0 stretch;
}

.url-plain {
  font-size: 22px;
  color: var(--pale-soft);
}

.url-block {
  font-size: 22px;
  color: #00121f;
  background: var(--blue);
  padding: 12px 26px;
  overflow-wrap: anywhere;
  min-width: 0;
  user-select: all;
}

.url-block.is-empty {
  color: var(--pale-soft);
  background: transparent;
  border-bottom: 2px solid var(--blue-dim);
  user-select: none;
}

.copy {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--blue);
  font-family: var(--ui);
  font-size: 19px;
  min-height: 48px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.copy[disabled] { color: var(--pale-soft); cursor: default; text-decoration: none; }
.copy:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.marks {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 6px;
}

.mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-style: solid;
  border-width: 12px;
  border-image: url("/img/key.webp") 26 fill / 12px / 0 stretch;
}

.mark img { width: 28px; height: 28px; object-fit: contain; }
.mark[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.mark:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

/* ---------- the giant cursor ---------- */

.cursor {
  position: absolute;
  z-index: 3;
  width: min(246px, 13.5vw);
  left: 48.6%;
  top: 78.4%;
  pointer-events: none;
  user-select: none;
}

/* ---------- brand and the section rows ---------- */

.rows {
  grid-column: 2;
  grid-row: 2 / 5;
  align-self: end;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 0 10px 28px 0;
  max-width: 420px;
}

.brand {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 32px;
  color: var(--pale);
}

.brand .ticker { color: var(--blue); }

.row-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 10px;
  min-height: 48px;
  font-size: 24px;
  color: var(--pale-soft);
  text-decoration: none;
}

.row-link:hover { color: var(--blue); }
.row-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.row-link .glyph { width: 24px; height: 24px; }

.drawer-key { display: none; }

/* ---------- phone ---------- */

@media (max-width: 1099px) {
  body { font-size: 19px; }

  .screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
    row-gap: 22px;
    padding-top: 24px;
  }

  .arc { font-size: clamp(27px, 7vw, 44px); min-height: 0; text-align: left; }
  .arc.is-arced { position: static; }
  .arc.is-arced .arc-flat { display: inline-block; }
  .arc-glyph { display: none; }

  .panel, .keys, .address, .rows { grid-column: 1; }
  .panel { grid-row: 2; border-width: 26px; border-image-width: 26px; padding: 6px 0 12px; }
  .keys { grid-row: 3; padding-left: 0; }
  .key { width: 100%; font-size: 22px; }
  .address { grid-row: 4; padding-left: 0; }
  .rows { grid-row: 5; justify-self: start; align-self: start; max-width: none; width: 100%; padding: 0 0 24px; }

  .field-value { font-size: 24px; padding: 8px 14px; }
  .field-right { flex-wrap: wrap; }
  .field { padding: 14px 20px 16px; gap: 10px; flex-wrap: wrap; }
  .field-label { font-size: 18px; }
  .book li { padding: 10px 14px; }
  .book .who, .book .amount { font-size: 20px; }
  .state { margin: 12px 6px 0; }

  .cursor { display: none; }

  .dial { width: min(1000px, 192vw); top: 62%; opacity: .78; }
  .hand { height: min(300px, 34vh); }

  .drawer-key {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    appearance: none;
    background: transparent;
    color: var(--pale);
    font-family: var(--ui);
    font-size: 22px;
    min-height: 56px;
    padding: 16px 28px;
    cursor: pointer;
    border-style: solid;
    border-width: 14px;
    border-image: url("/img/key.webp") 26 fill / 14px / 0 stretch;
  }

  .rows .brand { font-size: 28px; }
  .rows[data-open="false"] .row-link { display: none; }
}

/* ---------- the sections below the first screen ---------- */

.screen-plain {
  display: block;
  min-height: 0;
  padding: 7vh 0 0;
}

.panel-wide {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.field-title {
  margin: 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  color: var(--blue);
}

.book-wide li { gap: 22px; }

.book .hour-id {
  font-family: var(--display);
  font-size: 23px;
  color: var(--blue);
  width: 7.4em;
  flex: none;
}

.book .coin { font-size: 23px; color: var(--pale); min-width: 0; overflow-wrap: anywhere; }
.book .burned { font-size: 21px; color: var(--pale-soft); margin-left: auto; white-space: nowrap; }

/* the bid row inside the panel: the slot is always reserved, nothing reflows */

.bid-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  margin: 10px 14px 0;
  padding-top: 14px;
  border-top: 1px solid var(--blue-dim);
}

.bid-label, .form-label {
  font-size: 19px;
  color: var(--pale-soft);
  min-width: 9em;
  padding: 10px 21px;
}

.bid-input { flex: 0 1 230px; max-width: 230px; }

.key-small { margin-left: auto; min-width: 170px; }

.bid-input, .form-input {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--blue-dim);
  color: var(--pale);
  font-family: var(--ui);
  font-size: 23px;
  min-height: 52px;
  padding: 10px 16px;
  min-width: 0;
  flex: 1 1 180px;
  max-width: 420px;
}

.bid-input:focus, .form-input:focus { outline: none; border-bottom-color: var(--blue); }
.bid-input::placeholder, .form-input::placeholder { color: #3f6286; }
.bid-input[disabled], .form-input[disabled] { color: #5b7a99; }

.bid-unit { font-size: 21px; color: var(--pale-soft); padding: 11px 23px; }

.key-small {
  font-size: 21px;
  min-height: 56px;
  min-width: 0;
  padding: 16px 30px;
  border-width: 12px;
  border-image: url("/img/key.webp") 26 fill / 12px / 0 stretch;
}

.form { padding: 14px 14px 0; display: grid; row-gap: 12px; }

.form-line {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-file { padding: 12px 16px; font-size: 19px; }

.keys-inline { grid-column: auto; grid-row: auto; margin: 18px 14px 0; width: auto; }

.steps {
  list-style: none;
  margin: 0;
  padding: 10px 14px 0;
  display: grid;
  row-gap: 18px;
}

.steps li { display: flex; align-items: flex-start; gap: 22px; }

.step-n {
  font-family: var(--display);
  font-size: 32px;
  color: var(--blue);
  width: 1.4em;
  flex: none;
  line-height: 1.2;
}

.steps p {
  margin: 0;
  font-size: 21px;
  color: var(--pale);
  max-width: 68ch;
}

@media (max-width: 1099px) {
  .screen-plain { padding-top: 5vh; }
  .panel-wide { width: 100%; }
  .field-title { font-size: 28px; padding: 0 12px; }
  .steps p { font-size: 19px; }
  .step-n { font-size: 26px; }
  .bid-label, .form-label { min-width: 100%; padding: 6px 22px; }
  .bid-row { flex-wrap: wrap; }
  .bid-input { flex: 1 1 58%; max-width: none; }
  .key-small { margin-left: 0; }
  .bid-input, .form-input { flex: 1 1 58%; max-width: none; }
  .book .hour-id { width: 100%; }
  .book .burned { margin-left: 0; }
}

/* ---------- short desktop screens (1366 x 768 and the like) ---------- */

@media (min-width: 1100px) and (max-height: 920px) {
  .screen { row-gap: 8px; padding-top: 0.6vh; }
  .arc { font-size: clamp(26px, 2.5vw, 42px); }
  .panel { border-width: 26px; border-image-width: 26px; padding: 8px 10px; }
  .field { padding: 12px 26px 14px; flex-wrap: nowrap; }
  .field-title { padding: 2px 0; }
  .field-label { font-size: 17px; }
  .field-value { font-size: 26px; padding: 6px 16px; }
  .book li { padding: 3px 14px; }
  /* a short screen shows four of the six rows: the book is still the book, it just stops sooner */
  .book li:nth-child(n+5) { display: none; }
  .book .who, .book .amount { font-size: 21px; }
  .book .rank { font-size: 20px; }
  .bid-row { margin-top: 8px; padding-top: 10px; }
  .key-small { min-height: 50px; font-size: 19px; padding: 12px 20px; margin-left: auto; }
  .bid-input { min-height: 46px; font-size: 21px; max-width: 150px; flex: 0 1 150px; padding: 8px 12px; }
  .bid-label { min-width: 0; padding: 10px 20px; white-space: nowrap; }
  .bid-unit { padding: 8px 10px; }
  .bid-row { gap: 10px; flex-wrap: nowrap; margin-top: 6px; padding-top: 8px; }
  .state { font-size: 16px; margin-top: 4px; }
  .key { min-height: 54px; font-size: 22px; padding: 14px 26px; min-width: 240px; }
  .address { padding: 0 20px; margin-top: 4px; }
  .url-plain, .url-block { font-size: 20px; }
  .mark { width: 54px; height: 54px; }
  .cursor { width: min(190px, 14vw); top: 71%; left: 57%; }
  .dial { width: min(960px, 118vh, 150vw); }
  .brand { font-size: 28px; margin-bottom: 10px; }
  .row-link { font-size: 21px; padding: 9px 10px; }
}
