/* ==========================================================================
   L0CI Website - Lotus Oak Design System
   VERSION: 2.0.1 (Issue #690)
   UPDATED: 2026-01-20
   CACHE-KEY: 690-v2

   SOURCE OF TRUTH for the L0CI website design tokens.
   Reference doc for other projects: l0ci/docs/branding/design-tokens.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Colors - Lotus Oak Unified Palette (Issue #690) */
  --color-bg: #FAF9F6;
  --color-text: #2D3436;
  --color-text-muted: #5D6D7E;
  --color-accent: #74A892;
  --color-border: #E5E3DE;
  --color-gold: #B8860B;

  /* Typography - Aligned with The Way of Code aesthetic (Issue #697)
     Note: font-display:swap is set via Google Fonts URL parameter in base.njk
     Fallback fonts (Georgia, system-ui) ensure text remains visible during load */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Type Scale (1.25 ratio) - Reduced base for elegance */
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;        /* Was 1.125rem - matches Way of Code 16px */
  --font-size-lg: 1.25rem;       /* Was 1.406rem - proportionally reduced */
  --font-size-xl: 1.563rem;      /* Was 1.758rem */
  --font-size-2xl: 1.953rem;     /* Was 2.197rem */
  --font-size-3xl: 2.441rem;     /* Was 2.746rem */

  /* Line Heights - Tighter for elegance */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;     /* Was 1.6 - more compact like Way of Code */
  --line-height-relaxed: 1.6;    /* Was 1.8 - still readable */

  /* Letter Spacing - Breathing room at smaller font size */
  --letter-spacing-body: 0.03em;

  /* Spacing Scale (8px base) */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-12: 6rem;
  --space-16: 8rem;

  /* Viewport-Aware Spacing - Anti-fragile (adapts to screen size) */
  --space-section-pad: clamp(2rem, 8vh, 5rem);
  --space-heading-gap: clamp(1rem, 3vh, 2rem);

  /* Layout - Matches Way of Code nav width */
  --nav-width: 2.5rem;           /* Was 4rem - matches Way of Code 40px */
  --content-max-width: 38rem;    /* Was 42rem - tighter for elegance */
  --content-padding: var(--space-6);

  /* Animation */
  --transition-base: 300ms ease;
  --transition-slow: 600ms ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-body);  /* Breathing room at smaller size */
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Skip Link (Accessibility)
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--font-size-sm);
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;                 /* Reduced to fit narrower nav */
  height: 2rem;
  font-family: var(--font-serif);
  font-size: var(--font-size-sm);  /* Smaller for elegance */
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 50%;
  transition: all var(--transition-base);
}

nav a:hover,
nav a:focus {
  color: var(--color-text);
  background-color: var(--color-border);
  outline: none;
}

nav a.active {
  color: var(--color-text);
  font-weight: 600;
}

/* Home link (circle symbol) */
.nav-home a {
  font-size: var(--font-size-lg);
  font-family: var(--font-sans);
  font-weight: 300;
}

/* References link (PS) */
.nav-references a {
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */

main {
  margin-left: var(--nav-width);
  padding: 0 var(--content-padding);
  padding-bottom: var(--space-8); /* Space for footer */
  max-width: var(--content-max-width);
}

/* Site Header */
.site-header {
  height: 100vh;               /* Fixed height for snap alignment */
  overflow-y: auto;            /* Safety net - should rarely trigger */
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
  padding: var(--space-section-pad) 0;  /* Viewport-aware padding */
  border-bottom: 1px solid var(--color-border);
}

.site-header h1 {
  font-family: var(--font-serif);
  font-size: var(--font-size-3xl);
  font-weight: 400;
  margin: 0 0 var(--space-2);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.site-tagline {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Chapters
   -------------------------------------------------------------------------- */

.chapters {
  display: flex;
  flex-direction: column;
}

.chapter {
  position: relative;
  height: 100vh;               /* Fixed height for snap alignment */
  overflow-y: auto;            /* Safety net - should rarely trigger */
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
  padding: var(--space-section-pad) 0;  /* Viewport-aware padding */
}

/* Progressive enhancement: Only animate when JS is available
   Without JS, chapters are visible by default */
.js .chapter {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.js .chapter.visible {
  opacity: 1;
  transform: translateY(0);
}

.chapter-number {
  font-family: var(--font-serif);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  letter-spacing: 0.1em;
}

.chapter h2 {
  font-family: var(--font-serif);
  font-size: var(--font-size-2xl);
  font-weight: 400;
  margin: 0 0 var(--space-heading-gap);  /* Viewport-aware gap */
  line-height: var(--line-height-tight);
}

.chapter-content {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.chapter-content p {
  margin: 0 0 var(--space-3);
}

.chapter-content p:last-child {
  margin-bottom: 0;
}

/* Blockquotes for meditative passages */
.chapter-content blockquote {
  margin: var(--space-6) 0;
  padding: 0;
  border: none;
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--color-text);
  line-height: var(--line-height-relaxed);
}

.chapter-content blockquote p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --nav-width: 3rem;
    --content-padding: var(--space-3);
  }

  nav a {
    width: 2rem;
    height: 2rem;
    font-size: var(--font-size-sm);
  }

  .site-header h1 {
    font-size: var(--font-size-2xl);
  }

  .chapter h2 {
    font-size: var(--font-size-xl);
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background-color: var(--color-bg);
  letter-spacing: 0.05em;
  z-index: 50;
}

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

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

/* References Section */
.references {
  height: 100vh;               /* Fixed height for snap alignment */
  overflow-y: auto;            /* Safety net - should rarely trigger */
  display: flex;
  flex-direction: column;
  justify-content: center;
  scroll-snap-align: start;
  padding: var(--space-section-pad) 0;  /* Viewport-aware padding */
  border-top: 1px solid var(--color-border);
}

.references h2 {
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  font-weight: 400;
  margin: 0 0 var(--space-6);
  letter-spacing: 0.1em;
}

.references-content {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-muted);
}

.references-content p {
  margin: 0 0 var(--space-3);
}

.references-content ul {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0;
}

.references-content li {
  margin-bottom: var(--space-2);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  nav,
  .skip-link,
  .site-footer {
    display: none;
  }

  main {
    margin-left: 0;
    max-width: 100%;
  }

  .chapter {
    page-break-inside: avoid;
  }

  /* Override JS animations for print */
  .js .chapter {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion Accessibility
   -------------------------------------------------------------------------- */

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