/* ==========================================================================
   Engage Ridley — single stylesheet, no build step.
   Order: tokens → reset → layout → components → content → utilities.
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */

:root {
  color-scheme: dark light;

  /* Dark is the default; the light-mode block below overrides these. */
  --bg: #0f1117;
  --bg-raised: #171a23;
  --bg-inset: #10131a;
  --border: #262b38;
  --text: #e7e9ee;
  --text-muted: #99a1b3;
  --accent: #ff5d3b;
  --accent-soft: rgba(255, 93, 59, 0.14);
  --link: #ff8060;
  --focus: #7fb4ff;

  /* Text/overlay colors for content painted on top of photos or solid accent
     fills (review hero, review cards, skip link) — these stay constant across
     the light/dark switch below since they're chosen for image contrast, not
     page theme. Change them here rather than hunting for hardcoded values. */
  --on-image-text: #fff;
  --on-image-text-muted: rgb(255 255 255 / 85%);
  --on-accent-text: #fff;
  --scrim-rgb: 10 10 12;
  --card-hover-tint-alpha: 0.18;

  --font-body:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas,
    monospace;

  --measure: 68ch;
  --wrap: 72rem;
  --radius: 10px;

  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.075rem);
  --step-1: clamp(1.2rem, 1.13rem + 0.35vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.32rem + 0.65vw, 1.85rem);
  --step-3: clamp(1.8rem, 1.55rem + 1.2vw, 2.6rem);
  --step-4: clamp(2.2rem, 1.75rem + 2.2vw, 3.6rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf8;
    --bg-raised: #ffffff;
    --bg-inset: #f1efeb;
    --border: #e0dcd5;
    --text: #1a1c22;
    --text-muted: #5f6672;
    --accent: #d8340f;
    --accent-soft: rgba(216, 52, 15, 0.1);
    --link: #c02f0e;
    --focus: #1a5fd0;
  }
}

/* ---------------------------------------------------------------- reset -- */

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

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img,
video,
svg,
iframe {
  max-width: 100%;
  height: auto;
}

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

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

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

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  text-wrap: balance;
  margin: 2em 0 0.6em;
  font-weight: 650;
  letter-spacing: -0.015em;
}

h1 {
  font-size: var(--step-3);
  margin-top: 0;
}
h2 {
  font-size: var(--step-2);
}
h3 {
  font-size: var(--step-1);
}

p,
ul,
ol {
  margin: 0 0 1.1em;
}

ul,
ol {
  padding-left: 1.3em;
}

/* --------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

main {
  flex: 1 0 auto;
  padding-block: 3rem 5rem;
}

.prose {
  max-width: var(--measure);
}

.section {
  margin-block: 4rem;
}

.section__header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section__header h2 {
  margin: 0;
}

.section__more {
  font-size: 0.9rem;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent-text);
  z-index: 10;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* --------------------------------------------------- header and footer -- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  color: var(--accent);
  font-size: 0.95em;
}

.brand:hover .brand__text {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding-block: 0.2rem;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.75rem;
}

.site-footer__credit {
  margin: 0;
}

.site-footer__links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ------------------------------------------------------------------ hero -- */

.hero {
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(
      120% 100% at 15% 0%,
      var(--accent-soft) 0%,
      transparent 60%
    ),
    var(--bg);
}

.hero__title {
  font-size: var(--step-4);
  margin: 0 0 0.3em;
}

.hero__tagline {
  font-size: var(--step-1);
  color: var(--text);
  margin: 0 0 0.5em;
  max-width: 40ch;
}

.hero__blurb {
  color: var(--text-muted);
  max-width: var(--measure);
  margin: 0;
}

/* ------------------------------------------------------------ post lists -- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.75rem;
}

.post-list__item {
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.post-list__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.post-list__title {
  margin: 0 0 0.25rem;
  font-size: var(--step-1);
}

.post-list__title a {
  color: var(--text);
  text-decoration: none;
}

.post-list__title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.post-list__meta,
.post-meta {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-list__excerpt {
  margin: 0;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- page headers -- */

.page-header,
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.page-header__tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--step-1);
}

/* ------------------------------------------------------------------ tags -- */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

a.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-list--large .tag {
  font-size: 0.95rem;
  padding: 0.3rem 0.85rem;
}

