/* fourworlds.earth — consolidated stylesheet.
   Covers every content pattern across the 267-post corpus:
   h1–h4, p, ul/ol, blockquote, figure/figcaption, tables, links,
   responsive images, code, and page chrome (header, nav, footer).
   Clean semantic CSS — no Elementor cruft. */

/* =========================================================================
   Custom properties
   ========================================================================= */
:root {
  --measure: 68ch;
  --ink: #212121;
  --muted: #5b5b5b;
  --accent: #ff5924;      /* matches original FWII link colour */
  --bg: #ffffff;
  --rule: #e6e6e6;
  --table-head-bg: #f5f5f5;
  --font-body: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace;
}

/* =========================================================================
   Reset / base
   ========================================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;    /* 18px */
  line-height: 1.7;
}

/* =========================================================================
   Layout scaffold
   ========================================================================= */
.page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 2rem 1.25rem 4rem;
}

/* =========================================================================
   Site header
   ========================================================================= */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-logo {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: .95rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

/* =========================================================================
   Post header
   ========================================================================= */
.post-header { margin-bottom: 2rem; }

.post-header h1 {
  font-family: var(--font-ui);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 .5rem;
  color: var(--ink);
}

.post-meta {
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--muted);
  margin: 0;
}

.post-meta a { color: var(--muted); }

.post-meta .categories::before { content: " · "; }

/* =========================================================================
   Article body — typography
   ========================================================================= */
article {
  /* Establish a stacking context and constrain orphan image refs */
  min-width: 0;
}

article p {
  margin: 0 0 1.25rem;
}

/* Headings h1–h6 */
article h1,
article h2,
article h3,
article h4,
article h5,
article h6 {
  font-family: var(--font-ui);
  color: var(--ink);
  line-height: 1.25;
  margin: 2.25rem 0 .75rem;
}

article h1 { font-size: clamp(1.6rem, 4vw, 2.25rem); }
article h2 { font-size: 1.55rem; }
article h3 { font-size: 1.3rem; }
article h4 { font-size: 1.1rem; }
article h5 { font-size: 1rem; }
article h6 { font-size: .9rem; letter-spacing: .02em; text-transform: uppercase; color: var(--muted, #555); }

/* The first heading after the post-header gets less top space */
article > :first-child,
article > h2:first-child,
article > h3:first-child {
  margin-top: 0;
}

/* ---- Links ---- */
article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

article a:hover { text-decoration: none; }

/* ---- Strong / em ---- */
article strong, article b { font-weight: 700; }
article em, article i     { font-style: italic; }

/* ---- Lists ---- */
article ul,
article ol {
  margin: 0 0 1.25rem 1.5rem;
  padding: 0;
}

article li { margin-bottom: .5rem; }

article ul ul,
article ol ol,
article ul ol,
article ol ul {
  margin-top: .25rem;
  margin-bottom: 0;
}

/* ---- Blockquote ---- */
article blockquote {
  margin: 1.75rem 0;
  padding: .5rem .5rem .5rem 1.25rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

article blockquote p { margin-bottom: .5rem; }
article blockquote p:last-child { margin-bottom: 0; }

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

/* ---- Inline code ---- */
article code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: #f4f4f4;
  padding: .1em .35em;
  border-radius: 3px;
}

/* ---- Code block ---- */
article pre {
  font-family: var(--font-mono);
  font-size: .875rem;
  background: #f4f4f4;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* =========================================================================
   Images + figures
   ========================================================================= */
figure {
  margin: 1.75rem 0;
}

figure img,
article img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Standalone image (bare ![alt](…) in Markdown) */
article > p > img:only-child,
article img {
  display: block;
  margin-block: 1.5rem;
}

figcaption {
  font-family: var(--font-ui);
  font-size: .85rem;
  color: var(--muted);
  margin-top: .4rem;
  line-height: 1.5;
}

/* =========================================================================
   Tables
   ========================================================================= */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.5rem;
}

/* Markdown emits bare tables (no .table-wrapper), so make the table itself
   the horizontal-scroll container on narrow viewports. */
article table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-size: .95rem;
  font-family: var(--font-ui);
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

article th,
article td {
  border: 1px solid var(--rule);
  padding: .5rem .75rem;
  text-align: left;
  vertical-align: top;
}

article thead th {
  background: var(--table-head-bg);
  font-weight: 600;
  color: var(--ink);
}

article tbody tr:nth-child(even) td {
  background: #fafafa;
}

/* =========================================================================
   Post footer
   ========================================================================= */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--muted);
}

