/* ====================================
   STYLESHEET (Mechanically optimized)
   - Same behavior, fewer lines via:
     • Grouped media queries & selectors
     • Removed redundant blank lines
     • Shorthands where safe
   ==================================== */

/* 1) RESET & BASE */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  color: #000;
  background: #f8f8f8;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:root {
  font-family: Inter, sans-serif;
  font-feature-settings: "liga" 1, "calt" 1;
}
@supports (font-variation-settings: normal) {
  :root {
    font-family: InterVariable, sans-serif;
  }
}

/* 2) TYPOGRAPHY */
h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
h3 {
  font-family: Inter, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  line-height: 1;
}

/* 3) STRUCTURE */
main {
  flex: 1;
  padding-inline: 1rem;
  color: #000;
  max-width: 1100px;
  margin: 0 auto;
}
.body-section:first-of-type {
  margin-top: 1rem;
}
.body-section {
  padding: 1rem;
  margin-bottom: 15px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
footer {
  background: #fff;
  font-size: 0.75rem;
  font-weight: 300;
  color: #000;
  padding: 10px;
  text-align: center;
}

/* 4) NAV + HEADER */
.site-nav {
  font-family: Inter, sans-serif;
  font-style: italic;
  text-align: center;
  font-weight: 300;
  padding: 7px;
  background: #b3b3b3;
  color: #1e1e1e;
}
.site-nav a {
  font-size: 0.85rem;
  margin: 0 2px;
  text-decoration: none;
  color: #1e1e1e;
  text-transform: uppercase;
}
header {
  background: url("header.webp") center/cover;
  padding: 30px;
  position: relative;
  overflow: hidden;
  text-align: center;
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(2px);
}
header img {
  width: 80%;
  max-width: 450px;
  position: relative;
  z-index: 1;
}

/* 5) BUTTONS & LINKS */
.button {
  display: block;
  width: fit-content;
  padding: 5px 20px;
  font-weight: 300;
  font-style: italic;
  margin: 0 auto;
  background: #222225;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 10px;
  text-align: center;
  transition: opacity 0.3s;
}
.button:hover {
  opacity: 0.7;
}
.body-section a {
  color: #6b0000;
  text-decoration: underline;
}
.body-section a:hover,
.body-section a:focus {
  color: #ce0000;
}

/* 6) SOCIAL ICONS */
.social-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  padding: 0;
  gap: 24px;
}
.social-icons li,
.social-icons a {
  display: flex;
  justify-content: center;
  align-items: center;
}
.social-icons a {
  width: 40px;
  height: 40px;
  color: #000;
  transition: opacity 0.3s;
}
.social-icons a:hover,
.social-icons a:focus-visible {
  opacity: 0.7;
  outline: none;
}
.social-icons svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  display: block;
  transition: opacity 0.3s;
}

/* 7) VISUAL ELEMENTS (images/icons) */
.image-content {
  flex: 1 1 0;
  max-width: 100%;
  min-width: 0;
}
.image-content-headshot {
  flex: 0 1 350px;
  max-width: 350px;
}
.image-content img,
.image-content-headshot img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
}
.icon-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}
.icon {
  position: relative;
  width: 100%;
  height: 100%;
}
.png-icon {
  width: 100%;
  display: block;
  border-radius: 10px;
  transition: opacity 0.3s;
}
.svg-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  pointer-events: none;
}
.video-icon {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  transition: opacity 0.3s;
}
.video-icon:hover,
.icon:hover .png-icon {
  opacity: 0.7;
}

/* 8) FLEX LAYOUTS */
.two-column,
.two-column-reverse {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}
.two-column {
  flex-direction: row-reverse;
}
.text-content {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: break-word;
}

/* 9) 404 BUTTONS */
.error-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.error-btn {
  flex: 1 1 200px;
  max-width: 300px;
}
.error-buttons .error-btn {
  flex: 0 1 auto;
  min-width: 150px;
  white-space: nowrap;
}
.error-btn {
  all: unset;
  display: inline-block;
  padding: 5px 20px;
  font-weight: 300;
  font-style: italic;
  background: #222225;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 10px;
  text-align: center;
  transition: opacity 0.3s;
  white-space: nowrap;
  flex: 1;
  max-width: 300px;
  box-sizing: border-box;
}
.error-btn:hover {
  opacity: 0.7;
}

