:root {
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  --color-bg: #1a1814;
  --color-text: #e8e0d5;
  --color-accent: #c17a4d;

  --font-serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Montserrat", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

h1,
h2,
p {
  margin: 0;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.6;
}

a {
  color: var(--color-accent);
}

/* UI chrome — nav, meta, controls — stays sans, smaller, quieter than the reading type */
.stories-row,
.section-tags,
.post__meta,
.post-card__meta,
.post-card__eyebrow,
.post-pagination,
.site-footer,
.back-to-top,
.site-subtitle {
  font-family: var(--font-sans);
}

.post__meta,
.post-card__meta {
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.post__meta {
  margin-bottom: var(--space-4);
}

.tag-pill {
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.story-pill__label {
  font-size: 0.5625rem;
  letter-spacing: 0.02em;
}

.post-card__eyebrow {
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 var(--space-1);
}

.site-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text);
}

.site-title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.site-subtitle {
  font-size: 0.55rem;
  opacity: 0.75;
  margin: 0;
}

.site-title-row--home {
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.site-title--home {
  font-size: 1.4rem;
}

.site-subtitle--home {
  font-size: 0.8rem;
  opacity: 0.85;
}

.section-label,
.post__title,
.post-card__title {
  font-weight: 600;
  line-height: 1.25;
}

.section-label {
  font-size: 1.75rem;
  margin-bottom: var(--space-2);
}

.section-intro {
  margin-bottom: var(--space-3);
}

.section-intro p {
  margin: 0 0 var(--space-3);
}

.post__title {
  font-size: 2rem;
  margin-bottom: var(--space-1);
}

.post__subtitle,
.post-card__subtitle {
  font-style: italic;
  opacity: 0.8;
}

.post-card__subtitle {
  font-size: 0.9375rem;
}

.post__body p {
  margin: 0 0 var(--space-3);
}

.post__body ul,
.post__body ol {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-3);
}

.post__body li {
  margin-bottom: var(--space-1);
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: var(--space-3) 0;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.post-image {
  margin: var(--space-4) 0;
}

.post-image img {
  width: 100%;
  height: auto;
  display: block;
}

.post-image--polaroid {
  width: 65%;
  margin-left: auto;
  margin-right: auto;
  background: #f2ede4;
  padding: var(--space-3) var(--space-3) var(--space-4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transform: rotate(-2deg);
}

.post-image--polaroid figcaption {
  font-family: "Permanent Marker", cursive;
  font-size: 1rem;
  color: #1a1814;
  text-align: center;
  margin-top: var(--space-2);
  padding: 0 var(--space-1);
}

.post-image--full figcaption {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: var(--space-1);
}

.pull-quote {
  margin: var(--space-4) 0;
  padding-left: var(--space-3);
  border-left: 2px solid var(--color-accent);
  font-style: italic;
}

.pull-quote p {
  margin: 0;
}

.pull-quote cite {
  display: block;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.8125rem;
  opacity: 0.7;
  margin-top: var(--space-1);
}

.footnote,
.reversefootnote {
  color: var(--color-accent);
  text-decoration: none;
}

sup.footnote {
  font-size: 0.7em;
}

.footnotes {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  opacity: 0.85;
}

.footnotes ol {
  padding-left: var(--space-3);
  margin: 0;
}

.footnotes li {
  margin-bottom: var(--space-1);
}

.footnotes li p {
  margin: 0;
  display: inline;
}

.reversefootnote {
  margin-left: 4px;
}

.post__body .divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.6;
  width: 33.333%;
  margin: var(--space-4) auto;
}

.divider__line {
  flex: 1 1 0;
  height: 1px;
  background: currentColor;
}

.divider__mark {
  flex-shrink: 0;
}

/* Native markdown blockquote - "bootcamp" convention: left border, tinted background, small radius */
.post__body blockquote {
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-radius: 1px;
}

.post__body blockquote p {
  margin: 0;
}

/* Callout - distinct from blockquote: full tint, no left border, rounded box, optional label */
.callout {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  border-radius: 4px;
}

.callout__label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin: 0 0 var(--space-1);
}

.callout p {
  margin: 0;
}

/* Dev note - muted aside in working docs like the style guide, distinct from real body content */
.dev-note {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  opacity: 0.5;
  margin: var(--space-1) 0 var(--space-3);
}

.dev-note__label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-right: var(--space-1);
}

