/* Echo Random -- site styles.
   One stylesheet, no build step, no external requests, no webfonts.
   Webfonts are deliberately omitted: a font CDN is a third-party request and
   this site makes none. System stacks only.

   The look is a printed comic: ink on warm paper, products in ink-ruled
   panels. The colours come from the Mesmers palette
   (jesselucas.com/post/145939534578/mesmers), plus one accent, green.

   Rules never name a palette colour: they use the roles below (--bg,
   --text, --accent, ...), and each role points at the palette once, here.
   To recolour the site, change a role, not the rules. Each product owns one
   fill (--hue) and the text colour that reads on that fill (--on-hue); the
   pairs were picked by contrast, so swap them as pairs.

   The mark (img/mark.svg) is a standalone file and cannot read these
   variables; its colours are repeated there and must be changed by hand. */

:root {
  /* Mesmers */
  --paper:   #e5d0ba;
  --taupe:   #928070;
  --salmon:  #e19c7b;
  --olive:   #a1a08f;
  --plum:    #584d53;
  --ink:     #201c1c;
  --rust:    #8d4138;
  --ochre:   #b77936;
  --teal:    #316b81;
  /* the one colour not from Mesmers */
  --green:   #45926e;

  /* roles */
  --bg:        var(--paper);
  --text:      var(--ink);
  --text-soft: var(--plum);      /* 5.4:1 on paper; one secondary text color */
  --text-faint: var(--plum);
  --link:      var(--rust);      /* 4.8:1 on paper */
  --rule:      color-mix(in srgb, var(--text) 22%, transparent);
  --frame:     var(--ink);       /* panel borders and rules */
  --shadow:    var(--ink);       /* hard offset shadows */
  --accent:     var(--green);     /* the mark, current page, beta dot, selection */
  --accent-alt: var(--teal);     /* the mark's middle ring */
  --on-accent:  var(--ink);      /* text on an accent fill */
  --callout:    var(--salmon);   /* the beta / buy box */
  --on-callout: var(--ink);
  --screen:     #000;            /* watch glass */
  --bezel:      var(--plum);     /* watch case inner edge */
  --todo:       var(--ochre);    /* unfinished-copy marker */
  --hue:        var(--accent);
  --on-hue:     var(--on-accent);

  --measure: 40rem;
  --wide:    68rem;
  --line:    2px;                /* panel border, like an inked frame */

  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
           "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

/* Dark: the same comic printed in reverse -- paper-coloured line work on
   ink. Text roles are re-picked from the palette for contrast on ink. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         var(--ink);
    --text:       var(--paper);
    --text-soft:  var(--olive);  /* 6.4:1 on ink */
    --text-faint: var(--olive);
    --link:       var(--salmon); /* 7.4:1 on ink */
    --frame:      var(--paper);
    --shadow:     var(--taupe);
  }
}

/* Product fills. */
.hue-roche   { --hue: var(--rust);   --on-hue: var(--paper); }
.hue-nein    { --hue: var(--plum);   --on-hue: var(--paper); }
.hue-hanoi   { --hue: var(--ochre);  --on-hue: var(--ink); }
.hue-weather { --hue: var(--olive);  --on-hue: var(--ink); }
.hue-moji    { --hue: var(--taupe);  --on-hue: var(--ink); }
.hue-reader  { --hue: var(--salmon); --on-hue: var(--ink); }

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

::selection { background: var(--accent); color: var(--on-accent); }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: var(--text); color: var(--bg); }

/* ---- layout ------------------------------------------------------------- */

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap--wide { max-width: var(--wide); }

/* Reading pages (contact, legal, manual) share the wide frame, so the masthead
   and the text line up with every other page, but keep each block to a
   readable measure. */
.wrap--text > * { max-width: var(--measure); }

/* The same breathing room above the footer rule as below the masthead rule
   (.masthead's margin-bottom). Scoped to main.wrap because .wrap's padding
   shorthand would otherwise reset it. */
main.wrap { padding-bottom: 3.5rem; }

/* ---- masthead ----------------------------------------------------------- */

.masthead {
  border-bottom: var(--line) solid var(--frame);
  padding: 1.4rem 0 1.15rem;
  margin-bottom: 3.5rem;
}

.masthead__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark::before {
  content: "";
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  background: url("img/mark.svg") center / contain no-repeat;
}

.wordmark:hover { color: var(--link); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav a {
  color: var(--text-faint);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: var(--line) solid transparent;
}

.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---- type --------------------------------------------------------------- */

h1, h2 { font-family: var(--serif); font-weight: 700; }

h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 3.5rem 0 0.9rem;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 2rem 0 0.5rem;
}

p { margin: 0 0 1.1rem; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

.lede {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-soft);
  max-width: 36rem;
  margin-bottom: 2.5rem;
}

