/* dws.rip, dns.dws.rip, ntp.dws.rip, on Skiff, Amidol and Research's frame. Two halves: words on
   white in one mono, figure plates on the grey. Plates sit straight, like DWS Research's.

   ┌──────────── row ────────────┬──────────────────────────────┐
   │ .txt   mono, tables, config │ .pics  .plate                 │
   │                             │        .plate  (straight)     │
   └─────────────────────────────┴──────────────────────────────┘

   One copy of this file ships into each site's root (deploy.sh). */

@font-face {
  font-family: "DWS Mono";
  src: url("/fonts/dwsmono-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "DWS Mono";
  src: url("/fonts/dwsmono-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --side: #f2f1ee;
  --ink: #161616;
  --mute: #8f8c86;
  --rule: #c9c6bf;
  --hair: #e8e6e1;
  --edge: rgb(20 20 20 / 0.1);
  --shadow: 0 1px 2px rgb(20 20 20 / 0.05), 0 18px 36px -24px rgb(20 20 20 / 0.3);

  /* One accent, the anycast dot in the icons: green, as in "up". */
  --accent: #1f7a4a;
  --accent-soft: #dcefe0;

  --mono: "DWS Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(20px, 2.6vw, 36px);
  --gap: clamp(40px, min(8vw, 11vh), 112px);

  color-scheme: light;
}

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

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: clip;
  margin: 0;
  background: linear-gradient(90deg, var(--paper) 50%, var(--side) 50%);
  color: var(--ink);
  /* Type grows with the window, same curve as Skiff, Amidol and Research. */
  font: 400 clamp(15px, 0.9vw + 6.5px, 26px)/1.7 var(--mono);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  text-decoration-color: var(--rule);
}

a:hover {
  text-decoration-color: currentColor;
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
pre {
  margin: 0 0 1.4em;
}

h1,
h2,
h3 {
  font: inherit;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
}

.skip:focus {
  top: 12px;
}

/* ── Rows: words left, plates right ──────────────────────── */

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

.txt {
  padding: var(--gap) var(--pad) 0;
}

.txt > * {
  max-width: 54ch;
}

.txt > .tbl,
.txt > .svc,
.txt > pre,
.txt > .topbar {
  max-width: 66ch;
}

.pics {
  display: flex;
  flex-direction: column;
  gap: var(--pad);
  padding: var(--gap) var(--pad) 0;
}

.foot .txt {
  padding-bottom: var(--gap);
}

/* ── Top: name and nav ───────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  max-width: none !important;
  margin: calc(var(--pad) - var(--gap)) 0 clamp(40px, min(9vw, 10vh), 120px);
}

.topbar .name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
}

.topbar .name img {
  width: 1.45em;
  height: 1.45em;
  border-radius: 22%;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 22px;
  color: var(--mute);
}

.topbar nav a {
  text-decoration: none;
}

.topbar nav a:hover,
.topbar nav a[aria-current] {
  color: var(--ink);
}

/* Setup dropdown: a <details> panel of anchors, same as Research's Projects menu.

   Setup ▾
   ┌──────────────┐
   │ Linux        │
   │ Android      │
   └──────────────┘ */
.menu {
  position: relative;
}

.menu summary {
  display: block;
  list-style: none;
  cursor: pointer;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu summary::after {
  content: " ▾";
  font-size: 0.8em;
}

.menu summary:hover,
.menu[open] summary {
  color: var(--ink);
}

.topbar .menu ul {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  min-width: 18ch;
  margin: 0;
  padding: 0.6em 0;
  list-style: none;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.topbar .menu li {
  margin: 0;
  padding: 0;
}

.topbar .menu li::before {
  content: none;
}

.topbar .menu a {
  display: block;
  padding: 0.15em 1.2em;
  white-space: nowrap;
}

/* ── Text pieces ─────────────────────────────────────────── */

.lede {
  font-size: 1.12em;
  line-height: 1.6;
}

h2 .n,
.mute {
  color: var(--mute);
}

h2 .n {
  margin-right: 1ch;
}

.txt h3 {
  margin: 1.6em 0 0.4em;
  color: var(--mute);
}

/* A row that continues the section above starts on its h3. */
.txt > h3:first-child {
  margin-top: 0;
}

.txt ul {
  padding-left: 0;
  list-style: none;
}

.txt ul li {
  position: relative;
  padding-left: 2.6ch;
}

.txt ul li::before {
  content: "•";
  position: absolute;
  left: 1ch;
}

.txt li {
  margin-bottom: 0.2em;
}

code,
kbd {
  font: inherit;
}

code {
  padding: 0 0.3em;
  background: var(--side);
  border-radius: 3px;
}

/* Config files and commands, in a grey box so they read as "paste this". */
pre {
  overflow-x: auto;
  padding: 0;
  font: inherit;
  font-size: 0.92em;
  line-height: 1.55;
}

pre.box {
  padding: 16px 18px;
  background: var(--side);
  border-radius: 6px;
}

.fine {
  color: var(--mute);
  font-size: 0.86em;
}

/* Tags: a yes, a no, a role. */
.tag {
  display: inline-block;
  padding: 0 0.5em;
  border-radius: 4px;
  font-size: 0.86em;
  line-height: 1.7;
  white-space: nowrap;
}

.tag.on { background: var(--accent-soft); color: var(--accent); }
.tag.off { background: var(--side); color: var(--mute); }

/* Services: name on the left, what it is on the right.

   dns.dws.rip     Free recursive DNS with ad blocking. ...
   ntp.dws.rip     Public NTP with NTS authentication. ... */
.svc {
  display: grid;
  gap: 1em;
}

.svc div {
  display: grid;
  grid-template-columns: 15ch minmax(0, 1fr);
  gap: 2ch;
}

.svc dd {
  margin: 0;
}

/* Spec list: label left, value right. */
.spec {
  display: grid;
  grid-template-columns: 13ch minmax(0, 1fr);
  gap: 0.25em 2ch;
}

.spec dt {
  color: var(--mute);
}

.spec dd {
  margin: 0;
}

/* Table of contents on the legal pages: two columns of anchors. */
.toc {
  columns: 2;
  column-gap: 3ch;
}

.toc li {
  break-inside: avoid;
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* Plain tables. */
.tbl {
  overflow-x: auto;
  margin: 0 0 1.4em;
}

.tbl table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.tbl th,
.tbl td {
  padding: 0.45em 1.5ch 0.45em 0;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  vertical-align: top;
}

.tbl th {
  color: var(--mute);
  font-weight: 400;
}

/* ── Plates: figures on the grey, straight ───────────────── */

.plate {
  width: min(100%, 860px);
  margin: 0;
  padding: clamp(16px, 1.6vw, 28px);
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.plate figcaption {
  margin-top: 1em;
  color: var(--mute);
  font-size: 0.78em;
  line-height: 1.55;
}

.plate figcaption b {
  font-weight: 400;
  color: var(--ink);
}

.plate .spec,
.plate pre {
  margin: 0;
  font-size: 0.86em;
}

.plate .chart + .spec {
  margin-top: 1.4em;
}

.plate .tbl {
  margin: 0;
}

/* Big numbers, two across. */
.figs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2em 2ch;
  margin: 0;
}

.figs div {
  display: grid;
  gap: 0.1em;
}

.figs dt {
  order: 2;
  color: var(--mute);
  font-size: 0.8em;
}

.figs dd {
  margin: 0;
  font-size: 1.9em;
  line-height: 1.15;
}

/* Steps: a number and what happens there, top to bottom. A query's path, a stratum ladder.

   1  you
   2  dnsdist     <- .here gets the accent
   3  Unbound */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 2.5ch minmax(0, 1fr);
  gap: 2ch;
  align-items: baseline;
  padding: 0.7em 0;
  border-bottom: 1px solid var(--hair);
}

.steps li:first-child {
  padding-top: 0;
}

.steps b {
  font-weight: 400;
  font-size: 1.9em;
  line-height: 1;
}

.steps .here b {
  color: var(--accent);
}

.steps small {
  display: block;
  color: var(--mute);
  font-size: 0.8em;
}

/* Charts are inline SVG so they get the page's font. Sizes are SVG user units. */
.chart {
  width: 100%;
  font-family: var(--mono);
}

.chart text { fill: var(--ink); font-size: 15px; }
.chart .m { fill: var(--mute); }
.chart .s { font-size: 13px; }
.chart .ac { fill: var(--accent); }
.chart .ln { stroke: var(--rule); stroke-width: 1.5; fill: none; }
.chart .ring-ac { fill: var(--paper); stroke: var(--accent); stroke-width: 2; }

/* ASCII art keeps its spacing, centred in its plate. cats.js animates the ones with data-cat. */
.plate pre.art {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  overflow-x: auto;
  font-size: 1.15em;
  line-height: 1.25;
}

.plate pre.art + .spec {
  margin-top: 1.2em;
}

/* An app icon at the start of a heading. */
.ico {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.8ch;
  vertical-align: -0.4em;
  border-radius: 22%;
}

/* App cards: icon, name, platform. Two across.

   [icon]        [icon]
   Skiff         Amidol
   macOS         iPhone */
.apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2ch;
  margin: 0;
}

.apps a {
  display: grid;
  gap: 0.5em;
  justify-items: start;
  text-decoration: none;
}

.apps img {
  width: min(96px, 100%);
  border-radius: 22%;
  box-shadow: var(--shadow);
}

.apps small {
  display: block;
  color: var(--mute);
  font-size: 0.8em;
}

/* Screenshots. A pair gets columns in proportion to its aspect ratios so both end up the same height. */
.shot {
  display: grid;
  gap: clamp(12px, 1.4vw, 20px);
  align-items: end;
}

.shot img {
  width: 100%;
  border-radius: 6px;
}

.shot.amidol {
  grid-template-columns: 46fr 67fr;
}

.shot.amidol img:first-child {
  border-radius: 14px;
}

/* ── Footer ──────────────────────────────────────────────── */

.foot .txt {
  color: var(--mute);
  font-size: 0.86em;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0 0 1em;
  color: var(--ink);
}

.foot nav a {
  text-decoration: none;
}

.foot nav a:hover {
  text-decoration: underline;
}

/* ── Phones and narrow windows: one column, plates under their words ── */

@media (max-width: 900px) {
  body {
    background: var(--paper);
  }

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

  .txt {
    padding-top: 56px;
  }

  .topbar {
    margin-top: calc(var(--pad) - 56px);
    margin-bottom: 56px;
  }

  .pics {
    margin-top: 28px;
    padding: 32px var(--pad) 40px;
    background: var(--side);
  }

  .pics:empty {
    display: none;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14.5px;
  }

  .topbar nav .wide {
    display: none;
  }

  .svc div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1em;
  }

  .figs dd {
    font-size: 1.6em;
  }

  .plate pre.art {
    font-size: 0.92em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
