/* ═══════════════════════════════════════════════════════════════════════════════
   MARK STEVEN OLESON — styles.css
   Aesthetic: 19th-c. naturalism × Enlightenment typography × CRT wireframe × blueprint
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Typefaces ─────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,700;1,400;1,500&family=IBM+Plex+Mono:wght@400;500;600&family=Playfair+Display:wght@700;900&display=swap');

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --paper:   #f4f1e8;   /* aged-paper off-white              */
  --ink:     #0d0d0d;   /* near-black — main text & borders  */
  --rule:    #2e2e2e;   /* slightly lighter — body rules      */
  --ghost:   #9a9790;   /* secondary text, decorations        */
  --grid:    #ccc9c0;   /* blueprint grid lines               */

  --serif:   'EB Garamond', Georgia, 'Times New Roman', serif;
  --display: 'Playfair Display', Georgia, serif;
  --mono:    'IBM Plex Mono', 'Courier New', Courier, monospace;
}

/* ─── Global resets ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important; /* no soft corners — ever */
}

/* ─── Body & blueprint grid ─────────────────────────────────────────────────── */
body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Base typography ───────────────────────────────────────────────────────── */
p {
  margin: 0 0 1.1rem 0;
  orphans: 3;
  widows: 3;
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.25rem;
}

strong, b { font-weight: 700; }
em, i     { font-style: italic; }

small {
  font-size: 0.82em;
  font-family: var(--mono);
  letter-spacing: 0.03em;
}

/* ─── Headings ──────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.2;
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.55rem;
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.2rem;
}

h3 {
  font-size: 1rem;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rule);
}

h4 {
  font-size: 0.9rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.06em;
}

h5, h6 {
  font-size: 0.82rem;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--ghost);
}

/* ─── Links ─────────────────────────────────────────────────────────────────── */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ghost);
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  color: var(--ink);
  text-decoration-color: var(--ink);
  outline: none;
}

/* ─── Horizontal rules ──────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

/* ─── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  background-color: var(--ink) !important;
  border-bottom: 2px solid #ffffff;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  position: relative;
}

/* Scanline texture on the black bar */
.navbar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.022) 3px,
    rgba(255, 255, 255, 0.022) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.navbar > .container,
.navbar > .container-fluid,
.navbar > .container-xxl {
  position: relative;
  z-index: 1;
}

.navbar-brand,
.navbar-brand:hover,
.navbar-brand:focus {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff !important;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.navbar-nav .nav-link,
.navbar-nav .nav-item .nav-link {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75) !important;
  padding: 0.7rem 0.9rem !important;
  border: 1px solid transparent;
  margin: 0 1px;
  line-height: 1;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  color: var(--ink) !important;
  background-color: #ffffff !important;
  border-color: #ffffff;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link.show {
  color: var(--ink) !important;
  background-color: #ffffff !important;
}

/* GitHub icon sizing */
.navbar-nav .nav-link .bi-github,
.navbar-nav .nav-link .fa-github {
  font-size: 1rem;
}

/* Mobile hamburger */
.navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  padding: 0.25rem 0.5rem;
}

.navbar-toggler-icon {
  filter: invert(1);
}

/* ─── Search ────────────────────────────────────────────────────────────────── */
#quarto-search .aa-DetachedSearchButtonIcon,
#quarto-search .search-icon {
  color: rgba(255, 255, 255, 0.7);
}

#quarto-search input[type=search] {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

#quarto-search input[type=search]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Search results dropdown */
.aa-Panel {
  background: var(--paper);
  border: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: 0.9rem;
}

.aa-Item[aria-selected=true],
.aa-Item:hover {
  background: var(--ink);
  color: #ffffff;
}

/* ─── Page layout ───────────────────────────────────────────────────────────── */
/* Quarto wraps content in #quarto-content > main */
#quarto-content {
  padding-top: 0;
}

/* Paper card — grid shows in the outer margins, not under the text */
main.content {
  background-color: var(--paper);
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

/* TOC sidebar gets the same paper treatment */
.sidebar.margin-sidebar {
  background-color: var(--paper);
}

/* ─── Page title block (YAML-driven titles on article pages) ────────────────── */
#title-block-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--ink);
}

#title-block-header .title,
h1.title {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 0.35rem 0;
  color: var(--ink);
}

#title-block-header .subtitle,
p.subtitle.lead {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ghost);
  margin: 0 0 0.6rem 0;
}