.tag__count {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------------- cards -- */

.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

.card-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.card > *:last-child {
  margin-bottom: 0;
}

.card__title {
  margin: 0 0 0.3rem;
  font-size: var(--step-1);
}

.card__title a {
  color: var(--text);
  text-decoration: none;
}

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

.card__status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* -------------------------------------------------------- post nav / end -- */

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.post-nav__link {
  flex: 1 1 14rem;
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  text-decoration: none;
}

.post-nav__link:hover {
  border-color: var(--accent);
}

.post-nav__link--next {
  text-align: right;
}

.post-nav__label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --------------------------------------------------------- long-form body */

.prose :is(h2, h3, h4) {
  position: relative;
}

.heading-anchor {
  position: absolute;
  margin-left: 0.35em;
  color: var(--text-muted);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

:is(h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  white-space: nowrap;
}

pre {
  margin: 1.5em 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 0.925rem;
}

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

th {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Prism tokens — kept minimal and theme-aware rather than pulling in a theme. */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--text-muted);
  font-style: italic;
}

.token.punctuation {
  opacity: 0.7;
}

.token.tag,
.token.keyword,
.token.selector,
.token.important,
.token.atrule {
  color: #ff8fb0;
}

.token.string,
.token.attr-value,
.token.char,
.token.regex {
  color: #8fd98f;
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol {
  color: #f0b86e;
}

.token.function,
.token.class-name {
  color: #8fbcf5;
}

.token.attr-name,
.token.property,
.token.variable {
  color: #d9b8ff;
}

.token.operator {
  color: var(--text);
}

@media (prefers-color-scheme: light) {
  .token.tag,
  .token.keyword,
  .token.selector,
  .token.important,
  .token.atrule {
    color: #a3175c;
  }
  .token.string,
  .token.attr-value,
  .token.char,
  .token.regex {
    color: #1f7a3d;
  }
  .token.number,
  .token.boolean,
  .token.constant,
  .token.symbol {
    color: #9a5b00;
  }
  .token.function,
  .token.class-name {
    color: #1b5fa8;
  }
  .token.attr-name,
  .token.property,
  .token.variable {
    color: #6b3fa0;
  }
}

/* --------------------------------------------------------------- reviews -- */

.review-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(16rem, 40vw, 26rem);
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  color: var(--on-image-text);
}

.review-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgb(var(--scrim-rgb) / 88%) 0%,
    rgb(var(--scrim-rgb) / 55%) 45%,
    rgb(var(--scrim-rgb) / 15%) 100%
  );
}

.review-hero__inner {
  position: relative;
  padding-block: 2.5rem;
}

.review-hero__title {
  margin: 0.2em 0 0;
  color: var(--on-image-text);
}

.review-score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  margin: 0;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent-text);
  font-weight: 700;
}

.review-score__value {
  font-size: 1.2rem;
}

.review-score__max {
  font-size: 0.8rem;
  opacity: 0.85;
}

.review-body {
  padding-top: 2rem;
}

.review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.review-card {
  position: relative;
  display: block;
  min-height: 14rem;
  border-radius: var(--radius);
  overflow: hidden;
  background-image: var(--card-image);
  background-size: cover;
  background-position: center;
  color: var(--on-image-text);
  text-decoration: none;
  /* Inset box-shadow paints under child content, so this darkens the
     background/image on hover without dimming the title text on top. */
  box-shadow: inset 0 0 0 0 rgb(var(--scrim-rgb) / 0%);
  transition: box-shadow 0.2s ease;
}

.review-card:hover,
.review-card:focus-visible {
  box-shadow: inset 0 0 0 999px
    rgb(var(--scrim-rgb) / var(--card-hover-tint-alpha));
}

.review-card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgb(var(--scrim-rgb) / 90%) 0%,
    rgb(var(--scrim-rgb) / 35%) 60%,
    rgb(var(--scrim-rgb) / 5%) 100%
  );
}

.review-card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  height: 100%;
  padding: 1.1rem;
  justify-content: flex-end;
}

.review-card__score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.review-card__score-max {
  font-size: 0.7rem;
  opacity: 0.85;
}

.review-card__title {
  font-size: var(--step-1);
  font-weight: 650;
  line-height: 1.25;
  transition: color 0.2s ease;
}

.review-card:hover .review-card__title,
.review-card:focus-visible .review-card__title {
  color: var(--accent);
}

.review-card__excerpt {
  color: var(--on-image-text-muted);
  font-size: 0.875rem;
}

/* ----------------------------------------------------------------- author */

.author-card {
  margin: 2.5rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.author-card__label {
  margin: 0 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.author-card__name {
  font-weight: 650;
  text-decoration: none;
}

.author-card__name:hover {
  color: var(--accent);
}

.author-card__bio {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ author page */

.author-page {
  padding-top: 1rem;
}

.author-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.author-header__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-header__avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.author-header__text h1 {
  margin: 0;
}

.author-header__handle {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.author-header__bio {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  max-width: var(--measure);
}

.author-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin-bottom: 2.5rem;
}

.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.author-info {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.author-info__row {
  display: contents;
}

.author-info dt {
  color: var(--text-muted);
}

.author-info dd {
  margin: 0;
}

/* ------------------------------------------------------------ error page -- */

.error-page {
  padding-block: clamp(2rem, 8vw, 5rem);
}

.error-page__code {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1;
}

/* -------------------------------------------------------------- utilities */

.quiet {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