.meta {
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* Small uppercase monospace: catalog numbers, kinds, section labels. */
.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

hr {
  border: 0;
  border-top: var(--line) solid var(--frame);
  margin: 3rem 0;
}

ul, ol { padding-left: 1.25rem; margin: 0 0 1.1rem; }
li { margin-bottom: 0.35rem; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  /* anywhere, not break-word: a long path must also stop widening its box
     (min-content), or it pushes the page past a phone's width. */
  overflow-wrap: anywhere;
}

/* A block of paths keeps its line breaks, so on a phone it scrolls inside its
   own box rather than widening the page. */
pre { overflow-x: auto; }
pre code { overflow-wrap: normal; }

/* A shell command is long enough that inline wrapping collides with the text
   after it -- a padded inline box breaks across lines badly. Give code inside
   a callout its own line and let it scroll. */
.todo code,
.spec code {
  display: block;
  margin: 0.6rem 0;
  padding: 0.55rem 0.7rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- home: hero --------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2rem;
  padding-bottom: 3.5rem;
  border-bottom: var(--line) solid var(--frame);
}

.hero h1 { max-width: 11em; }
.hero .lede { margin-bottom: 0; }

/* The echo mark, animated: the same drawing as img/mark.svg, inline so its
   ink can follow the theme. Each ring grows out of the source to exactly
   where it sits in the mark -- scaling from the source point, so a ring's
   centre drifts off the source as it grows, just as the mark's do -- holds,
   and fades, one echo after another. The resting frame is the mark, so
   under reduced motion the animation simply is the logo. CSS only. */
.echo {
  width: clamp(9rem, 22vw, 15rem);
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
}

.echo__src  { fill: var(--accent); stroke: var(--frame); }
.echo__ring--1 { stroke: var(--frame); }
.echo__ring--2 { stroke: var(--accent-alt); }
.echo__ring--3 { stroke: var(--accent); }

.echo__ring,
.echo__src {
  transform-box: view-box;
  transform-origin: 13px 19px;          /* the source, in mark coordinates */
}

@media (prefers-reduced-motion: no-preference) {
  .echo__ring { animation: echo 5.4s cubic-bezier(0.2, 0.7, 0.3, 1) infinite both; }
  .echo__ring--2 { animation-delay: 0.45s; }
  .echo__ring--3 { animation-delay: 0.9s; }
  .echo__src { animation: ping 5.4s ease-out infinite; }
}

@keyframes echo {
  0%   { transform: scale(0.3); opacity: 0; }
  6%   { opacity: 1; }
  24%  { transform: scale(1); }
  72%  { transform: scale(1); opacity: 1; }
  88%, 100% { transform: scale(1); opacity: 0; }
}

@keyframes ping {
  0%   { transform: scale(1); }
  5%   { transform: scale(1.35); }
  16%, 100% { transform: scale(1); }
}

/* ---- home: catalog ------------------------------------------------------ */

.shelf { margin-top: 4rem; }

.shelf__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
}

.shelf__head h2 { margin: 0; }
.shelf__head h2 a { color: inherit; text-decoration: none; }
.shelf__head h2 a:hover { color: var(--link); }

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

.card { margin: 0; }

/* A comic panel: inked frame, art on top, caption box below. */
.card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  border: var(--line) solid var(--frame);
  color: inherit;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.card > a:hover {
  transform: translate(-3px, -3px);
  box-shadow: 4px 4px 0 var(--shadow);
}

.card__art {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--hue);
  border-bottom: var(--line) solid var(--frame);
  overflow: hidden;
}

.card__art > img,
.card__art > svg { width: 100%; height: 100%; object-fit: cover; }

.card__art > .watch { width: 52%; }

.card__body { padding: 0.9rem 1.1rem 1.2rem; }

/* Tag, then status on its own line, on every card: side by side they wrapped
   or not depending on the tag's length, so cards did not match. */
.card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

/* Catalog number on its product's fill, like a colour-keyed tab. */
.card__no,
.feature__no {
  display: inline-block;
  white-space: nowrap;           /* a catalog number never breaks */
  background: var(--hue);
  color: var(--on-hue);
  padding: 0.2rem 0.5rem;
  border: 1.5px solid var(--frame);
}

.card__name {
  display: block;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.card__line { color: var(--text-soft); font-size: 0.95rem; line-height: 1.5; margin: 0; }

/* ---- status ------------------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.status--beta { color: var(--text); }
.status--beta::before { background: var(--accent); border-color: var(--frame); }

/* ---- watch frame -------------------------------------------------------- */

/* Screenshots of watch apps sit in a drawn watch: a thin case around black
   glass, with the screen filling it the way a real display does. The case
   and the screenshot share the display's 416:496 shape, and the black bezel
   is the margin -- the screenshot is never padded or squeezed. */
.watch {
  aspect-ratio: 416 / 496;
  padding: 4%;
  border-radius: 24% / 20%;
  background: var(--screen);
  border: var(--line) solid var(--frame);
  box-shadow:
    inset 0 0 0 3px var(--bezel),
    5px 5px 0 color-mix(in srgb, var(--shadow) 45%, transparent);
}

.watch img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 19% / 16%;
  background: var(--screen);
}

