/* ============================================================
   1. TOKENS & CUSTOM PROPERTIES
   ============================================================ */

:root {
  /* Color */
  --color-bg:           #FFFFFF;
  --color-bg-note:      #F7F6F4;     /* warm off-white for note cards */
  --color-surface:      #F0EFEC;     /* subtle tint for category banners */
  --color-text:         #1A1A1A;
  --color-text-muted:   #6B6B6B;
  --color-rule:         #E0DFDB;
  --color-accent:       #DF2935;     /* red — logo, note border, category tags */
  --color-link:         #1A56DB;     /* standard blue */
  --color-link-visited: #7E3AF2;

  /* Type scale — fluid between mobile and desktop */
  --text-xs:    0.75rem;    /* 12px — timestamps, meta labels */
  --text-sm:    0.875rem;   /* 14px — tags, captions */
  --text-base:  1.125rem;   /* 18px — body copy */
  --text-lg:    1.25rem;    /* 20px — note headline, tagline */
  --text-xl:    1.5rem;     /* 24px — featured post headline (small) */
  --text-2xl:   1.875rem;   /* 30px — featured post headline (large) */
  --text-3xl:   2.25rem;    /* 36px — category page title */

  /* Line heights */
  --leading-tight:  1.25;
  --leading-snug:   1.4;
  --leading-normal: 1.65;   /* body copy — generous for readability */

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Layout */
  --column-read:    680px;   /* single reading column */
  --column-wide:    900px;   /* category landing page list */
  --column-outer:   1100px;  /* max site width */
  --gutter:         var(--space-6);

  /* Borders */
  --radius-sm:  3px;
  --note-border-width: 3px;

  /* Transitions */
  --transition-fast: 150ms ease;
}

@media (prefers-color-scheme: dark) {
    :root {
      --color-bg:           #1A1A1A;
      --color-bg-note:      #6B6B6B;     /* warm off-white for note cards */
      --color-surface:      #F0EFEC;     /* subtle tint for category banners */
      --color-text:         #FFFFFF;
      --color-text-muted:   #E0DFDB;
      --color-rule:         #E0DFDB;
      --color-link:         #8ab4f8;
      --color-link-visited: #c58af9;
    }
}


/* ============================================================
   2. RESET & BASE
   ============================================================ */

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

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

body {
  font-family: system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

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

figure {
  margin: 0;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:visited {
  color: var(--color-link-visited);
}

a:hover {
  opacity: 0.75;
}

/* Focus ring — keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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


/* ============================================================
   3. TYPOGRAPHY SCALE
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

/* Post headlines — uniform across featured and notes */
.post-title {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--leading-snug);
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a:visited {
  color: inherit;
}

.post-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 1;
}

/* Featured post tagline */
.post-tagline {
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-muted);
  line-height: var(--leading-snug);
  margin-top: var(--space-3);
}

/* Body prose */
.post-body {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

.post-body p + p {
  margin-top: var(--space-5);
}

.post-body h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.post-body h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.post-body blockquote {
  border-left: var(--note-border-width) solid var(--color-rule);
  padding-left: var(--space-5);
  margin: var(--space-8) 0;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Meta — date, category tag */
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1;
  margin: var(--space-3) 0;
}

.post-meta time {
  font-variant-numeric: tabular-nums;
}

/* Category tag pill */
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  text-decoration: none;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  line-height: 1.4;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.tag:visited {
  color: var(--color-accent);
}

.tag:hover {
  background-color: var(--color-accent);
  color: #FFFFFF;
  opacity: 1;
}


/* ============================================================
   4. LAYOUT CONTAINERS
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--column-outer);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Reading column — for single post, homepage feed */
.container--read {
  max-width: var(--column-read);
}

/* Wide column — for category listing */
.container--wide {
  max-width: var(--column-wide);
}

/* Page-level spacing */
.page-content {
  padding-top: var(--space-12);
  padding-bottom: var(--space-20);
}


/* ============================================================
   5. SITE HEADER & NAVIGATION
   ============================================================ */

.site-header {
  border-bottom: 1px solid var(--color-rule);
  padding-block: var(--space-5);
  top: 0;
  background-color: var(--color-bg);
  z-index: 100;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

/* Logo */
.site-logo {
  font-size: 2rem;
  color: transparent;
  background-image: url('/assets/images/confabulator-title.svg');
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1;
  flex-shrink: 0;
}

.site-logo:hover {
  opacity: 0.85;
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.site-nav__link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  white-space: nowrap;
}

.site-nav__link:visited {
  color: var(--color-text);
}

.site-nav__link:hover {
  background-color: var(--color-surface);
  opacity: 1;
}

/* Tagline — sits below header on homepage only */
.site-tagline {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--color-rule);
  text-align: center;
  letter-spacing: 0.02em;
}


/* ============================================================
   6. POST CARDS — FEATURED
   ============================================================ */

.featured-post {
  padding-block: var(--space-12);
  border-bottom: 1px solid var(--color-rule);
}

.featured-post:first-child {
  padding-top: 0;
}

/* 4:3 image container */
.featured-post__image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-6);
  background-color: var(--color-surface); /* placeholder tint */
}

