/* Spacebox landing page.
   Colour comes only from the paint of the logo; everything else is black on white. */

:root {
  --paper: #fff;
  --ink: #000;
  --mute: #5c5c5c;
  --hair: #d6d6d6;
  --blue: #1b3bd0;   /* the ultramarine of the paint */
  --yellow: #ffd21f; /* the yellow of the paint */
  --focus: var(--blue);
  --pad: clamp(1.25rem, 4vw, 3rem);
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, table { margin: 0; }
ul { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.wrap {
  width: min(100% - 2 * var(--pad), 75rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: var(--pad);
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 0.9rem;
}
.skip:focus { top: 0.75rem; }

/* Top bar and footer */

.top,
.foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}
.top { padding-block: 1.4rem; }
.foot {
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--ink);
  font-size: 0.9375rem;
}

.wordmark {
  font-stretch: 118%;
  font-weight: 680;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Hero */

.hero {
  padding-block: clamp(1rem, 2vw, 1.5rem) clamp(3.5rem, 7vw, 5.5rem);
}

.headline {
  font-stretch: 118%;
  font-weight: 640;
  font-size: clamp(2.25rem, 5.6vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.022em;
  max-width: 22ch;
  text-wrap: balance;
}

/* The plate: the box, with one note on each side.
   A hairline runs from each note to the face it describes. */

.plate {
  --box-h: clamp(16rem, 47vh, 32rem);
  --box-w: calc(var(--box-h) * 715 / 825);
  --gap: clamp(1rem, 2.5vw, 2.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--box-w) minmax(0, 1fr);
  column-gap: var(--gap);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}

/* Whole pixels, so that the hairlines of the notes and the ones on the
   faces meet: 44% of a multiple of 25px is a whole number. */
@supports (width: round(1px, 1px)) {
  .plate {
    --box-h: round(clamp(16rem, 47vh, 32rem), 25px);
    --box-w: round(calc(var(--box-h) * 715 / 825), 1px);
  }
}

.box {
  position: relative;
  width: var(--box-w);
  height: var(--box-h);
}

.box-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The top and the right face. The background is the same picture the
   script draws, so the box is complete without WebGL. */
.box-paint {
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 50% 50%, 0 25%);
  background: url("/assets/paint-1024.webp") 50% 50% / 121.15% 100% no-repeat;
  touch-action: pan-y;
}

.note {
  display: grid;
  align-content: start;
  margin-top: calc(var(--box-h) * 0.44);
  border-top: 1px solid var(--ink);
  padding-top: 0.85rem;
}
/* Each note reaches across the gap, so its top line ends at the box. */
.note-server {
  margin-right: calc(var(--gap) * -1);
  padding-right: var(--gap);
}
.note-laptop {
  justify-items: end;
  margin-left: calc(var(--gap) * -1);
  padding-left: var(--gap);
}

.note-title,
.note-text { width: min(100%, 21rem); }

.note-title {
  font-stretch: 112%;
  font-weight: 620;
  font-size: 1.3125rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.note-text {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.live-only { display: none; }
.paint-live .live-only { display: inline; }

/* The line of each note goes on across the face it describes, in white,
   and ends in a dot. */
.lead {
  position: absolute;
  top: calc(var(--box-h) * 0.44);
  width: 24%;
  height: 1px;
  background: #fff;
}
.lead-server { left: 0; }
.lead-laptop { right: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6); }

.lead::after {
  content: "";
  position: absolute;
  top: 0.5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.lead-server::after { left: 100%; }
.lead-laptop::after { left: 0; box-shadow: 0 0 0 1.5px #000; }

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 38rem) auto;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem 3rem;
  margin-top: clamp(2rem, 3.5vw, 2.5rem);
}

.lede {
  font-size: 1.1875rem;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-weight: 560;
  line-height: 1.2;
  padding: 0.85rem 1.25rem;
  text-decoration: none;
}
.btn:hover { background: var(--blue); }

/* Sections */

.band { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

/* A section that follows another white one starts with a rule as wide as
   the text. */
.ruled { padding-top: 0; }
.ruled-top {
  border-top: 1px solid var(--ink);
  padding-top: clamp(3.5rem, 8vw, 6.5rem);
}

.dark {
  background: var(--ink);
  color: var(--paper);
  --focus: var(--yellow);
}

.h2 {
  font-stretch: 116%;
  font-weight: 630;
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
  max-width: 28ch;
}
/* A phrase that stays on one line where there is room for it. */
.phrase { display: inline-block; }

.prose {
  margin-top: 1.25rem;
  max-width: 40rem;
}

.fine {
  margin-top: 1.25rem;
  max-width: 46rem;
  font-size: 0.9375rem;
  color: var(--mute);
}

/* What travels between the two */

.wire {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid rgba(255, 255, 255, 0.38);
}

.wire-row {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr) minmax(0, 1.5fr);
  align-items: baseline;
  gap: 0.25rem 2rem;
  padding-block: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
}

.wire-dir {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.wire-what {
  font-stretch: 108%;
  font-weight: 600;
}

.wire-note { color: rgba(255, 255, 255, 0.74); }

/* Measurements */

.table {
  width: 100%;
  margin-top: clamp(2rem, 4vw, 3rem);
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  text-align: left;
  vertical-align: baseline;
  padding: 1.05rem 2rem 1.05rem 0;
  border-bottom: 1px solid var(--hair);
}

.table thead th {
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--ink);
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--mute);
}

.table tbody th {
  font-stretch: 108%;
  font-weight: 600;
  width: 26%;
}

.table + .fine { margin-top: 2rem; }

/* Status: a filled box is done, an empty box is not yet. */

.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem clamp(2rem, 6vw, 5rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

.list-title {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ink);
  font-stretch: 112%;
  font-weight: 620;
  font-size: 1.3125rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.list li {
  position: relative;
  padding: 0.85rem 0 0.85rem 1.75rem;
  border-bottom: 1px solid var(--hair);
}

.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.3rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid var(--ink);
}
.list-done li::before { background: var(--ink); }

/* Narrow screens */

@media (max-width: 52rem) {
  .plate {
    --box-h: min(88vw, 24rem);
    grid-template-columns: minmax(0, 1fr);
  }
  .box {
    order: -1;
    margin-inline: auto;
  }
  .lead { display: none; }
  .note {
    margin: 1.75rem 0 0;
    padding-inline: 0;
  }
  .note-laptop { justify-items: start; }
  .note-title,
  .note-text { width: min(100%, 32rem); }

  /* Without the hairlines, a swatch says which face a note describes. */
  .note-title::before {
    content: "";
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin-right: 0.5em;
    background: var(--ink);
  }
  .note-laptop .note-title::before {
    background: url("/assets/paint-1024.webp") 30% 40% / 900% no-repeat;
  }

  .hero-foot { grid-template-columns: minmax(0, 1fr); }

  .wire-row { grid-template-columns: minmax(0, 1fr); }

  .cols { grid-template-columns: minmax(0, 1fr); }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .table tr {
    display: block;
    padding-block: 1rem;
    border-bottom: 1px solid var(--hair);
  }
  .table tbody tr:first-child { border-top: 1px solid var(--ink); }
  .table th,
  .table td {
    display: block;
    width: auto;
    padding: 0.15rem 0;
    border: 0;
  }
  .table tbody th { width: auto; }
  .table td::before {
    content: attr(data-label) ": ";
    color: var(--mute);
  }
}
