/* ============================================
   RESET
   Andy Bell's CSS Reset
   https://andy-bell.co.uk/a-more-modern-css-reset/
   ============================================ */

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

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scrollbar-gutter: stable;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* ============================================
   TOKENS
   Utopia Fluid Type Scale
   https://utopia.fyi/type/calculator
   Min 320px — Max 1240px
   Base 16px (1rem) — Scale 1.25 (Major Third)
   ============================================ */

:root {
  --step--2: clamp(0.64rem, 0.5957rem + 0.2217vi, 0.8rem);
  --step--1: clamp(0.8rem, 0.7446rem + 0.2772vi, 1rem);
  --step-0: clamp(1rem, 0.9308rem + 0.3464vi, 1.25rem);
  --step-1: clamp(1.25rem, 1.1635rem + 0.433vi, 1.5625rem);
  --step-2: clamp(1.5625rem, 1.4543rem + 0.5413vi, 1.9531rem);
  --step-3: clamp(1.9531rem, 1.8179rem + 0.6766vi, 2.4414rem);
  --step-4: clamp(2.4414rem, 2.2724rem + 0.8457vi, 3.0518rem);

  /* Utopia Fluid Space Scale
     https://utopia.fyi/space/calculator
     Min 320px — Max 1240px
     Base 16px (1rem) */

  --space-3xs: clamp(0.25rem, 0.2283rem + 0.1087vi, 0.3125rem);
  --space-2xs: clamp(0.5rem, 0.4565rem + 0.2174vi, 0.625rem);
  --space-xs: clamp(0.75rem, 0.6848rem + 0.3261vi, 0.9375rem);
  --space-s: clamp(1rem, 0.913rem + 0.4348vi, 1.25rem);
  --space-m: clamp(1.5rem, 1.3696rem + 0.6522vi, 1.875rem);
  --space-l: clamp(2rem, 1.8261rem + 0.8696vi, 2.5rem);
  --space-xl: clamp(3rem, 2.7391rem + 1.3043vi, 3.75rem);
  --space-2xl: clamp(4rem, 3.6522rem + 1.7391vi, 5rem);
  --space-3xl: clamp(6rem, 5.4783rem + 2.6087vi, 7.5rem);

  /* One-up pairs */
  --space-3xs-2xs: clamp(0.25rem, 0.1196rem + 0.6522vi, 0.625rem);
  --space-2xs-xs: clamp(0.5rem, 0.3478rem + 0.7609vi, 0.9375rem);
  --space-xs-s: clamp(0.75rem, 0.5761rem + 0.8696vi, 1.25rem);
  --space-s-m: clamp(1rem, 0.6957rem + 1.5217vi, 1.875rem);
  --space-m-l: clamp(1.5rem, 1.1522rem + 1.7391vi, 2.5rem);
  --space-l-xl: clamp(2rem, 1.3913rem + 3.0435vi, 3.75rem);
  --space-xl-2xl: clamp(3rem, 2.3043rem + 3.4783vi, 5rem);
  --space-2xl-3xl: clamp(4rem, 2.7826rem + 6.087vi, 7.5rem);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: var(--step-0);
  color: hsl(0 0% 15%);
  background: white;
}

body > * + *,
main > * + *,
article > * + *,
section > * + *,
footer > * + * {
  margin-block-start: var(--flow-space, var(--space-s-m));
}

main > .region + .region {
  margin-block-start: 0;
}

h1 {
  font-size: var(--step-4);
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-2);
}
h4 {
  font-size: var(--step-1);
}

h1,
h2,
h3,
h4 {
  --flow-space: var(--space-l-xl);
}

h1 + *,
h2 + *,
h3 + *,
h4 + * {
  --flow-space: var(--space-xs);
}

a {
  color: currentColor;
}

ul,
ol {
  padding-inline-start: 1em;
}

blockquote {
  border-inline-start: 3px solid;
  padding-inline-start: var(--space-s);
}

hr {
  border: none;
  border-block-start: 1px solid hsl(0 0% 45%);
  margin-block: var(--space-s-m);
}

small {
  font-size: var(--step--1);
}

strong {
  font-weight: 700;
}

label {
  font-weight: 600;
}

input,
textarea,
select {
  color: inherit;
  background: inherit;
  border: 1px solid;
  padding: 0.5em 1em;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid;
  outline-offset: 2px;
}

input::placeholder {
  color: hsl(0 0% 45%);
}

button {
  color: inherit;
  background: inherit;
  border: 1px solid;
  padding: 0.5em 1em;
  cursor: pointer;
}

button:focus {
  outline: 2px solid;
  outline-offset: 2px;
}

/* ============================================
   COMPOSITIONS
   Layout primitives that control flow and
   spatial relationships between elements.
   ============================================ */

/* Flow */
.flow > * + * {
  margin-block-start: var(--flow-space, 1em);
}

/* Stack */
.stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.stack > * + * {
  margin-block-start: var(--space, var(--space-s-m));
}

/* Box */
.box {
  padding: var(--space-s-m);
  border: 1px solid;
  color: inherit;
  background-color: inherit;
}

/* Center */
.center {
  box-sizing: content-box;
  margin-inline: auto;
  max-inline-size: var(--measure, 60ch);
  padding-inline: var(--gutter, var(--space-s));
}

/* Cluster */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  justify-content: flex-start;
  align-items: center;
}

/* Shelf */
.shelf {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}

.shelf > * + * {
  margin-inline-start: var(--space, var(--space-s-m));
}

/* With-Sidebar */
.with-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s-m);
}

.with-sidebar > :first-child {
  flex-basis: 20rem;
  flex-grow: 1;
}

.with-sidebar > :last-child {
  flex-basis: 0;
  flex-grow: 999;
  min-inline-size: 50%;
}

/* Cover */
.cover {
  display: flex;
  flex-direction: column;
  min-block-size: 100svh;
}

.cover > main {
  flex: 1;
}

/* Switcher */
.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
}

.switcher > * {
  flex-grow: 1;
  flex-basis: calc((30rem - 100%) * 999);
}

/* Region */
.region {
  padding-block: var(--space-s-m);
}

/* Grid */
.grid {
  display: grid;
  grid-gap: var(--space-s-m);
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
}

/* Reel */
.reel {
  display: flex;
  block-size: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: hsl(0 0% 45%) transparent;
}

.reel > * {
  flex: 0 0 auto;
}

.reel > * + * {
  margin-inline-start: var(--space-s);
}

/* Frame */
.frame {
  aspect-ratio: var(--frame-ratio, 2 / 3);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ============================================
   UTILITIES
   ============================================ */

.wrapper {
  max-inline-size: 60ch;
  margin-inline: auto;
  padding-inline: var(--space-s);
}
