/* SPDX-License-Identifier: Apache-2.0 */
/* Etsah website. Identity: docs/design/IDENTITY.md (Graphite and cobalt, lines only, words with a rule). */

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

:root {
  --graphite: #16171A;
  --raised: #222429;
  --offwhite: #F2F3F5;
  --cobalt: #2F5BFF;
  --haze: #A3A7B0;
  --rule: rgba(242, 243, 245, .28);
  --rail: 232px;
  /* Spacing: one fluid scale, used for every margin, padding and gap below. Each step grows with the window. */
  --s1: .25rem;                                   /* 4 */
  --s2: .5rem;                                    /* 8 */
  --s3: clamp(.75rem, .65rem + .3vw, 1rem);       /* 12 to 16 */
  --s4: clamp(1rem, .85rem + .5vw, 1.5rem);       /* 16 to 24 */
  --s5: clamp(1.5rem, 1.15rem + 1.1vw, 2.25rem);  /* 24 to 36: the heading gap and the gap between blocks */
  --s6: clamp(2.5rem, 1.8rem + 2.2vw, 4.5rem);    /* 40 to 72: the section gap */
  --s7: clamp(3.5rem, 2.2rem + 4.4vw, 7.5rem);    /* 56 to 120: above the opening */
  --gutter: clamp(1.25rem, .5rem + 3.5vw, 4rem);  /* 20 to 64: either side of the column */
  --col: 48rem;                                   /* the one content column; every block and rule spans it */
  --tabs: 3.5rem;                                 /* the phone's bottom tabs */
  /* Archivo Black is not in this folder yet; Archivo at 900 stands in for display (see README.md). */
  --display: "Archivo Black", "Archivo", system-ui, sans-serif;
  --reading: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--s4); }

body {
  margin: 0;
  color: var(--offwhite);
  background-color: var(--graphite);
  font: 400 16px/1.6 var(--reading);
  -webkit-text-size-adjust: 100%;
}

/* The painting, fixed behind the content, the bench low on the left, under a graphite layer. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(22, 23, 26, .78), rgba(22, 23, 26, .78)),
    url("img/background-1536.webp") left bottom / cover no-repeat,
    var(--graphite);
}

@media (max-width: 800px) {
  body::before {
    background:
      linear-gradient(rgba(22, 23, 26, .78), rgba(22, 23, 26, .78)),
      url("img/background-800.webp") left bottom / cover no-repeat,
      var(--graphite);
  }
}

h1, h2 { font-family: var(--display); font-weight: 900; margin: 0; letter-spacing: -.01em; }
/* The type scale of IDENTITY.md (72, 40, 30, 24, 18), reached at desktop and eased down between. */
h1 { font-size: clamp(2.5rem, 1.75rem + 3.2vw, 4.5rem); line-height: 1.02; max-width: 12ch; }
h2 { font-size: clamp(1.875rem, 1.6rem + 1vw, 2.5rem); line-height: 1.1; }
p { margin: 0 0 var(--s4); max-width: 65ch; }

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

.label {
  font-size: 13px;
  font-weight: 700;
  color: var(--haze);
  margin: 0 0 var(--s2);
}
.label-cobalt { color: var(--offwhite); }
.lead { font-size: clamp(1.125rem, .95rem + .7vw, 1.5rem); line-height: 1.45; margin-top: var(--s5); }

/* ------------------------------------------------------------ the rail of places */

