/* =============================================================================
   GAKHUR Philosophy Platform — Global Stylesheet
   assets/css/main.css
   =============================================================================
   Contents:
     1.  CSS Custom Properties (Design Tokens)
     2.  Theme Variants (Sepia, Dark)
     3.  Base Reset & Box Model
     4.  Typography Scale
     5.  Body & Page Layout
     6.  Site Header & Navigation
     7.  Signup Banner
     8.  Buttons
     9.  Site Footer
     10. Home Page
     11. Volume Index Page
     12. Utility Classes
     13. Focus & Accessibility
     14. Responsive — Mobile First
   ============================================================================= */

/* =============================================================================
   1. CSS Custom Properties — Light Theme (default)
   ============================================================================= */
:root {
  /* Background layers */
  --bg:          #FAFAF7;
  --bg-alt:      #F0EDE8;
  --bg-raised:   #FFFFFF;
  --bg-sunken:   #EEEAE4;

  /* Text */
  --text:        #1A1A2E;
  --text-muted:  #6B6B7E;
  --text-faint:  #9898A8;

  /* Brand */
  --accent:      #C84B31;
  --accent-dark: #A03A23;
  --link:        #2D3561;
  --link-hover:  #1A1F3E;

  /* Borders */
  --border:      #D8D4CE;
  --border-faint:#E8E4DE;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(26,26,46,0.06);
  --shadow-md:   0 4px 16px rgba(26,26,46,0.08);

  /* Typography */
  --font-serif:  'Lora', Georgia, 'Times New Roman', serif;
  --font-display:'Playfair Display', Georgia, serif;
  --font-ui:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'Courier New', Courier, monospace;

  /* Type scale (fluid) */
  --text-xs:    0.75rem;    /*  12px */
  --text-sm:    0.875rem;   /*  14px */
  --text-base:  1rem;       /*  16px */
  --text-md:    1.125rem;   /*  18px */
  --text-lg:    1.25rem;    /*  20px */
  --text-xl:    1.5rem;     /*  24px */
  --text-2xl:   1.875rem;   /*  30px */
  --text-3xl:   2.25rem;    /*  36px */
  --text-4xl:   3rem;       /*  48px */

  /* Layout */
  --content-width:  700px;
  --wide-width:     1000px;
  --sidebar-width:  260px;
  --gutter:         1.5rem;

  /* Reading */
  --reader-line-height: 1.85;
  --reader-font-size:   1.125rem;   /* 18px */

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.25s ease;
  --transition-slow:   0.4s ease;

  /* Progress bar */
  --progress-color: var(--accent);
  --progress-height: 3px;

  /* Z-index layers */
  --z-progress:    100;
  --z-header:      200;
  --z-banner:      300;
  --z-overlay:     400;
  --z-watermark:   9000;
  --z-modal:       10000;
}

/* =============================================================================
   2. Theme Variants
   ============================================================================= */

/* ── Sepia ── */
body.sepia {
  --bg:         #F4ECD8;
  --bg-alt:     #EDE2C8;
  --bg-raised:  #FAF5E9;
  --bg-sunken:  #E8DEC8;
  --text:       #3B2F2F;
  --text-muted: #7A6155;
  --text-faint: #A89080;
  --accent:     #8B4513;
  --accent-dark:#6B3210;
  --link:       #5C3D2E;
  --link-hover: #3B2318;
  --border:     #D4C4A8;
  --border-faint:#E0D4BC;
}

/* ── Dark ── */
body.dark {
  --bg:          #1A1A2E;
  --bg-alt:      #12121F;
  --bg-raised:   #252540;
  --bg-sunken:   #0E0E1C;
  --text:        #E8E0D0;
  --text-muted:  #9898A8;
  --text-faint:  #6B6B7E;
  --accent:      #E07B54;
  --accent-dark: #C85E38;
  --link:        #9BAFD4;
  --link-hover:  #BDD0EE;
  --border:      #2E2E50;
  --border-faint:#232340;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
}

/* =============================================================================
   3. Base Reset & Box Model
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

ul, ol {
  list-style: none;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* =============================================================================
   4. Typography Scale
   ============================================================================= */
body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  transition:
    background-color var(--transition-slow),
    color var(--transition-slow);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }

p {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
}

strong, b { font-weight: 600; }
em, i     { font-style: italic; }

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--accent);
}

/* =============================================================================
   5. Body & Page Layout
   ============================================================================= */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  width: 100%;
}

.container {
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* =============================================================================
   6. Site Header & Navigation
   ============================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: var(--bg);
  border-bottom: 1px solid var(--border-faint);
  transition: background-color var(--transition-slow);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 56px;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-word {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  transition: color var(--transition-fast);
}

.site-logo:hover .logo-word {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background-color: var(--bg-alt);
  text-decoration: none;
}

.nav-link--active {
  color: var(--text);
  background-color: var(--bg-alt);
}

.nav-identity {
  margin-left: auto;
  flex-shrink: 0;
}

.nav-reader-name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* =============================================================================
   7. Signup Banner
   ============================================================================= */
.signup-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-banner);
  background-color: var(--bg-raised);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(26,26,46,0.08);
  padding: 1.25rem var(--gutter);
  transition:
    transform var(--transition-base),
    opacity var(--transition-base);
}