/* Code blocks - syntax highlighting via Rouge (kramdown's built-in highlighter), warm palette to match the site */
.highlight {
  background: color-mix(in srgb, var(--color-text) 6%, var(--color-bg));
  border-radius: 4px;
  padding: var(--space-2);
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.highlight pre {
  margin: 0;
}

.highlight code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.highlight .c, .highlight .c1, .highlight .cm { color: var(--color-text); opacity: 0.5; font-style: italic; } /* comments */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kt { color: var(--color-accent); } /* keywords */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb { color: #a8b88a; } /* strings - warm muted green */
.highlight .m, .highlight .mi, .highlight .mf { color: #c9a679; } /* numbers - warm tan */
.highlight .nc, .highlight .nf, .highlight .nl { color: var(--color-text); } /* names/properties */
.highlight .no { color: #c9a679; } /* constants */
.highlight .p { color: var(--color-text); opacity: 0.6; } /* punctuation */
.highlight .nt { color: var(--color-accent); } /* HTML tags */
.highlight .na { color: #c9a679; } /* HTML attributes */

.post-card__title {
  font-size: 1.25rem;
  margin: 0 0 var(--space-1);
}

.start-here {
  margin-top: var(--space-3);
  padding: var(--space-2) 0;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-1) 5%; /* 5% either side so text doesn't slam into the phone edge */
}

.page__title {
  padding-top: var(--space-3);
}

.site-header {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.scenes-banner {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-bg));
  font-family: var(--font-sans);
  font-size: 0.75rem;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.scenes-banner__icon {
  font-size: 14px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.scenes-banner p {
  margin: 0;
}

.scenes-banner a {
  color: inherit;
  text-decoration: underline;
}

.latest-label {
  font-family: var(--font-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
  margin: 0 0 var(--space-1);
}

.rail-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rail-logo__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}

.rail-nav-middle {
  display: contents; /* unwrapped on mobile so its pills sit directly in the .stories-row flex row, unchanged order */
}

.stories-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow-x: auto;
  margin-top: var(--space-1);
  height: 13vh; /* mobile rail - grown to fit larger circles */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge */
  /* symmetric: same margin left (before Black Cat) as right (after About) - inherits site-header's equal left/right padding, no override needed */
}

.stories-row::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.story-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: var(--space-1);
  text-decoration: none;
  color: var(--color-text);
  opacity: 0.65;
}

.story-pill__dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e0403a;
}

.story-pill__dot.is-visible {
  display: block;
}

.story-pill.is-active {
  opacity: 1;
}

.story-pill__icon {
  width: 60px;
  height: 60px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.story-pill__icon .dot {
  fill: currentColor;
}

.story-pill__icon .faint {
  stroke-width: 0.6;
  opacity: 0.6;
}

.story-pill.is-active .story-pill__icon {
  color: var(--color-accent);
}

.story-pill__label {
  white-space: normal;
  text-align: center;
  max-width: 60px;
}

/* Second-tier taxonomy — not wired into any section yet, no content needs it. Reserved so the height is decided before it's built. */
.section-tags {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  height: 3vh;
}

.tag-pill {
  white-space: nowrap;
  padding: var(--space-1) var(--space-2);
  border: 1px solid;
  border-radius: 1px;
  text-decoration: none;
}

.post-card {
  padding: var(--space-2) 0;
  border-bottom: 1px solid;
}

/* Home page feed - divider shrunk to a thin centred line instead of a full-width rule */
.latest .post-card {
  border-bottom: none;
}

.latest .post-card::after {
  content: "";
  display: block;
  width: 50%;
  margin: var(--space-2) auto 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 60%, transparent);
}

/* Tighter title/subtitle/meta rhythm on mobile so more of Start Here shows without scrolling */
.latest .post-card__title {
  margin: 0 0 4px;
}

.latest .post-card__subtitle {
  line-height: 1.3;
  margin: 0 0 4px;
}

.latest .post-card__meta {
  line-height: 1.3;
}

/* Mobile shows 3 posts, desktop shows up to 5 */
.latest article.post-card:nth-of-type(n+4) {
  display: none;
}

@media (min-width: 1024px) {
  .latest article.post-card:nth-of-type(n+4) {
    display: block;
  }
}

.post-card.post-card--start-here {
  border: 1px solid var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  padding: var(--space-4);
}

.post-card--start-here .post-card__title {
  font-size: 1.5rem;
}

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

.post-card__excerpt-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card__excerpt {
  position: relative;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: var(--space-2) 0 0;
  padding-bottom: 1.5em;
  opacity: 0.8;
  mask-image: linear-gradient(to bottom, black 0%, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 60%, transparent 100%);
}

.post-pagination {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) 0 var(--space-8); /* extra bottom clearance so back-to-top (fixed, bottom-right) never sits over the Next link */
}

.post-pagination__prev,
.post-pagination__next {
  flex: 1 1 0;
  min-width: 0; /* lets text-overflow: ellipsis actually truncate inside a flex item */
  padding: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--color-text) 25%, transparent);
  border-radius: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-decoration: none;
  color: inherit;
}

.post-pagination__next {
  margin-left: auto;
  text-align: right;
}

.site-footer {
  padding: var(--space-3);
  text-align: center;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.back-to-top {
  display: none;
  position: fixed;
  bottom: var(--space-3);
  right: var(--space-3);
  padding: var(--space-2);
  border: 1px solid;
  border-radius: 999px;
  background: none;
  font: inherit;
  cursor: pointer;
  z-index: 20;
}

.back-to-top.is-visible {
  display: block;
}

/* Desktop — first-pass breakpoint, still structural only. Rail 5% / margin 23.75% / text+images 47.5% / margin 23.75%. Text is 50% of the 95% leftover after the rail. */
@media (min-width: 1024px) {
  .site-header,
  main,
  .site-footer {
    padding-left: 28.75%; /* rail 5% + left margin 23.75% */
    padding-right: 23.75%; /* right margin */
  }

  main,
  .site-header {
    max-width: none;
    margin: 0;
  }

  .site-title-row--home {
    align-items: center;
  }

  .page__title {
    padding-top: calc(var(--space-8) + var(--space-4));
  }

  .rail-logo {
    position: fixed;
    top: var(--space-4);
    left: 0;
    width: 5%;
    margin: 0;
    z-index: 11;
  }

  .stories-row {
    position: fixed;
    top: 0;
    left: 0;
    width: 5%;
    height: 100vh;
    flex-direction: column;
    overflow-x: visible;
    overflow-y: auto;
    margin-top: 0;
    padding-top: var(--space-8);
    padding-bottom: var(--space-4);
    z-index: 10;
  }

  .rail-nav-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin: auto 0; /* centres this whole cluster in the space between the logo and About */
  }

  /* Bottom-to-top reading order Claire specified: Black Cat, then The Floor, then The Art of Small Things */
  .story-pill--the-art-of-small-things {
    order: 1;
  }

  .story-pill--the-floor {
    order: 2;
  }

  .story-pill--black-cat {
    order: 3;
  }

  .story-pill--about {
    margin-top: auto; /* anchors About to the bottom of the rail, mirroring the logo at the top */
  }

}
