/* ==========================================================================
   Kat McGowan — Learning experience design
   Single stylesheet. No build step.
   ========================================================================== */

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

:root {
  --ink: #000;
  --ink-soft: #444;
  --ink-faint: #767676;
  --paper: #fff;
  --rule: #d8d8d8;

  --coral: #ff4b4c;
  --olive: #6e660a;
  --blue: #0034ad;
  --purple: #5f00ad;
  --magenta: #ab0782;

  /* Coral is only 3.3:1 on white — fine for display type at 24px+, but it
     fails AA everywhere else. --accent-ink is the small-text version; the
     other four accents clear AA as they are, so they share one value. */
  --coral-ink: #cc2b2c;

  /* Per-page accent. Each page overrides this on <body>.
     --accent      display type, rules, borders, markers
     --accent-ink  anything below 24px: tags, buttons, links, labels */
  --accent: var(--ink);
  --accent-ink: var(--accent);
  --accent-tint: color-mix(in srgb, var(--accent) 8%, #fff);

  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, monospace;

  --measure: 44rem;   /* readable column */
  --wide: 68rem;      /* page frame */
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
}

/* --accent and --accent-ink must always be set together. A custom property
   that references another resolves where it is DECLARED, not where it is
   used, so a rule that sets only --accent leaves --accent-ink pointing at
   whatever the ancestor had. One attribute, both values, no exceptions.
   The selector is bare so it works on <body>, a card, or a single button. */
[data-accent="coral"]   { --accent: var(--coral);   --accent-ink: var(--coral-ink); }
[data-accent="olive"]   { --accent: var(--olive);   --accent-ink: var(--olive); }
[data-accent="blue"]    { --accent: var(--blue);    --accent-ink: var(--blue); }
[data-accent="purple"]  { --accent: var(--purple);  --accent-ink: var(--purple); }
[data-accent="magenta"] { --accent: var(--magenta); --accent-ink: var(--magenta); }
[data-accent]           { --accent-tint: color-mix(in srgb, var(--accent) 8%, #fff); }

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.62;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* --- Layout --------------------------------------------------------------- */

.frame {
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The reading column sits inset from the frame on wide screens, matching the
   indented body text of the original design. */
.column {
  max-width: var(--measure);
  margin-inline: auto;
}

.stack > * + * { margin-top: var(--stack-gap, 1.5rem); }

/* --- Header --------------------------------------------------------------- */

.masthead {
  padding-block: 1.75rem 0;
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.brand__name {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand__role {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  line-height: 1.4;
}

.nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
}

.nav a {
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] { border-bottom-color: currentColor; }

.nav a:nth-child(1) { color: var(--magenta); }
.nav a:nth-child(2) { color: var(--purple); }
.nav a:nth-child(3) { color: var(--blue); }
.nav a:nth-child(4) { color: var(--olive); }

.masthead__tagline {
  margin: 0.5rem 0 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
}

/* --- Type ----------------------------------------------------------------- */

h1, h2, h3, h4 {
  font-weight: 400;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

.display {
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  line-height: 1.22;
}

.page-title {
  font-size: clamp(1.625rem, 1.2rem + 1.9vw, 2.375rem);
  line-height: 1.2;
  color: var(--accent);
}

h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: 1.125em;
  color: var(--ink-soft);
}

ul, ol { margin: 0 0 1.05em; padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--accent); }

strong { font-weight: 600; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

.rule-accent { border-top-color: color-mix(in srgb, var(--accent) 45%, #fff); }

/* --- Tags ----------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
  margin: 0 0 0.875rem;
  padding: 0;
}

.tag {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-ink);
  margin: 0;
  white-space: nowrap;
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--accent-ink);
  color: var(--accent-ink);
  background: transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--accent-ink);
  color: #fff;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

/* --- Home ----------------------------------------------------------------- */

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

.hero .display { max-width: 32ch; }

.feature { padding-block: clamp(2rem, 5vw, 3rem); }

.feature__media {
  margin-bottom: 1.5rem;
  max-width: 44rem;
  margin-inline: auto;
}

.feature__title {
  font-size: clamp(1.375rem, 1.05rem + 1.4vw, 1.875rem);
  line-height: 1.24;
  color: var(--accent-ink);
  margin-bottom: 0.875rem;
  max-width: 22ch;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.75rem, 4vw, 2.75rem);
  padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4rem);
}

.card {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
}

.card__media { margin-bottom: 1rem; }

.card__media img {
  width: 100%;
  aspect-ratio: 1 / 1;   /* home card exports are square; don't crop them */
  object-fit: cover;
  background: #f4f4f2;
}

.card__title {
  font-size: 1.375rem;
  line-height: 1.26;
  color: var(--accent-ink);
  margin-bottom: 0.875rem;
}

.card__title a { text-decoration: none; }
.card__title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.card .btn { align-self: flex-start; margin-top: auto; }

/* --- Case study ----------------------------------------------------------- */

.case { padding-block: clamp(2.5rem, 6vw, 4rem) 1rem; }

.case__header { margin-bottom: 2rem; }

.case__header .btn { margin-top: 1.25rem; }

/* Skim block for recruiters: role, tools, format at a glance. */
.at-a-glance {
  margin: 2.5rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.25rem 2rem;
}

.at-a-glance div { margin: 0; }

.at-a-glance dt {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}

.at-a-glance dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}

figure { margin: 2.5rem 0; }

figure img { width: 100%; }

figcaption {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-top: 0.75rem;
}

/* Callout for the "behind the scenes" style asides. */
.note {
  border-left: 2px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.125rem;
  margin: 2rem 0;
  color: var(--ink-soft);
}


/* --- About ---------------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
  margin-top: 3.5rem;
}

.now dl { margin: 0; }

.now div {
  border-top: 1px solid var(--rule);
  padding-block: 1rem;
}

.now div:first-of-type { border-top: 0; padding-top: 0; }

.now dt,
.now dd {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 0;
}

.now dt { color: var(--ink); margin-bottom: 0.4rem; }
.now dd { color: var(--ink-soft); }

.now__label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.pull {
  font-size: clamp(1.375rem, 1.05rem + 1.4vw, 1.875rem);
  line-height: 1.3;
  margin: 3.5rem 0 1.25rem;
  max-width: 24ch;
}

/* --- Visual design / TAE index cards -------------------------------------- */

.entry {
  border-top: 1px solid var(--rule);
  padding-top: 1.75rem;
  margin-top: 3rem;
}

.entry h2 { margin-top: 0.5rem; }

.entry__kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.cluster {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
}

.cluster__n {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-ink);
  margin-bottom: 0.5rem;
}

.cluster h3 { margin-top: 0; font-weight: 400; font-size: 1.0625rem; }

.cluster ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.cluster .btn { align-self: flex-start; margin-top: auto; }

.cluster .btn[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

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

.footer {
  border-top: 1px solid var(--rule);
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 1.75rem 2.5rem;
}

.footer__links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.footer__links a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 1.0625rem;
}

.footer__links a:nth-child(1) { color: var(--blue); }
.footer__links a:nth-child(2) { color: var(--olive); }
.footer__links a:nth-child(3) { color: var(--coral); }

.footer__legal {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin: 0;
}

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

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

/* --- Writing --------------------------------------------------------------- */

.post-list {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.post-list > li {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  margin: 0 0 2.75rem;
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1.5rem;
  align-items: start;
}

.post-list img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #f4f4f2;
}

.post-list h3 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.28;
}

.post-list h3 a {
  color: var(--accent-ink);
  text-decoration: none;
}

.post-list h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-list p { margin: 0; color: var(--ink-soft); }

@media (max-width: 34rem) {
  .post-list > li { grid-template-columns: 1fr; gap: 1rem; }
  .post-list img { aspect-ratio: 2 / 1; }
}

/* Date line above a post title, and on index rows. */
.post-date {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}

.post__header { margin-bottom: 2rem; }
.post__header .post-date { margin-bottom: 0.75rem; }
.post__header .tags { margin-top: 1rem; margin-bottom: 0; }

.post__cover { margin: 2.5rem 0; }

.post__cover img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}

/* "Originally published in …" credit. */
.origin {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.25rem;
}

.origin a { color: var(--accent-ink); }

/* Previous / next within the series. */
.series {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem 2rem;
}

.series__label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.4rem;
}