.signup-banner--hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.signup-banner__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.signup-banner__prompt {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--text);
  margin: 0;
  flex-shrink: 0;
}

.signup-banner__form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.signup-input {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.875rem;
  min-width: 220px;
  max-width: 320px;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.signup-input:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(45,53,97,0.12);
}

.signup-recovery {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--bg-alt);
  border-radius: 4px;
  width: 100%;
  margin-top: 0.5rem;
}

/* =============================================================================
   8. Buttons
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.55rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Primary */
.btn--primary {
  background-color: var(--link);
  color: #FFFFFF;
  border-color: var(--link);
}

.btn--primary:hover {
  background-color: var(--link-hover);
  border-color: var(--link-hover);
  color: #FFFFFF;
}

/* Secondary / outline */
.btn--secondary {
  background-color: transparent;
  color: var(--link);
  border-color: var(--border);
}

.btn--secondary:hover {
  background-color: var(--bg-alt);
  border-color: var(--link);
}

/* Ghost (text-only) */
.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--text);
  background-color: var(--bg-alt);
}

/* Danger */
.btn--danger {
  background-color: transparent;
  color: #C84B31;
  border-color: #C84B31;
}

.btn--danger:hover {
  background-color: #C84B31;
  color: #FFFFFF;
}

/* Enter the Work — home page CTA */
.btn--enter {
  font-size: var(--text-base);
  padding: 0.85rem 2.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* =============================================================================
   9. Site Footer
   ============================================================================= */
.site-footer {
  border-top: 1px solid var(--border-faint);
  padding: 2.5rem var(--gutter);
  margin-top: 4rem;
  background-color: var(--bg);
}

.site-footer__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.footer-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.footer-tagline {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.footer-copy {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* =============================================================================
   10. Home Page
   ============================================================================= */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5rem var(--gutter) 4rem;
  max-width: var(--content-width);
  margin: 0 auto;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 1rem;
}

.home-tagline {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.home-intro {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 2.5rem;
  text-align: left;
}

.home-intro p + p {
  margin-top: 1.25rem;
}

.home-map-section {
  width: 100%;
  padding: 2rem 0 4rem;
  background: var(--bg-alt);
}

.map-placeholder {
  text-align: center;
  padding: 4rem 2rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-faint);
  font-style: italic;
}

/* =============================================================================
   11. Volume Index Page (read/index.php)
   ============================================================================= */
.volume-index {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 3rem var(--gutter);
}

.volume-index__header {
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border-faint);
  padding-bottom: 1.5rem;
}

.volume-index__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.volume-index__subtitle {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--text-muted);
}

.volume-list {
  display: grid;
  gap: 2rem;
}

.volume-card {
  display: flex;
  gap: 1.5rem;
  padding: 1.75rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-faint);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    transform var(--transition-base);
}

.volume-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.volume-card__accent {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  background-color: var(--card-color, var(--link));
}

.volume-card__body {
  flex: 1;
}

.volume-card__number {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.volume-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.volume-card__summary {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.volume-card__meta {
  display: flex;
  gap: 1.25rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.volume-card__meta span::before {
  content: '·';
  margin-right: 0.4rem;
}

.volume-card__meta span:first-child::before {
  content: none;
}

/* Smoke test block (Phase 1) */
.smoke-test {
  font-family: var(--font-mono);
}

/* =============================================================================
   12. Utility Classes
   ============================================================================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-faint   { color: var(--text-faint); }
.text-accent  { color: var(--accent); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.hidden { display: none !important; }

/* =============================================================================
   13. Focus & Accessibility
   ============================================================================= */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: calc(var(--z-modal) + 10);
  background: var(--link);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 4px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* =============================================================================
   14. Responsive — Mobile First
   ============================================================================= */

/* ── Base (mobile, < 640px) ─────────────────────────────────────────────── */
.site-nav {
  height: 52px;
  gap: 0.75rem;
}

.nav-links {
  gap: 0;
}

.nav-link {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
}

.home-hero {
  padding: 3rem var(--gutter) 2.5rem;
}

.volume-card {
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
}

.volume-card__accent {
  width: 100%;
  height: 3px;
}

.signup-banner__inner {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.signup-banner__form {
  width: 100%;
}

.signup-input {
  min-width: unset;
  max-width: 100%;
}

/* ── Small tablets (≥ 480px) ─────────────────────────────────────────────── */
@media (min-width: 480px) {
  .volume-card {
    flex-direction: row;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .volume-card__accent {
    width: 4px;
    height: auto;
  }

  .signup-banner__inner {
    flex-direction: row;
    align-items: center;
  }
}

/* ── Tablets (≥ 768px) ────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .site-nav {
    height: 56px;
    gap: 2rem;
  }

  .nav-link {
    font-size: var(--text-sm);
    padding: 0.4rem 0.75rem;
  }

  .home-hero {
    padding: 5rem var(--gutter) 4rem;
  }

  .volume-index {
    padding: 3rem var(--gutter);
  }
}

/* ── Desktop (≥ 1024px) ───────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .volume-list {
    gap: 2rem;
  }
}