.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail);
  padding: var(--s5) var(--s4);
  display: flex;
  flex-direction: column;
}
.rail a {
  display: flex;
  align-items: center;
  min-height: 48px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.rail-name { font-family: var(--display); font-weight: 900; font-size: 30px; margin-bottom: var(--s4); }
.rail-place { font-size: 16px; font-weight: 600; color: var(--haze); }
.rail-place:hover { color: var(--offwhite); }

/* The rail's line is main's left edge, so it runs the full height of the page, not only the first screen. */
main { margin-left: var(--rail); padding: 0 var(--gutter) var(--s6); min-height: 100vh; border-left: 1px solid var(--rule); }

/* One column, centred in the room right of the rail. Every block, rule and divider shares its two edges. */
.opening, section, .foot { width: min(100%, var(--col)); margin-inline: auto; }

.opening { padding: var(--s7) 0 var(--s6); border-bottom: 1px solid var(--rule); }

section { padding: var(--s6) 0; border-bottom: 1px solid var(--rule); }
section > h2, section > .decision { margin-bottom: var(--s5); }
.opening > :last-child, section > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ words with a rule */

.actions { margin-top: var(--s5); }
.act {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: var(--s2) 0;
  font-size: clamp(1.125rem, .95rem + .7vw, 1.5rem);
  font-weight: 700;
  text-decoration: none;
  color: var(--offwhite);
  border-bottom: 1px solid var(--rule);
}
.act + .act { margin-top: var(--s2); }
.act-main { color: var(--cobalt); border-bottom: 2px solid var(--cobalt); }
.act-quiet { color: var(--haze); font-size: clamp(1rem, .95rem + .25vw, 1.125rem); }
.arrow { margin-left: var(--s3); font-weight: 400; }
.act:hover .arrow { transform: translateX(4px); }

/* ------------------------------------------------------------ what it is */

.steps { list-style: none; margin: var(--s5) 0; padding: 0; }
.steps li {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: var(--s3);
  padding: var(--s4) 0;
  border-top: 1px solid var(--rule);
}
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.step-n { font-family: var(--display); font-weight: 900; font-size: 30px; line-height: 1; grid-row: span 2; }
.step-t { font-size: 18px; font-weight: 700; }
.step-d { color: var(--offwhite); }

/* ------------------------------------------------------------ the ruling */

.sample-mark {
  display: flex;
  gap: var(--s3);
  align-items: baseline;
  max-width: none;
  padding: var(--s3) 0;
  border-top: 2px solid var(--offwhite);
  border-bottom: 1px solid var(--rule);
  font-size: 16px;
}
.sample-word {
  font-family: var(--display);
  font-weight: 900;
  font-size: 18px;
  flex: none;
}

/* Five seats on a half circle around (50%, 84%), the open side down, symmetric about the column's centre.
   The dissenter, the middle seat, steps forward out of line into the open side and leaves its place empty. */
.bench { position: relative; width: min(100%, 30rem); aspect-ratio: 2 / 1; margin: var(--s5) auto var(--s6); }
.seat {
  position: absolute;
  width: 16%;
  height: auto;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.s1 { left: 16%; top: 84%; }
.s2 { left: 26%; top: 35.9%; }
.s3 { left: 50%; top: 16%; }
.s4 { left: 74%; top: 35.9%; }
.s5 { left: 84%; top: 84%; }
.seat.dissent { left: 50%; top: 62%; outline: 2px solid var(--cobalt); outline-offset: 3px; animation: step-out .9s ease-out .4s both; }
@keyframes step-out { from { top: 16%; } to { top: 62%; } }

.decision { display: flex; gap: var(--s4); align-items: center; }
.cover { width: 120px; height: 60px; object-fit: cover; flex: none; }
.question { font-size: clamp(1.125rem, .95rem + .7vw, 1.5rem); line-height: 1.35; font-weight: 600; margin: 0; }

.ruling > .label { margin-top: var(--s5); }
.verdict { font-size: clamp(1.125rem, .95rem + .7vw, 1.5rem); line-height: 1.45; max-width: none; border-left: 2px solid var(--offwhite); padding-left: var(--s4); }

.dissent-block { margin: var(--s5) 0; border-left: 2px solid var(--cobalt); padding-left: var(--s4); }
.dissent-block > :last-child { margin-bottom: 0; }
.dissent-text { font-size: clamp(1rem, .95rem + .25vw, 1.125rem); }

.seats { list-style: none; margin: 0; padding: 0; }
.seats li {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  column-gap: var(--s3);
  align-items: center;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
}
.seats li:last-child { border-bottom: 1px solid var(--rule); }
.seats img { width: 48px; height: 48px; border-radius: 50%; grid-row: span 2; }
.seat-name { font-weight: 700; }
.seat-model { color: var(--haze); font-weight: 400; margin-left: var(--s3); }
.seat-state { font-size: 13px; font-weight: 700; }
.seat-line { grid-column: 2 / 4; color: var(--offwhite); }
.is-dissent img { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.is-dissent .seat-state { color: var(--offwhite); border-bottom: 2px solid var(--cobalt); }

/* ------------------------------------------------------------ keys and privacy */

.facts { margin: 0; }
.facts dt { font-size: 18px; font-weight: 700; padding-top: var(--s4); border-top: 1px solid var(--rule); }
.facts dd { margin: var(--s2) 0 var(--s4); max-width: 65ch; }
.facts dd:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ download */

.cmd {
  margin: var(--s4) 0;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font: 16px/1.6 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.foot { padding: var(--s5) 0 0; color: var(--haze); font-size: 13px; }
.foot p { margin: 0; }

.tabs { display: none; }

/* ------------------------------------------------------------ phone */

@media (max-width: 800px) {
  .rail { display: none; }
  /* The tabs are fixed along the bottom: leave their height, the safe area and a section gap below the footer. */
  main { margin-left: 0; border-left: 0; padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + var(--s6)); }
  .decision { gap: var(--s3); }
  .cover { width: 96px; height: 48px; }
  .sample-mark { flex-direction: column; gap: var(--s1); }

  .tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--graphite);
    border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tabs);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--offwhite);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .seat.dissent { animation: none; }
  .act:hover .arrow { transform: none; }
}