.post-footer a { color: var(--accent); }

.post-categories {
  margin-top: .5rem;
}

/* =========================================================================
   Site footer
   ========================================================================= */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 1.25rem;
  font-family: var(--font-ui);
  font-size: .875rem;
  color: var(--muted);
  text-align: center;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* =========================================================================
   Video embed — responsive 16:9 iframe wrapper (YouTube etc.)
   ========================================================================= */
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;   /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 1.75rem 0;
  border-radius: 6px;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =========================================================================
   Document-missing placeholder (Scribd / embed-only posts)
   ========================================================================= */
.missing-doc {
  border: 2px dashed var(--rule);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-family: var(--font-ui);
  font-size: .95rem;
  color: var(--muted);
}

.missing-doc strong { color: var(--ink); }
.missing-doc a { color: var(--accent); }

/* =========================================================================
   Responsive — narrow viewports
   ========================================================================= */
@media (max-width: 640px) {
  body { font-size: 1rem; }

  .page { padding: 1.25rem .875rem 3rem; }

  article h2 { font-size: 1.35rem; }
  article h3 { font-size: 1.15rem; }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }
}

/* =========================================================================
   Print
   ========================================================================= */
@media print {
  .site-header,
  .site-nav,
  .site-footer { display: none; }

  body { font-size: 11pt; color: #000; }
  article a::after { content: " (" attr(href) ")"; font-size: .85em; }
}

/* =========================================================================
   Nav dropdowns (M3 — pure CSS, keyboard-accessible via :focus-within)
   ========================================================================= */
.nav-group { position: relative; }
.nav-label {
  color: var(--ink);
  cursor: default;
}
.nav-group > a::after,
.nav-label::after { content: " ▾"; font-size: .75em; color: var(--muted); }
.nav-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 14rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
  padding: .5rem 0;
}
.nav-group:hover .nav-sub,
.nav-group:focus-within .nav-sub { display: block; }
.nav-sub a {
  display: block;
  padding: .35rem 1rem;
  white-space: nowrap;
}

/* =========================================================================
   Archives (M3 — post lists, year index, pagination)
   ========================================================================= */
.post-list { list-style: none; padding: 0; }
.post-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-list time {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: .85rem;
  white-space: nowrap;
}
.year-list { list-style: none; padding: 0; }
.year-list li { padding: .35rem 0; }
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  font-family: var(--font-ui);
  font-size: .95rem;
}
.pagination span { color: var(--muted); }

/* =========================================================================
   Site footer content (M3)
   ========================================================================= */
.footer-mission {
  font-style: italic;
  max-width: var(--measure);
  margin-inline: auto;
}
.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: .9rem;
  margin: 1rem 0;
}
.footer-contact { font-style: normal; color: var(--muted); }
.footer-copyright { font-size: .85rem; color: var(--muted); }

/* ============================================================
   Ken Burns hero slideshow
   Restores the fourworlds.earth homepage hero's crossfading
   background slideshow + subtle zoom ("Ken Burns") that previously
   depended on Elementor's frontend JS. Pure-CSS animation.

   - Crossfade: gap-free. Per-slide delays of cycle/3 (e.g. 0s,8s,16s
     for the 24s cycle) make each slide's fade-out exactly overlap the
     next slide's fade-in (linear + complementary), so combined opacity
     stays ~1 — no blank frame. A black base guards against sub-pixel flashes.
   - Zoom: slow, gentle, decoupled. A yo-yo (1 -> 1.07 -> 1) on its own
     30s timeline, so it never snaps and its speed is independent of how
     fast the slides change.
   ============================================================ */

