/* ==========================================================================
   wikki.org: "The Wiki of Wikis" Master Design System & Stylesheet
   Protocol: Athena-Web v3.0 
   ========================================================================== */

:root {
  /* Color Tokens: Academic Parchment & Deep Ink */
  --background: #F8F8F6;
  --foreground: #111111;
  --surface: #FCFCFA;
  --surface-elevated: #1E2221;
  --border: #D8D8D3;
  --border-subtle: #E8E8E3;
  --muted: #E6E6E3;
  --muted-foreground: #60605B;
  --accent: #0070ba;
  --accent-hover: #005a96;
  --accent-foreground: #FFFFFF;
  
  /* Typography */
  --font-display: "Editorial Georgia", Georgia, Cambria, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Spacing Scale (4-Point Foundation) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */

  /* Radii */
  --radius-sm: 0.125rem; /* 2px */
  --radius-md: 0.25rem;  /* 4px */
  --radius-lg: 0.375rem; /* 6px */
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dot-Grid Background Canvas Module */
.bg-dot-grid {
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--foreground);
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); margin-bottom: var(--space-4); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: var(--space-4); }
h3 { font-size: 1.35rem; margin-bottom: var(--space-2); }
p { margin-bottom: var(--space-4); }
a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Structural Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

/* Navigation Header */
.site-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  text-decoration: none !important;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* Touch-target law */
}

.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Touch-Target & CLS Armor */
.touch-target-safe {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ad-leaderboard-shield {
  min-height: 90px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--surface);
  border: 1px solid var(--border);
  margin: var(--space-8) 0;
  overflow: hidden;
}

/* Buttons & Triggers */
.btn-primary {
  background-color: var(--accent);
  color: var(--accent-foreground) !important;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(0,112,186,0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--foreground) !important;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background-color: var(--muted);
  border-color: var(--foreground);
}

/* Hero Section */
.hero-section {
  padding: var(--space-16) 0 var(--space-12) 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
  display: block;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--muted-foreground);
  max-width: 780px;
  margin: 0 auto var(--space-8) auto;
}

/* Search Bar Module */
.search-container {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  padding: var(--space-2);
  gap: var(--space-2);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: var(--space-2) var(--space-4);
  outline: none;
  color: var(--foreground);
}

.search-filter-select {
  border: 1px solid var(--border);
  background: var(--background);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--foreground);
  outline: none;
  cursor: pointer;
}

/* Category Grid */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-6);
}

.cat-chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.cat-chip.active, .cat-chip:hover {
  background: var(--surface-elevated);
  color: #FFF;
  border-color: var(--surface-elevated);
}

/* Wiki Cards Grid */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-6);
  margin: var(--space-12) 0;
}

.wiki-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.wiki-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border-color: var(--muted-foreground);
}

.wiki-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.wiki-engine-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--muted);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
}

.wiki-card-title {
  font-size: 1.3rem;
  margin-bottom: var(--space-2);
}

.wiki-card-desc {
  font-size: 0.95rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wiki-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

/* Edge-Swap Unblur Gate Animations */
@keyframes fadeInUnblur {
  0% { filter: blur(16px); opacity: 0.3; }
  100% { filter: blur(0px); opacity: 1; }
}

@keyframes modalSlide {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.blur-shield-active {
  filter: blur(12px);
  user-select: none;
  pointer-events: none;
  opacity: 0.4;
  transition: all 0.5s ease-out;
}

.unblurred-active {
  animation: fadeInUnblur 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin: var(--space-12) 0;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(0,112,186,0.12);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  right: var(--space-6);
  background: var(--accent);
  color: #FFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  margin: var(--space-4) 0;
  color: var(--foreground);
}

.pricing-features {
  list-style: none;
  margin: var(--space-6) 0;
}

.pricing-features li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Sovereign Footer */
.sovereign-footer {
  background-color: var(--surface-elevated);
  color: #CBD5E1;
  padding: var(--space-16) 0 var(--space-8) 0;
  margin-top: var(--space-16);
  border-top: 1px solid #334155;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.footer-brand h3 {
  color: #FFFFFF;
  font-size: 1.4rem;
  margin-bottom: var(--space-2);
}

.footer-brand p {
  color: #94A3B8;
  font-size: 0.9rem;
  max-width: 360px;
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: 1rem;
  margin-bottom: var(--space-4);
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-col a {
  color: #94A3B8;
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: #FFFFFF;
}

.footer-monetization-bar {
  border-top: 1px solid #334155;
  padding-top: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  align-items: center;
}

.footer-legal-text {
  font-size: 0.8rem;
  color: #64748B;
  max-width: 900px;
  line-height: 1.5;
}

/* Responsive Overrides */
@media (max-width: 992px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .nav-bar {
    flex-direction: column;
    height: auto;
    padding: var(--space-4) 0;
    gap: var(--space-3);
  }
  .nav-links {
    gap: var(--space-3);
    flex-wrap: wrap;
    justify-content: center;
  }
  .directory-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
