/* 8pence.com: the only stylesheet. Global styles only: every page uses these classes, and no page
   sets its own styles. Every colour, typeface, size, spacing and line value is a token in :root;
   nothing below writes a raw value that belongs in a token (the styles check in tools/check.mjs
   fails on raw colours, sizes and spacing outside :root).

   Layout: an editorial index on near-black. A left-aligned column of type, hairline rules between
   sections, and one row per app with its artwork beside it.

   Spacing rhythm, used everywhere a heading appears:
     label to heading      --space-3  (inside .heading-group)
     heading to its text   --space-5  (the gap of the block holding the group)
     between sections      --section-space */

/* ---------- Fonts (self-hosted, SIL Open Font License; see fonts/LICENSES.txt) ---------- */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("fonts/dm-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: dark;

  /* Colour. One deliberate dark look, matching remspencer.design. */
  --color-ground: #0C0C0B;           /* page background */
  --color-surface: #141413;          /* artwork frames, the banner */
  --color-line: #2A2926;             /* hairline rules and frames */
  --color-line-strong: #4A4843;      /* the rule above each step */
  --color-text: #EDEBE5;             /* headings and body */
  --color-text-soft: #B9B6AE;        /* secondary text, 9.9:1 on ground */
  --color-text-quiet: #918E86;       /* labels and captions, 6.2:1 on ground */
  --color-coin: #D8B25C;             /* the 8pence accent: coin gold */
  --color-on-coin: #0C0C0B;          /* text on a coin-gold button */

  /* Each app keeps its own brand colour. Tints are for text and lines on the dark ground. */
  --color-grounds: #8EC2DC;          /* Groundskeeping, tint of #173D52 */
  --color-floor: #E2A6D0;            /* Floorkeeping, tint of #521743 */
  --color-lockedin: #E19A57;         /* LockedIn, tint of #D4883A */

  /* Type. Fraunces for display, Instrument Sans for reading, DM Mono for labels. */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-label: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --size-display: clamp(2.75rem, 1.55rem + 5.4vw, 6rem);   /* hero headline, 44px to 96px */
  --size-headline: clamp(2rem, 1.45rem + 2.4vw, 3.25rem);  /* section headings, 32px to 52px */
  --size-title: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);    /* app names and step numbers, 28px to 40px */
  --size-contact: clamp(1.5rem, 1.05rem + 2.2vw, 2.75rem); /* the email address, 24px to 44px */
  --size-wordmark: 1.625rem;                               /* 26px */
  --size-step: 1.5rem;                                     /* 24px, step titles */
  --size-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem); /* 17px to 19px */
  --size-body: 1rem;                                       /* 16px */
  --size-small: 0.875rem;                                  /* 14px */
  --size-label: 0.75rem;                                   /* 12px, the floor for any text */
  --size-icon: 1em;                                        /* arrows match the text beside them */

  --weight-display: 250;
  --weight-title: 320;
  --weight-body: 400;

  --leading-numeral: 1;              /* step numbers */
  --leading-display: 1.02;           /* the hero headline */
  --leading-heading: 1.12;           /* every other heading */
  --leading-email: 1.2;              /* the large email address */
  --leading-label: 1.5;              /* mono labels */
  --leading-body: 1.65;              /* reading text */

  --tracking-display: -0.025em;      /* large Fraunces headings */
  --tracking-title: -0.01em;         /* wordmark, step titles, the email address */
  --tracking-mono: 0.05em;           /* lower-case mono text: addresses, terms, notes */
  --tracking-label: 0.14em;          /* upper-case mono labels */

  /* Space, on a 4px grid. */
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.5rem;   /* 24 */
  --space-6: 2rem;     /* 32 */
  --space-7: 3rem;     /* 48 */
  --space-8: 4rem;     /* 64 */
  --space-9: 6rem;     /* 96 */
  --space-10: 8rem;    /* 128 */

  --gutter: clamp(1rem, 0.4rem + 3vw, 3rem);               /* page side padding, 16px to 48px */
  --section-space: clamp(var(--space-8), 2rem + 6vw, var(--space-10));
  --page-width: 75rem;                                     /* 1200px */
  --measure: 38rem;                                        /* about 65 characters of body text */
  --measure-display: 13ch;                                 /* the hero headline's line length */
  --target: 2.75rem;                                       /* 44px, the smallest touch target */
  --dot: 0.5rem;                                           /* status dots */
  --rule: 1px;
  --radius: 2px;                                           /* square, editorial corners */
  --focus-ring: 2px;
  --focus-offset: 3px;
  --icon-stroke: 1.6;
  --nudge: 2px;                                            /* how far an arrow moves on hover */
  --first-line-middle: calc(var(--leading-body) * 0.5em);  /* half a line of body text, from its top */
  --motion: 160ms ease-out;
}

