/* Layout and type for the "Stones" direction. tokens.css is linked ahead of
   this file from the layout, so both download in parallel. Do not @import it.

   Breakpoints: phone below 640px (the base rules), tablet 640px to 1023px,
   laptop 1024px and up. Content is capped at 1200px and centred. */

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

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

body {
  margin: 0;
  background: var(--base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  --gutter: 20px;
  --col-gap: 20px;
}

h1,
h2,
p,
figure,
ul {
  margin: 0;
}

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

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

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

a:hover {
  text-decoration-thickness: 2px;
}

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

/* ---------- Chrome ---------- */

.site-header,
.site-main,
.site-footer {
  padding-inline: max(var(--gutter), calc((100% - 1200px) / 2));
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 1;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

/* The toggle does nothing without JavaScript, so it stays hidden until the
   inline head script has added the js class to <html>. */
.mode-toggle {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -11px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 120ms ease;
}

.js .mode-toggle {
  display: inline-grid;
}

.mode-toggle:hover {
  color: var(--text-accent);
}

/* A half filled disc: the filled half swaps sides with the mode. */
.mode-toggle-icon {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

html[data-mode="dark"] .mode-toggle-icon {
  transform: rotate(180deg);
}

.site-footer {
  margin-top: 80px;
  padding-block: 32px 48px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer p + p {
  margin-top: 4px;
}

/* ---------- Shapes ---------- */

.shape {
  display: block;
  aspect-ratio: 1;
}

.shape svg {
  width: 100%;
  height: 100%;
}

/* ---------- Index ---------- */

.intro {
  padding-block: 48px 32px;
}

.intro-line {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 22ch;
}

.group {
  padding-block: 20px;
}

.group h2,
.family h2 {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-muted);
}

.item-list {
  display: grid;
  gap: 22px;
  margin-top: 14px;
}

.item-link {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 16px;
  align-items: start;
  color: var(--text-primary);
  text-decoration: none;
}

.item-link .shape {
  grid-row: span 2;
  width: 44px;
}

.item-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  transition: color 120ms ease;
}

.item-blurb {
  grid-column: 2;
  margin-top: 2px;
  max-width: 52ch;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.item-link:hover .item-name,
.item-link:focus-visible .item-name {
  color: var(--text-accent);
}

/* ---------- Project ---------- */

.project {
  padding-block: 40px 24px;
}

.project > .project-head > .shape {
  width: 120px;
  margin-bottom: 28px;
}

.project-name {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.project-kind {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.project-description,
.project-note {
  margin-top: 22px;
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.project-note {
  margin-top: 12px;
  font-size: 1rem;
}

.project-text > p:last-child {
  margin-top: 28px;
}

.project-link {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--button-fill);
  color: var(--button-label);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.project-shot {
  margin-top: 48px;
}

.project-shot img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface);
}

.family {
  margin-top: 56px;
}

.family-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 10px;
}

.family-list a,
.pager a {
  color: var(--text-primary);
  text-decoration: none;
}

.family-list a {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 600;
  transition: color 120ms ease;
}

.family-list a:hover,
.family-list a:focus-visible {
  color: var(--text-accent);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 56px;
  font-size: 0.9375rem;
}

.pager a {
  color: var(--text-secondary);
}

.pager-next {
  margin-left: auto;
  text-align: right;
}

.pager-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  transition: color 120ms ease;
}

.pager a:hover .pager-name,
.pager a:focus-visible .pager-name {
  color: var(--text-accent);
}

/* ---------- 404 ---------- */

.not-found {
  padding-block: 48px 32px;
}

.not-found-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
}

.not-found p {
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

/* ---------- Tablet, 640px to 1023px ---------- */

@media (min-width: 640px) {
  body {
    --gutter: 32px;
    --col-gap: 24px;
  }

  .intro,
  .group {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
  }

  .intro {
    padding-block: 64px 48px;
  }

  .intro-line {
    grid-column: 4 / span 9;
    font-size: 2.25rem;
  }

  .group {
    padding-block: 24px;
  }

  .group h2 {
    grid-column: 1 / span 3;
    padding-top: 6px;
  }

  .item-list {
    grid-column: 4 / span 9;
    margin-top: 0;
    gap: 26px;
  }

  /* Shape left (about a third), text right. The head wrapper steps aside
     so the shape, the text and the screenshot share one grid. */
  .project,
  .family {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    column-gap: 40px;
  }

  .project {
    padding-block: 64px 32px;
  }

  .project-head {
    display: contents;
  }

  .project > .project-head > .shape {
    grid-column: 1;
    width: 100%;
    max-width: 200px;
    margin-bottom: 0;
  }

  .project-text,
  .project-shot,
  .family-list {
    grid-column: 2;
  }

  .project-name {
    font-size: 3.25rem;
  }

  .family h2 {
    grid-column: 1;
    padding-top: 4px;
  }

  .family-list {
    margin-top: 0;
  }

  .not-found {
    padding-block: 72px 48px;
  }

  .not-found-title {
    font-size: 3.25rem;
  }
}

/* ---------- Laptop, 1024px and up ---------- */

@media (min-width: 1024px) {
  body {
    --gutter: 40px;
    --col-gap: 20px;
  }

  .intro {
    padding-block: 72px 56px;
  }

  .intro-line {
    font-size: 2.5rem;
  }

  .group {
    padding-block: 28px;
  }

  .group h2 {
    padding-top: 8px;
  }

  .item-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px var(--col-gap);
  }

  /* Shape in columns 1 to 4, text in columns 6 to 12. */
  .project,
  .family {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--col-gap);
  }

  .project {
    padding-block: 72px 40px;
  }

  .project > .project-head > .shape {
    grid-column: 1 / span 4;
    max-width: 240px;
  }

  .project-text,
  .project-shot,
  .family-list {
    grid-column: 6 / span 7;
  }

  .family h2 {
    grid-column: 1 / span 4;
  }

  .project-name {
    font-size: 3.5rem;
  }
}

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