.featured-post__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.featured-post__image-wrap:hover img {
  transform: scale(1.015);
}

.featured-post-read-more {
  display: inline-block;
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 2px solid var(--color-rule);
  padding-bottom: 1px;
  transition: border-color var(--transition-fast);
}

.featured-post-read-more:visited {
  color: var(--color-text);
}

.featured-post-read-more:hover {
  border-color: var(--color-text);
  opacity: 1;
}


/* ============================================================
   7. POST CARDS — NOTES (short / commonplace)
   ============================================================ */

/*
  Notes are visually quieter than featured posts.
  The red left border signals "this is a collected thought"
  without competing with the featured posts.
*/

.note {
  padding-block: var(--space-8);
  border-bottom: 1px solid var(--color-rule);
  padding-left: var(--space-5);
  border-left: var(--note-border-width) solid var(--color-accent);
  margin-left: calc(-1 * var(--note-border-width));  /* align to column edge */
}

blockquote {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background-color: var(--color-bg-note);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

/* ============================================================
   8. CATEGORY LANDING PAGES
   ============================================================ */

/* Banner — full-width image with title overlay */
.category-banner {
  width: 100%;
  position: relative;
  background-color: var(--color-surface);
  overflow: hidden;
  max-height: 280px;
}

.category-banner__image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  filter: brightness(0.55);
}

.category-banner__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-8) var(--gutter);
  max-width: var(--column-outer);
  margin-inline: auto;
}

.category-banner__label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin-bottom: var(--space-2);
}

.category-banner__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: #FFFFFF;
  line-height: var(--leading-tight);
}

/* ============================================================
   10. PAGINATION
   ============================================================ */
 
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-10);
  border-top: 1px solid var(--color-rule);
  font-size: var(--text-sm);
  font-weight: 600;
}
 
/* Prev / Next links */
.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background-color var(--transition-fast);
  /* Reserve min-width so the page numbers stay centered
     even when one side is a wider label than the other */
  min-width: 6rem;
}
 
.pagination-btn:visited {
  color: var(--color-text);
}
 
.pagination-btn:hover {
  background-color: var(--color-surface);
  opacity: 1;
}
 
.pagination__next {
  justify-content: flex-end;
}

/* Disabled state — rendered as <span> so it isn't focusable */
.pagination-btn-disabled {
  color: var(--color-text-muted);
  cursor: default;
  /* No hover background — these are inert */
}
 
/* Page number list */
.pagination__pages {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}

/* Individual page button — shared base for both <a> and <span> */
.pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding-inline: var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color var(--transition-fast);
}
 
/* Clickable page number */
a.pagination__page {
  color: var(--color-text);
}
 
a.pagination__page:visited {
  color: var(--color-text);
}
 
a.pagination__page:hover {
  background-color: var(--color-surface);
  opacity: 1;
}
 
/* Current page — accent underline, not filled, keeps it quiet */
.pagination__page--current {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  cursor: default;
  /* rendered as <span> so it isn't in the tab order */
}
 


/* ============================================================
   11. FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-rule);
  padding-block: var(--space-10);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  justify-content: space-between;
  align-items: baseline;
}

.site-logo-footer {
  font-size: 1.4rem;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  list-style: none;
}

.site-footer__nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
}

.site-footer__nav a:visited {
  color: var(--color-text-muted);
}

.site-footer__nav a:hover {
  color: var(--color-text);
  opacity: 1;
}

.site-footer__copy {
  width: 100%;
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============================================================
   12. RESPONSIVE
   ============================================================ */

/* Mobile nav: stack logo and nav vertically, smaller gaps */
@media (max-width: 600px) {
  :root {
    --gutter: var(--space-4);
  }

  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .site-nav {
    gap: var(--space-1);
  }

  .site-nav__link {
    padding: var(--space-2) var(--space-2);
    font-size: var(--text-xs);
  }

  .category-banner__title {
    font-size: var(--text-2xl);
  }

  .post-title {
    font-size: var(--text-xl);
  }

  .note {
    margin-left: 0;   /* don't pull border into page gutter on small screens */
  }

  .post-list__item--note {
    margin-left: 0;
  }
}

pre:has(code) {
  border-radius: .25rem;
  padding: .25rem .5rem;
  border: 1px solid var(--color-rule);
  background-color: var(--color-bg-note);
  overflow-x: auto;
}
code {
  background-color: var(--color-bg-note);
}