/* ---------- Base ---------- */

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--color-ground);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  font-weight: var(--weight-body);
  line-height: var(--leading-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
hgroup {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

h1 em,
h2 em {
  font-style: italic;
  color: var(--color-coin);
}

p {
  text-wrap: pretty;
}

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

:focus-visible {
  outline: var(--focus-ring) solid var(--color-coin);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius);
}

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

/* The arrow drawings: one hidden sprite, and each use of it sized to the text beside it. */
.icon-sprite {
  position: absolute;
  inline-size: 0;
  block-size: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  inline-size: var(--size-icon);
  block-size: var(--size-icon);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: square;
  transition: transform var(--motion);
}

/* ---------- Page frame ---------- */

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: var(--space-2);
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--color-coin);
  color: var(--color-on-coin);
  font-family: var(--font-label);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  border-block-end: var(--rule) solid var(--color-line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  font-family: var(--font-display);
  font-size: var(--size-wordmark);
  font-weight: var(--weight-title);
  letter-spacing: var(--tracking-title);
  text-decoration: none;
}

.wordmark-eight {
  font-style: italic;
  color: var(--color-coin);
}

.site-nav ul,
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
}

.site-nav a,
.footer-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target);
  min-height: var(--target);
  font-family: var(--font-label);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text-soft);
  transition: color var(--motion);
}

.site-nav a:hover,
.footer-nav a:hover {
  color: var(--color-text);
}

main > section {
  padding-block: var(--section-space);
  border-block-end: var(--rule) solid var(--color-line);
}

/* ---------- Shared pieces ---------- */

/* A small label over its heading, the pair kept close together. */
.heading-group {
  display: grid;
  gap: var(--space-3);
}

.eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-label);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-coin);
}

.section-head {
  display: grid;
  gap: var(--space-5);
  max-width: var(--measure);
  margin-block-end: var(--space-8);
}

.section-head h2,
.contact h2 {
  font-size: var(--size-headline);
}

.section-lead,
.hero-lead,
.contact-lead {
  max-width: var(--measure);
  font-size: var(--size-lead);
  color: var(--color-text-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: var(--target);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  background: var(--color-coin);
  color: var(--color-on-coin);
  font-family: var(--font-label);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color var(--motion);
}

.button:hover {
  background: var(--color-text);
}

.plain-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  font-family: var(--font-label);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-mono);
  color: var(--color-text-quiet);
  text-decoration: none;
}

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

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

main > .hero-section {
  padding-block-end: 0;
  border-block-end: 0;
}

.hero {
  display: grid;
  gap: var(--space-5);
}

.hero h1 {
  max-width: var(--measure-display);
  font-size: var(--size-display);
  line-height: var(--leading-display);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
  padding-block-start: var(--space-2);
}

.banner {
  margin-block-start: var(--space-8);
  border-block: var(--rule) solid var(--color-line);
  background: var(--color-surface);
  overflow: hidden;
}

/* The banner's shape: 4:3 on phones, 21:9 on tablets, 5:2 on wide screens (IMAGES.md). */
.banner img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: 70% 50%;
}

@media (max-width: 40rem) {
  .banner img {
    aspect-ratio: 4 / 3;
  }
}

@media (min-width: 64rem) {
  .banner img {
    aspect-ratio: 5 / 2;
  }
}

/* ---------- Apps ---------- */

.apps {
  display: grid;
  gap: var(--space-9);
}

.app {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

@media (min-width: 56rem) {
  .app {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-8);
  }
}

.app-figure {
  border: var(--rule) solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  overflow: hidden;
}