.series a {
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--accent-ink);
  text-decoration: none;
}

.series a:hover { text-decoration: underline; text-underline-offset: 3px; }

.series__next { text-align: right; }
.series__next:only-child { grid-column: 2; }

@media (max-width: 34rem) {
  .series__next, .series__next:only-child { text-align: left; grid-column: auto; }
}

/* Callout linking a post to the case study it produced. */
.related-case {
  background: var(--accent-tint);
  padding: 1.25rem 1.375rem;
  margin: 3rem 0 0;
}

.related-case p { margin: 0 0 0.6rem; font-size: 0.9375rem; }
.related-case p:last-child { margin: 0; }

/* Links inside running prose. Nav, buttons and cards set their own colour. */
.column p a,
.column li a,
.related-case a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.column p a:hover,
.column li a:hover,
.related-case a:hover { text-decoration-thickness: 2px; }


/* --- Homepage routes ------------------------------------------------------- */

.routes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: clamp(2rem, 5vw, 3.5rem);
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.route {
  border-top: 2px solid var(--accent);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
}

.route h2 {
  margin: 0 0 0.625rem;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
  line-height: 1.22;
  color: var(--accent-ink);
}

.route p { color: var(--ink-soft); }

.route ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--ink-faint);
}

.route .btn { align-self: flex-start; margin-top: auto; }

/* Compact writing teaser on the homepage. */
.teaser {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.teaser ul { list-style: none; margin: 1.25rem 0 0; padding: 0; }

.teaser li {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0 1.5rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--rule);
  margin: 0;
  align-items: baseline;
}

.teaser li:first-child { border-top: 0; }

.teaser a { color: var(--accent-ink); text-decoration: none; }
.teaser a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 34rem) {
  .teaser li { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* A four-card grid reads better as 2x2 than 3 + 1 stranded. */
.card-grid--four { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

/* A full-page screenshot capped to a scrollable frame, so one artefact
   doesn't cost the reader two screens of scrolling. */
.figure--page {
  max-height: 34rem;
  overflow-y: auto;
  border: 1px solid var(--rule);
  background: #fff;
}

.figure--page img { width: 100%; }

/* --- Case study navigation -------------------------------------------------- */

/* Back to the section index, above the title. */
.crumb {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  margin: 0 0 1.25rem;
}

/* .column p a is more specific than .crumb a, so match its weight. */
.column .crumb a {
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.column .crumb a:hover { border-bottom-color: currentColor; }

/* Every sibling project, at the foot of a case study. */
.more {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding-top: 1.5rem;
}

.more__label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.5rem;
}

.more__grid {
  display: grid;
  /* 8.5rem keeps four siblings on one row inside the 44rem column;
     wider and the fourth strands onto a line of its own. */
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.more__grid li { margin: 0; }

.more__grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f4f4f2;
  margin-bottom: 0.75rem;
}

.more__grid li a {
  color: var(--accent-ink);
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.3;
  display: block;
}

.more__grid li a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Each card keeps its own project's colour. */
.more__grid li[data-accent] a { color: var(--accent-ink); }