/* Date / author metadata row */
.quarto-title-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ghost);
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.quarto-title-meta-heading {
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--ghost);
  display: block;
  margin-bottom: 0.1rem;
}

.quarto-title-meta-contents {
  color: var(--rule);
}

/* ─── Listing pages ─────────────────────────────────────────────────────────── */
/* Outer container */
.quarto-listing {
  margin-top: 1.5rem;
}

/* Individual post entry */
.quarto-post {
  background-color: var(--paper);
  border: 1px solid var(--rule);
  padding: 1.4rem 1.7rem;
  margin-bottom: 1rem !important;
  position: relative;
  display: flex !important;
  gap: 1.25rem;
  align-items: flex-start;
  transition: background-color 0.08s;
}

.quarto-post:hover {
  background-color: rgba(13, 13, 13, 0.035);
}

/* Blueprint corner marks — top-left and top-right */
.quarto-post::before,
.quarto-post::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--ink);
  border-style: solid;
}

.quarto-post::before {
  top:  -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.quarto-post::after {
  top:   -1px;
  right: -1px;
  border-width: 2px 2px 0 0;
}

/* Text body area */
.quarto-post .body {
  flex: 1;
  min-width: 0;
}

/* Metadata column (date, reading-time) */
.quarto-post .metadata {
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* Listing title */
.quarto-post .listing-title,
.quarto-post h3.listing-title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.35rem 0;
}

.quarto-post .listing-title a,
.quarto-post h3.listing-title a {
  color: var(--ink);
  text-decoration: none;
}

.quarto-post .listing-title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--ink);
}

/* Subtitle */
.quarto-post .listing-subtitle {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 0.4rem;
}

/* Description */
.quarto-post .listing-description {
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--rule);
  margin: 0;
}

/* Date */
.quarto-post .listing-date {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ghost);
  margin: 0;
  display: block;
}

/* Reading time */
.quarto-post .listing-reading-time {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--ghost);
  margin: 0.2rem 0 0 0;
  display: block;
}

/* Category tags */
.listing-category,
.quarto-category {
  display: inline-block;
  font-family: var(--mono) !important;
  font-size: 0.63rem !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--ink) !important;
  padding: 2px 7px !important;
  margin: 3px 3px 0 0;
  color: var(--ink) !important;
  background: transparent !important;
  text-decoration: none;
  cursor: default;
}

.listing-category:hover,
.quarto-category:hover {
  background: var(--ink) !important;
  color: var(--paper) !important;
}

.listing-categories {
  margin-top: 0.55rem;
}

/* ─── Inline code ───────────────────────────────────────────────────────────── */
code:not(pre code) {
  font-family: var(--mono);
  font-size: 0.84em;
  background: rgba(13, 13, 13, 0.07);
  border: 1px solid var(--grid);
  padding: 0.1em 0.35em;
  color: var(--ink);
}

/* ─── Code blocks ───────────────────────────────────────────────────────────── */
pre.sourceCode,
div.sourceCode > pre {
  background-color: var(--ink) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-left: 3px solid #ffffff !important;
  padding: 1.2rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.81rem;
  line-height: 1.55;
  color: #e2dece;
  overflow-x: auto;
  position: relative;
}

/* Scanline texture on code blocks */
pre.sourceCode::before,
div.sourceCode > pre::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.015) 3px,
    rgba(255, 255, 255, 0.015) 4px
  );
  pointer-events: none;
}

pre.sourceCode code,
div.sourceCode > pre > code {
  font-family: var(--mono) !important;
  background: none !important;
  border: none !important;
  padding: 0;
  color: #e2dece;
  font-size: 1em;
}