.app-figure img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.app-body {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

/* Who it is for, then its status, each on its own line so all three apps read alike. */
.app-meta {
  display: grid;
  justify-items: start;
  gap: var(--space-1);
  font-family: var(--font-label);
  font-size: var(--size-label);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-quiet);
}

.app-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--app-color);
}

.app-status::before {
  content: "";
  inline-size: var(--dot);
  block-size: var(--dot);
  border-radius: 50%;
  background: var(--app-color);
}

.app h3 {
  font-size: var(--size-title);
  font-weight: var(--weight-title);
}

.app-summary {
  font-size: var(--size-lead);
  color: var(--color-text-soft);
}

.app-features {
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-2);
}

.app-features li {
  display: grid;
  grid-template-columns: var(--space-5) minmax(0, 1fr);
  color: var(--color-text-soft);
}

/* A short rule in the app's colour, centred on the first line of each feature. */
.app-features li::before {
  content: "";
  inline-size: var(--space-3);
  block-size: var(--rule);
  margin-block-start: var(--first-line-middle);
  background: var(--app-color);
}

.app-terms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  padding-block-start: var(--space-4);
  border-block-start: var(--rule) solid var(--color-line);
  font-family: var(--font-label);
  font-size: var(--size-label);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-mono);
  color: var(--color-text-quiet);
}

.app-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  justify-self: start;
  min-height: var(--target);
  font-family: var(--font-label);
  font-size: var(--size-small);
  letter-spacing: var(--tracking-mono);
  color: var(--app-color);
  text-decoration: none;
  border-block-end: var(--rule) solid currentColor;
}

.app-link:hover .icon {
  transform: translate(var(--nudge), calc(-1 * var(--nudge)));
}

.app--grounds {
  --app-color: var(--color-grounds);
}

.app--floor {
  --app-color: var(--color-floor);
}

.app--lockedin {
  --app-color: var(--color-lockedin);
}

/* ---------- How an app is made ---------- */

.steps {
  display: grid;
  gap: var(--space-7);
  counter-reset: step;
}

@media (min-width: 56rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-7) var(--space-8);
  }
}

.step {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding-block-start: var(--space-5);
  border-block-start: var(--rule) solid var(--color-line-strong);
  counter-increment: step;
}

.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--size-title);
  font-weight: var(--weight-display);
  font-style: italic;
  line-height: var(--leading-numeral);
  color: var(--color-coin);
}

.step h3 {
  font-size: var(--size-step);
  font-weight: var(--weight-title);
  letter-spacing: var(--tracking-title);
}

.step p {
  color: var(--color-text-soft);
}

.standards {
  display: grid;
  gap: var(--space-5);
  margin-block-start: var(--space-9);
  padding-block-start: var(--space-6);
  border-block-start: var(--rule) solid var(--color-line);
}

@media (min-width: 56rem) {
  .standards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-8);
  }
}

.standard {
  display: grid;
  align-content: start;
  gap: var(--space-2);
}

.standard dt {
  font-family: var(--font-label);
  font-size: var(--size-label);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-quiet);
}

.standard dd {
  margin: 0;
  color: var(--color-text-soft);
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  gap: var(--space-5);
}

.contact-email {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: var(--target);
  max-width: 100%;
  font-family: var(--font-display);
  font-size: var(--size-contact);
  font-weight: var(--weight-display);
  line-height: var(--leading-email);
  letter-spacing: var(--tracking-title);
  overflow-wrap: anywhere;
  text-decoration-color: var(--color-coin);
  text-underline-offset: 0.18em;
}

.contact-email:hover {
  color: var(--color-coin);
}

.founder {
  max-width: var(--measure);
  color: var(--color-text-quiet);
  font-size: var(--size-small);
}

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

.site-footer .wrap {
  display: grid;
  gap: var(--space-5);
  padding-block: var(--space-7);
}

@media (min-width: 48rem) {
  .site-footer .wrap {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
}

.footer-note {
  font-family: var(--font-label);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-mono);
  color: var(--color-text-quiet);
}

/* ---------- Not-found page ---------- */

.not-found {
  display: grid;
  justify-items: start;
  gap: var(--space-5);
  padding-block: var(--space-10);
}

.not-found h1 {
  font-size: var(--size-headline);
}

.not-found p {
  max-width: var(--measure);
  color: var(--color-text-soft);
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
