/* Shared by the essay (index.html) and the timer (timer.html). */

@font-face {
  font-family: "Archivo";
  src: url("../vendor/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

/* Registered so the ink can cross-fade when the water gets dark. */
@property --ink  { syntax: "<color>"; inherits: true; initial-value: #04101A; }
@property --mark { syntax: "<color>"; inherits: true; initial-value: #04101A; }
@property --on-mark { syntax: "<color>"; inherits: true; initial-value: #DCE8E4; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.7s; }

:root {
  --surface: #DCE8E4;
  --abyss: #04101A;
  --lume: #F2D45C;

  --ink: var(--abyss);
  --mark: var(--abyss);
  --on-mark: var(--surface);
  --soft: color-mix(in srgb, var(--ink) 72%, transparent);
  --faint: color-mix(in srgb, var(--ink) 22%, transparent);

  --gauge: 104px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  transition: --ink 1.2s ease, --mark 1.2s ease, --on-mark 1.2s ease;
}

:root.deep {
  --ink: var(--surface);
  --mark: var(--lume);
  --on-mark: var(--abyss);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: clip; }

body {
  background: var(--surface);
  color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

#water {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 4px;
  border-radius: 2px;
}

kbd {
  font: inherit;
  font-size: 0.82em;
  font-weight: 500;
  padding: 1px 6px 2px;
  border: 1px solid var(--faint);
  border-radius: 3px;
}

/* Header */

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px 0 var(--gauge);
  font-size: 15px;
}

.brand {
  font-weight: 600;
  font-stretch: 110%;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.top nav { display: flex; align-items: baseline; gap: 26px; }
.top nav a { color: var(--soft); text-decoration: none; }
.top nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

/* Depth tape: ticks scroll past a fixed pointer. */

.gauge {
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--gauge);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 4%, #000 26%, #000 74%, transparent 96%);
          mask-image: linear-gradient(to bottom, transparent 4%, #000 26%, #000 74%, transparent 96%);
}

.tape {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  background-image:
    linear-gradient(to bottom, var(--ink) 1px, transparent 1px),
    linear-gradient(to bottom, var(--soft) 1px, transparent 1px);
  background-size: 24px calc(var(--tick) * 5), 10px var(--tick);
  background-repeat: repeat-y;
}

.tape span {
  position: absolute;
  left: 36px;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
}

.pointer {
  left: 0;
  width: 30px;
  height: 3px;
  margin-top: -1px;
  background: var(--mark);
  pointer-events: none;
}

@media (max-width: 640px) {
  :root { --gauge: 62px; }
  .top { padding-right: 18px; }
  .top nav { gap: 16px; }
  .tape { background-size: 16px calc(var(--tick) * 5), 7px var(--tick); }
  .tape span { left: 24px; font-size: 12px; }
  .pointer { width: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  @view-transition { navigation: none; }
}
