/* ------------------------------------------------------------------
   Design tokens
   Palette: cool bone paper, near-black ink, ultramarine accent.
   Type: Space Grotesk (display) / IBM Plex Sans (body) / IBM Plex Mono
   (metadata "record lines" — the site's signature device).
------------------------------------------------------------------- */
:root {
  --paper: #f6f2e0;
  --panel: #fdfbf0;
  --ink: #17181c;
  --muted: #696351;
  --line: #e1dcc2;
  --accent: #3457d5;
  --accent-ink: #ffffff;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --measure: 66ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 10px;
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.skip {
  position: absolute; left: -999px;
  background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem;
}
.skip:focus { left: var(--gutter); top: .5rem; z-index: 10; }

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

.mono, .record { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; }
.record { color: var(--muted); text-transform: lowercase; margin: 0 0 .5rem; }
.record a { text-decoration: none; }
.record a:hover, .tag-link:hover { color: var(--accent); }
.tag-link { text-decoration: none; }
.featured .tag-link:hover { color: var(--accent-ink); opacity: .8; }

/* -- header ------------------------------------------------------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 2rem;
  padding: .4rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.ident { display: flex; flex-direction: column; gap: 0; }
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  line-height: 1.25; text-decoration: none; letter-spacing: -.01em;
}
.wordmark-role { color: var(--muted); font-weight: 400; margin-left: .6rem; font-size: .85rem; }
.ident-links { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.3; }
.ident-links a { text-decoration: none; }
.ident-links a:hover { color: var(--accent); }
.site-header nav { display: flex; gap: 1.25rem; margin-inline-start: auto; }
.site-header nav a {
  font-family: var(--font-mono); font-size: .8rem; text-decoration: none;
  padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.site-header nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }

.search-form { display: flex; gap: .5rem; }
.search-form input {
  font: inherit; font-family: var(--font-mono); font-size: .8rem;
  padding: .45rem .7rem; min-width: 12rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
}
.search-form button {
  font-family: var(--font-mono); font-size: .8rem; cursor: pointer;
  padding: .45rem .9rem; border: none; border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
}
.search-form button:hover { background: var(--accent); }

/* -- layout blocks ------------------------------------------------- */
main {
  flex: 1;                        /* pushes the footer to the viewport bottom */
  padding: 0 var(--gutter) 2rem;
  max-width: 74rem; margin-inline: auto; width: 100%;
}

.hero { padding: clamp(1.25rem, 3.5vw, 2.25rem) 0 1.5rem; max-width: 52rem; }
.hero-compact { padding-block: 1.25rem 1rem; }
.hero h1 {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em;
  font-size: clamp(1.7rem, 4.2vw, 2.9rem); line-height: 1.15; margin: 0;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 1.75rem 0 .5rem;
}
.section-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; margin: 0; }
.section-head a { text-decoration: none; color: var(--muted); }
.section-head a:hover { color: var(--accent); }

/* -- featured ------------------------------------------------------- */
.featured {
  display: grid; gap: 1.25rem 2.5rem; align-items: center;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: .75rem;
}
.featured a { color: var(--accent-ink); }
.featured .record { color: color-mix(in srgb, var(--accent-ink) 78%, transparent); }
.featured .summary { color: color-mix(in srgb, var(--accent-ink) 88%, transparent); }
.featured .cta { color: var(--accent-ink); border-bottom: 1px solid color-mix(in srgb, var(--accent-ink) 55%, transparent); }
.featured a:hover { color: var(--accent-ink); opacity: .85; }
.featured .media-empty {
  border-color: color-mix(in srgb, var(--accent-ink) 45%, transparent);
  background:
    linear-gradient(135deg, transparent 49.5%, color-mix(in srgb, var(--accent-ink) 40%, transparent) 49.5%, color-mix(in srgb, var(--accent-ink) 40%, transparent) 50.5%, transparent 50.5%),
    color-mix(in srgb, var(--accent-ink) 10%, transparent);
}
.featured-media, .card-media, .post-media {
  display: block; overflow: hidden; border-radius: calc(var(--radius) - 3px);
  aspect-ratio: 16 / 9; background: var(--line);
}
.featured-media svg, .card-media svg, .post-media svg,
.featured-media img, .card-media img, .post-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .45s ease;
}
.featured-media:hover svg, .card-media:hover svg,
.featured-media:hover img, .card-media:hover img { transform: scale(1.03); }

