/* RedPDF design system.
 *
 * The look: a mid grey ground with everything sitting on it as a raised
 * physical chip, lit from the top left. Monospace throughout, because the
 * product is about documents and precision, and because a technical typeface
 * is the trust signal for a privacy tool.
 *
 * Fonts are served from this domain. No font host, no CDN, nothing that
 * would need a hole in the content security policy.
 */

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: optional;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: optional;
}

/* Handjet carries the retro character. One variable file covers every
   weight, and it stays readable at heading sizes where a blockier pixel face
   becomes hard work. Small text stays in the mono. */
@font-face {
  font-family: "Handjet";
  src: url("/static/fonts/handjet-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  /* Not swap. swap paints the fallback at once and changes the text when the
     real face arrives, which on a hard reload is a visible jump in the logo
     and every heading. optional gives the font a brief window to arrive and
     then never swaps, so the text is painted once and stays put. Paired with
     a preload in the head, it wins that window on any normal connection. */
  font-display: optional;
}

:root {
  /* The ground everything sits on. Warm grey, not blue, so it reads as
     painted metal rather than screen. */
  --ground: #c9c7c4;
  --ground-low: #b4b2af;
  --chip: #cdcbc8;
  --chip-hover: #d3d1ce;
  --chip-press: #c0bebb;
  --inset: #b9b7b4;

  --ink: #201f1d;
  --ink-2: #4e4c48;
  --ink-3: #7b7873;
  --ink-4: #99958f;

  --accent: #c8452a;
  --accent-hi: #dc5637;
  --accent-low: #a53620;
  --on-accent: #fffaf8;

  /* The light comes from the top left, so highlights go up and left and
     shadows go down and right. Every raised surface uses the same pair. */
  --lit: rgba(255, 255, 255, 0.85);
  --shade: rgba(88, 84, 78, 0.32);
  --shade-soft: rgba(88, 84, 78, 0.18);

  --raise: -1px -1px 3px var(--lit), 2px 2px 5px var(--shade-soft);
  --raise-lg: -2px -2px 7px var(--lit), 4px 4px 11px var(--shade);
  --press: inset 2px 2px 4px var(--shade), inset -2px -2px 4px var(--lit);

  --r: 12px;
  --r-sm: 8px;
  --r-xs: 4px;

  /* Four sizes, and only four.
   *
   * Every piece of text on the site is one of these. The page had grown to
   * eight distinct sizes, most of them a step or two apart, which reads as
   * carelessness rather than hierarchy: the eye cannot tell a deliberate
   * difference from an accidental one when the gaps are that small.
   *
   * Display is the page title, heading is a section, body is everything you
   * read, small is everything that labels or reports. Anything that does not
   * fit one of those four is being asked to carry a distinction the design
   * does not actually make. */
  --text-display: clamp(2.5rem, 6vw, 4.5rem);
  --text-heading: clamp(1.75rem, 3vw, 2.375rem);
  --text-body: clamp(1.375rem, 1.5vw, 1.75rem);
  --text-small: 1.25rem;

  /* Rechroma is snappy at .15s, tonik is calm at .4s. This sits between. */
  --t: 0.18s ease;
  --t-slow: 0.3s ease;

  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas,
    monospace;
  --display: "Handjet", "IBM Plex Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #262523;
    --ground-low: #1b1a19;
    --chip: #2c2a28;
    --chip-hover: #333130;
    --chip-press: #232120;
    --inset: #1e1d1b;
    --ink: #ebe8e3;
    --ink-2: #b0aca6;
    --ink-3: #837f79;
    --ink-4: #66625d;
    --accent: #e8583a;
    --accent-hi: #f26c50;
    --accent-low: #c8452a;
    --on-accent: #1a0f0c;
    --lit: rgba(255, 255, 255, 0.05);
    --shade: rgba(0, 0, 0, 0.5);
    --shade-soft: rgba(0, 0, 0, 0.32);
  }
}

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink-2);
  font-family: var(--display);
  font-size: var(--text-body);
  letter-spacing: 0.01em;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* The ground brightens from near black up to its resting grey.
 *
 * Timed from a frame by frame reading of the reference: the brightness rises
 * from 30 to 193 over 2.7 seconds, slow at first, fastest through the middle,
 * then easing to a stop. The mark stays full black throughout, so contrast
 * builds rather than the whole page fading in together.
 */
@keyframes ground-up {
  0% {
    background-color: #1c1b1a;
  }
  100% {
    background-color: var(--ground);
  }
}

body.intro-running,
body.intro-drop,
body.intro-dock,
body.intro-reveal {
  animation: ground-up 2.7s cubic-bezier(0.62, 0.02, 0.34, 1) forwards;
}

/* Anchor links glide rather than jumping.
 *
 * Applied only while a link to a section is being followed, never globally:
 * a global rule also animates the browser restoring your scroll position on
 * reload, so the page creeps down instead of simply appearing where you
 * left it. nav.js adds the class for the length of the jump. */
html.gliding {
  scroll-behavior: smooth;
}

html {
  scroll-padding-top: 0;
}

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

/* The header stays put while the page scrolls under it. */
/* The header itself scrolls away with the page. Only the navigation stays.
 *
 * The logo has to scroll for the trail to work: the mark leaves the logo and
 * the trail records where it went, and a sticky logo would slide down the
 * page while the trail stayed put, so the two could only ever line up at the
 * very top. Letting the logo scroll puts both in the same coordinates, and
 * the trail genuinely comes out of the box. */
.topbar-wrap {
  /* Deliberately not positioned. An absolutely positioned descendant takes
     its coordinates from the nearest positioned ancestor, and the travelling
     mark is one: making this a containing block would pin the mark to the
     header rather than letting it range over the page. */
  z-index: 40;
}

.wrap {
  /* Wide enough that a large screen feels used rather than boxed in, while
     the measure of any single column of text stays readable. Text blocks
     set their own narrower max-width, so widening here gives the layout
     room without producing lines that are hard to follow. */
  max-width: 1520px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 4rem);
}

/* ---------- plates and chips ---------- */

.plate {
  background: var(--chip);
  border-radius: var(--r);
  box-shadow: var(--raise-lg);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  /* At least 48px tall, which is the usual minimum for a comfortable
     target on a touchscreen or with an unsteady hand. */
  /* The same height as the logo plate opposite, so the two ends of the
     header are built from parts of one size rather than the nav being a row
     of smaller things inside a bigger frame. */
  min-height: 48px;
  padding: 0.45rem 1.25rem;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink-2);
  font: inherit;
  font-weight: 500;
  /* The same size as the logo word across the header, so the two ends of it
     read as one row rather than a big name beside three small links. */
  font-size: var(--text-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), color var(--t),
    transform var(--t);
}

/* The same lamp behind the plate that the logo and the tool cards get, so
   every raised thing on the site answers to a pointer the same way. */
.chip:hover {
  background: var(--chip-hover);
  color: var(--ink);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.chip:active {
  box-shadow: var(--press);
  background: var(--chip-press);
  transform: translateY(1px);
}

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

.chip[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: var(--raise);
}

/* The workspace chip is the same plate as the rest of the nav. It used to be
   filled to mark it out, which read as a different kind of control sitting
   in a row of links.
 *
 * No permanent lamp on it either: every other lamp in the nav means "you are
 * here", so one that is always lit says something untrue. */

.chip.accent {
  background: var(--accent);
  color: var(--on-accent);
}
.chip.accent:hover {
  background: var(--accent-hi);
  color: var(--on-accent);
}

/* The little indicator light. Dead by default, lit when active. */
.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--ground-low);
  box-shadow: inset 1px 1px 2px var(--shade), inset -1px -1px 2px var(--lit);
  transition: background var(--t), box-shadow var(--t);
}

.chip.on .led,
.chip[aria-current="true"] .led {
  background: var(--accent);
  /* No inset shadow here: a lit bulb glows outward rather than looking
     recessed, which is what separates it from the dead state. */
  box-shadow: 0 0 6px var(--accent), 0 0 2px var(--accent);
}

/* The language picker.
 *
 * A details element, so it opens and closes without any script and keeps
 * working with none. The lamp takes the language's own colour through a
 * custom property, which is the one place on the site where a lamp is not
 * the accent red: here the colour is doing work, telling you which language
 * a row is before you read it. */
