/* ==========================================================================
   Deitysoft blog — public stylesheet
   Standalone by design: the React app's Tailwind bundle is content-hashed and
   purges any class it can't find in src/, so PHP templates can't rely on it.
   Tokens below are copied verbatim from src/styles.css to stay in lockstep.
   ========================================================================== */

:root {
  --background: oklch(0.16 0.008 60);
  --foreground: oklch(0.94 0.018 80);
  --cream: oklch(0.94 0.018 80);
  --amber-glow: #eaa70b;
  --card: oklch(0.20 0.01 60);
  --muted: oklch(0.22 0.01 60);
  --muted-foreground: oklch(0.65 0.02 70);
  --border: oklch(0.94 0.018 80 / 12%);
  --radius: 0.5rem;

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --container: 1200px;
  --measure: 68ch;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor links from the table of contents must clear the fixed header. */
  scroll-padding-top: 6rem;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--amber-glow); color: var(--background); }

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

.font-display { font-family: var(--font-display); font-feature-settings: "ss01"; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
@media (min-width: 768px) { .container { padding-inline: 2.5rem; } }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Grain overlay — pure CSS, matches the React site's .grain treatment ------ */
.grain::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.94 0 0 0 0 0.92 0 0 0 0 0.85 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .06;
  mix-blend-mode: overlay;
}

/* Animated underline, lifted from .story-link -------------------------------- */
.story-link { position: relative; display: inline-block; text-decoration: none; }
.story-link::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  height: 1px; width: 100%;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.story-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* Focus ring — visible for keyboard users, absent for mouse clicks ---------- */
:focus-visible {
  outline: 2px solid var(--amber-glow);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--background) 72%, transparent);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { width: 26px; height: 26px; }

.site-nav { display: none; gap: 2rem; font-size: .875rem; }
@media (min-width: 900px) { .site-nav { display: flex; } }
.site-nav a { text-decoration: none; color: var(--foreground); opacity: .85; transition: opacity .3s, color .3s; }
.site-nav a:hover { opacity: 1; }
.site-nav a[aria-current="page"] { color: var(--amber-glow); opacity: 1; }

.nav-cta {
  display: none;
  padding: .55rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .3s, color .3s, border-color .3s;
}
@media (min-width: 900px) { .nav-cta { display: inline-block; } }
.nav-cta:hover { background: var(--amber-glow); border-color: var(--amber-glow); color: var(--background); }

/* Mobile menu — CSS-only, driven by a hidden checkbox so it needs no JS ----- */
.menu-toggle { display: block; background: none; border: 0; color: inherit; cursor: pointer; padding: .5rem; }
@media (min-width: 900px) { .menu-toggle { display: none; } }
.menu-toggle svg { display: block; }

#menu-state { position: absolute; opacity: 0; pointer-events: none; }
.mobile-menu {
  position: fixed; inset: 0; z-index: 45;
  background: var(--background);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 1.5rem;
  opacity: 0; visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
}
#menu-state:checked ~ .mobile-menu { opacity: 1; visibility: visible; }
.mobile-menu a {
  font-family: var(--font-display);
  font-size: 2rem;
  text-decoration: none;
}
.mobile-menu .close {
  position: absolute; top: 1.5rem; right: 1.75rem;
  font-size: 2rem; cursor: pointer; line-height: 1;
}

/* ==========================================================================
   Page shell
   ========================================================================== */
main { padding-top: 72px; }

.page-head { padding: 5rem 0 3rem; border-bottom: 1px solid var(--border); }
@media (min-width: 768px) { .page-head { padding: 7rem 0 4rem; } }

.eyebrow {
  font-size: .75rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--amber-glow);
  margin: 0 0 1.25rem;
}

.page-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-head .lede {
  margin: 1.5rem 0 0;
  max-width: 55ch;
  color: var(--muted-foreground);
  font-size: 1.05rem;
}

/* Breadcrumbs -------------------------------------------------------------- */
.breadcrumbs {
  font-size: .8rem;
  color: var(--muted-foreground);
  padding: 1.5rem 0 0;
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.breadcrumbs li::after { content: "/"; margin-left: .5rem; opacity: .4; }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--amber-glow); }

/* ==========================================================================
   Category filter bar
   ========================================================================== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .6rem;
  padding: 2rem 0 0;
}
.filter-bar a {
  padding: .4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .8rem;
  text-decoration: none;
  color: var(--muted-foreground);
  transition: border-color .3s, color .3s;
}
.filter-bar a:hover { color: var(--foreground); border-color: var(--muted-foreground); }
.filter-bar a.is-active { background: var(--amber-glow); border-color: var(--amber-glow); color: var(--background); }

/* ==========================================================================
   Post grid
   ========================================================================== */