/* 10) VALUES */
.grid-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  width: 100%;
}
.grid-values .value-box p {
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.value-box {
  padding: 1rem;
  border-radius: 10px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: background-color 0.3s;
}
.value-box:hover {
  background: #f8f8f8; /* same as story-card hover */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* 11) BLOG / MARKDOWN */
#post .blog-section {
  max-width: 72ch;
  margin-inline: auto;
}
.blog-section {
  --ink: #111;
  --muted: #555;
  --border: #e6e6e6;
  --blockquote-bg: #fafafa;
  --code-bg: #f4f4f4;
  --kbd-bg: #f7f7f7;
  --media-width: 70%;
  color: var(--ink);
  line-height: 1.7;
  font-size: 1rem;
}
.blog-section p,
.blog-section ul,
.blog-section ol,
.blog-section blockquote,
.blog-section pre,
.blog-section table,
.blog-section figure,
.blog-section .callout {
  margin: 0 0 1rem;
}
.blog-section > *:first-child {
  margin-top: 0;
}
.blog-section h2 {
  font-size: clamp(1.25rem, 1vw + 1rem, 1.5rem);
  font-weight: 900;
}
.blog-section h3 {
  font-size: clamp(1.1rem, 0.7vw + 0.9rem, 1.3rem);
  font-weight: 700;
}
.blog-section h4 {
  font-size: 1.05rem;
  font-weight: 700;
}
.blog-section h5 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.blog-section h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.blog-section h2,
.blog-section h3,
.blog-section h4,
.blog-section h5,
.blog-section h6 {
  line-height: 1.25;
  margin: 1.5rem 0 0.5rem;
}
.blog-section p {
  color: var(--ink);
}
.blog-section a {
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.blog-section a:hover {
  text-decoration-thickness: 2px;
}
.blog-section a:focus-visible {
  outline: 2px dashed currentColor;
  outline-offset: 2px;
}
.blog-section ul,
.blog-section ol {
  padding-left: 1.25rem;
}
.blog-section li {
  margin: 0.3rem 0;
}
.blog-section li > ul,
.blog-section li > ol {
  margin-top: 0.3rem;
}
.blog-section blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #6b0000;
  background: var(--blockquote-bg);
  border-radius: 8px;
}
.blog-section blockquote p:last-child {
  margin-bottom: 0;
}
.blog-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.95em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.blog-section pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.blog-section pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.95rem;
  display: block;
}
.blog-section kbd {
  background: var(--kbd-bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.1em 0.4em;
  font-family: inherit;
  font-size: 0.9em;
}
.blog-section img,
.blog-section a img {
  display: block;
  max-width: var(--media-width);
  max-height: 700px;
  margin: 1rem auto;
  border-radius: 10px;
}
.blog-section figure {
  margin: 1.25rem auto;
  max-width: 100%;
  text-align: center;
}
.blog-section figure img {
  margin: 0 auto;
}
.blog-section figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.blog-section iframe,
.blog-section figure iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  border: 0;
  margin-inline: auto;
}
.blog-section figure:where(.video, .embed, .iframe),
.blog-section figure iframe {
  max-width: var(--media-width);
}
.blog-section hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}
.blog-section table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
.blog-section thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.blog-section th,
.blog-section td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.blog-section tbody tr:nth-child(odd) {
  background: rgba(0, 0, 0, 0.015);
}
.blog-section .footnotes {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.blog-section .footnotes ol {
  padding-left: 1.25rem;
}
#post .post-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.25rem 0 1.25rem;
}