.picker {
  position: relative;
}

.picker > summary {
  /* A chip like the others, minus the marker the browser draws on a
     summary element, which is a triangle from another design language. */
  list-style: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

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

   Hard stops rather than blends, so a tricolour reads as three bands. */
.lamp-en { background: linear-gradient(135deg, #012169 0 38%, #ffffff 38% 50%, #c8102e 50% 62%, #012169 62%) }
.lamp-zh { background: radial-gradient(circle at 32% 34%, #ffde00 0 26%, #de2910 26%) }
.lamp-hi { background: linear-gradient(#ff9933 0 33%, #ffffff 33% 67%, #138808 67%) }
.lamp-es { background: linear-gradient(#aa151b 0 27%, #f1bf00 27% 73%, #aa151b 73%) }
.lamp-fr { background: linear-gradient(90deg, #0055a4 0 33%, #ffffff 33% 67%, #ef4135 67%) }
.lamp-pt { background: linear-gradient(90deg, #046a38 0 40%, #da291c 40%) }
.lamp-de { background: linear-gradient(#000000 0 33%, #dd0000 33% 67%, #ffce00 67%) }
.lamp-ja { background: radial-gradient(circle at 50% 50%, #bc002d 0 42%, #ffffff 42%) }
.lamp-ko { background: linear-gradient(135deg, #cd2e3a 0 50%, #0047a0 50%) }
.lamp-sv { background: linear-gradient(90deg, #005293 0 34%, #fecb00 34% 52%, #005293 52%) }
.lamp-fi { background: linear-gradient(90deg, #ffffff 0 34%, #002f6c 34% 52%, #ffffff 52%) }

/* The flag itself, clipped to a circle so it sits where a lamp would.
   Larger than the indicator lamps elsewhere: this one carries a picture
   rather than an on or off state, and a cross needs room to read as a
   cross. A thin inset ring gives a white flag an edge against the plate. */
.picker .flag {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--shade);
}

.picker .flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The panel is only as wide as the names in it, hanging under the chip
   rather than stretching across the plate behind it. */
.picker-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 70;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  width: max-content;
  max-height: 70vh;
  overflow-y: auto;
}

.picker-choice {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  /* A comfortable target, since this is a list of eleven small rows. */
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t), color var(--t);
}

.picker-choice:hover,
.picker-choice:focus-visible {
  background: var(--chip-hover);
  color: var(--ink);
}

/* The language you are already reading. */
.picker-choice.on {
  color: var(--ink);
  background: var(--inset);
  box-shadow: var(--press);
}

/* The note beside a link to a page that exists only in English. Quieter
   than the link it follows, since it is a caveat rather than part of the
   name. */
.only-english {
  font-size: 0.85em;
  opacity: 0.7;
  /* Space of its own, rather than relying on the newline in the markup
     collapsing into one. The note reads as an aside beside the name, and
     that only works if it is not touching it. */
  margin-left: 0.4em;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* The same height as the nav chips opposite, so the two ends of the header
     balance. */
  min-height: 54px;
  padding: 0.9rem 1.5rem;
  text-decoration: none;
  /* A step back like the nav chips, brightening on hover the same way. */
  color: var(--ink-2);
  transition: box-shadow 0.32s ease-out, color var(--t);
}

/* Hovering the logo warms its edge, the same idea as the tool cards but
   quieter.
 *
 * The same bloom the cards carry, with a ring on the edge as well since the
 * plate is smaller and the glow alone would be lost against it. */
.brand:hover {
  color: var(--ink);
  box-shadow:
    var(--raise-lg),
    0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent),
    0 0 20px color-mix(in srgb, var(--accent) 34%, transparent),
    0 0 7px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* The mark in the logo, and the same element that travels down the page.
   There is only ever this one: scrolling moves it out of the plate rather
   than hiding it and showing another copy elsewhere.

   The slot holds its space so the word never shifts once the mark has left,
   and with no scripting the mark simply stays in it. */
.brand-slot {
  display: block;
  width: 22px;
  height: 26px;
  flex: none;
  color: var(--ink);
}

/* Lifted out of the plate's clipping and layout so it can move freely, while
   staying a child of the header. That matters: the route layer is painted
   behind the content, so a mark parked there would be hidden by the header
   sitting above it. Kept here, it is visible in the plate and out on the
   page alike. */
.brand-slot > svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The navigation stays put while the page scrolls under it, so the links are
   always reachable. It holds its place on its own rather than the whole
   header doing so, which lets the logo scroll away with the page.

   Fixed rather than sticky: a sticky element only stays within its own
   parent, and this one's parent is the header, which is a few rows tall. It
   would come unstuck the moment the header scrolled past.

   Above the route, so the trail passes behind it rather than over the
   links. */
.navgroup {
  position: fixed;
  top: 1.25rem;
  /* Held to the same column the rest of the page uses, so it lines up with
     the content rather than the window edge. */
  right: max(clamp(1.25rem, 5vw, 4rem), calc((100vw - 1520px) / 2 + clamp(1.25rem, 5vw, 4rem)));
  z-index: 60;
}

/* Narrow enough that the nav would sit on the logo, so it stops being fixed
   and rejoins the flow underneath it.
 *
 * Being fixed takes it out of the header's layout altogether, which is why
 * the header's own wrapping cannot save it: as far as the flex row is
 * concerned the nav is not there, so the logo lays out across the full width
 * and the nav lands on top of it.
 *
 * This is the zoom case as well. Zooming in shrinks the window measured in
 * CSS pixels, which is what this asks about, so a zoomed page crosses the
 * same threshold a small window does and is handled by the same rule. */
@media (max-width: 640px) {
  /* The nav rides along at the top of the screen.
   *
   * Stuck to the header rather than to the nav itself: a sticky element only
   * travels within its own parent, and the nav's parent is a header a couple
   * of rows tall, so it came unstuck immediately. The header is the child of
   * the body, which is the whole page, so sticking it there carries the nav
   * the full length of the document.
   *
   * Only the nav rides: the header is pulled up by exactly the height of the
   * logo row, so the logo sits off the top of the screen once stuck while the
   * nav lands at the edge. The logo is still there at the top of the page and
   * still scrolls away normally, which keeps a phone screen for the content
   * rather than spending a hundred pixels of it on a permanent title. */
  header {
    /* How far the header is pulled up: everything above the nav, which is
       the top padding of the header row, the logo plate itself and the gap
       under it. Measured rather than guessed, since a plate that is taller
       than the figure here leaves its bottom edge stuck on screen.

       The plate is its 26 pixel mark plus 0.9rem of padding each side, and
       the row below adds the topbar's own padding and gap. */
    --logo-plate: calc(26px + 1.8rem);
    --logo-row: calc(1.25rem + var(--logo-plate) + 0.75rem);
    position: sticky;
    top: calc(-1 * var(--logo-row));
    z-index: 60;
  }

  .topbar .navgroup {
    /* Above the page, so content scrolls behind the bar rather than over it. */
    position: relative;
    z-index: 60;
    /* Only the downward half of the usual plate shadow. The raised look is
       built from a pale shadow up and left and a dark one down and right,
       which reads as light falling on a raised object. Stuck to the top of
       the screen the pale one has nothing above it to fall on, so it painted
       a smear across the page scrolling past behind the bar. */
    box-shadow: 4px 4px 11px var(--shade);
    /* The desktop rule pins the nav to the right edge with `right`. Relative
       positioning honours that too, as an offset, which pushed the whole bar
       past the left edge of the screen by the width of the margin. */
    right: auto;
    /* As many chips to a row as the words allow, every row stretched to the
       full width. English fits on one row. Spanish or German on a narrow
       phone needs two, and stretched they read as a taskbar of two rows
       rather than as a row that ran out of room. Forcing one row instead
       broke "Herramientas" into a letter or two per line. */
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .topbar .navgroup > * {
    flex: 1 1 auto;
  }

  /* The names centre in their stretched chip, and the lamp sits with the
     word rather than being pushed to the far edge. */
  .topbar .navgroup .chip {
    display: flex;
    justify-content: center;
    padding-inline: 0.5rem;
    gap: 0.4rem;
  }

  .topbar .navgroup .picker summary {
    width: 100%;
  }

  /* The header becomes two rows, the logo above and the nav below. */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .brand {
    align-self: flex-start;
  }

  /* The nav rides at the top of the screen here, so anything scrolled to has
     to stop below it rather than under it. Without this the heading you asked
     for lands at the very top of the window and the taskbar sits over it.

     The bar is its 48 pixel chips plus the plate's padding around them, and
     --bar-clear adds a little air below so the heading is not touching it.
     nav.js works the same figure out from the bar it measures, so a section
     scrolled to by hand stops in the same place as one scrolled to by
     anchor. Change one and the other has to follow. */
  html {
    --bar-clear: calc(48px + 1rem + 16px);
    scroll-padding-top: var(--bar-clear);
  }

  .panel,
  [id] {
    scroll-margin-top: calc(48px + 1rem + 16px);
  }
}

.brand-slot.travelling > svg {
  /* Positioned against the page, not the window: the logo scrolls with the
     page now, so the mark and its trail share one set of coordinates and the
     trail genuinely runs back to the box.

     Pinned to the page's corner so the transform below is the whole
     position. Without this the element keeps its normal layout spot as its
     starting point and the transform is added on top of it, which puts the
     mark twice as far across as intended. */
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 26px;
  /* Above the page content, so it reads as having come out of the plate and
     travelled over the page rather than sliding behind it. The header it
     lives in is already above the content, and this keeps it above the
     header's own plates too. */
  z-index: 120;
  /* Set by the route each frame. No transition: the position is recomputed
     every scroll frame, so an eased transform would chase a target that has
     already moved, dragging going down and overshooting coming back up. */
  will-change: transform;

  /* No transition while scrolling: the position is recomputed every frame,
     so an eased transform would chase a target that has already moved,
     dragging going down and overshooting coming back up.

     The exception is a layout change. Clearing files or switching tools can
     move the mark a long way without the reader touching anything, and that
     jump is worth easing. The class is added for the length of the move and
     taken off again. */

  /* Clickable, unlike the trail behind it. The mark is inside the logo link,
     so clicking it does what the logo does: takes you back to the top of the
     page it set off from. Which is what the thing appears to offer, having
     visibly come from up there. */
  pointer-events: auto;
}

/* Landed in the logo at the foot of the page, so it is the logo's icon again
   rather than something in flight. It stops answering the pointer, the way
   it does while parked in the plate at the top: the plate around it is the
   link, and an icon that lights up inside a logo reads as a second control
   sitting on top of one. */
.brand-slot.settling > svg {
  transition: transform 0.45s cubic-bezier(0.22, 0.75, 0.3, 1);
}

/* The footer's own mark, drawn in the markup rather than travelling there.
   It gives the logo at the foot of the page an icon on every screen, since
   the travelling mark only arrives where the trail runs and the trail needs
   clear space beside the text. Hidden while the real mark is in the slot, so
   the two are never both there. */
.mark-landed .brand-end-mark {
  display: none;
}

.brand-end-mark {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-slot.arrived > svg {
  pointer-events: none;
}

/* Warms on hover the way the logo plate does, so it is discoverable as
   something you can click rather than only decoration. */
.brand-slot.travelling > svg:hover {
  color: var(--accent);
}

.brand-word {
  font-family: var(--display);
  /* Body size, not heading. At heading size the word made the logo plate
     taller than the nav plate opposite it, which left the header lopsided. */
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.navgroup {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem;
  flex-wrap: wrap;
}

/* ---------- headings ---------- */

h1 {
  font-family: var(--display);
  font-size: var(--text-display);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 1.75rem;
  text-wrap: balance;
}

h2 {
  font-family: var(--display);
  font-size: var(--text-heading);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 2rem;
}

h3 {
  font-family: var(--display);
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

p {
  margin: 0 0 1rem;
  max-width: 68ch;
}

a {
  color: var(--accent);
}

/* Names the page above its heading. Larger and darker than it was, because
   a pixel face at 13px with wide tracking loses its shapes and the line
   turns into a grey smudge. */
/* Names the page above its heading. Set close to body size rather than as
   small print: it is the first line on a tool page and was reading as a
   caption for the heading rather than as part of it. */
.label {
  /* The same size as the line below it. It was fixed at 1.375rem while the
     lede scaled up to 1.75rem, so on a wide screen the page name ended up
     smaller than the sentence under it. */
  font-size: var(--text-body);
  letter-spacing: 0.04em;
  color: var(--ink-2);
  margin: 0 0 1rem;
}

/* Tighter where it heads the other tools at the foot of a tool page: the
   space below it is what decides whether the cards show at the bottom of the
   screen or fall out of sight. */
.panel .label {
  margin-bottom: 0.5rem;
}

.lede {
  font-size: var(--text-body);
  color: var(--ink-2);
  max-width: 58ch;
}

section {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}


/* A screenful each.
 *
 * Landing on a section should show that section and nothing else, so each
 * one fills the window and is centred within it. The effect is that clicking
 * Tools puts you in front of the tools, with no half visible next thing
 * pulling at the corner of your eye.
 *
 * min-height rather than height, so a section taller than the window still
 * grows instead of being cut off. */
.panel {
  /* A screen minus the header, so a section fills the view without pushing
     the next one more than a screen away. Full viewport height plus padding
     made each one noticeably taller than the window, which meant a long
     stretch of nothing between sections.
   *
   * The space above and below is set here rather than left to the centring,
   * so the gap between two sections is the same wherever you are on the
   * page. Centring alone made it depend on how tall each section's content
   * happened to be: the hero has three short lines and the tools have two
   * rows of cards, so one gap came out twice the other. */
  /* A whole screen each, so landing on one shows that one and nothing else.
     Anything shorter lets the next section show below it, and the reader
     arrives at two things at once. */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  /* Content sits in the middle of its screen. Landing on a section should
     put what you came to read in front of you rather than at the top edge
     with a screen of nothing below it. */
  justify-content: center;
  padding-block: clamp(4rem, 11vh, 8rem);
  scroll-margin-top: 0;
}

/* The last section on the page sizes to what it holds.
 *
 * Every other section is a screenful with its content centred, which works
 * while there is another section below to scroll to. The last one is
 * different: landing on it means scrolling to the bottom of the page, and a
 * short piece of text centred in a tall box then sits with its heading above
 * the top of the window. Sizing to the content keeps the whole of it on
 * screen at once. */
/* The last section shares its screen with the footer.
 *
 * Every other section gets a whole screen to itself, but this one is
 * followed by the footer rather than by another section, and the two have to
 * fit together: landing here should show the heading, the text and the
 * footer at once, with nothing of the section above.
 *
 * So it takes what is left of the screen after the footer instead of a
 * screen of its own. */
/* The last section on the page shares its screen with the footer.
 *
 * Every other section gets a screen to itself and centres its content in it.
 * This one is followed by the footer rather than by another section, so the
 * two are centred together: landing here shows the heading, the text and the
 * footer at once, with nothing of the section above.
 *
 * The space above is set by a script on tool pages, where it depends on
 * where the tool panel ends. What is here is the floor that script never
 * goes below, and what a page without scripting gets. */
.panel:last-of-type {
  min-height: 0;
  justify-content: flex-start;
  padding-block: clamp(1rem, 4vh, 9rem) clamp(4rem, 12vh, 9rem);
}

/* On a phone the last section keeps the same room above its heading as every
   other one, so arriving at Info puts its heading the same distance below the
   taskbar as arriving at Tools does. Its own smaller padding, which exists to
   share a screen with the footer on a desktop, left the heading against the
   bar while the others sat well clear.

   Written here rather than beside the other mobile rules because this has to
   come after the rule above to win. */
@media (max-width: 640px) {
  .panel:last-of-type {
    padding-top: clamp(4rem, 11vh, 8rem);
  }
}

/* Short screens would otherwise force a scroll inside the section itself. */
@media (max-height: 620px) {
  .panel {
    min-height: 0;
    padding-block: clamp(3rem, 8vh, 5rem);
  }
}

.hero {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem);
}

/* Sitting exactly centred puts the text lower than it reads as centred,
   because the eye treats the optical middle as slightly above the
   geometric one. Shifting the content up corrects for that. */
.hero.panel {
  /* Centred like the other panels, but nudged up: the optical middle sits
     slightly above the geometric one, so exactly centred text reads low. */
  justify-content: center;
  padding-bottom: clamp(3rem, 10vh, 7rem);
}

/* A block cursor on any typed heading. It stays after the line finishes, so
   there is always the sense that something more could be written. */
h1[data-type]::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.85em;
  margin-left: 0.08em;
  background: var(--accent);
  vertical-align: -0.08em;
  animation: blink 0.9s steps(1) infinite;
}

/* While typing it holds steady so it reads as a cursor being pushed along.
   Once finished it blinks slowly, as if waiting for the next word. */
h1.typing::after {
  animation: none;
}

/* The typed heading carries its own line breaks, so each row is written and
   then left alone rather than being rewrapped as the next words arrive. The
   breaks are newlines, which need honouring, and the wrapping stays on for
   anything the measurement did not foresee. */
h1.typing {
  white-space: pre-wrap;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- tool cards ---------- */

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.25rem;
  margin-top: 0;
  padding: 0;
  list-style: none;
}

/* The grid stretches each row to its tallest cell, but the card inside is
   only as tall as its own text, so a one line description left a visibly
   shorter box beside a two line one. Filling the cell makes every card in a
   row the same height. */
.tools > li {
  display: flex;
}

.tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.375rem;
  text-decoration: none;
  color: inherit;
  transition: transform var(--t), box-shadow var(--t);
}

/* Hovering warms the card, the way an indicator lamp comes on.
 *
 * Three shadows over the raised one: a tight ring that reads as the edge
 * catching the light, a soft bloom around it, and the existing drop shadow
 * underneath. All spread rather than offset, so the glow sits behind the
 * card evenly instead of falling to one side.
 *
 * Kept low in opacity on purpose. The point is that something switched on,
 * not that the card is lit up. */
.tool:hover h3 {
  color: var(--ink);
}

.tool:hover p,
.tool:hover .k {
  color: var(--ink-2);
}

.tool:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--raise-lg),
    0 10px 24px -12px var(--shade),
    /* The same two shadows a lit indicator carries, scaled up to a card:
       a tight halo and a wider bloom, both in the accent. Matching the LED
       is the point, so the card reads as the same lamp switching on. */
    0 0 18px color-mix(in srgb, var(--accent) 38%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Slower coming on than going off, which is how a lamp behaves: it warms up
   and then drops away. */
.tool {
  transition: transform var(--t), box-shadow 0.32s ease-out;
}

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

/* The card numbers. A pixel face needs whole pixels to form a letter, so at
   the original 12px they were unreadable: this is the smallest that still
   draws cleanly, and a step darker because the lightest grey in the scale
   vanishes in a thin stroked face. */
.tool .k {
  font-size: var(--text-small);
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.tool h3 {
  color: var(--ink-2);
  transition: color var(--t);
}

.tool p {
  margin: 0;
  font-size: var(--text-small);
  color: var(--ink-3);
  transition: color var(--t);
}

/* Two tools to a row on a phone, without their descriptions.
 *
 * Eight cards each carrying a line of explanation is a long scroll on a small
 * screen, and the names already say what the tools do: "Merge PDF" needs no
 * gloss. Dropping the sentence makes each card short enough that two fit side
 * by side, which turns eight rows into four.
 *
 * The text stays in the markup rather than being removed from it, so search
 * engines and screen readers still have it. */
@media (max-width: 640px) {
  .tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .tools .tool p {
    display: none;
  }
}

.tool-art {
  color: var(--accent);
  opacity: 0.9;
}

/* Drawn at 52 by 40 and shown larger, so the line weight thins slightly as
   it scales rather than growing with the drawing. Set here rather than in
   each drawing, so there is one number to change. */
.tool-art svg {
  width: 68px;
  height: auto;
  display: block;
}

/* ---------- workspace ---------- */

.workspace {
  padding: clamp(1rem, 2vw, 1.5rem);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* The file input is replaced by a chip, since the browser default cannot be
   styled and looks out of place. */
input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* The two lines that report what is happening: what is loaded, and how large
   a file this device can take.
 *
 * In the display face like everything else, and sized up to carry it. These
 * lines hold file names and figures, so they are set larger than the copy
 * around them rather than smaller, which is what a pixel face needs for
 * digits to stay apart and unambiguous. */
/* A blinking square while the page is busy, sitting at the end of the status
   line. The pointer says the same thing, but only where the pointer is: this
   stays visible wherever the reader is looking, and it is the same square the
   trail is drawn from, so it belongs to the page rather than being borrowed
   from somewhere else. */
.readout.busy::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-left: 0.5em;
  background: var(--accent);
  animation: blink 0.9s steps(1, end) infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0.15; }
}

.readout {
  font-size: var(--text-small);
  color: var(--ink-2);
  margin: 0 0 0.375rem;
  min-height: 1.65em;
}

.note {
  font-size: var(--text-small);
  color: var(--ink-3);
  margin: 0 0 1rem;
}

/* The hidden attribute only holds while display is none, and the rule below
   sets display: flex on every fieldset, which quietly overrode it. Every
   option panel was therefore visible at once whatever tool was chosen. */
[hidden] {
  display: none !important;
}

fieldset {
  border: 0;
  border-radius: var(--r-sm);
  background: var(--inset);
  box-shadow: var(--press);
  padding: 0.875rem 1rem;
  margin: 0 0 1rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

legend {
  font-size: var(--text-small);
  letter-spacing: 0.03em;
  color: var(--ink-3);
  padding: 0;
}

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-size: var(--text-small);
}

/* A choice and the number it needs, kept together.
 *
 * The fieldset wraps its children when they run out of room, and a switch and
 * its stepper were separate children, so a narrow screen broke them apart and
 * left a number sitting beside the wrong switch. Wrapped as one, a pair either
 * fits on the row or moves to the next together. */
.option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input[type="number"],
select {
  font: inherit;
  font-size: var(--text-small);
  padding: 0.3125rem 0.5rem;
  border: 0;
  border-radius: var(--r-xs);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink);
  width: 5em;
}

select {
  width: auto;
}

/* The page grid sits recessed, like a screen set into the panel. */
.screen {
  background: var(--inset);
  border-radius: var(--r-sm);
  box-shadow: var(--press);
  padding: clamp(0.75rem, 1.5vw, 1.125rem);
  min-height: 120px;
}

#pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#pages:empty::after {
  /* Not "loaded", which reads as "uploaded" to anyone not thinking about it,
     and this is the one site where that impression is worth avoiding. */
  content: "No files selected yet.";
  /* Larger and a step darker: this sits alone in a big empty panel, so at
     13px in the lightest grey it read as a stray mark rather than a line
     telling you the panel is waiting for a file. */
  color: var(--ink-3);
  font-size: var(--text-small);
}

/* ---------- page thumbnails ---------- */

[data-position] {
  background: var(--chip);
  border-radius: var(--r-xs);
  box-shadow: var(--raise);
  padding: 5px;
  text-align: center;
  user-select: none;
  transition: transform var(--t), opacity var(--t), box-shadow var(--t);
}

/* A fixed box for every thumbnail, whatever shape the page is.
 *
 * Letting each one keep its own height meant a landscape page sat shorter
 * than a portrait one, and everything below it rode up: in a row of pages
 * the arrows ended up at several different heights. The page is centred
 * inside the box instead, so the controls line up across the row. */
[data-position] .thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Big enough to tell one page from another at a glance. At 120px a page of
     text was a grey rectangle and you had to open the file to know which was
     which. */
  width: 170px;
  height: 226px;
}

[data-position] canvas,
[data-position] img {
  display: block;
  /* Choosing a page dims it, and turning one rotates it. Both were instant,
     which read as the page flickering rather than answering. */
  transition: opacity var(--t-slow), transform var(--t-slow);
  border-radius: 2px;
  background: #fff;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

[data-position] .num {
  font-size: var(--text-small);
  color: var(--ink-3);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

[data-position].marked {
  box-shadow: var(--raise), inset 0 0 0 2px var(--accent);
}

[data-position].marked .num {
  color: var(--accent);
  font-weight: 600;
}

.page-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 5px;
}

/* The small controls on a page: move, turn, look closer. Built like the
   chips elsewhere, down to the lamp behind them on hover, so every raised
   thing on the site answers to a pointer the same way. */
.mini {
  font: inherit;
  font-size: var(--text-small);
  line-height: 1;
  min-width: 34px;
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}

/* The same lamp the chips and cards carry. Not on a disabled arrow: there is
   nothing behind it to switch on. */
.mini:hover:not([disabled]) {
  background: var(--chip-hover);
  color: var(--accent);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.mini:active:not([disabled]) {
  box-shadow: var(--press);
}

.mini[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

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

/* ---------- dragging ---------- */

body.drag-over::after {
  content: "";
  position: fixed;
  inset: 10px;
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  pointer-events: none;
  z-index: 900;
}

[data-position].drag-source {
  opacity: 0.25;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  transform: scale(0.78) rotate(-2deg);
  transform-origin: center;
  box-shadow: var(--raise-lg), 0 14px 30px -8px var(--shade);
  transition: transform 0.16s ease;
}

.drag-ghost.drag-landing {
  transition: left 0.18s ease, top 0.18s ease, transform 0.18s ease,
    opacity 0.18s ease;
  transform: scale(1) rotate(0deg);
  opacity: 0;
}

[data-position].shift-forward {
  transform: translateX(12%);
}
[data-position].shift-back {
  transform: translateX(-12%);
}

body.dragging-page {
  cursor: grabbing;
}

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

/* The space below the footer is what lets the last section reach the top of
   the window.
 *
 * Scrolling can only go as far as the page allows, so a page that ends
 * shortly after its last section cannot bring that section to the top: the
 * browser stops early and the tail of the section above stays on screen.
 * This makes the page long enough for the scroll to finish. */
footer {
  padding-block: 2rem 4rem;
  /* A step darker and larger than the mono needed: Handjet draws thinner
     strokes, so the same grey at the same size disappears into the ground. */
  color: var(--ink-2);
  font-size: var(--text-small);
}

footer nav {
  display: flex;
  /* Row gap is smaller than column gap because the links now carry their own
     vertical padding, which already separates the rows when they wrap. */
  gap: 0.25rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* Padded to a comfortable size for a finger.
 *
 * The text alone made these 34px tall, and a row of eight tool names that
 * close together is a row of mistaps on a phone. The padding grows the area
 * that responds to a tap without changing how the link looks, since it is
 * the box that catches the touch rather than the letters. */
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0;
  color: var(--ink-2);
  font-size: var(--text-small);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .tool:hover,
  .drag-ghost {
    transform: none;
  }
}

/* ============================================================
   Opening sequence
   ============================================================ */

/* Hidden from the first frame, before any script has run, so the finished
   page is never briefly visible. intro.js takes it from here and decides
   whether to play the sequence or simply reveal the page. */
.intro-pending body {
  visibility: hidden;
}

/* Everything is held back until its moment. Only applied while the intro is
   actually running, so a page without scripting shows the lot. */
body.intro-running .topbar-wrap,
body.intro-running main,
body.intro-running footer,
body.intro-running .wrap > section {
  opacity: 0;
}

.intro-mark {
  display: none;
}

body.intro-running .intro-mark {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 500;
  pointer-events: none;
}

.intro-mark svg {
  width: 84px;
  height: auto;
  color: var(--ink);
  opacity: 0;
}

/* 1. The mark arrives on the dark ground, alone. It grows very slightly as
      it appears, which reads as arriving rather than simply fading up. */
body.intro-drop .intro-mark svg {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.7s ease-out, transform 0.9s cubic-bezier(0.16, 0.9, 0.3, 1);
}

.intro-mark svg {
  transform: scale(0.82);
}

/* 2. It travels to the corner and lands exactly where the brand icon sits.
      The distance and scale are measured from the real icon in intro.js. */
body.intro-dock .intro-mark svg {
  transform: translate(var(--dock-x, -38vw), var(--dock-y, -40vh))
    scale(var(--dock-scale, 0.26));
  opacity: 1;
  transition: transform 0.7s cubic-bezier(0.55, 0.02, 0.25, 1);
}

/* 3. The brand plate fades up around the landed mark, and the mark fades out
      underneath it. Same position, same size, so it reads as the mark
      becoming the logo rather than being swapped for it. */
body.intro-brand .topbar-wrap {
  opacity: 1;
  transition: opacity 0.45s ease-out;
}

body.intro-brand .intro-mark svg {
  opacity: 0;
  transition: opacity 0.45s ease-in 0.15s,
    transform 0.75s cubic-bezier(0.55, 0.02, 0.25, 1);
}

/* 4. The heading alone, empty, ready to be written into.
 *
 * The section it lives in becomes visible, but everything inside it except
 * the heading is still held back. Otherwise the paragraph and buttons would
 * be sitting there while the heading was still being typed, which reads as
 * the page having already arrived. */
body.intro-typing .wrap > section.hero,
body.intro-typing .wrap > section.tool-head {
  opacity: 1;
  transition: opacity 0.35s ease-out;
}

/* 5. Everything the earlier steps have not already brought in: the rest of
 * the heading's own section, the sections below it, and the footer.
 *
 * The header arrived at step 3 and the heading at step 4, so neither is
 * named here. Naming them again would fade them in a second time, which
 * reads as the whole page reloading. */
body.intro-reveal footer {
  opacity: 1;
  transition: opacity 0.55s ease-out;
}

/* ============================================================
   Appearing on scroll
   ============================================================ */

/* Only dimmed once the script is running, so the page is fully visible
   without JavaScript and to search engines. */
html.reveal-on [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}

/* A section arriving with the page is already being animated by the page
   transition, so the scroll reveal must not also hold it back. */
body.intro-skipped .wrap > section[data-reveal] {
  opacity: 1;
  transform: none;
}

html.reveal-on [data-reveal].shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease-out, transform 0.5s cubic-bezier(0.16, 0.9, 0.3, 1);
}

/* Children arrive one after another, top to bottom. */
html.reveal-on [data-reveal] > * {
  opacity: 0;
  transform: translateY(10px);
}

html.reveal-on [data-reveal].shown > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.4s ease-out, transform 0.4s cubic-bezier(0.16, 0.9, 0.3, 1);
}

html.reveal-on [data-reveal].shown > *:nth-child(1) { transition-delay: 0.04s; }
html.reveal-on [data-reveal].shown > *:nth-child(2) { transition-delay: 0.10s; }
html.reveal-on [data-reveal].shown > *:nth-child(3) { transition-delay: 0.16s; }
html.reveal-on [data-reveal].shown > *:nth-child(4) { transition-delay: 0.22s; }
html.reveal-on [data-reveal].shown > *:nth-child(5) { transition-delay: 0.28s; }

/* Tool cards arrive in sequence within their grid. */
html.reveal-on [data-reveal].shown .tools > li {
  animation: arrive 0.45s cubic-bezier(0.16, 0.9, 0.3, 1) backwards;
}

.tools > li:nth-child(1) { animation-delay: 0.06s; }
.tools > li:nth-child(2) { animation-delay: 0.11s; }
.tools > li:nth-child(3) { animation-delay: 0.16s; }
.tools > li:nth-child(4) { animation-delay: 0.21s; }
.tools > li:nth-child(5) { animation-delay: 0.26s; }
.tools > li:nth-child(6) { animation-delay: 0.31s; }
.tools > li:nth-child(7) { animation-delay: 0.36s; }
.tools > li:nth-child(8) { animation-delay: 0.41s; }

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ============================================================
   Form controls
   ============================================================ */

/* The browser default radio and checkbox cannot be styled and look wrong
   next to everything else, so they are replaced by physical looking
   switches. The real input stays for keyboard and screen reader users. */

.switchbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  /* One line, whatever the name. "Delete PDF pages" wrapped while "Split
     PDF" did not, which left half the row two lines tall and the other half
     one, and the switches ragged. */
  white-space: nowrap;
  /* The same padding and gap as a chip, so a row of tools reads as one set
     of controls rather than a different kind of button that happens to sit
     nearby. */
  padding: 0.45rem 1.25rem;
  gap: 0.625rem;
  min-height: 62px;
  border-radius: var(--r-sm);
  background: var(--chip);
  box-shadow: var(--raise);
  /* Small, not body: eight of these sit in one row, and at body size the
     longer names overflow their own switch. The height still matches the
     buttons below, so the row reads as one set of controls. */
  font-size: var(--text-small);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  min-height: 44px;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}

.switchbox:hover {
  color: var(--ink);
  background: var(--chip-hover);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.switchbox input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switchbox .led {
  width: 10px;
  height: 10px;
}

/* Chosen. The lamp says so, the way it does on the download button, rather
   than the whole switch inverting to white. Two ways of saying "this one is
   on" in one row of controls read as two different kinds of thing.

   The plate still presses in, so the state is not carried by colour alone
   for anyone who cannot see the lamp. */
.switchbox:has(input:checked) {
  color: var(--ink);
  box-shadow: var(--press);
}

.switchbox:has(input:checked) .led {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 2px var(--accent);
}

/* The chosen switch lights up on hover like every other control.
 *
 * It needs its own rule, and it has to come after the checked one: that sets
 * a pressed shadow, and being later in the file it was overriding the hover
 * glow. The pressed look stays underneath the glow, so the switch still
 * reads as the one that is chosen. */
.switchbox:has(input:checked):hover {
  box-shadow:
    var(--press),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.switchbox:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Numbers and selects, styled to match. */
input[type="number"],
select {
  appearance: none;
  font: inherit;
  font-size: var(--text-small);
  padding: 0.4375rem 0.625rem;
  border: 0;
  border-radius: var(--r-xs);
  background: var(--inset);
  box-shadow: var(--press);
  color: var(--ink);
  width: 4.5em;
}

select {
  width: auto;
  padding-right: 1.75rem;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input[type="number"]:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .intro-mark {
    display: none !important;
  }
  html.reveal-on [data-reveal],
  html.reveal-on [data-reveal] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  body.intro-running .topbar-wrap,
  body.intro-running main,
  body.intro-running footer,
  body.intro-running .wrap > section {
    opacity: 1;
  }
}

/* Visible to screen readers, not on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.placeholder {
  width: 110px;
  height: 146px;
  border-radius: 2px;
  background: var(--inset);
  box-shadow: var(--press);
}

.tool-head {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 3vw, 2rem);
}

/* The heading and the tool below it share the first screen, so nothing that
   belongs further down is visible while the heading is being written. The
   height is generous rather than exact: the tool panel varies with how many
   options it has, and forcing it would cut a tall one off. */
.first-screen {
  padding-top: clamp(3rem, 9vh, 6rem);
}

/* The workspace tool switcher.
 *
 * Eight switches is too many for the single row the option fieldsets use, so
 * this wraps into a grid that stays readable down to a phone.
 */
/* The tools, laid out to fit their names rather than into equal columns.
 *
 * A grid of equal fractions forced every switch to the same width whatever
 * its name, so the longer ones could not grow and the lamp was pushed
 * outside the switch. Wrapping flex items take the width they need, and the
 * row wraps to a second line rather than squeezing. */
.toolbar {
  display: grid;
  /* Four across, so eight tools make two even rows rather than six on one
     line and two orphaned below. Equal columns are fine here because they
     are wide enough for the longest name, which is what pushed the lamp
     outside its switch when they were narrower. */
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .toolbar {
    /* minmax(0, 1fr) rather than 1fr, which is minmax(auto, 1fr) and so
       refuses to shrink a column below the width of its own content. The
       switch labels do not wrap, so on a narrow phone the columns held
       their full width and pushed the whole grid past the screen edge. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Room is scarce here, so the switches give up their generous side padding
     rather than their single line of text. Keeping the names unwrapped is
     what stops a row being half one line tall and half two. */
  .toolbar .switchbox {
    padding-inline: 0.6rem;
    gap: 0.4rem;
  }
}

/* One switch per row on a phone.
 *
 * "Reorder PDF pages" needs about 155 pixels of its own, and two columns on
 * a 360 pixel screen leave 124, so the names ran past their switches however
 * the padding was trimmed. A single column gives every name its full width
 * and makes each switch an easy target for a thumb. */
@media (max-width: 560px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
}

.toolbar legend {
  margin-bottom: 0.25rem;
}

.toolbar .switchbox {
  justify-content: space-between;
}

/* ============================================================
   Number inputs and selects
   ============================================================ */

/* The browser draws its own spinner arrows and dropdown, which look like
   Windows rather than like this page. Both are replaced below. */

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

/* A number and its two stepper buttons, held together as one control. */
.stepper {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-sm);
  background: var(--inset);
  box-shadow: var(--press);
}

.stepper input[type="number"] {
  width: 3em;
  background: none;
  box-shadow: none;
  padding: 0.3125rem 0.25rem;
}

.stepper input[type="number"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-radius: var(--r-xs);
}

.stepper button.mini,
.stepper button {
  font: inherit;
  font-size: var(--text-small);
  line-height: 1;
  width: 2rem;
  border: 0;
  border-radius: var(--r-xs);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}

.stepper button:hover {
  background: var(--chip-hover);
  color: var(--accent);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.stepper button:active {
  box-shadow: var(--press);
}

.stepper button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The picker: a select replaced by a listbox that can actually be styled.
   The native select stays underneath for its value, hidden from view and
   from assistive technology, which reads the listbox instead. */

.picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.picker {
  position: relative;
  display: inline-block;
}

.picker-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 10rem;
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-small);
  text-align: left;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), color var(--t);
}

.picker-button:hover {
  color: var(--ink);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

.picker-button::after {
  content: "";
  margin-left: auto;
  width: 0;
  height: 0;
  /* A solid triangle, so there is no image to load and it follows the
     text colour. */
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform var(--t);
}

.picker.open .picker-button::after {
  transform: rotate(180deg);
}

.picker-button:hover {
  background: var(--chip-hover);
}

.picker.open .picker-button {
  box-shadow: var(--press);
  background: var(--chip-press);
}

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

.picker-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  z-index: 200;
  background: var(--chip);
  border-radius: var(--r-sm);
  box-shadow: var(--raise-lg), 0 10px 26px -10px var(--shade);
  max-height: 15rem;
  overflow-y: auto;
  animation: picker-open 0.14s ease-out;
}

@keyframes picker-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.picker-option {
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-xs);
  font-size: var(--text-small);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

/* Whichever option the pointer or keyboard is on. */
.picker-option.active {
  background: var(--chip-press);
  color: var(--ink);
}

/* The one currently in effect, marked so it is clear even while the
   keyboard is somewhere else in the list. */
.picker-option.chosen {
  color: var(--ink);
  font-weight: 500;
}

.picker-option.chosen::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent);
  vertical-align: 0.05em;
}

.picker-option:not(.chosen)::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.5rem;
  vertical-align: 0.05em;
}


/* ============================================================
   Moving between pages
   ============================================================ */

/* A page change is a full reload, which lands as a hard cut.
 *
 * The content settles downward and away as you leave, then rises into place
 * on arrival, so the two halves read as one continuous movement. The header
 * is deliberately left out of both: it is the one thing common to every
 * page, and holding it still is what makes the change feel like moving
 * within a place rather than leaving one and entering another.
 *
 * The easing is asymmetric on purpose. Leaving accelerates away, arriving
 * decelerates into place, which is how physical things actually move.
 */

/* Must match LEAVE_MS in nav.js. */
:root {
  --leave-ms: 380ms;
  --arrive-ms: 620ms;
}

@keyframes page-arrive {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* Arriving. The header is excluded so it appears settled from the first
   frame, as though it never went anywhere. */
body.intro-skipped .wrap > section,
body.intro-skipped footer {
  animation: page-arrive var(--arrive-ms) cubic-bezier(0.16, 0.84, 0.32, 1)
    backwards;
}

/* The heading leads, the rest follows a beat later. */
body.intro-skipped .wrap > section:nth-of-type(1) { animation-delay: 0.02s; }
body.intro-skipped .wrap > section:nth-of-type(2) { animation-delay: 0.09s; }
body.intro-skipped .wrap > section:nth-of-type(3) { animation-delay: 0.15s; }
body.intro-skipped footer { animation-delay: 0.2s; }

/* Leaving. Everything but the header drifts down and dims together, which
   keeps it reading as one page departing rather than parts of it. */
body.leaving .wrap > section,
body.leaving footer {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity var(--leave-ms) cubic-bezier(0.5, 0, 0.9, 0.4),
    transform var(--leave-ms) cubic-bezier(0.5, 0, 0.9, 0.4);
}

/* The header dims very slightly on the way out, just enough to acknowledge
   the change without moving. */
body.leaving .topbar-wrap {
  opacity: 0.55;
  transition: opacity var(--leave-ms) ease-out;
}

@media (prefers-reduced-motion: reduce) {
  body.intro-skipped .wrap > section,
  body.intro-skipped footer,
  body.leaving .wrap > section,
  body.leaving footer,
  body.leaving .topbar-wrap {
    animation: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Scrollbar
   ============================================================ */

/* The browser's own scrollbar is a bright strip down the side of a dark
   page, which is the first thing your eye lands on. These make it part of
   the page instead: a recessed channel with a raised handle, matching every
   other surface here. */

/* Firefox. It offers colours only, not shape. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) var(--ground-low);
}

/* Chrome, Edge and Safari, which allow the full treatment. */
/* No cursor rule here. The scrollbar is drawn by the browser rather than
   being part of the page, so the pointer over it belongs to the operating
   system and a cursor declared on this pseudo element is ignored. The site's
   own arrow stops at the edge of the content, which is the browser's rule
   rather than an oversight. */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--ground-low);
}

::-webkit-scrollbar-thumb {
  background: var(--chip);
  border-radius: 999px;
  /* The border shows the track through it, so the handle reads as floating
     in the channel rather than filling it. */
  border: 3px solid var(--ground-low);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
  background-clip: padding-box;
}

::-webkit-scrollbar-corner {
  background: var(--ground-low);
}

/* ============================================================
   Scroll cue and progress
   ============================================================ */

/* The route the mark travels.
 *
 * A trail of squares rather than a drawn line, so the edges are stepped in
 * the same way the display face is. Squares are placed once and then lit in
 * order as the page is scrolled, which costs nothing per frame.
 *
 * Purely decorative: behind the content, no pointer events, hidden from
 * screen readers. */

.route {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Behind the page text, which it may pass under, but above the plate it
     starts from so the trail is seen coming out of the box rather than
     appearing below it.

     The header is lowered to 40 for this, and the nav plate on the right is
     raised back above the route on its own so only the brand plate is
     crossed. */
  z-index: 50;
  pointer-events: none;
}

.route-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.35s ease-out;
}

/* Lit once the reader has passed it. They stay lit, so the route behind is
   a record of where you have been. */
.route-dot.lit {
  opacity: 0.5;
}


/* Content sits above the route, or the trail would be drawn over the text.
   The header's own wrap is left out: it is already above the route through
   the header's z-index, and positioning it would make it the containing
   block for the travelling mark, pinning the mark to the header instead of
   letting it range over the page. */
.wrap:not(.topbar-wrap > .wrap) {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill {
    transition: none;
  }
}

/* ============================================================
   The three proof points
   ============================================================ */

/* What actually differs from every other PDF site, each one checkable.
   The lit dots tie them to the indicator lights used elsewhere, so they
   read as readouts on a device rather than a bullet list. */

.proof {
  list-style: none;
  margin: 3.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.proof li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-body);
  color: var(--ink-2);
}

.proof .led {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 2px var(--accent);
}

/* Selected text carries the accent rather than the browser's blue, which is
   the one colour on the page that belongs to nobody. The ground colour for
   the text on top of it, so the selection reads as the page inverted rather
   than as a highlighter pen. */
::selection {
  background: var(--accent);
  color: var(--ground);
}

/* The line under the other tools, pointing at the workspace. Its spacing was
   an inline style attribute, which our own Content Security Policy blocks,
   so it never applied. */
.workspace-note {
  margin-top: 1.5rem;
}

/* Links inside a paragraph. No underline at rest: the accent colour marks
   them clearly enough, and an underline cuts through the descenders of a
   pixel face. It appears on hover, where it confirms what is about to be
   clicked. */
.workspace-note a,
.lede a,
.prose a,
.plain a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t);
  /* A little room above and below, so a link inside a sentence is still
     catchable with a finger. Kept small: any more and it would push the
     lines of the paragraph apart. */
  padding-block: 0.35rem;
  position: relative;
}

/* The rest of the finger target, added without taking up any room.
 *
 * Padding alone cannot reach the 44 pixels a touch target wants, since
 * padding on an inline element inside a paragraph pushes the lines apart.
 * An absolutely positioned overlay is outside the flow, so it enlarges what
 * a thumb can hit while the text stays exactly where it was set. */
@media (pointer: coarse) {
  .workspace-note a::after,
  .lede a::after,
  .prose a::after,
  .plain a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    /* Half the shortfall each side, so the target grows evenly around the
       words rather than hanging below them. */
    top: -6px;
    bottom: -6px;
  }
}

.workspace-note a:hover,
.lede a:hover,
.prose a:hover,
.plain a:hover {
  text-decoration: underline;
}

/* Our own tooltip, in our own type.
 *
 * A native title attribute is drawn by the operating system: its font, its
 * colour and how long it waits are all beyond reach, so on a page set in a
 * pixel face it arrives looking like it belongs to another program. This is
 * an ordinary element, so it looks like everything else here.
 *
 * Pointer only. Touch has no hover, and a tooltip that never appears is
 * worse than none, so every control carries a real aria-label as well. */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-xs);
  background: var(--ink);
  color: var(--ground);
  font-size: var(--text-small);
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-slow), transform var(--t-slow);
  z-index: 200;
}

@media (hover: hover) {
  [data-tip]:hover::after,
  [data-tip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* The zoom button sits in the top corner of a page, so its tooltip goes
   above it. Below would land on the page it is offering to show. */
.zoom[data-tip]::after {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
}

@media (hover: hover) {
  .zoom[data-tip]:hover::after,
  .zoom[data-tip]:focus-visible::after {
    transform: translateX(-50%) translateY(0);
  }
}

/* The workspace panel is the last thing on its page, with only the footer
   after it, so it ends flush against it. Every other page has a further
   section below the panel whose padding provides that gap, so this puts the
   same room back. */
/* The workspace panel is the last thing on its page, with only the footer
   below it. Every other page ends with a full height section whose padding
   and centring leaves room above the footer, so this puts the same room
   back. Margin rather than padding: padding would grow the panel itself,
   which is the plate the reader can see. */
.workspace-page {
  margin-bottom: clamp(9rem, 22vh, 16rem);
}

/* The logo at the foot of the page, where the travelling mark lands. Set
   like the one in the header so the two read as the same object arriving
   rather than two separate marks. */
.footer-brand {
  display: inline-flex;
  margin: 0 0 1.25rem;
}

/* The footer text sits above the trail so the line does not run through the
   words, but the logo plate does not: the trail has to be seen arriving at
   it, and a plate drawn on top cuts the last squares off at its corner so
   the mark looks parked beside the logo rather than sitting in it.
 *
 * Raised on the wrap rather than on the links themselves, because the wrap
 * carries z-index 1 while the route layer is a sibling of it at 50, so
 * nothing inside the wrap can win on its own. */
.wrap:has(> footer) {
  position: relative;
  z-index: 60;
}

.footer-brand {
  /* Back under the trail, so the squares run all the way in. */
  position: relative;
  z-index: 0;
}

/* The second footer row. A step back from the tools above it, since these
   are pages you look for rather than pages you use. */
.footer-legal {
  margin-bottom: 1rem;
}

.footer-legal a {
  color: var(--ink-3);
  /* Wide enough for a finger even when the word is short. "Terms" came out
     at 42px on its own, which is under the 44px a touch target wants. */
  min-width: 44px;
  justify-content: center;
}

/* ---------- the pages that are mostly words ---------- */

/* Privacy, terms and security: long enough to need reading rather than
   scanning, so the measure is narrower than the rest of the site and the
   spacing is looser. Everything else comes from the same variables the tools
   use, so these pages belong to the site rather than looking like a document
   that wandered in. */
.prose {
  max-width: 62ch;
  padding-block: clamp(2rem, 6vh, 4rem) clamp(6rem, 16vh, 11rem);
}

.prose h2 {
  margin-top: 3rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p {
  color: var(--ink-2);
  margin: 0 0 1.25rem;
}

/* A list of statements rather than a list of items: no bullets, since each
   line is a sentence and a marker in front of it only adds noise. */
.plain {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  color: var(--ink-2);
}

.plain li {
  margin-bottom: 0.875rem;
  padding-left: 1.25rem;
  position: relative;
}

/* A lit indicator lamp instead of a bullet, the same one the chips carry.
   Round and glowing outward rather than recessed, since a marker standing
   for a point being made should read as on. */
.plain li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 2px var(--accent);
}

.plain strong {
  color: var(--ink);
  font-weight: 600;
}

/* The desktop app question, under the nav on the right.
 *
 * An ordinary link rather than a form: the page may not make requests of its
 * own, so being counted means going to a page. The label says so before it is
 * pressed, which matters more here than anywhere else on the site, since
 * counting somebody who only meant to read is exactly what this is trying not
 * to do.
 *
 * Quieter than the nav chips. It is an aside, not a fourth destination. */
.wanted {
  /* Under the left hand end of the nav, below Tools and Info.
   *
   * It used to sit under the right hand end, directly below the language
   * chip, where the language panel opened straight down onto it and covered
   * it completely. The panel belongs under its own chip, so the button moved
   * instead. The offset is the nav's own right margin plus its width, which
   * puts this at the nav's left edge. */
  position: fixed;
  top: calc(1.25rem + 66px + 0.75rem);
  /* Set from the nav's measured left edge rather than guessed here: the nav
     changes width with the language, so any fixed offset drifts. picker.js
     writes the value. The fallback keeps it roughly right without scripting. */
  left: var(--nav-left, max(clamp(1.25rem, 5vw, 4rem), calc((100vw - 1520px) / 2 + clamp(1.25rem, 5vw, 4rem))));
  z-index: 55;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  color: var(--ink-3);
  font-size: var(--text-small);
  transition: box-shadow 0.32s ease-out, color var(--t);
}

.wanted:hover {
  color: var(--ink);
  box-shadow:
    var(--raise-lg),
    0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent),
    0 0 20px color-mix(in srgb, var(--accent) 34%, transparent);
}

/* The question, smaller than the answer. */
.wanted-ask {
  opacity: 0.85;
}

/* The part that reads as the button. */
.wanted-do {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
}

/* Already asked, so it is a note rather than a button.
 *
 * The lamp is lit because the thing it stands for is done, and the hover
 * glow is gone because there is nothing left to press. */
.wanted.asked {
  cursor: default;
}

.wanted.asked .wanted-do {
  color: var(--ink-3);
}

.wanted.asked:hover {
  color: var(--ink-3);
  box-shadow: var(--raise-lg);
}

/* On a phone it joins the flow under the nav rather than being fixed over it.
   The nav is not fixed at this width either, so a fixed button simply landed
   on top of it.

   Written here rather than with the other mobile rules because it has to come
   after the rule above to win. */
@media (max-width: 640px) {
  .wanted {
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding-block: 0.55rem;
    /* Clear of the nav plate above, whose shadow and padding reach past its
       chips. The header's own gap is measured to the plate's edge and leaves
       the two touching. */
    margin-top: 0.65rem;
  }
}

/* The count on the desktop app page, set large enough to be the thing you
   look at. It is the whole answer that page gives, so it reads as a figure
   rather than as a word in a sentence. */
.tally {
  color: var(--accent);
  font-size: var(--text-heading);
  /* Sits with the line it belongs to rather than pushing it apart. */
  line-height: 1;
  margin-right: 0.15em;
}

/* A line of the actual policy, quoted. Set apart so it reads as something
   the browser is told rather than something we are saying. */
.code {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: var(--r-sm);
  background: var(--inset);
  box-shadow: var(--press);
  color: var(--accent);
  font-family: var(--mono);
  font-size: var(--text-small);
}

/* ---------- looking closer at a page ---------- */

/* Sits in the corner of a thumbnail. Faint until the page is hovered, so a
   grid of pages is not a grid of buttons. */
.zoom {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--chip);
  box-shadow: var(--raise);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-small);
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-slow), background var(--t), color var(--t);
}

[data-position] {
  position: relative;
}

[data-position]:hover .zoom,
.zoom:focus-visible {
  opacity: 1;
}

/* Declared after the rule above, not with the arrows further up the file:
   .zoom sets its own box-shadow, so a hover rule placed earlier is simply
   overridden. */
.zoom:hover {
  background: var(--chip-hover);
  color: var(--accent);
  box-shadow:
    var(--raise),
    0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 30%, transparent),
    0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
}

/* The page shown large, over a darkened site. */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: color-mix(in srgb, var(--ground) 82%, #000);
  animation: viewer-in var(--t-slow) ease-out;
}

.viewer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-height: 100%;
  animation: viewer-rise 0.34s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.viewer canvas {
  max-width: min(90vw, 800px);
  max-height: 72vh;
  width: auto;
  height: auto;
  background: #fff;
  border-radius: var(--r-xs);
  box-shadow: var(--raise-lg), 0 20px 60px -20px var(--shade);
}

.viewer-name {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--text-small);
}

@keyframes viewer-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes viewer-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- cursors ---------- */

/* Drawn to match the rest of the site rather than left to the operating
 * system, which draws its own smooth arrow that belongs to a different era
 * from everything else here.
 *
 * Two numbers follow each image: where in it the click actually lands. The
 * arrow points from its top left, the hand from its fingertip, and the other
 * two from their middle. Getting these wrong makes a page feel subtly
 * unresponsive, since the pointer and the click disagree.
 *
 * Every rule ends in a standard cursor name. If the image cannot be loaded
 * the browser falls back to it, rather than leaving no pointer at all. */

body {
  cursor: url("/static/cursors/arrow.svg") 2 1, default;
}

a,
label[for],
summary,
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
.tool,
.chip:not(:disabled),
[data-position],
/* The switches wrap their input rather than pointing at one with a for
   attribute, so label[for] above does not reach them. */
.switchbox,
.picker-button,
.picker-option,
/* The travelling mark. It sits inside the logo link, but an SVG does not
   take the cursor from its parent the way an HTML element does, so without
   naming it here it falls back to the system hand. */
.brand-slot.travelling > svg {
  cursor: url("/static/cursors/hand.svg") 9 1, pointer;
}

/* Anything switched off, and anything the page will not accept. */
button:disabled,
.chip:disabled,
[aria-disabled="true"] {
  cursor: url("/static/cursors/stop.svg") 12 12, not-allowed;
}

/* While a file is being read or built. Set on the root so it covers the
   whole window, including whatever the pointer happens to be over. */
body.working,
body.working a,
body.working button,
body.working label[for],
body.working [data-position] {
  cursor: url("/static/cursors/wait.svg") 12 12, progress;
}

/* Text still gets a text cursor, since a custom one there would stop the
   pointer showing where the caret would land. */
input,
textarea,
[contenteditable] {
  cursor: text;
}

/* Shown by support.js, and only on a browser too old for the tools.
 *
 * Plain colours and nothing newer than the browsers it is for can read: the
 * rest of this stylesheet uses color-mix and :has, which is exactly what
 * those browsers lack, so this cannot lean on any of it. */
.old-browser-note {
  margin: 16px auto;
  max-width: 720px;
  padding: 16px 20px;
  border-radius: 8px;
  background: #c8452a;
  color: #fffaf8;
  font: 600 18px/1.5 "IBM Plex Mono", monospace;
}

/* The two ways out of an error page sit under the words, with the same
 * spacing the tool controls use. */
.error-ways {
  margin-top: 24px;
}
.error-ways a {
  text-decoration: none;
}
