:root{
  --bg: #0f0f10;
  --bg-elev: #151517;
  --text: #e8e8ea;
  --muted: #b7b7bd;
  --brand: #9d4040;
  --brand-2: #75252d;
  --border: #2a2a2e;
  --link: #efeae6;
  --success: #4fb377;
  --warning: #e6b34a;
  --danger: #e24d4d;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --maxch: 72ch;
  --radius: 16px;
  --header-h: 64px;
}
@media (prefers-color-scheme: light) {
  :root{
    --bg: #fafafa;
    --bg-elev: #ffffff;
    --text: #1a1b1e;
    --muted: #50535a;
    --brand: #7a2d2d;
    --brand-2: #5a2f73;
    --border: #e3e3ea;
    --link: #ded7d1;
    --shadow: 0 10px 30px rgba(0,0,0,.07);
  }
}
html { scroll-behavior: smooth; hanging-punctuation: first allow-end; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.7; letter-spacing: 0.02px; text-rendering: optimizeLegibility;
}

/* Header */
.site-header { position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  backdrop-filter: saturate(120%) blur(8px);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
}
.nav-wrap{ max-width: 1200px; margin: 0 auto; padding: 0 .75rem; display: flex; align-items: center; height: 100%; gap: .75rem; }
.brand { font-family: Georgia, "Times New Roman", Times, serif; font-size: 1.125rem; letter-spacing: .02em; text-transform: lowercase; color: var(--text); text-decoration: none; }
.nav { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; height: 40px; padding: 0 .8rem; border-radius: 999px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-color: var(--border); background: var(--bg-elev); }
.skip-link{ position: absolute; left: -9999px; } .skip-link:focus{ left:.75rem; top:.75rem; z-index:1001; background: var(--brand); color:#fff; padding:.5rem .75rem; border-radius:.5rem; }


/* Progress bar */
.progress{ position: fixed; top: var(--header-h); left:0; height:3px; width:0%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); z-index:999; }

main { flex: 1; }
.section { padding: clamp(2rem, 3vw + 1rem, 4rem) 0; }
.container { width:100%; max-width:1200px; margin:20px; margin-inline:auto; padding-inline:1rem; }

/* Hero base (kept for non-image sections) */
/* ==== Fixed-background hero (fills the viewport) ==== */
.hero.parallax{
  position: relative;
  min-height: 50svh;            /* reliable small viewport on mobile */
  display: grid;
  align-content: center;

  /* Image */
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center 25%; /* tweak vertical framing */
  background-attachment: fixed;    /* the key: image stays fixed */
  background-repeat: no-repeat;
  overflow: clip;
}

/* Overlay for legibility (gradient, vignette) */
.hero.parallax::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 500px at 70% 20%, rgba(0,0,0,0.45), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.55) 60%, rgba(0,0,0,.7));
}

/* Foreground content sits above overlay */
.hero-content{
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  padding: clamp(3rem, 6vw, 7rem) 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Tighten small devices a bit */
@media (max-width: 420px){
  .hero.parallax{ min-height: 92svh; }
}

.hero-title{text-align:center; font-family:Georgia, 'Times New Roman', Times, serif;font-size: 4em;font-weight: lighter;}

/* ===== Section variants (no image / image left / image right / dimmed bg image) ===== */

/* Every section can have its own full-width background via --section-bg */
.section{
  position: relative;
  background: var(--section-bg, transparent); /* set per section */
}

/* Shared split layout for image+text sections */
.section.with-image .container.split{
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr); /* both sides can shrink */
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
}

/* Let the text column actually shrink (important in CSS Grid) */
.section.with-image .sec-body{ min-width: 0; }

/* Media block */
.sec-media{
  margin: 0;
  overflow: clip;
  justify-self: stretch;          /* fill the column */
}

/* Always scale to its grid area; no fixed width/margins */
.sec-media img{
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  margin: 0;                      /* spacing comes from grid gap */
}

/* Optional: if you want the picture to never get too wide on large screens */
.sec-media.is-narrow{ max-inline-size: 560px; }
.image-left  .sec-media.is-narrow{ justify-self: start; }
.image-right .sec-media.is-narrow{ justify-self: end; }

/* Left/Right variants simply change order on wide screens */
.image-right .sec-media{ order: 2; }
.image-right .sec-body { order: 1; }

/* Stack on narrow screens */
@media (max-width: 900px){
  .section.with-image .container.split{
    grid-template-columns: 1fr;
  }
}