.post-grid {
  display: grid;
  gap: 2.5rem 2rem;
  grid-template-columns: 1fr;
  padding: 3.5rem 0;
}
@media (min-width: 640px)  { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card { display: flex; flex-direction: column; }
.post-card a.thumb {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card);
  aspect-ratio: 16 / 10;
  margin-bottom: 1.25rem;
}
.post-card a.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2,.7,.2,1);
}
.post-card a.thumb:hover img { transform: scale(1.04); }

.post-card .thumb-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: color-mix(in oklab, var(--amber-glow) 45%, transparent);
}

.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: .75rem;
}
.post-meta .dot { opacity: .4; }
.post-meta a { color: var(--amber-glow); text-decoration: none; }

.post-card h2, .post-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 .65rem;
}
.post-card h2 a, .post-card h3 a { text-decoration: none; transition: color .3s; }
.post-card h2 a:hover, .post-card h3 a:hover { color: var(--amber-glow); }

.post-card p { margin: 0; color: var(--muted-foreground); font-size: .925rem; }

/* Empty state -------------------------------------------------------------- */
.empty-state { padding: 6rem 0; text-align: center; color: var(--muted-foreground); }
.empty-state h2 { font-family: var(--font-display); font-weight: 400; color: var(--foreground); font-size: 1.75rem; }

/* Pagination --------------------------------------------------------------- */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: .5rem;
  padding: 0 0 5rem;
}
.pagination a, .pagination span {
  min-width: 40px; height: 40px;
  display: grid; place-items: center;
  padding-inline: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  text-decoration: none;
  transition: border-color .3s, color .3s;
}
.pagination a:hover { border-color: var(--amber-glow); color: var(--amber-glow); }
.pagination .current { background: var(--amber-glow); border-color: var(--amber-glow); color: var(--background); }
.pagination .disabled { opacity: .3; }

/* ==========================================================================
   Single post
   ========================================================================== */
.article-head { padding: 4rem 0 2.5rem; }
@media (min-width: 768px) { .article-head { padding: 5.5rem 0 3rem; } }

.article-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 5.5vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 1.25rem 0 0;
  max-width: 22ch;
}

.article-head .lede {
  margin: 1.5rem 0 0;
  max-width: var(--measure);
  font-size: 1.15rem;
  color: var(--muted-foreground);
}

.article-byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--muted-foreground);
}
.article-byline img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.article-byline strong { color: var(--foreground); font-weight: 500; }

.hero-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 3.5rem;
  background: var(--card);
}
.hero-image img { width: 100%; }
.hero-image figcaption {
  padding: .85rem 1rem;
  font-size: .8rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* Two-column layout: sticky TOC beside the article ------------------------- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding-bottom: 5rem;
}
@media (min-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 4rem; }
}

/* Table of contents -------------------------------------------------------- */
.toc { order: -1; }
@media (min-width: 1100px) {
  .toc { order: 0; position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 140px); overflow-y: auto; }
}
.toc h2 {
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 0 0 1rem;
  font-weight: 500;
}
.toc ol { list-style: none; margin: 0; padding: 0; font-size: .875rem; }
.toc li { margin-bottom: .6rem; }
.toc li.lvl-3 { padding-left: 1rem; font-size: .825rem; }
.toc a { text-decoration: none; color: var(--muted-foreground); transition: color .3s; line-height: 1.45; display: block; }
.toc a:hover { color: var(--amber-glow); }

@media (max-width: 1099px) {
  .toc {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2.5rem;
  }
}

/* ==========================================================================
   Article prose
   ========================================================================== */
.prose {
  max-width: var(--measure);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.prose > * + * { margin-top: 1.5rem; }

.prose h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
  scroll-margin-top: 6rem;
}

.prose h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.4vw, 1.55rem);
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: .75rem;
  scroll-margin-top: 6rem;
}

.prose h4 {
  font-size: 1.075rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: .5rem;
}

.prose p { margin-block: 0; color: color-mix(in oklab, var(--foreground) 92%, transparent); }

.prose a {
  color: var(--amber-glow);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity .3s;
}
.prose a:hover { opacity: .75; }

.prose strong { font-weight: 600; color: var(--foreground); }

.prose ul, .prose ol { padding-left: 1.35rem; margin-block: 0; }
.prose li { margin-bottom: .6rem; }
.prose li::marker { color: var(--amber-glow); }

