:root {
  color-scheme: light dark;
  --paper: oklch(.975 .018 83);
  --paper-soft: oklch(.945 .026 82);
  --ink: oklch(.23 .024 68);
  --muted: oklch(.44 .022 68);
  --subtle: oklch(.57 .02 68);
  --line: oklch(.75 .035 72);
  --accent: oklch(.42 .135 16);
  --accent-soft: oklch(.92 .035 13);
  --desktop: oklch(.17 .013 65);
  --overlay: rgb(16 13 11 / .56);
  --title: Optima, "Segoe UI", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --shadow: 0 24px 70px oklch(.08 .015 65 / .38), 0 2px 10px oklch(.08 .015 65 / .18);
  --space-xs: .5rem;
  --space-sm: .75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(.245 .008 55);
    --paper-soft: oklch(.285 .012 55);
    --ink: oklch(.93 .02 82);
    --muted: oklch(.77 .02 82);
    --subtle: oklch(.65 .02 82);
    --line: oklch(.43 .016 58);
    --accent: oklch(.7 .125 13);
    --accent-soft: oklch(.34 .055 11);
    --desktop: oklch(.12 .009 55);
    --overlay: rgb(9 8 7 / .7);
    --shadow: 0 28px 78px oklch(.04 .006 55 / .6);
  }
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(1.25rem, 6vh, 4.5rem) 1.25rem;
  background: var(--desktop);
  color: var(--ink);
  font: 1rem/1.65 var(--body);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(var(--overlay), var(--overlay)), url("early-middle-ages/images/cole-background.jpg");
  background-position: center;
  background-size: cover;
  content: "";
}

a { color: inherit; text-underline-offset: .22em; }
a:hover { color: var(--accent); }

.paper {
  position: relative;
  width: min(780px, 100%);
  margin: 0 auto;
  padding: clamp(4.5rem, 10vw, 7rem) clamp(1.4rem, 8vw, 5.75rem) clamp(2rem, 6vw, 4rem);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.paper::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--line) 13%, transparent) 32px);
  content: "";
  pointer-events: none;
}

.paper > * { position: relative; z-index: 1; }

.binding {
  position: absolute;
  top: 16px;
  right: 26px;
  left: 26px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
}

.binding i,
.cover-holes i {
  display: block;
  border-radius: 50%;
  background: var(--desktop);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / .5), 0 1px 0 color-mix(in srgb, var(--paper) 80%, transparent);
}

.binding i { width: 14px; height: 14px; }

.intro { display: grid; gap: var(--space-md); max-width: 35rem; }

.eyebrow,
.collection-heading,
.course-label,
.cover-copy small {
  font-size: .6875rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eyebrow { margin: 0; color: var(--accent); }

h1,
h2,
.notebook-copy > strong,
.cover-copy strong {
  font-family: var(--title);
  color: var(--ink);
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 9vw, 4.8rem);
  font-weight: 800;
  line-height: .94;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.intro p:not(.eyebrow) { max-width: 58ch; margin: 0; color: var(--muted); }
.intro .lede { max-width: 31ch; font: 700 clamp(1.15rem, 3vw, 1.45rem)/1.35 var(--title); color: var(--ink); }

.collection { display: grid; gap: var(--space-xl); margin-top: clamp(3.5rem, 9vw, 5.75rem); }

.collection-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--line);
  color: var(--accent);
}

.collection-heading h2 { margin: 0; font: inherit; color: inherit; }
.collection-heading span { color: var(--subtle); }

.notebook {
  display: grid;
  grid-template-columns: minmax(210px, 5fr) minmax(220px, 6fr);
  gap: clamp(1.5rem, 5vw, 2.75rem);
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / .28);
  border-radius: 7px;
  background-image: linear-gradient(180deg, rgb(18 13 11 / .05), rgb(18 13 11 / .79)), url("early-middle-ages/images/cole-background.jpg");
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 38px rgb(26 19 14 / .24), 0 2px 6px rgb(26 19 14 / .16);
  transition: transform 180ms cubic-bezier(.16, 1, .3, 1), filter 180ms ease;
}

.cover::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgb(255 255 255 / .16), transparent 32%, rgb(0 0 0 / .12));
  content: "";
  pointer-events: none;
}

.cover-holes {
  position: absolute;
  top: 10px;
  right: 12px;
  left: 12px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
}

.cover-holes i { width: 12px; height: 12px; border: 2px solid rgb(245 242 233 / .72); }

.cover-copy {
  position: absolute;
  right: 20px;
  bottom: 22px;
  left: 20px;
  z-index: 1;
  display: grid;
  gap: var(--space-md);
  color: oklch(.98 .01 82);
  text-shadow: 0 2px 12px rgb(0 0 0 / .45);
}

.cover-copy small { color: inherit; line-height: 1.45; }
.cover-copy strong { color: inherit; font-size: clamp(1.55rem, 4vw, 2rem); line-height: .96; letter-spacing: -.05em; }

.notebook-copy { display: grid; gap: var(--space-md); }
.course-label { color: var(--accent); }
.notebook-copy > strong { font-size: clamp(1.75rem, 4.6vw, 2.65rem); line-height: 1; letter-spacing: -.045em; }
.course-description { color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.open-label { margin-top: var(--space-xs); color: var(--accent); font-size: .8125rem; font-weight: 750; }
.open-label b { display: inline-block; margin-left: .35rem; font-size: 1.2rem; font-weight: 500; transition: transform 180ms cubic-bezier(.16, 1, .3, 1); }

.notebook:hover .cover,
.notebook:focus-visible .cover { filter: saturate(1.06); transform: translateY(-5px) rotate(-.35deg); }
.notebook:hover .open-label b,
.notebook:focus-visible .open-label b { transform: translateX(4px); }
.notebook:focus-visible { border-radius: 5px; outline: 3px solid var(--accent); outline-offset: 9px; }

footer { display: grid; gap: var(--space-xs); margin-top: clamp(3.5rem, 9vw, 5.5rem); padding-top: var(--space-md); border-top: 1px solid var(--line); }
footer p { max-width: 68ch; margin: 0; color: var(--subtle); font-size: .6875rem; line-height: 1.55; }
.art-credit { margin-top: var(--space-xs); }
.home-link { justify-self: start; margin-top: var(--space-md); color: var(--accent); font-size: .8125rem; font-weight: 750; text-decoration: none; }
.home-link:hover { text-decoration: underline; }

@media (max-width: 620px) {
  body { padding: .75rem; }
  .paper { padding: 4.25rem 1.35rem 2rem; border-radius: 9px; }
  .binding { right: 16px; left: 16px; }
  .binding i:nth-child(even) { display: none; }
  .notebook { grid-template-columns: minmax(125px, 2fr) minmax(145px, 2.3fr); gap: 1rem; align-items: start; }
  .cover-copy { right: 12px; bottom: 14px; left: 12px; gap: .65rem; }
  .cover-copy small { font-size: .56rem; letter-spacing: .07em; }
  .cover-copy strong { font-size: clamp(1.05rem, 6vw, 1.45rem); }
  .cover-holes { right: 7px; left: 7px; }
  .cover-holes i { width: 8px; height: 8px; border-width: 1px; }
  .notebook-copy { gap: .75rem; }
  .course-label { font-size: .6rem; }
  .notebook-copy > strong { font-size: clamp(1.35rem, 7vw, 1.8rem); }
  .course-description { font-size: .8125rem; line-height: 1.5; }
  .open-label { font-size: .75rem; }
}

@media (max-width: 390px) {
  .notebook { grid-template-columns: 1fr; }
  .cover { width: min(245px, 100%); }
}

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