/* Horizon — the type that rests on the horizon line, and tone handling for a piece whose sky
   may be pale while its sea stays dark. */

:root {
  --hz-text: rgba(235, 229, 214, 0.74);
  --hz-dim: rgba(235, 229, 214, 0.56);
  --hz-rule: rgba(235, 229, 214, 0.4);
  --hz-mark: rgba(255, 190, 122, 0.82);
}
body.hz-pale {
  --hz-text: rgba(23, 22, 28, 0.78);
  --hz-dim: rgba(23, 22, 28, 0.56);
  --hz-rule: rgba(23, 22, 28, 0.42);
}
body.hz-sky-pale { --hz-mark: rgba(120, 44, 12, 0.85); }

/* The chrome's footer sits over the sea, which is dark at every hour: keep it bone even when
   the header has gone dark for a pale sky. */
body.tone-light .chrome-foot {
  --text: #ebe5d6;
  --text-dim: rgba(235, 229, 214, 0.66);
  --text-faint: rgba(235, 229, 214, 0.36);
  color: var(--text);
}
.chrome-foot { text-shadow: 0 0 9px rgba(8, 8, 11, 0.95), 0 0 22px rgba(8, 8, 11, 0.8), 0 0 40px rgba(8, 8, 11, 0.5); }

.hz {
  position: fixed;
  left: var(--edge);
  right: var(--edge);
  top: 50%;
  height: 0;
  z-index: 5;
  pointer-events: none;
  color: var(--hz-text);
  opacity: 0;
  transition: opacity 2.4s ease 0.5s, color 1.2s ease;
}
.hz.on { opacity: 1; }
body:not(.hz-pale) .hz { text-shadow: 0 0 14px rgba(8, 8, 11, 0.45); }

.hz-end {
  position: absolute;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.hz-left { left: 0; padding-left: 11px; }
.hz-right { right: 0; padding-right: 11px; text-align: right; }
.hz-end .k, .hz-end .sep { color: var(--hz-dim); }

/* Dimension ticks: the horizon is the line being measured. */
.hz-tick { position: absolute; bottom: 0; width: 1px; height: 26px; background: linear-gradient(to top, var(--hz-rule), transparent); }
.hz-tick.l { left: 0; }
.hz-tick.r { right: 0; }

.hz-gap {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(17px, 1.55vw, 23px);
  letter-spacing: 0.005em;
  white-space: nowrap;
  line-height: 1.2;
}
.hz-gap.tick { animation: hz-arrive 2.2s ease; }
@keyframes hz-arrive { from { opacity: 0; letter-spacing: 0.05em; } to { opacity: 1; letter-spacing: 0.005em; } }

.hz-marks { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.hz-mark {
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--hz-mark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 1.6s ease 0.25s, color 1.2s ease;
  will-change: transform;
}
.hz-mark.on { opacity: 1; }

/* Mid widths: the three pieces of type no longer fit on one line, so the sentence steps up. */
@media (max-width: 1120px) {
  .hz-gap { bottom: 38px; }
}

@media (max-width: 760px) {
  .hz-end { font-size: 9px; letter-spacing: 0.13em; bottom: 8px; line-height: 1.55; }
  .hz-end .sep { display: none; }
  .hz-end .k, .hz-end .v { display: block; }
  .hz-left { padding-left: 9px; }
  .hz-right { padding-right: 9px; }
  .hz-gap {
    bottom: 54px;
    width: min(84vw, 22em);
    white-space: normal;
    text-align: center;
    font-size: 18px;
    text-wrap: balance;
  }
  .hz-tick { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .hz, .hz-mark { transition: none; }
  .hz-gap.tick { animation: none; }
}
