/* ================================================================
   rhenos.nl — style.css

   Single-file stylesheet, well-organized by section.
   Inter (sans) for headings, navigation, UI.
   Source Serif 4 (serif) for body text, italics, document content.
   Self-hosted fonts, no external dependencies.

   Sections:
     1. Font faces (self-hosted)
     2. Variables (colors, typography, spacing)
     3. Reset (minimal, opinionated)
     4. Base typography
     5. Layout
     6. Site header & navigation
     7. Site footer
     8. Article styles (locked documents rendered as pages)
     9. Reusable typographic classes (minimal, quiet)
     10. Responsive
     11. Entrance animations (opt-in, per-element configurable)
   ================================================================ */


/* ================================================================
   1. FONT FACES — self-hosted
   ================================================================ */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}


/* ================================================================
   2. VARIABLES — colors, typography, spacing
   ================================================================ */

:root {
  /* Colors — warm, restrained, Option A */
  --color-bg:           #fdfcf9;   /* warm off-white background */
  --color-bg-white:     #ffffff;   /* white background */
  --color-bg-subtle:    #f5f3ee;   /* hover states, subtle blocks */
  --color-text:         #1a1a1a;   /* near-black body text */
  --color-text-soft:    #555555;   /* meta info, soft text */
  --color-border:       #e5e1d8;   /* hairlines, dividers */
  --color-accent:       #7a3a2c;   /* deep terra-cotta — link hover */
  --color-accent-soft:  #a86650;   /* lighter terra-cotta */

  /* Typography */
  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --font-size-base:    1.125rem;   /* 18px — comfortable reading */
  --line-height-base:  1.7;        /* generous for body text */
  --line-height-tight: 1.3;        /* for headings */

  /* Spacing — 1.5rem rhythm */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.75rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;

  /* Layout widths */
  --content-width:      690px;     /* ~608px — optimal reading line length */
  --content-width-wide: 52rem;     /* for header & footer */
}


/* ================================================================
   3. RESET — minimal, opinionated
   ================================================================ */

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

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

body { margin: 0; }

img, picture, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}


/* ================================================================
   4. BASE TYPOGRAPHY
   ================================================================ */

body {
  font-family: var(--font-serif);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-bg);
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings use sans-serif — Inter */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin: 0 0 var(--space-md);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.375rem;
  margin-top: var(--space-xl);
}

h3 {
  font-size: 1.225rem;
  margin-top: var(--space-lg);
}

h4 {
  font-size: 1.125rem;
  margin: 0 1 var(--space-lg) 0;
}

/* Paragraph */
p { 
  margin: 0 0 var(--space-md); 
}

/* Links */
a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}

a:hover {
  color: var(--color-accent);
  text-decoration-thickness: 2px;
}

/* Styles */
strong, b { 
  font-weight: 600; 
}

em, i { 
  font-style: italic; 
}

blockquote {
  margin: var(--space-md) 0;
  padding: 0 0 0 var(--space-md);
  border-left: 2px solid var(--color-border);
  color: var(--color-text-soft);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-bg-subtle);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.ul ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.li {
  margin: 0 0 var(--space-xs);
  line-height: 1.6;
}

.ul li {
  list-style-type: disc;
}

.ol li {
  list-style-type: decimal;
}


/* ================================================================
   5. LAYOUT
   ================================================================ */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  flex: 1;
  padding: var(--space-xl) var(--space-md);
}


/* ================================================================
   6. SITE HEADER & NAVIGATION
   ================================================================ */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md);
  background: var(--color-bg-white);
}

.site-header-inner {
  max-width: var(--content-width-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-logo {
  display: block;
  text-decoration: none;
  border: none;
  flex-shrink: 0;
}

.site-logo img {
  height: 3.25rem;
  width: auto;
  display: block;
}

.site-logo:hover {
  opacity: 0.75;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

.site-nav a.current {
  border-bottom-color: var(--color-text);
}


/* ================================================================
   7. SITE FOOTER
   ================================================================ */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg) var(--space-md);
  background: var(--color-bg-white);
}

.site-footer-inner {
  max-width: var(--content-width-wide);
  margin: 0 auto;
  text-align: center;
}

.footer-tagline {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-style: italic;
  color: var(--color-text);
  margin: 0 0 var(--space-sm);
}

.footer-meta {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text-soft);
  margin: 0;
}

.footer-meta a {
  color: var(--color-text-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

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

.footer-meta .sep {
  margin: 0 0.5em;
  color: var(--color-border);
}


/* ================================================================
   8. ARTICLE STYLES — locked documents rendered as pages
   ================================================================ */

.article {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* Footer note: trailing italic line (e.g., reference to /aanpak) */
.article .footer-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--color-text-soft);
  margin: var(--space-lg) 0 0;
  padding: var(--space-md) 0 0;
  border-top: 1px solid var(--color-border);
}


/* ================================================================
   9. REUSABLE TYPOGRAPHICS CLASSES — minimal, quiet
   ================================================================ */

.section-opener {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--color-text);
  margin: 60px 0 var(--space-xl);
}

