/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

/* Medieval Victoriana font for drop caps */
@font-face {
  font-family: 'Medieval Victoriana';
  src: url("/assets/mevno1-1e76b5f3.ttf") format('truetype');
  font-weight: normal;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

html {
  font-size: 18px;  /* Base size for 1rem */
  line-height: var(--line-height-relaxed);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  letter-spacing: 0.01em;  /* Slight opening for readability */
  color: var(--grey-700);
  background-color: var(--parchment-200);
  padding: 0;
  max-width: 75rem;
  margin: 0 auto;
  font-feature-settings: "liga" 1, "kern" 1, "onum" 1;  /* Enable ligatures and old-style numerals */
  position: relative;
}

/* Subtle parchment texture grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(139, 69, 19, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(193, 147, 80, 0.10) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Main Content Area */
.main-content {
  padding: var(--space-lg);
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;  /* Optical tightening for large text */
  color: var(--grey-700);
  margin-bottom: var(--space-sm);
  font-feature-settings: "liga" 1, "kern" 1;  /* Enable ligatures */
}

h1 {
  font-size: var(--text-3xl);  /* 44.8px */
  font-weight: 700;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-2xl);  /* 37.3px */
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--text-xl);  /* 31.1px */
}

h4 {
  font-size: var(--text-lg);  /* 25.9px */
}

h5 {
  font-size: var(--text-md);  /* 21.6px */
}

h6 {
  font-size: var(--text-base);  /* 18px */
}

p {
  margin-bottom: var(--space-sm);
  color: var(--grey-600);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--grey-500);
  font-style: italic;
}

/* Text Size Utilities */
.text-xs {
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

.text-sm {
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.color-preview {
  display: inline-block;
  width: 2rem;
  height: 1rem;
  border: 1px solid #ccc;
  vertical-align: middle;
}

/* ==========================================================================
   Enhanced Focus Indicators
   Gold ring matching the parchment theme
   ========================================================================== */

*:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Specific focus styles for inputs and textareas */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 0;
  box-shadow: 0 0 0 3px rgba(193, 147, 80, 0.2);
}

/* ==========================================================================
   Modal Entrance Animations
   Smooth fade-in, slide-up, and backdrop blur for all modals
   ========================================================================== */

/* Overlay fade-in with blur */
@keyframes modal-fade-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

/* Content slide-up with scale */
@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Base modal overlay styles - use opacity instead of display: none for smooth animations */
.global-search-modal,
.entity-create-modal,
.command-palette-modal,
.questioning-modal,
.onboarding-modal-overlay {
  /* Add backdrop blur support */
  backdrop-filter: blur(4px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              backdrop-filter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hidden state - use opacity and pointer-events instead of display: none */
.global-search-modal.hidden,
.entity-create-modal.hidden,
.command-palette-modal.hidden,
.questioning-modal.hidden,
.onboarding-modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0);
}

/* Apply slide-up animation to modal content */
.global-search-content,
.entity-create-content,
.command-palette-content,
.questioning-content,
.onboarding-modal-content {
  animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Platform-specific Keyboard Shortcuts
   Uses body[data-platform] set by lib/platform.js
   ========================================================================== */

body[data-platform="mac"] .kbd-other,
body[data-platform="other"] .kbd-mac {
  display: none !important;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) /* tablet */ {
  html {
    font-size: 16px;  /* Reduce base size slightly on mobile */
  }

  body {
    padding: 0;  /* Remove horizontal padding, let .main-content handle it */
  }

  .main-content {
    padding: var(--space-md);  /* Reduce from lg to md (1.5rem vs 2rem) */
  }

  /* Scale down heading sizes for mobile */
  h1 {
    font-size: var(--text-2xl);  /* Reduce from 3xl */
    margin-bottom: var(--space-sm);
  }

  h2 {
    font-size: var(--text-xl);  /* Reduce from 2xl */
    margin-top: var(--space-md);  /* Reduce from lg */
    margin-bottom: var(--space-sm);  /* Reduce from md */
  }

  h3 {
    font-size: var(--text-lg);  /* Reduce from xl */
  }

  /* Tables - force horizontal scrolling on mobile */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Trix toolbar - allow wrapping on mobile */
  trix-toolbar {
    flex-wrap: wrap;
  }
}
