@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/**
 * GROUNDFRAME - Global Styles & Theme System
 * 
 * This file defines:
 * 1. CSS Variables (custom properties) for theming
 * 2. Base reset and typography
 * 3. Utility classes
 * 4. Component styles
 */

/* ============================================================
   CSS VARIABLES - These can be overridden per-page for theming
   ============================================================ */
:root {
  /* Default theme (light editorial) */
  --color-primary: #151515;
  --color-primary-hover: #2a2a2a;
  --color-background: #f8f5f1;
  --color-surface: #ffffff;
  --color-surface-elevated: #f1eeea;
  --color-text: #111111;
  --color-text-secondary: #5f5b53;
  --color-accent: #d16a3a;
  --color-error: #b42318;
  --color-warning: #b26a00;
  
  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border radius */
  --radius-sm: 0.35rem;
  --radius-md: 0.6rem;
  --radius-lg: 0.85rem;
  --radius-xl: 1.2rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.08);
  --shadow-md: 0 12px 24px rgba(17, 17, 17, 0.08);
  --shadow-lg: 0 24px 48px rgba(17, 17, 17, 0.1);
  --shadow-glow: 0 0 0 rgba(0, 0, 0, 0);
  
  /* Typography */
  --font-sans: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.75rem;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ============================================================
   RESET & BASE STYLES
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--color-primary-hover);
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

p {
  margin-bottom: var(--space-md);
}

.text-secondary {
  color: var(--color-text-secondary);
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--space-md);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-surface);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.7rem 1.4rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid rgba(18, 18, 18, 0.15);
}

.btn-secondary:hover {
  background: rgba(18, 18, 18, 0.04);
  border-color: rgba(18, 18, 18, 0.3);
}

.btn-accent {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.btn-accent:hover {
  transform: translateY(-1px);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: var(--font-size-xs);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(18, 18, 18, 0.08);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(18, 18, 18, 0.18);
  box-shadow: 0 14px 26px rgba(17, 17, 17, 0.12);
}

.card-header {
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-xs);
}

.card-description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
}

.form-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid rgba(18, 18, 18, 0.12);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.08);
}

.form-input::placeholder {
  color: var(--color-text-secondary);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-error {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-sm {
  max-width: 640px;
}

.container-md {
  max-width: 768px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SPACING UTILITIES
   ============================================================ */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.py-2xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
.py-3xl { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); }

/* ============================================================
   TEXT UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.badge-primary {
  background: rgba(18, 18, 18, 0.08);
  color: var(--color-text);
}

.badge-accent {
  background: rgba(200, 107, 66, 0.18);
  color: var(--color-accent);
}

.badge-warning {
  background: rgba(178, 106, 0, 0.18);
  color: var(--color-warning);
}

/* ============================================================
   GLASSMORPHISM EFFECTS
   ============================================================ */
.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.animate-slide-up {
  animation: slideUp var(--transition-slow) ease-out;
}

/* ============================================================
   PAGE-SPECIFIC: HERO SECTION
   ============================================================ */
.hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  padding: calc(var(--space-3xl) * 1.1) var(--space-lg);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.04), transparent 40%);
}

.hero-compact {
  min-height: auto;
  padding: var(--space-2xl) var(--space-lg);
}

.hero-compact-grid {
  min-height: auto;
  padding: var(--space-2xl) var(--space-lg);
}

/* ============================================================
   SITE NAV + SECTIONS
   ============================================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 245, 241, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--color-text);
  color: var(--color-background);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.section {
  padding: var(--space-3xl) 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-2xl);
  align-items: center;
}

.hero-single {
  max-width: 100%;
  width: 100%;
}

.hero-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  border: 1px solid rgba(18, 18, 18, 0.08);
  box-shadow: var(--shadow-md);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(18, 18, 18, 0.08);
}

.stat-number {
  font-size: var(--font-size-3xl);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feature-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid rgba(18, 18, 18, 0.08);
}

.feature-row:last-child {
  border-bottom: none;
}

@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .feature-row {
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.hero-title {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  max-width: 560px;
  margin-bottom: var(--space-xl);
}

/* ============================================================
   PAGE-SPECIFIC: TIER CARDS
   ============================================================ */
.tier-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  border: 1px solid rgba(18, 18, 18, 0.1);
  text-align: left;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.tier-card:hover {
  transform: translateY(-3px);
  border-color: rgba(18, 18, 18, 0.18);
  box-shadow: 0 16px 30px rgba(17, 17, 17, 0.12);
}

.tier-card.featured {
  border-color: rgba(18, 18, 18, 0.28);
  box-shadow: 0 14px 26px rgba(17, 17, 17, 0.14);
}

.tier-name {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.tier-price {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.tier-price .currency {
  font-size: var(--font-size-xl);
  vertical-align: super;
}

.tier-price .period {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 400;
}

.tier-perks {
  list-style: none;
  margin: var(--space-lg) 0;
  text-align: left;
}

.tier-perks li {
  padding: var(--space-sm) 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-secondary);
}

.tier-perks li::before {
  content: '+';
  color: var(--color-accent);
  font-weight: bold;
}

/* ============================================================
   PAGE-SPECIFIC: POST CARDS
   ============================================================ */
.post-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid rgba(18, 18, 18, 0.1);
  transition: all var(--transition-base);
  display: block;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.post-card:visited {
  color: inherit;
}

.post-card:hover {
  border-color: rgba(18, 18, 18, 0.18);
  box-shadow: 0 14px 26px rgba(17, 17, 17, 0.12);
}

.post-banner {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  background: var(--color-surface-elevated);
}

.post-banner-detail {
  height: 260px;
  margin-bottom: var(--space-lg);
}

.post-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.post-excerpt {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: auto;
}

.post-locked {
  position: relative;
}

.post-locked::after {
  content: 'LOCK';
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: var(--font-size-lg);
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.dashboard-sidebar {
  background: var(--color-surface);
  border-right: 1px solid rgba(18, 18, 18, 0.08);
  padding: var(--space-lg);
}

.dashboard-main {
  padding: var(--space-xl);
  overflow-y: auto;
}

.dashboard-nav {
  list-style: none;
  margin-top: var(--space-xl);
}

.dashboard-nav li {
  margin-bottom: var(--space-xs);
}

.dashboard-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.dashboard-nav a:hover,
.dashboard-nav a.active {
  background: rgba(18, 18, 18, 0.05);
  color: var(--color-text);
}

.dashboard-nav a.active {
  color: var(--color-text);
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  
  .dashboard-sidebar {
    display: none;
  }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.04), transparent 60%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  border: 1px solid rgba(18, 18, 18, 0.1);
  box-shadow: var(--shadow-md);
}

.auth-shell {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-xl);
  align-items: stretch;
}

.auth-panel {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  border: 1px solid rgba(18, 18, 18, 0.1);
  box-shadow: var(--shadow-md);
}

.auth-side {
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  border: 1px solid rgba(18, 18, 18, 0.08);
  background: rgba(17, 17, 17, 0.03);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.auth-side h3 {
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-side {
    display: none;
  }
}

.auth-title {
  font-size: var(--font-size-2xl);
  text-align: center;
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-surface-elevated);
}

.auth-links {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.auth-links a {
  margin-left: var(--space-xs);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.table td {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}

.table tr:last-child td {
  border-bottom: none;
}