/* --- reusable component (no Elementor dependency) --- */
.kb-hero{position:absolute;inset:0;overflow:hidden;z-index:0;background:#000;}
.kb-hero .kb-slide{
  position:absolute;inset:0;
  background-size:cover;background-position:center center;
  opacity:0;will-change:opacity,transform;
  animation:kb-fade 24s linear infinite, kb-zoom 30s ease-in-out infinite;
}
.kb-hero .kb-overlay{position:absolute;inset:0;background:#000;opacity:.8;z-index:1;}

/* Gap-free crossfade. fade-in [0,8.333%], hold to 33.333%, fade-out to
   41.666%. With delays of cycle/3 the fade-out of slide N lines up exactly
   with the fade-in of slide N+1, so the two opacities always sum to ~1. */
@keyframes kb-fade{
  0%{opacity:0}
  8.333%{opacity:1}
  33.333%{opacity:1}
  41.666%{opacity:0}
  100%{opacity:0}
}

/* Slow gentle zoom — yo-yo so there is never a hard reset/snap. */
@keyframes kb-zoom{
  0%{transform:scale(1)}
  50%{transform:scale(1.07)}
  100%{transform:scale(1)}
}

/* Accessibility: under reduced-motion keep the gentle crossfade (a fade is not
   vestibular-triggering) but drop the zoom. Everyone still sees the slideshow. */
@media (prefers-reduced-motion: reduce){
  .kb-hero .kb-slide{animation: kb-fade 24s linear infinite;}
}

/* =========================================================================
   Home page (Phase 3.5a — hero, section grid, cards)
   ========================================================================= */
.hero{position:relative;min-height:70vh;display:flex;align-items:center;justify-content:center;text-align:center;color:#fff;}
.hero-content{position:relative;z-index:2;max-width:44rem;padding:4rem 1.25rem;}
.hero-content h1{font-family:var(--font-ui);font-size:clamp(2rem,5vw,3.25rem);line-height:1.15;margin:0 0 .5em;}
.hero-content p{font-size:1.15rem;opacity:.92;}
.button{display:inline-block;background:var(--accent);color:#fff;text-decoration:none;font-family:var(--font-ui);font-weight:600;padding:.65rem 1.4rem;border-radius:4px;margin-top:1rem;}
.button:hover{filter:brightness(1.08);}
.home-section{max-width:64rem;margin-inline:auto;padding:3rem 1.25rem;}
.section-label{font-family:var(--font-ui);text-transform:uppercase;letter-spacing:.12em;font-size:.8rem;color:var(--accent);margin-bottom:.25rem;}
.home-section h2{font-family:var(--font-ui);font-size:1.9rem;margin:.1em 0 .4em;}
.card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(16rem,1fr));gap:1.5rem;margin-top:1.5rem;}
.card img{width:100%;aspect-ratio:3/2;object-fit:cover;border-radius:6px;display:block;}
.card h3{font-family:var(--font-ui);font-size:1.05rem;line-height:1.35;margin:.6em 0 .2em;}
.card h3 a{color:var(--ink);text-decoration:none;}
.card h3 a:hover{color:var(--accent);}
.card-meta{color:var(--muted);font-family:var(--font-ui);font-size:.85rem;margin:0;}
.home-about{display:grid;grid-template-columns:1fr 1.6fr;gap:2.5rem;align-items:center;}
.home-about img{width:100%;border-radius:8px;}
@media (max-width:44rem){.home-about{grid-template-columns:1fr;}}
.home-mission{text-align:center;}
.home-mission p{font-size:1.25rem;font-style:italic;max-width:38rem;margin-inline:auto;}
.home-prophecy{text-align:center;}
.home-prophecy blockquote{margin:1rem auto;max-width:44rem;font-size:1.1rem;font-style:italic;}
.home-prophecy blockquote footer{margin-top:.75rem;font-style:normal;font-family:var(--font-ui);color:var(--muted);}

/* =========================================================================
   Events-widget isolation (Phase 3.5a)
   The InfiniteCal widget renders its cards as <article> elements, so the
   long-form content rules above (article img margins, heading/paragraph
   margins and sizes) bleed into it. Neutralize them inside the widget root;
   the widget's own class-based rules (.tlc-cal__*) then win as intended.
   ========================================================================= */
.tlc-cal article img { margin-block: 0; border-radius: 0; }
.tlc-cal :is(h1, h2, h3, h4, h5, h6, p) { margin: 0; }
.tlc-cal :is(h1, h2, h3, h4, h5, h6) { font-size: inherit; }