/* ===== Dimmed image as full-section background ===== */
.bg-photo{
  position: relative;             /* create containing block for ::before */
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.bg-photo::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: color-mix(in oklab, #000 40%, transparent); /* default dim */
}
.bg-photo[data-dim="strong"]::before{ background: color-mix(in oklab, #000 55%, transparent); }
.bg-photo[data-dim="none"]::before  { background: none; }

/* Ensure content sits above the dim overlay */
.bg-photo .container{ position: relative; z-index: 1; }

/* Button stuff */
.btn{ display: inline-flex; align-items:center; gap:.5rem; padding:.625rem 1rem; border-radius:999px; border:1px solid var(--border); background:var(--bg-elev); color:var(--text); text-decoration:none !important; font-weight:600; transition: transform .06s ease; }
.btn:hover{ transform: translateY(-1px); }
.btn.primary{ background: linear-gradient(90deg, color-mix(in oklab, var(--brand) 40%, transparent), color-mix(in oklab, var(--brand-2) 40%, transparent)); border-color: color-mix(in oklab, var(--brand) 35%, var(--border)); }



/* Long-form typography */
.prose { max-width: var(--maxch); margin-inline: auto; hyphens: auto; overflow-wrap: anywhere; }
.prose h2, .prose h3, .prose h4, .prose h5{ font-family: Georgia, "Times New Roman", Times, serif; line-height:1.25; text-wrap: balance; margin-bottom: .6em; color: var(--text); }
.prose h2{ font-size: 2em; }
.prose h3{line-height:1; margin-top:2.1em; color:#898989; font-size:.8em;}
.prose p, .prose li { font-size: clamp(1rem, .3vw + .95rem, 1.05rem); text-align:justify;}
.prose p { margin: 0 0 1.1em 0; padding:10px;}
.prose ul, .prose ol { padding-left: 1.2em; margin: .75em 0 1.25em; }
.prose li + li{ margin-top: .35em; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: .03em; }
.prose a:hover{ text-decoration-thickness: .13em; }
blockquote{ border-inline-start: 4px solid var(--border); padding-inline: 1rem; margin-inline: 0; color: var(--muted); }
hr{ border:0; height:1px; background: linear-gradient(90deg, transparent, var(--border), transparent); margin: 2rem 0; }
.callout{ border: 1px solid var(--border); border-left: 4px solid var(--brand-2); background: color-mix(in oklab, var(--bg-elev) 92%, transparent); padding: 1rem; border-radius: .5rem; margin: 1.25rem 0; }
.callout.info { border-left-color: var(--brand-2); } .callout.success { border-left-color: var(--success); } .callout.warning { border-left-color: var(--warning); } .callout.danger { border-left-color: var(--danger); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

/* Footer */
.site-footer{ background: var(--bg-elev); color: var(--muted); }
.site-footer .container{ display:flex; align-items:center; justify-content:space-between; gap:1rem; padding-block:1.25rem; flex-wrap:wrap; }
.site-footer a{ color:inherit; }

.flow > * + * { margin-top: 1rem; }

:target{ scroll-margin-top: calc(var(--header-h) + 12px); animation: tgt 1.6s ease 1; }
@keyframes tgt{ 0%{ box-shadow: 0 0 0 0 rgba(155,155,255,0); } 15%{ box-shadow: 0 0 0 6px rgba(155,155,255,.2); } 100%{ box-shadow: 0 0 0 0 rgba(155,155,255,0); } }

/* ToC (article pages) */
.toc-wrap{ display: grid; grid-template-columns: minmax(0,1fr); gap: 2rem; }
@media (min-width: 1100px){ .toc-wrap{ grid-template-columns: 280px 1fr; } .toc{ position: sticky; top: calc(var(--header-h) + 12px); align-self: start; max-height: calc(100dvh - var(--header-h) - 24px); overflow:auto; padding-right:.25rem; } }
.toc{ border:1px solid var(--border); background: var(--bg-elev); border-radius:.75rem; padding:1rem; }
.toc h2{ margin:0 0 .5rem 0; font-size:1rem; letter-spacing:.02em; }
.toc a{ display:block; padding:.3rem .25rem; border-radius:.5rem; color:var(--text); text-decoration:none; }
.toc a:hover, .toc a[aria-current="true"]{ background: color-mix(in oklab, var(--bg) 92%, transparent); }

/* Media sections (image cards) */
.media-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap:1rem; }
.media-grid h2 {text-align: center;}
.card-img{ border:1px solid var(--border); border-radius: var(--radius); overflow: clip; background: var(--bg-elev); display:grid; grid-template-rows:auto 1fr; box-shadow: var(--shadow); }
.card-img img{ width:100%; height:180px; object-fit:cover; display:block; }
.card-img .content{ padding:.9rem 1rem 1.1rem; }
.card-img h3{ margin:0 0 .25rem 0; }

@media (prefers-reduced-motion: reduce){ html{ scroll-behavior: auto; } }
