/* Project site. Left-aligned, one column of reading width, wide figures. */

code {
  font-family: inherit;
  font-weight: 600;
  background: var(--ink-raised);
  padding: 0.05em 0.35em;
  border-radius: 2px;
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 1rem 2rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px var(--gutter);
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--paper);
}

.lockup:hover {
  color: var(--paper);
}

.lockup__mark {
  width: 26px;
  height: 26px;
  fill: var(--signal);
}

.lockup__word {
  height: 22px;
  width: auto;
  aspect-ratio: 134 / 28;
  fill: currentColor;
}

.top__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-left: auto;
}

.top__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-weight: 500;
  color: var(--paper-dim);
}

.top__nav a:hover {
  color: var(--paper);
}

.top__badge {
  flex: none;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 2rem 4rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3rem, 9vw, 7rem) var(--gutter) clamp(3rem, 8vw, 6rem);
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, var(--t-72));
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 13ch;
}

.hero__lede {
  max-width: var(--measure);
  margin-top: 1.5rem;
  font-size: var(--t-18);
  color: var(--paper-dim);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.75rem;
  font-size: var(--t-14);
  color: var(--paper-dim);
}

.hero__mark {
  margin: 0;
  justify-self: end;
  width: min(100%, 26rem);
}

.hero__mark svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: var(--signal);
}

.hero__mark .flap {
  fill: var(--paper);
}

/* The one orchestrated moment: four corners fold in once, then the flaps turn over. */
@media (prefers-reduced-motion: no-preference) {
  .fold {
    animation: fold-in 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .fold--tl { --dx: -4px; --dy: -4px; animation-delay: 80ms; }
  .fold--tr { --dx: 4px; --dy: -4px; animation-delay: 160ms; }
  .fold--br { --dx: 4px; --dy: 4px; animation-delay: 240ms; }
  .fold--bl { --dx: -4px; --dy: 4px; animation-delay: 320ms; }

  .flap {
    transform-box: fill-box;
    animation: flap-turn 520ms cubic-bezier(0.3, 0.7, 0.2, 1) both;
    animation-delay: 900ms;
  }

  .fold--tl .flap { transform-origin: top left; }
  .fold--tr .flap { transform-origin: top right; animation-delay: 980ms; }
  .fold--br .flap { transform-origin: bottom right; animation-delay: 1060ms; }
  .fold--bl .flap { transform-origin: bottom left; animation-delay: 1140ms; }
}

@keyframes fold-in {
  from {
    opacity: 0;
    transform: translate(var(--dx), var(--dy));
  }
}

@keyframes flap-turn {
  from {
    transform: scale(0);
  }
}

/* ---------- Sections ---------- */

.section {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
  border-top: 1px solid var(--line);
}

.section__intro {
  max-width: var(--measure);
  margin-bottom: 2.5rem;
}

.section__intro h2 {
  font-size: clamp(2rem, 4.2vw, var(--t-48));
  margin-bottom: 1rem;
}

.section__intro p {
  color: var(--paper-dim);
  font-size: var(--t-18);
}

/* ---------- Byte rulers ---------- */

.ruler-figure {
  margin: 0 0 3rem;
}

.ruler-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 0.75rem;
}

.ruler-figure__title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: var(--t-21);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  color: var(--paper-dim);
  font-size: var(--t-14);
}

.key {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 0.6rem;
}

.key--frame { background: var(--line-strong); }
.key--id { background: var(--paper); }
.key--time { background: var(--signal); }

.ruler {
  display: grid;
  gap: 2px;
  height: 56px;
}

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

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

.seg {
  grid-column: span var(--w);
  display: flex;
  align-items: flex-end;
  min-width: 0;
  padding: 0 0 0.4rem 0.45rem;
  overflow: hidden;
  font-size: var(--t-12);
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

/* The first segment of each figure carries the fold. */
.seg:first-child {
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

.seg--frame {
  background: var(--line-strong);
  color: var(--paper);
}

.seg--id {
  background: var(--paper);
  color: var(--ink);
}

.seg--time {
  background: var(--signal);
  color: var(--ink);
}

.ruler-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  color: var(--paper-dim);
  font-size: var(--t-12);
  font-variant-numeric: tabular-nums;
}

.ruler-figure__note {
  max-width: var(--measure);
  margin-top: 1rem;
  color: var(--paper-dim);
}

.bytes {
  width: 100%;
  max-width: 48rem;
  margin-top: 1.5rem;
  border-collapse: collapse;
  font-size: var(--t-14);
}

.bytes th,
.bytes td {
  padding: 0.45rem 1rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.bytes th {
  color: var(--paper-dim);
  font-weight: 500;
}

.bytes td.num {
  width: 4.5rem;
  color: var(--paper-dim);
}

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1.5rem 3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  padding-top: 0.9rem;
  border-top: 2px solid var(--signal);
  color: var(--paper-dim);
}

.rules strong {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--font-brand);
  font-size: var(--t-21);
  line-height: 1.2;
  color: var(--paper);
}

/* ---------- Status ledger ---------- */

.ledger {
  width: 100%;
  border-collapse: collapse;
}

.ledger th,
.ledger td {
  padding: 1rem 1.5rem 1rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.ledger thead th {
  padding-top: 0;
  color: var(--paper-dim);
  font-size: var(--t-14);
  font-weight: 500;
}

.ledger tbody th {
  width: 38%;
  font-family: var(--font-brand);
  font-size: var(--t-18);
  font-weight: 600;
  line-height: 1.3;
}

.ledger td:last-child {
  color: var(--paper-dim);
}

/* ---------- Project family ---------- */

.family {
  margin: 0;
  border-top: 1px solid var(--line);
}

.family__row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 2fr;
  gap: 0.5rem 3rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.family dt {
  font-family: var(--font-brand);
  font-size: var(--t-24);
  font-weight: 700;
  line-height: 1.15;
}

.family dd {
  margin: 0;
  max-width: var(--measure);
  color: var(--paper-dim);
}

.family__row--self dt {
  color: var(--signal);
}

/* ---------- Dashboard teaser ---------- */

.dash-facts {
  display: grid;
  gap: 0.6rem;
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.dash-facts li {
  position: relative;
  padding-left: 1.4rem;
}

.dash-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  background: var(--signal);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.section--dash p:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Footer ---------- */

.foot {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem 3rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) max(3rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--paper-dim);
  font-size: var(--t-14);
}

.foot__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.foot__mark {
  width: 20px;
  height: 20px;
  flex: none;
  fill: var(--signal);
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.foot__fine {
  grid-column: 1 / -1;
  max-width: 48rem;
}

/* Short segments lose their labels before they would clip; the table names them. */
@media (max-width: 1000px) {
  .seg--short {
    font-size: 0;
  }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero__mark {
    grid-row: 1;
    justify-self: start;
    width: 9rem;
  }

  .family__row {
    grid-template-columns: 1fr;
  }

  .foot {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .top {
    flex-wrap: wrap;
  }

  .top__nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .top__badge {
    margin-left: auto;
  }

  .ruler {
    height: 40px;
  }

  .seg {
    font-size: 0;
    padding: 0;
  }

  .ledger thead {
    display: none;
  }

  .ledger tr {
    display: grid;
    gap: 0.4rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
  }

  .ledger th,
  .ledger td {
    width: auto;
    padding: 0;
    border: 0;
  }
}