/* 12) POST PAGER */
.post-pager {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  color: #000;
  gap: 1rem;
  margin-top: 2rem;
  border-radius: 10px;
  background: #f0f0f0;
  font-weight: 700;
}
.post-pager .pager-link.newer {
  text-align: left;
}
.post-pager .pager-link.older {
  text-align: right;
}
nav.post-pager {
  padding: 1rem;
}
.post-pager .pager-link {
  flex: 1;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: #000;
  border: 1px solid #ddd;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.post-pager .pager-link:hover,
.post-pager .pager-link:focus {
  background: #f8f8f8;
}
.pager-title {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: #666;
}

/* 13) STORIES INDEX */
.stories-index {
  padding: 1rem;
}
.stories-index h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.story-card {
  background: #f0f0f0;
  border-radius: 10px;
  border: 1px solid #ddd;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s, box-shadow 0.2s;
}
.story-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.story-card a,
.story-card a:link,
.story-card a:visited,
.story-card a:hover,
.story-card a:active {
  text-decoration: none !important;
  color: inherit !important;
}
.story-card img {
  aspect-ratio: 16 / 10;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: center;
  display: block;
}

.story-card h3 {
  font-size: 1.2rem;
  margin: 1rem 1rem 0.5rem;
  line-height: 1.4;
}
.story-card .meta {
  font-size: 0.85rem;
  color: #666;
  margin: 0 1rem 0.5rem;
}
.story-card p {
  margin: 0 1rem 1rem;
  font-size: 0.95rem;
  color: #333;
}
.story-card:hover {
  background: #f8f8f8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* 14) ACCESSIBILITY */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------- */
/* GROUPED MEDIA QUERIES        */
/* ---------------------------- */
/* ≤ 850px */
@media (max-width: 850px) {
  .two-column,
  .two-column-reverse {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 0;
    width: 100%;
  }
  .grid-values {
    grid-template-columns: 1fr;
    gap: 0.5rem; /* Restored spacing for mobile */
  }

  .image-content {
    flex: 1 1 auto;
    max-width: 100%;
    width: 100%;
    display: block;
  }
  .image-content-headshot {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  .image-content-headshot img {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
  }
  .text-content {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    display: block;
  }
  .button-stack .text-content + .text-content {
    margin-top: 10px;
  }
  .blog-section img,
  .blog-section a img {
    max-width: 100%;
    max-height: none;
  }
  .blog-section figure:where(.video, .embed, .iframe),
  .blog-section figure iframe {
    max-width: 100%;
  }
}

/* ≤ 750px */
@media (max-width: 750px) {
  .post-pager {
    flex-direction: column;
    margin: 0 !important;
  }
  .post-pager .pager-link {
    flex: unset;
    width: 100%;
  }
}

/* ≤ 500px */
@media (max-width: 500px) {
  .error-buttons {
    flex-direction: column;
    align-items: center;
  }
  .error-buttons .error-btn {
    width: 100%;
    max-width: 300px;
  }
}

/* Dark mode (all overrides) */
@media (prefers-color-scheme: dark) {
  body,
  html {
    background: #121212;
  }
  body {
    color: #fff;
  }
  .body-section {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  .body-section a {
    color: #c40000;
  }
  .body-section a:hover,
  .body-section a:focus {
    color: #868686;
  }
  .site-nav,
  .site-nav a {
    background: #1e1e1e;
    color: #b3b3b3;
  }
  .value-box {
    background: #2a2a2a; /* matches .body-section */
    border: 1px solid #444; /* matches story-card border */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    transition: background-color 0.2s, box-shadow 0.2s;
  }
  .value-box:hover {
    background: #333; /* same as story-card hover */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  }
  .button,
  .error-btn {
    background: #b3b3b3;
    color: #222225 !important;
  }
  footer {
    background: #1e1e1e;
    color: #b3b3b3;
  }
  .social-icons a {
    color: #b3b3b3;
  }
  .social-icons svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
  }
  /* Blog dark tokens */
  .blog-section {
    --ink: #e7e7e7;
    --muted: #b6b6b6;
    --border: #3a3a3a;
    --blockquote-bg: #1b1b1b;
    --code-bg: #171717;
    --kbd-bg: #202020;
  }
  .blog-section thead th {
    background: #2a2a2a;
  }
  .blog-section tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
  }
  .blog-section pre {
    background: var(--code-bg);
    border-color: var(--border);
  }
  .blog-section code {
    background: var(--code-bg);
    border-color: var(--border);
  }
  /* Post pager */
  .post-pager {
    background: #1e1e1e;
    color: #fff;
  }
  .post-pager .pager-link {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  .post-pager .pager-link:hover,
  .post-pager .pager-link:focus {
    background: #333;
  }
  .pager-title {
    color: #aaa;
  }
  .stories-index {
    color: #e0e0e0;
  }
  .stories-index h1 {
    color: #e7e7e7;
  }
  .story-card {
    background: #2a2a2a; /* matches .body-section */
    border: 1px solid #444; /* matches .value-box/.post-pager borders */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    transition: background-color 0.2s, box-shadow 0.2s;
  }
  .story-card:hover {
    background: #333; /* matches post-pager hover */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  }
  .story-card h3 {
    color: #e7e7e7; /* = --ink in blog dark */
  }
  .story-card .meta {
    color: #b6b6b6; /* = --muted in blog dark */
  }
  .story-card p {
    color: #e0e0e0; /* align with .body-section text */
  }
  .story-card a:hover,
  .story-card a:focus {
    text-decoration: none;
    outline: none;
  }
}