/* ---- section pages (audio, apps) ---------------------------------------- */

.page-head { max-width: 42rem; }

.page-head .label { display: block; margin-bottom: 1rem; color: var(--link); }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding: 3.5rem 0;
  border-top: var(--line) solid var(--frame);
  scroll-margin-top: 1rem;
}

.feature:nth-of-type(even) .feature__art { order: 2; }

.feature__art {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: var(--line) solid var(--frame);
  background: var(--hue);
  box-shadow: 6px 6px 0 var(--shadow);
  overflow: hidden;
}

.feature__art > img,
.feature__art > svg { width: 100%; height: 100%; object-fit: cover; }
.feature__art > .watch { width: 52%; }

/* On the audio page the art also opens the product page, like the title. The
   link is a blank overlay kept out of the tab order and away from screen
   readers (the title is the accessible link), so the image keeps its alt. */
.feature__art--link {
  position: relative;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.feature__art--link:hover {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 var(--shadow);
}
.feature__link { position: absolute; inset: 0; }

.feature__no { margin-bottom: 0.8rem; }

.feature h2 { margin: 0 0 0.35rem; font-size: 2.2rem; letter-spacing: -0.02em; }
.feature h2 a { color: inherit; text-decoration: none; }
.feature h2 a:hover { color: var(--link); }

.feature__line { font-size: 1.1rem; color: var(--text-soft); margin-bottom: 1rem; }

.feature__status { margin-bottom: 1.25rem; }

.feature .spec { font-size: 0.85rem; margin-top: 1.25rem; }

/* Kept for pages that still use the plain list layout. */
.plugin__line { font-size: 1.05rem; color: var(--text-soft); margin-bottom: 0.9rem; }

/* ---- product page media ------------------------------------------------- */

.demos { list-style: none; padding: 0; margin: 0 0 1.5rem; }

.demos li {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.demos li:last-child { border-bottom: 1px solid var(--rule); }
.demos p { margin-bottom: 0.6rem; }
.demos audio { width: 100%; }

.shot { margin: 0 0 1.5rem; }

.shot img {
  width: min(100%, 470px);
  height: auto;
  border: var(--line) solid var(--frame);
  box-shadow: 6px 6px 0 var(--shadow);
}

.shot figcaption { margin-top: 0.9rem; }

/* ---- spec table --------------------------------------------------------- */

.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 1.5rem;
}

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

.spec th {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  width: 9rem;
  padding-top: 0.8rem;
}

/* ---- buy / callout ------------------------------------------------------ */

.buy {
  border: var(--line) solid var(--frame);
  background: var(--callout);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 1.75rem;
  margin: 2.5rem 0 3.5rem;
}

.buy, .buy p { color: var(--on-callout); }
.buy a:not(.button) { color: var(--on-callout); text-decoration-thickness: 1.5px; }

.buy__price {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.35rem;
}

.button {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: var(--line) solid var(--frame);
  background: var(--frame);
  color: var(--bg);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.button:hover {
  background: var(--accent);
  color: var(--on-accent);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--shadow);
}

/* ---- about -------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem 2.5rem;
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: var(--line) solid var(--frame);
}

.about h2 { margin: 0; font-size: 1.5rem; }
.about .label { display: block; margin-top: 0.4rem; }
.about p { font-size: 1.1rem; color: var(--text-soft); max-width: 38rem; }
.about p:first-child { color: var(--text); font-family: var(--serif); font-size: 1.35rem; line-height: 1.45; }

/* A TODO marker, visible on purpose so unfinished copy cannot ship unnoticed. */
.todo {
  display: block;
  border-left: 4px solid var(--todo);
  background: color-mix(in srgb, var(--todo) 14%, transparent);
  padding: 0.7rem 1rem;
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.todo::before {
  content: "TODO ";
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--link);
}

/* ---- footer ------------------------------------------------------------- */

.footer {
  border-top: var(--line) solid var(--frame);
  padding: 2.5rem 0 3.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.footer__nav a { color: var(--text-soft); text-decoration: none; }
.footer__nav a:hover { color: var(--text); }

/* ---- legal documents ---------------------------------------------------- */

.legal { font-size: 0.95rem; }
.legal h2 { font-size: 1.15rem; margin-top: 2.25rem; }
.legal ol { padding-left: 1.4rem; }
.legal ol > li { margin-bottom: 0.9rem; }

.legal .disclaimer {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

/* ---- narrow screens ----------------------------------------------------- */

@media (max-width: 44rem) {
  .hero { grid-template-columns: 1fr; }
  .echo { width: 8rem; order: -1; }
  .feature { grid-template-columns: 1fr; gap: 1.5rem; padding: 2.5rem 0; }
  .feature:nth-of-type(even) .feature__art { order: 0; }
  .about { grid-template-columns: 1fr; }
}
