/*
 * schematiq.net — a drawing sheet. Tokens follow Deadlinewatch (graphite, flag-red, fern, steel
 * blue, Assistant, square corners). Motion is one reveal on load, transform and opacity only, and
 * none at all for visitors who prefer reduced motion.
 */

@font-face {
  font-family: "Assistant";
  src: url("fonts/assistant-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #faf8f4;
  --ink: #353535;
  --ink-soft: #6b6a5f;
  --ink-line: rgba(53, 53, 53, 0.34);
  --red: #c72b2b;
  --fern: #568259;
  --steel: #3a7ca5;
  --grid-minor: rgba(53, 53, 53, 0.045);
  --grid-major: rgba(53, 53, 53, 0.085);

  --margin: clamp(12px, 2.6vw, 32px);
  --strip: 28px;
  --fs: clamp(
    3rem,
    min(13.5vw, 21vh),
    10.5rem
  ); /* width or height, whichever is tighter: the sheet never scrolls on a laptop */
  --dot: clamp(10px, calc(var(--fs) * 0.085), 16px);
  --axis: max(1.5px, calc(var(--fs) * 0.011));
  --red-x: 83.05%; /* the centre of the "I", measured: the point sits under it */
  --axis-y: calc(var(--fs) * 1.08); /* word box 0.86 + gap 0.22 */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Assistant",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* ------------------------------------------------------------------ page + paper */

.page {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--margin);
  isolation: isolate;
}

.paper {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size:
    120px 120px,
    120px 120px,
    24px 24px,
    24px 24px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(130% 110% at 45% 42%, #000 45%, rgba(0, 0, 0, 0.35) 100%);
  mask-image: radial-gradient(130% 110% at 45% 42%, #000 45%, rgba(0, 0, 0, 0.35) 100%);
}

/* Registration marks, just outside each corner of the sheet. */
.reg {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  translate: -50% -50%;
}

.reg::before,
.reg::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--ink);
  translate: -50% -50%;
}

.reg::before {
  width: 23px;
  height: 1px;
}

.reg::after {
  width: 1px;
  height: 23px;
}

.reg--tl {
  left: var(--margin);
  top: var(--margin);
}

.reg--tr {
  left: calc(100% - var(--margin));
  top: var(--margin);
}

.reg--bl {
  left: var(--margin);
  top: calc(100% - var(--margin));
}

.reg--br {
  left: calc(100% - var(--margin));
  top: calc(100% - var(--margin));
}

/* ------------------------------------------------------------------ the sheet */

.sheet {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-rows: var(--strip) 1fr auto;
  border: 1.5px solid var(--ink);
  box-shadow:
    inset 0 0 0 5px var(--paper),
    inset 0 0 0 6px var(--ink-line);
  overflow: hidden;
}

.refs {
  display: flex;
  justify-content: space-around;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  user-select: none;
}

.refs--top {
  margin: 0 6px 0 calc(var(--strip) + 6px);
  border-bottom: 1px solid var(--ink-line);
}

.refs--side {
  position: absolute;
  top: calc(var(--strip) + 6px);
  bottom: 6px;
  left: 6px;
  width: var(--strip);
  flex-direction: column;
  border-right: 1px solid var(--ink-line);
}

.stage {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: clamp(28px, min(7vw, 8vh), 96px) clamp(20px, 5vw, 72px) clamp(28px, min(6vw, 6vh), 88px)
    calc(var(--strip) + clamp(20px, 6vw, 112px));
}

/* ------------------------------------------------------------------ the lockup */

.lockup {
  position: relative;
  display: inline-block;
  padding-bottom: 40px;
  font-size: var(--fs);
}

.mark {
  position: relative;
  z-index: 1;
  display: flex; /* flex, so the empty axis can't collapse margins into the lines around it */
  flex-direction: column;
  margin: 0;
  font-size: inherit;
  font-weight: 800;
  line-height: 1;
}

.mark__word {
  display: block;
  margin-left: -0.045em;
  letter-spacing: -0.045em;
  line-height: 0.86;
}

.mark__sub {
  display: block;
  margin-top: max(calc(var(--fs) * 0.17), 18px);
  font-size: clamp(0.875rem, calc(var(--fs) * 0.125), 1.25rem);
  font-weight: 700;
  letter-spacing: 0.34em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* The datum: a timeline axis through the whole sheet, carrying the Deadlinewatch points. */
.axis {
  position: relative;
  display: block;
  height: 0;
  margin-top: calc(var(--fs) * 0.22);
}

.axis__line {
  position: absolute;
  left: -100vw;
  right: -100vw;
  top: calc(var(--axis) / -2);
  height: var(--axis);
  background: var(--ink);
  transform-origin: 30% 50%;
}

.axis__ticks {
  position: absolute;
  left: 0;
  right: -100vw;
  top: calc(var(--axis) / 2);
  height: 7px;
  background-image: linear-gradient(90deg, var(--ink) 1px, transparent 1px);
  background-size: calc(var(--fs) * 0.3) 100%;
  opacity: 0.55;
}

.dot {
  position: absolute;
  top: 0;
  z-index: 2;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  translate: -50% -50%;
}

.dot--fern {
  left: 2%;
  background: var(--fern);
}

.dot--red {
  left: var(--red-x);
  width: calc(var(--dot) * 1.45);
  height: calc(var(--dot) * 1.45);
  background: var(--red);
}

/* Projection line: the I drops its point onto the axis. */
.dot--red::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  width: 1px;
  height: calc(var(--fs) * 0.2 - var(--dot) * 0.72);
  background-image: linear-gradient(var(--ink) 50%, transparent 50%);
  background-size: 1px 6px;
  opacity: 0.6;
}

.dot--steel {
  left: calc(100% + var(--fs) * 0.9);
  background: var(--steel);
}

/* Construction arcs around the red point. */
.arc {
  position: absolute;
  left: var(--red-x);
  top: var(--axis-y);
  border: 1px dashed rgba(53, 53, 53, 0.2);
  border-radius: 50%;
  translate: -50% -50%;
  pointer-events: none;
}

.arc--outer {
  width: calc(var(--fs) * 2.7);
  height: calc(var(--fs) * 2.7);
}

.arc--inner {
  width: calc(var(--fs) * 1.25);
  height: calc(var(--fs) * 1.25);
  border-style: solid;
  border-color: rgba(53, 53, 53, 0.12);
}

/* The detail callout: the red point is Deadlinewatch, detail 01. */
.callout {
  --r: 21px;
  position: absolute;
  z-index: 1;
  left: calc(var(--red-x) - var(--r));
  top: calc(var(--axis-y) + var(--dot) * 0.72);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
}

.callout__leader {
  width: 1px;
  height: calc(var(--fs) * 0.42);
  margin-left: calc(var(--r) - 0.5px);
  background: var(--ink);
  transform-origin: top center;
}

.callout__row {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.bubble {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--ink);
}

.bubble__top {
  align-self: end;
  padding-bottom: 3px;
}

.bubble__bottom {
  align-self: start;
  padding-top: 3px;
  color: var(--red);
}

.callout__text {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 150ms ease-out;
}

.callout__arrow {
  font-size: 1rem;
  transition: transform 150ms ease-out;
}

.callout:hover .callout__text,
.callout:focus-visible .callout__text {
  background-size: 100% 1px;
}

.callout:hover .callout__arrow,
.callout:focus-visible .callout__arrow {
  transform: translate(2px, -2px);
}

/* The 404 sheet: a short word, so the callout sits below instead of hanging from the point. */
.lockup--quiet {
  padding-bottom: 0;
}

.lockup--quiet .dot--red {
  left: 100%;
}

.lockup--quiet .dot--red::before {
  display: none;
}

.lockup--quiet .callout {
  position: static;
  margin-top: 32px;
}

.lockup--quiet .callout__leader {
  display: none;
}

/* ------------------------------------------------------------------ title block */

.titleblock {
  justify-self: end;
  width: min(100%, 440px);
  margin: 0 6px 6px 0;
  border-top: 1.5px solid var(--ink);
  border-left: 1.5px solid var(--ink);
  background: var(--paper);
  position: relative;
  z-index: 1;
}

.tb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  background: var(--ink-line);
}