/* Blank box shown until a post image is uploaded; any png/jpg dropped in is
   cropped to fit via object-fit: cover on the img rules above. */
.media-empty {
  display: block; width: 100%; height: 100%;
  background:
    linear-gradient(135deg, transparent 49.5%, var(--line) 49.5%, var(--line) 50.5%, transparent 50.5%),
    var(--panel);
  border: 1px dashed var(--line); border-radius: inherit;
}

.featured-body h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; letter-spacing: -.01em; margin: .25rem 0 .5rem; }
.featured-body h2 a { text-decoration: none; }
.cta { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); text-decoration: none; }

/* -- card grid ------------------------------------------------------- */
.card-grid {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}
.card-body { padding-top: .9rem; }
.card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; margin: .15rem 0 .35rem; letter-spacing: -.01em; }
.card h3 a { text-decoration: none; }
.summary { color: var(--muted); margin: 0; font-size: .95rem; }

/* -- post ------------------------------------------------------- */
.post { max-width: 52rem; margin-inline: auto; }
.post-media { aspect-ratio: 21 / 9; margin-top: 2rem; }
.post-header { padding: 2rem 0 1rem; }
.post-header h1 {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em;
  font-size: clamp(1.6rem, 3.6vw, 2.5rem); line-height: 1.15; margin: 0 0 .5rem;
}

.prose { max-width: var(--measure); }
.about-prose { padding-top: .5rem; }
.prose h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; margin-top: 2.2rem; letter-spacing: -.01em; }
.prose h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; margin-top: 1.8rem; }
.prose pre {
  background: #14161c; color: #e6e8ee; border-radius: var(--radius);
  padding: 1rem 1.25rem; overflow-x: auto;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.6;
}
.prose code { font-family: var(--font-mono); font-size: .85em; }
.prose :not(pre) > code { background: #efe5cf; padding: .1em .35em; border-radius: 4px; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .75rem; text-align: left; }
.prose th { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .04em; background: var(--panel); }
.prose blockquote { border-left: 3px solid var(--accent); margin-left: 0; padding-left: 1.25rem; color: var(--muted); }
.prose ul { padding-left: 1.25rem; margin: .5rem 0 1rem; }
.prose li { margin: .2rem 0; }
.prose li::marker { color: var(--accent); }

/* -- archive ------------------------------------------------------- */
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list .record { text-transform: none; }
.archive-list li {
  display: grid; gap: .35rem 1.5rem; align-items: baseline;
  grid-template-columns: 4.5rem 1fr auto;
  padding: .55rem 0; border-bottom: 1px dotted color-mix(in srgb, var(--muted) 55%, transparent);
}
.archive-title { font-family: var(--font-display); font-weight: 500; text-decoration: none; }
.archive-tags { text-align: right; }

.post-return { margin: 2rem auto 0; max-width: 52rem; }
.post-return a { text-decoration: none; color: var(--muted); }
.post-return a:hover { color: var(--accent); }

.empty { color: var(--muted); max-width: var(--measure); }

/* -- footer ------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: .4rem var(--gutter);
  display: flex; flex-wrap: wrap; gap: .25rem 2rem; justify-content: space-between;
  align-items: center; color: var(--muted); line-height: 1.3;
}
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }

/* -- responsive & motion ------------------------------------------------ */
@media (max-width: 800px) {
  .featured { grid-template-columns: 1fr; }
  .search-form { width: 100%; }
  .search-form input { flex: 1; }
  .archive-list li { grid-template-columns: 1fr; }
  .archive-tags { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .featured-media svg, .card-media svg,
  .featured-media img, .card-media img { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important;
  }
}
