:root {
  --paper: #fff9ef;
  --paper-deep: #f3eadf;
  --ink: #151b2a;
  --muted: #626a78;
  --accent: #1746d1;
  --accent-dark: #0e319e;
  --blue-soft: #dbe7ff;
  --coral: #f05a47;
  --peach: #ffded0;
  --sun: #f6c84c;
  --night: #10245a;
  --line: #d8d3ca;
  --code: #20262d;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", Baskerville, "Times New Roman", serif;
  --page-width: 72rem;
  --reading-width: 46rem;
  --gutter: clamp(1.25rem, 4vw, 4rem);
}

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

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body.site-body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--sun);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

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

.skip-link {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--coral);
  color: white;
  transform: translateY(-200%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 0;
}

.site-nav,
.site-masthead__inner,
.home-posts,
.list-shell,
.site-footer__inner {
  width: min(calc(100% - (2 * var(--gutter))), var(--page-width));
  margin-inline: auto;
}

.site-nav {
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.site-brand {
  flex: none;
  font-size: 1.18rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.site-brand span {
  color: var(--coral);
}

.site-nav__links,
.site-nav__links ul,
.site-socials {
  display: flex;
  align-items: center;
}

.site-nav__links {
  gap: clamp(1rem, 3vw, 2.5rem);
}

.site-nav__links ul {
  gap: clamp(0.8rem, 2vw, 1.6rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__links a {
  position: relative;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav__links a::after {
  position: absolute;
  right: 0;
  bottom: -0.38rem;
  left: 0;
  height: 1px;
  background: var(--coral);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: var(--ink);
}

.site-nav__links a:hover::after,
.site-nav__links a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.site-socials {
  gap: 1rem;
  padding-left: clamp(1rem, 2.5vw, 2rem);
  border-left: 1px solid var(--line);
}

.site-masthead {
  width: 100%;
  background: var(--accent);
  color: white;
}

.site-masthead__inner {
  padding-block: clamp(4.5rem, 10vw, 8rem);
  animation: content-in 550ms both ease-out;
}

.eyebrow {
  margin: 0 0 1.1rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  line-height: 1.3;
  text-transform: uppercase;
}

.site-masthead h1 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 8vw, 6.8rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.site-masthead .eyebrow {
  color: var(--sun);
}

.site-masthead__description {
  max-width: 35rem;
  margin: 1.75rem 0 0;
  color: var(--blue-soft);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.5;
}

.site-main {
  min-height: 60vh;
}

.home-posts {
  display: grid;
  grid-template-columns: minmax(12rem, 0.38fr) minmax(0, 1fr);
  gap: clamp(3rem, 8vw, 8rem);
  padding-block: clamp(4.5rem, 9vw, 8rem);
}

.section-intro {
  align-self: start;
  position: sticky;
  top: 2rem;
}

.section-intro h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.section-intro .eyebrow {
  color: var(--coral);
}

.section-intro > p:last-child {
  max-width: 20rem;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.post-list {
  min-width: 0;
  border-top: 2px solid var(--ink);
}

.post-preview {
  position: relative;
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(2rem, 5vw, 3.25rem);
  border-bottom: 1px solid var(--line);
}

.post-preview::before {
  position: absolute;
  top: 2rem;
  bottom: 2rem;
  left: -1.25rem;
  width: 0.3rem;
  border-radius: 999px;
  background: var(--coral);
  content: "";
}

.post-preview:nth-child(3n + 2)::before {
  background: var(--sun);
}

.post-preview:nth-child(3n + 3)::before {
  background: var(--accent);
}

.post-preview__meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.38rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
}

.post-preview h2 {
  max-width: 25ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.13;
}

.post-preview h2 a {
  text-decoration: none;
}

.post-preview h2 a:hover {
  color: var(--accent);
}

.post-preview__body > p {
  max-width: 42rem;
  margin: 1rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.text-link span {
  transition: transform 160ms ease;
}

.text-link:hover span {
  transform: translateX(0.25rem);
}

.post-preview .text-link span {
  transition: none;
}

.post-preview .text-link:hover span {
  transform: none;
}

.list-shell {
  padding-block: clamp(3.5rem, 8vw, 7rem);
}

.list-shell__intro {
  margin-bottom: 4rem;
}

.empty-state {
  padding-block: 3rem;
  color: var(--muted);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.project-row {
  grid-column: span 2;
  min-height: 21rem;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--paper);
  border-top: 0.45rem solid var(--coral);
}

.project-row:nth-last-child(-n + 2) {
  grid-column: span 3;
}

.project-row:nth-child(3n + 2) {
  border-top-color: var(--sun);
}

.project-row:nth-child(3n + 3) {
  border-top-color: var(--accent);
}

.project-row__number {
  display: block;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.project-row:nth-child(3n + 2) .project-row__number {
  color: #9a7100;
}

.project-row:nth-child(3n + 3) .project-row__number {
  color: var(--accent);
}

.project-row .eyebrow {
  margin-bottom: 0.75rem;
}

.project-row__body {
  flex: 1;
}

.project-row h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.project-row h2 a {
  text-decoration: none;
}

.project-row h2 a:hover {
  color: var(--accent);
}

.project-row__body > p:last-child {
  max-width: 40rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.project-row__link {
  margin-top: 2rem;
  white-space: nowrap;
}

.project-row__link span,
.project-row__link:hover span {
  transition: none;
  transform: none;
}

.demo-shell {
  width: min(calc(100% - (2 * var(--gutter))), 96rem);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.demo-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.demo-toolbar .article-header__back {
  margin-bottom: 1rem;
}

.demo-toolbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.demo-toolbar__link {
  flex: none;
}

.demo-toolbar__link span,
.demo-toolbar__link:hover span {
  transition: none;
  transform: none;
}

.demo-stage {
  border-top: 0.5rem solid var(--accent);
  background: white;
}

.demo-frame {
  width: 100%;
  height: clamp(32rem, 76svh, 58rem);
}

.demo-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.article-shell {
  width: 100%;
  padding-bottom: clamp(4rem, 9vw, 8rem);
}

.article-hero {
  margin-bottom: clamp(4rem, 9vw, 7rem);
  background: var(--peach);
  border-top: 0.55rem solid var(--coral);
}

.article-header {
  width: min(calc(100% - (2 * var(--gutter))), 53rem);
  max-width: 53rem;
  margin: 0 auto;
  padding-block: clamp(4rem, 9vw, 7rem);
  animation: content-in 500ms both ease-out;
}

.article-header__back {
  display: inline-block;
  margin-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
  text-transform: capitalize;
}

.article-header__back:hover {
  color: var(--accent);
}

.article-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.9rem, 7vw, 5.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.99;
}

.article-header__description {
  max-width: 44rem;
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.55;
}

.article-header__meta {
  display: flex;
  gap: 0.85rem;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-header__meta > * + *::before {
  margin-right: 0.85rem;
  color: var(--line);
  content: "/";
}

.article-body {
  width: min(calc(100% - (2 * var(--gutter))), var(--reading-width));
  max-width: var(--reading-width);
  margin-inline: auto;
  color: #31373c;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.5vw, 1.2rem);
  line-height: 1.78;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body pre,
.article-body figure,
.article-body table {
  margin-block: 1.5em;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: 2rem;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.article-body h1 {
  margin: 2.8em 0 0.7em;
  font-size: clamp(1.9rem, 4vw, 2.55rem);
}

.article-body h2 {
  margin: 2.4em 0 0.7em;
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.article-body h3 {
  margin: 2.1em 0 0.6em;
  font-size: 1.35rem;
}

.article-body a {
  color: var(--accent);
  text-decoration-color: #9eb4f1;
}

.article-body a:hover {
  text-decoration-color: currentColor;
}

.article-body strong {
  color: var(--ink);
}

.article-body blockquote {
  margin-inline: 0;
  padding: 0.15rem 0 0.15rem 1.5rem;
  border-left: 4px solid var(--coral);
  color: #555d64;
  font-size: 1.05em;
  font-style: italic;
}

.article-body :not(pre) > code {
  padding: 0.15em 0.35em;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  background: var(--paper-deep);
  color: #374b59;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
}

.article-body pre,
.article-body .highlight {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 0.35rem;
  background: var(--code);
}

.article-body .highlight {
  margin-block: 1.8em;
}

.article-body .highlight pre {
  margin: 0;
}

.article-body pre {
  padding: 1.25rem;
  color: #f4f0e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
}

.article-body img,
.article-body video,
.article-body iframe {
  max-width: 100%;
  height: auto;
}

.article-body hr {
  margin-block: 3rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.article-body th,
.article-body td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.article-tags {
  width: min(calc(100% - (2 * var(--gutter))), var(--reading-width));
  max-width: var(--reading-width);
  margin: clamp(4rem, 9vw, 7rem) auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.article-tags ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-tags a {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration-color: var(--line);
}

.article-tags a:hover {
  color: var(--accent);
}

.term-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 1.6rem;
  text-decoration: none;
}

.term-list a:hover {
  color: var(--accent);
}

.term-list small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
}

.not-found {
  width: min(calc(100% - (2 * var(--gutter))), 44rem);
  margin-inline: auto;
  padding-block: clamp(5rem, 14vw, 10rem);
}

.not-found h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
}

.not-found > p:not(.eyebrow) {
  margin: 1rem 0 2rem;
  color: var(--muted);
}

.site-footer {
  border-top: 0;
  background: var(--night);
}

.site-footer__inner {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  color: #bfcaf0;
  font-size: 0.78rem;
}

.site-footer__inner p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: white;
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 50rem) {
  .site-nav {
    align-items: flex-start;
    padding-block: 1.25rem;
  }

  .site-nav__links {
    align-items: flex-end;
    flex-direction: column;
    gap: 0.6rem;
  }

  .site-socials {
    padding-left: 0;
    border-left: 0;
  }

  .home-posts {
    grid-template-columns: 1fr;
  }

  .section-intro {
    position: static;
  }

  .project-row {
    grid-column: span 3;
    min-height: 19rem;
  }

  .project-row:nth-last-child(-n + 2) {
    grid-column: span 3;
  }

  .project-row:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .demo-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 36rem) {
  .site-nav {
    display: block;
  }

  .site-brand {
    display: inline-block;
    margin-bottom: 1rem;
  }

  .site-nav__links {
    align-items: flex-start;
  }

  .site-nav__links ul {
    flex-wrap: wrap;
  }

  .site-masthead__inner {
    padding-block: 4rem;
  }

  .post-preview {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    padding-inline: 0.75rem;
  }

  .post-preview::before {
    left: 0;
  }

  .project-list {
    grid-template-columns: 1fr;
  }

  .project-row,
  .project-row:nth-last-child(-n + 2),
  .project-row:last-child:nth-child(odd) {
    grid-column: auto;
    min-height: 0;
  }

  .project-row__number {
    margin-bottom: 2rem;
  }

  .post-preview__meta {
    flex-direction: row;
    gap: 0.75rem;
  }

  .article-header__meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .article-header__meta > * + *::before {
    content: none;
  }

  .site-footer__inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