/* Warm monochrome syntax highlighting */
.sourceCode .kw { color: #ffffff; font-weight: 600; }        /* keyword      */
.sourceCode .dt { color: #c8c4b0; }                           /* data type    */
.sourceCode .dv,
.sourceCode .fl { color: #ddd8b8; }                           /* number       */
.sourceCode .st { color: #c4bc9c; font-style: italic; }       /* string       */
.sourceCode .co { color: #707068; font-style: italic; }       /* comment      */
.sourceCode .fu { color: #e2dece; font-weight: 500; }         /* function     */
.sourceCode .op { color: #a8a490; }                           /* operator     */
.sourceCode .im { color: #d8d4bc; }                           /* import       */
.sourceCode .cf { color: #ffffff; font-weight: 600; }         /* control flow */

/* Code copy button */
.code-copy-button {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: rgba(255, 255, 255, 0.45) !important;
  font-family: var(--mono);
  font-size: 0.62rem;
  padding: 2px 6px !important;
}

.code-copy-button:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* ─── Blockquotes ───────────────────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid var(--ink);
  border-right: none;
  background: rgba(13, 13, 13, 0.03);
  margin: 1.75rem 0;
  padding: 0.65rem 1.5rem;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--rule);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ─── Tables ────────────────────────────────────────────────────────────────── */
table {
  font-family: var(--mono);
  font-size: 0.79rem;
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
}

thead th {
  background-color: var(--ink);
  color: #ffffff;
  text-align: left;
  padding: 0.45rem 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid var(--ink);
}

tbody td {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--grid);
  vertical-align: top;
  line-height: 1.45;
}

tbody tr:nth-child(even) {
  background: rgba(13, 13, 13, 0.03);
}

tbody tr:hover {
  background: rgba(13, 13, 13, 0.06);
}

/* ─── Figures & images ──────────────────────────────────────────────────────── */
figure {
  margin: 2rem 0;
}

figure img,
.quarto-figure img {
  border: 1px solid var(--rule);
  max-width: 100%;
  display: block;
}

.profile-photo {
  display: block;
  width: 200px;
  height: auto;
  margin: 0 0 1.75rem 0;
  border: 1px solid var(--ink);
  filter: grayscale(1) contrast(1.05);
}

figcaption,
.figure-caption {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-top: 0.45rem;
  text-align: left;
}

/* ─── Callout boxes ─────────────────────────────────────────────────────────── */
div.callout {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink);
  background: rgba(13, 13, 13, 0.035);
  padding: 0.8rem 1.1rem;
  margin: 1.5rem 0;
  box-shadow: none;
}

div.callout-title-container {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

div.callout .callout-icon::before {
  display: none; /* remove emoji icons; the border-left signals type */
}

div.callout-note    { border-left-color: var(--ink); }
div.callout-warning { border-left-color: var(--ink); }
div.callout-tip     { border-left-color: var(--ghost); }

/* ─── TOC sidebar ───────────────────────────────────────────────────────────── */
nav#TOC,
#quarto-sidebar-toc-left nav {
  font-family: var(--mono);
  font-size: 0.71rem;
}

nav#TOC .nav-link,
#quarto-sidebar-toc-left .nav-link {
  color: var(--ghost) !important;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  text-transform: none;
  font-size: 0.71rem;
  border-left: 2px solid transparent;
  background: transparent !important;
  line-height: 1.4;
}

nav#TOC .nav-link:hover,
nav#TOC .nav-link.active,
#quarto-sidebar-toc-left .nav-link:hover,
#quarto-sidebar-toc-left .nav-link.active {
  color: var(--ink) !important;
  border-left-color: var(--ink);
  background: transparent !important;
}

.sidebar-title,
.toc-title {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 0.6rem;
  display: block;
}

/* ─── Page footer ───────────────────────────────────────────────────────────── */
.nav-footer {
  background-color: var(--ink);
  border-top: 2px solid #ffffff;
  padding: 0.9rem 0;
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.5);
}

.nav-footer a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
}

.nav-footer a:hover {
  color: #ffffff;
  text-decoration: none;
}

.nav-footer-left,
.nav-footer-center,
.nav-footer-right {
  color: rgba(255, 255, 255, 0.5);
}

/* ─── Opt-in drop cap for essay-style documents ─────────────────────────────── */
/* Add class="drop-cap" to the page div or body to activate */
.drop-cap main p:first-of-type::first-letter {
  font-family: var(--display);
  font-size: 4rem;
  font-weight: 900;
  float: left;
  line-height: 0.78;
  padding-right: 0.07em;
  padding-top: 0.06em;
  color: var(--ink);
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  html {
    font-size: 16px;
  }

  body {
    background-size: 24px 24px;
    background-attachment: scroll; /* fixed causes jank on mobile */
  }

  #title-block-header .title,
  h1.title {
    font-size: 1.85rem;
  }

  .navbar-nav .nav-link {
    font-size: 0.68rem;
    padding: 0.5rem 0.65rem !important;
  }

  .quarto-post {
    flex-direction: column;
    padding: 1rem 1.1rem;
  }

  .quarto-post .metadata {
    text-align: left;
    min-width: unset;
  }

  h2 {
    font-size: 1.35rem;
  }
}
