/* oomoo -- the voicemail page. Same construction as the canary: this file is the page.
 *
 * Two visual registers on purpose. The machine is a photograph with fixed colors, so
 * everything painted ON it (the display crawl) uses hard-coded VFD phosphor values and
 * ignores the theme. Everything AROUND it -- handset keys, the tape -- reads the site
 * tokens and follows the palette like every other page.
 */

@import url('../tokens.css');
@import url('../reset.css');
@import url('../utilities.css');
@import url('../home/fonts.css');

/* ------------------------------------------------------------------- Page */

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'National Park', system-ui, sans-serif;
  min-height: 100svh;
}

.label {
  text-transform: uppercase;
  font-family: 'National Park', system-ui, sans-serif;
}

.back {
  position: fixed;
  top: 14px;
  left: 14px;
  font-size: 11px;
  color: var(--dim);
  text-decoration: none;
  z-index: 2;
}

.back:hover {
  color: var(--accent);
}

.vm {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 18px 48px;
}

.vm__masthead {
  text-align: center;
  margin-bottom: 28px;
}

.vm__title {
  font-family: 'Terminal Grotesque', 'National Park', sans-serif;
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  line-height: 1;
  color: var(--ink);
}

/* ---------------------------------------------------------------- Machine */

.machine {
  position: relative;
  margin: 0 auto;
  max-width: 643px;
}

.machine__img {
  display: block;
  width: 100%;
  height: auto;
}

/* The display window. Percentages measured off the 643x445 photo: the clear strip of
 * black glass between the printed "AUTOMATIC TELEPHONE ANSWERING SYSTEM" header and the
 * INCOMING/OUTGOING legends. overflow:hidden is what "cuts the text off at the right
 * points": the glass clips, the bezel appears to. */
.machine__glass {
  position: absolute;
  left: 9.2%;
  top: 43.5%;
  width: 67.2%;
  height: 11%;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* VFD phosphor. Fixed colors -- this text lives inside the photograph, not the theme. */
.machine__crawl {
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: clamp(8px, 2.4vw, 15px);
  letter-spacing: 0.14em;
  color: #b8f5ec;
  text-shadow:
    0 0 4px rgba(122, 240, 220, 0.9),
    0 0 12px rgba(80, 220, 200, 0.45);
  will-change: transform;
  animation: crawl var(--crawl-ms, 14000ms) linear infinite;
}

/* JS duplicates the text so -50% lands exactly one copy over: a seamless loop. */
@keyframes crawl {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Static states (countdowns, verdicts) hold still instead of crawling. */
.machine__crawl--static {
  animation: none;
  padding-left: 4%;
}

/* -------------------------------------------------------------- Handset */

.handset {
  margin: 26px auto 0;
  text-align: center;
}

.handset__nojs {
  color: var(--dim);
  font-size: 0.9rem;
}

.handset__row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.key {
  font-family: 'National Park', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border: 1px solid var(--line);
  border-bottom-width: 3px; /* the springy mechanical travel */
  border-radius: 4px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.key:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.key:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

.key:disabled {
  opacity: 0.4;
  cursor: default;
}

.key--pickup {
  font-size: 14px;
  padding: 12px 26px;
}

.key__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.key--record:hover .key__dot {
  animation: blink 1s steps(2, start) infinite;
}

.key--stop .key__dot,
.handset__row[data-state='recording'] .key--stop {
  color: var(--accent);
  border-color: var(--accent);
}

@keyframes blink {
  to { visibility: hidden; }
}

.handset__meter {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 18px;
  color: var(--accent);
  min-width: 4ch;
  text-align: left;
}

.handset__note {
  margin-top: 14px;
  color: var(--dim);
  font-size: 0.8rem;
  font-style: italic;
}

/* ------------------------------------------------------------------ Tape */

.tape {
  margin-top: 44px;
}

.tape__title {
  font-family: 'Terminal Grotesque', 'National Park', sans-serif;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 14px;
}

.tape--pending .tape__title {
  color: var(--accent);
}

.tape__empty {
  color: var(--dim);
  font-style: italic;
}

.tape__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
}

.msg--playing {
  border-color: var(--accent);
}

.msg__play {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.msg__play:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.msg__body {
  flex: 1;
  min-width: 0;
}

.msg__date {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg__bar {
  height: 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.msg__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.msg__len {
  flex: none;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--dim);
}

.msg__approve,
.msg__delete {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.msg__approve:hover {
  color: #7be07b;
  border-color: #7be07b;
}

.msg__delete:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ------------------------------------------------------------------ Foot */

.vm__foot {
  margin-top: 52px;
  text-align: center;
  color: var(--dim);
  font-size: 0.75rem;
  font-style: italic;
}

/* The word that carries the footnote: same dim voice, the underline is the only tell. */
.vm__foot a {
  color: inherit;
  text-decoration: underline;
}

.vm__foot a:hover {
  color: var(--accent);
}