.section-italic {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-soft);
  margin: var(--space-md) 0 var(--space-md);
  padding-left: var(--space-md);
  border-left: 2px solid var(--color-accent-soft);
}

.section-spine {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--color-text);
  margin: 0 0 var(--space-xl);
  letter-spacing: -0.005em;
}

.section-paragraph {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0 0 var(--space-md);
}

.section-invitation {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--color-text-soft);
  margin: 0 0 var(--space-sm);
}

/* Only the first invitation paragraph gets the visual separator above.
   The second sits tightly below it as part of the same visual block. */
.section-invitation:first-of-type {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
}

.section-invitation a {
  color: var(--color-text);
  font-weight: 500;
}


/* ================================================================
   10. RESPONSIVE
   ================================================================ */

@media (max-width: 640px) {
  :root {
    --font-size-base: 1.0625rem;
  }

  .site-main {
    padding: var(--space-lg) var(--space-md);
  }

  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .site-nav ul {
    gap: var(--space-sm) var(--space-md);
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }

  .home {
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .section-opener { font-size: 1.25rem; }
  .section-spine { font-size: 1.125rem; }

  .article .document-opener { font-size: 1.1875rem; }
}


/* ================================================================
   10a. SITE NAV — SUBMENU + CHEVRON + ANIMATION (desktop)
   The Gedachtegoed parent has a chevron indicator. The submenu
   fades in/slides down on hover or focus-within. A small invisible
   bridge above the submenu prevents hover-loss while moving the
   mouse from parent to child.
   ================================================================ */

/* The parent <li> establishes the positioning context for the submenu.
   Position relative so the submenu can be absolutely positioned within. */
.site-nav .has-submenu {
  position: relative;
}

/* The parent link gets some right-padding to leave room for the chevron. */
.site-nav .has-submenu > a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Chevron — drawn as a CSS-only down-arrow using border tricks.
   No SVG, no font icons. Rotates when submenu is open. */
.site-nav .chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  margin-top: 2px;
  transition: transform 0.2s ease;
}

/* Rotate chevron when parent is hovered/focused (submenu opening). */
.site-nav .has-submenu:hover .chevron,
.site-nav .has-submenu:focus-within .chevron {
  transform: rotate(180deg);
}

/* The submenu itself.
   - Absolutely positioned beneath the parent (lifted out of flex flow,
     which is critical: the parent .site-nav ul has flex-wrap: wrap, and
     without absolute positioning the submenu items would wrap to a new
     line under the main nav).
   - Hidden with opacity + visibility (not display: none) so the fade
     animation can run.
   - pointer-events: none when hidden, so it can't be accidentally clicked.
*/
.site-nav .submenu {
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  list-style: none;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  min-width: 11rem;
  z-index: 100;

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0s linear 0.18s;
}

/* Hover bridge — an invisible padding-top on the submenu so the mouse
   can travel from parent to submenu without crossing a gap.
   We do this with a ::before pseudo-element. */
.site-nav .submenu::before {
  content: "";
  position: absolute;
  top: -10px;          /* covers the gap above the submenu */
  left: 0;
  right: 0;
  height: 10px;
}

/* Visible state — submenu opens on hover and on keyboard focus. */
.site-nav .has-submenu:hover .submenu,
.site-nav .has-submenu:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0s linear 0s;
}

/* Submenu items — block-level, slightly smaller than main nav */
.site-nav .submenu li {
  margin: 0;
}

.site-nav .submenu a {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-soft);
  padding: 0.35rem 0;
  border-bottom: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.site-nav .submenu a:hover,
.site-nav .submenu a:focus {
  color: var(--color-accent);
}

/* Current-page highlight on submenu items */
.site-nav .submenu a.current {
  color: var(--color-text);
  font-weight: 500;
}


/* ================================================================
   10b. SITE NAV — HAMBURGER BUTTON (hidden on desktop)
   The button is hidden by default (desktop) and revealed by the
   mobile media query below.
   ================================================================ */

.nav-toggle {
  display: none;          /* desktop: hidden */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin: 0;
  width: 2.5rem;
  height: 2.5rem;
  position: relative;
  z-index: 110;
}

.nav-toggle-bar {
  display: block;
  width: 1.5rem;
  height: 2px;
  background: var(--color-text);
  margin: 4px auto;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Animated hamburger → X transformation when open */
.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}


/* ================================================================
   10c. SITE NAV — MOBILE (≤ 760px)
   Below this breakpoint:
   - The hamburger button is shown
   - The main nav becomes a slide-down panel, hidden until toggled
   - The submenu becomes always-visible indented children (no hover)
   - Body scroll locks when nav is open
   ================================================================ */

