/* ============================================================
   Tenor API death watch
   Look: a blue status console watching a developer API die.
   Reason: Tenor is an API, and after June 30 it just returns
   errors. Blue is the normal "deprecated" state; red is dead.
   ============================================================ */

:root {
  --bg: #070a0d;
  --panel: rgba(0, 210, 255, 0.05);

  /* Blue console palette; flips to red the moment Tenor dies. */
  --phosphor: #00d2ff;        /* primary readout */
  --phosphor-soft: #7cc2d6;   /* body copy */
  --phosphor-faint: #4d7e8c;  /* labels, dim chrome */
  --line: rgba(0, 210, 255, 0.24);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--phosphor-soft);
  font-family: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 16px;
  line-height: 1.65;
  transition: background 0.9s ease;
}

a {
  color: var(--phosphor);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { background: var(--phosphor); color: var(--bg); text-decoration: none; }

.screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* red full-screen flash at the moment of death */
.flash {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #ff3b30;
  opacity: 0;
  pointer-events: none;
}
.flash.fire { animation: flash 1.5s ease-out forwards; }
@keyframes flash {
  0% { opacity: 0; }
  7% { opacity: 0.8; }
  100% { opacity: 0; }
}

.wrap {
  position: relative;
  z-index: 9;
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(36px, 8vh, 80px) 22px 32px;
}

/* ---- Headline ---- */
.headline {
  font-weight: 600;
  font-size: clamp(1.5rem, 4.5vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--phosphor);
  transition: color 0.9s ease;
}
.dek {
  margin: 0 0 36px;
  max-width: 60ch;
  color: var(--phosphor-soft);
}

/* ---- Console window ---- */
.console {
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.9s ease;
}
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  transition: border-color 0.9s ease;
}
.path { color: var(--phosphor-faint); }
.pill {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 9px;
  border: 1px solid var(--phosphor);
  color: var(--phosphor);
  transition: color 0.9s ease, border-color 0.9s ease, background 0.3s ease;
}

.readout {
  padding: 30px 22px 26px;
  text-align: center;
}
.lead {
  margin: 0 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--phosphor-faint);
}

/* ---- The clock ---- */
.clock {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(2px, 0.8vw, 8px);
  max-width: 100%;
}
.unit { display: flex; flex-direction: column; align-items: center; }
.num {
  display: block;
  min-width: 2ch;           /* one digit takes the same space as two */
  text-align: center;
  font-size: clamp(2.2rem, 11vw, 5rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--phosphor);
  transition: color 0.9s ease;
}
.label {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--phosphor-faint);
  margin-top: 10px;
}
.sep {
  font-size: clamp(1.6rem, 8vw, 3.4rem);
  font-weight: 700;
  line-height: 1;
  color: var(--phosphor);
  animation: blink 1.1s steps(1) infinite;
  transition: color 0.9s ease;
}
@keyframes blink { 50% { opacity: 0.18; } }

.status {
  margin: 18px 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  color: var(--phosphor);
  transition: color 0.9s ease;
}
.cursor { animation: blink 1.1s steps(1) infinite; }

.sound {
  margin-top: 20px;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--phosphor);
  border: 1px solid var(--phosphor);
  padding: 9px 16px;
  cursor: pointer;
}
.sound:hover { background: var(--phosphor); color: var(--bg); }

/* ---- Log / reading ---- */
.log { margin-top: 40px; }
.log h2 {
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--phosphor-faint);
  font-weight: 500;
  margin: 0 0 12px;
}
.log h2::before { content: "// "; opacity: 0.6; }
.log p { margin: 0 0 16px; max-width: 64ch; }
.srclabel {
  color: var(--phosphor-faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin-top: 28px !important;
}
.srclabel::before { content: "// "; opacity: 0.6; }
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.links li { position: relative; padding-left: 18px; }
.links li::before { content: ">"; position: absolute; left: 0; color: var(--phosphor-faint); }

/* ---- Footer ---- */
.footer {
  position: relative;
  z-index: 9;
  border-top: 1px solid var(--line);
  padding: 20px 22px;
  text-align: center;
  transition: border-color 0.9s ease;
}
.gh {
  position: absolute;
  left: 22px;
  bottom: 16px;
  color: var(--phosphor-soft);
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
}
.gh:hover { color: var(--phosphor); background: transparent; }
.credit { margin: 0; color: var(--phosphor-faint); font-size: 0.82rem; }

/* ============================================================
   DEAD STATE: the whole monitor goes critical (amber -> red)
   ============================================================ */
body.dead {
  --phosphor: #ff3b30;
  --phosphor-soft: #ff7a72;
  --phosphor-faint: #b8443d;
  --line: rgba(255, 59, 48, 0.3);
  background: #120403;
}
body.dead .pill { background: rgba(255, 59, 48, 0.15); }
body.dead .num { animation: glitch 2.6s infinite; }
body.dead .clock { animation: shake 0.55s ease-in-out; }
body.dead .status { font-weight: 600; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes glitch {
  0%, 90%, 100% { transform: translate(0, 0); }
  91% { transform: translate(-2px, 1px); }
  93% { transform: translate(3px, -1px); }
  95% { transform: translate(-2px, -1px); }
  97% { transform: translate(2px, 1px); }
}

@media (prefers-reduced-motion: reduce) {
  .sep, .cursor, .screen::after { animation: none; }
  body.dead .num, body.dead .clock { animation: none; }
  .flash.fire { animation-duration: 0.3s; }
}