.tb__cell {
  padding: 10px 14px 11px;
  background: var(--paper);
}

.tb__cell--wide {
  grid-column: 1 / -1;
}

.tb dt {
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

.tb dd {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.tb__cell--wide dd {
  font-size: 1.125rem;
}

.tb__links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.tb a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tb a:hover {
  text-decoration-thickness: 2px;
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 720px) {
  :root {
    --fs: 17.5vw;
  }

  .refs--side {
    display: none;
  }

  .refs--top {
    margin-left: 6px;
  }

  .refs--top span:nth-child(n + 5) {
    display: none;
  }

  .stage {
    padding: 48px 20px 40px;
  }

  .lockup {
    display: block;
    padding-bottom: 0;
  }

  .mark {
    display: inline-flex;
  }

  .dot--steel {
    left: 100%;
  }

  .arc--outer {
    display: none;
  }

  .callout {
    position: static;
    margin-top: 28px;
  }

  .callout__leader {
    display: none;
  }

  .titleblock {
    justify-self: stretch;
    width: auto;
    margin: 0 6px 6px;
    border-left: 0;
  }
}

@media (max-width: 480px) {
  .tb {
    grid-template-columns: 1fr auto;
  }

  .tb__cell--deco {
    display: none;
  }
}

/* ------------------------------------------------------------------ the reveal (once) */

@media (prefers-reduced-motion: no-preference) {
  .paper {
    animation: fade 900ms ease-out both;
  }

  .sheet,
  .reg {
    animation: fade 700ms ease-out 100ms both;
  }

  .axis__line {
    animation: draw 1100ms var(--ease) 250ms both;
  }

  .axis__ticks {
    animation: fade-soft 700ms ease-out 900ms both;
  }

  .mark__word {
    animation: rise 900ms var(--ease) 450ms both;
  }

  .mark__sub {
    animation: rise 700ms var(--ease) 800ms both;
  }

  .dot {
    animation: pop 520ms cubic-bezier(0.3, 1.5, 0.5, 1) both;
  }

  .dot--fern {
    animation-delay: 950ms;
  }

  .dot--red {
    animation-delay: 1150ms;
  }

  .dot--steel {
    animation-delay: 1300ms;
  }

  .arc {
    animation: widen 1200ms var(--ease) 1150ms both;
  }

  .callout__leader {
    animation: drop 500ms var(--ease) 1350ms both;
  }

  .callout__row {
    animation: fade 600ms ease-out 1600ms both;
  }

  .titleblock,
  .refs {
    animation: fade 700ms ease-out 1300ms both;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes fade-soft {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.55;
  }
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.14em);
  }
}

@keyframes pop {
  from {
    scale: 0;
  }
}

@keyframes widen {
  from {
    opacity: 0;
    scale: 0.6;
  }
}

@keyframes drop {
  from {
    transform: scaleY(0);
  }
}