@media (max-width: 760px) {
  /* Show the hamburger */
  .nav-toggle {
    display: block;
    margin-left: auto;       /* push to right side */
  }

  /* Header lays the logo on the left, hamburger on the right.
     We override the desktop column-flex from the existing 640px rule. */
  .site-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
  }

  /* The nav becomes a panel that slides in from the top.
     Hidden by default; shown when body has .nav-open class. */
  .site-nav {
    position: absolute;
    top: 100%;               /* directly below the header */
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
    padding: var(--space-md);

    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition:
      max-height 0.25s ease,
      visibility 0s linear 0.25s;
    z-index: 105;
  }

  body.nav-open .site-nav {
    max-height: 80vh;
    overflow-y: auto;
    visibility: visible;
    transition:
      max-height 0.25s ease,
      visibility 0s linear 0s;
  }

  /* Stack nav items vertically inside the panel */
  .site-nav ul {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  .site-nav a {
    font-size: 1.0625rem;     /* slightly larger touch targets */
    padding: 0.5rem 0;
  }

  /* Hide the chevron on mobile — the submenu is always expanded */
  .site-nav .chevron {
    display: none;
  }

  /* Submenu on mobile: always visible, indented under parent */
  .site-nav .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    margin: var(--space-xs) 0 0 var(--space-md);
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 0;
  }

  .site-nav .submenu::before {
    display: none;            /* no hover bridge needed */
  }

  .site-nav .submenu a {
    font-size: 0.9375rem;
    padding: 0.35rem 0;
  }

  /* Lock body scroll when the nav is open, so the page behind doesn't
     scroll while the panel is showing. */
  body.nav-open {
    overflow: hidden;
  }
}

/* ================================================================
   10d. MOBILE NAV — positioning fix for iOS
   The absolutely-positioned .site-nav needs an explicitly-positioned
   ancestor to anchor against. On iOS Safari/WebKit, default static
   positioning of the header can cause the nav panel to position
   against the wrong reference, placing it off-screen.
   ================================================================ */

@media (max-width: 760px) {
  .site-header {
    position: relative;
  }
  .site-header-inner {
    position: relative;
  }
}

/* ================================================================
   11. ENTRANCE ANIMATIONS - opt-in, per-element configurable

   How it works:
   - Elements opt in by getting a data-reveal attribute in the HTML
   - The attribute value names the direction: up / down / left / right / fade
   - Per-element settings are passed as inline CSS custom properties:
       --rev-duration, --rev-delay, --rev-distance
   - JS adds .is-visible when the element enters the viewport
   - Way 1: above-the-fold elements also animate on initial page load
     (the JS waits 50ms before starting the observer, so initial-paint
     elements catch the transition)

   AUTHORING — in .md files, after a block, add an attribute list:
       This paragraph fades in from below.
       {: reveal=up duration=800ms delay=200ms distance=16px }

   AUTHORING — for the homepage (hard-coded in build.py):
       Edit render_homepage() to set data-reveal and inline styles
       on the four .home-* elements directly.

   TUNING — default values live in the :root block below.
   ================================================================ */

:root {
  /* Defaults — used when an element doesn't specify its own value */
  --rev-duration: 700ms;          /* fade-in length */
  --rev-delay:    0ms;            /* wait before starting */
  --rev-distance: 12px;           /* travel distance for directional reveals */
  --rev-easing:   ease-out;       /* easing curve */
}

/* Base hidden state — applied to ANY element with data-reveal,
   regardless of direction. Uses the element's own --rev-* variables
   if set, falls back to :root defaults otherwise. */
[data-reveal] {
  opacity: 0;
  transition:
    opacity   var(--rev-duration) var(--rev-easing) var(--rev-delay),
    transform var(--rev-duration) var(--rev-easing) var(--rev-delay);
  will-change: opacity, transform;
}

/* Direction-specific starting transforms */
[data-reveal="up"]    { transform: translateY(var(--rev-distance)); }
[data-reveal="down"]  { transform: translateY(calc(var(--rev-distance) * -1)); }
[data-reveal="left"]  { transform: translateX(calc(var(--rev-distance) * -1)); }
[data-reveal="right"] { transform: translateX(var(--rev-distance)); }
[data-reveal="fade"]  { transform: none; }   /* pure opacity, no motion */

/* Visible state — added by JavaScript when element scrolls into view
   (or, for above-the-fold elements, ~50ms after page load). */
[data-reveal].is-visible {
  opacity: 1;
  transform: translate(0, 0);
}

/* Accessibility — users who've asked their OS for reduced motion
   get no animation at all. Elements appear instantly in final state. */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* JavaScript-fallback — if JS doesn't run, the .no-js class on <html>
   stays in place, and we force all reveal elements to be visible
   so the page is fully readable without animations. */
.no-js [data-reveal] {
  opacity: 1;
  transform: none;
  transition: none;
}