.prose blockquote {
  margin: 2.5rem 0;
  padding: .35rem 0 .35rem 1.75rem;
  border-left: 2px solid var(--amber-glow);
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.55;
  font-style: italic;
  color: var(--foreground);
}
.prose blockquote p { margin: 0; }

.prose figure { margin: 2.5rem 0; }
.prose figure img { border-radius: var(--radius); width: 100%; }
.prose figcaption {
  margin-top: .75rem;
  font-size: .825rem;
  color: var(--muted-foreground);
  text-align: center;
}
.prose img { border-radius: var(--radius); }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: .875em;
  background: var(--muted);
  padding: .15em .4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.prose pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: .875rem;
  line-height: 1.65;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

/* Tables scroll inside their own container so the page never scrolls sideways */
.prose .table-wrap { overflow-x: auto; margin: 2.5rem 0; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: .925rem; min-width: 460px; }
.prose th, .prose td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.prose th {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  font-weight: 500;
}

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-section { max-width: var(--measure); margin-top: 4.5rem; }
.faq-section > h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  margin: 0 0 1.75rem;
  scroll-margin-top: 6rem;
}

.faq-item { border-top: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 1px solid var(--border); }

/* <details>/<summary> gives an accessible accordion with zero JavaScript. */
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 1.35rem 2.5rem 1.35rem 0;
  position: relative;
  font-size: 1.05rem;
  font-weight: 500;
  transition: color .3s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--amber-glow); }

.faq-item summary::after {
  content: "+";
  position: absolute; right: .25rem; top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--amber-glow);
  transition: transform .3s;
}
.faq-item[open] summary::after { content: "−"; }

.faq-item .answer { padding: 0 2.5rem 1.5rem 0; color: var(--muted-foreground); }
.faq-item .answer > :first-child { margin-top: 0; }

/* ==========================================================================
   Tags, author box, share
   ========================================================================== */
.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 3rem; max-width: var(--measure); }
.tag-list a {
  padding: .35rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: border-color .3s, color .3s;
}
.tag-list a:hover { color: var(--amber-glow); border-color: var(--amber-glow); }

.author-box {
  display: flex; gap: 1.25rem;
  max-width: var(--measure);
  margin-top: 3.5rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--card) 60%, transparent);
}
.author-box img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-box h3 { margin: 0 0 .2rem; font-size: 1rem; font-weight: 500; }
.author-box .role { font-size: .8rem; color: var(--amber-glow); margin: 0 0 .6rem; }
.author-box p { margin: 0; font-size: .9rem; color: var(--muted-foreground); }

.share-row {
  display: flex; align-items: center; gap: 1rem;
  max-width: var(--measure);
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.share-row a { text-decoration: none; transition: color .3s; }
.share-row a:hover { color: var(--amber-glow); }

/* ==========================================================================
   Related posts + CTA
   ========================================================================== */
.related { border-top: 1px solid var(--border); padding: 4.5rem 0; }
.related h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  margin: 0 0 2.5rem;
}

.cta-band {
  border-top: 1px solid var(--border);
  padding: 5rem 0;
  text-align: center;
}
.cta-band h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.cta-band p { color: var(--muted-foreground); max-width: 50ch; margin: 0 auto 2rem; }
.cta-band .btn {
  display: inline-block;
  padding: .9rem 2rem;
  background: var(--amber-glow);
  color: var(--background);
  border-radius: 999px;
  text-decoration: none;
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 500;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), opacity .3s;
}
.cta-band .btn:hover { transform: translateY(-2px); opacity: .92; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3.5rem 0 2.5rem;
  font-size: .85rem;
  color: var(--muted-foreground);
}
.site-footer .cols {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1fr;
  margin-bottom: 3rem;
}
@media (min-width: 700px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h3 {
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--foreground);
  margin: 0 0 1rem;
  font-weight: 500;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .55rem; }
.site-footer a { text-decoration: none; transition: color .3s; }
.site-footer a:hover { color: var(--amber-glow); }
.site-footer .bottom {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
}
.site-footer .tagline {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--foreground);
  margin: 0 0 1rem;
  max-width: 26ch;
  line-height: 1.3;
}

/* ==========================================================================
   Reading progress bar (CSS scroll-driven animation; no JS, no layout thrash)
   ========================================================================== */
.read-progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 100%;
  transform-origin: 0 50%;
  background: var(--amber-glow);
  z-index: 60;
  transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .read-progress {
    animation: read-progress-grow linear;
    animation-timeline: scroll(root block);
  }
  @keyframes read-progress-grow { to { transform: scaleX(1); } }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .site-header, .site-footer, .toc, .cta-band, .related, .share-row, .read-progress, .grain::before { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { max-width: none; }
  .prose a::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
