/* CSS Reset and Foundation */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent horizontal scroll and ensure proper mobile layout */
html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

body {
  font-family: 'Lora', 'Georgia', serif;
  color: #2c2824;
  background-color: #fefcf8;
  font-weight: 400;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  position: relative;
  margin: 0;
  padding: 0;
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Crimson Text', 'Times New Roman', serif;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: #2c2824;
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-top: 2rem; }
h3 { font-size: 1.5rem; margin-top: 1.5rem; }
h4 { font-size: 1.25rem; margin-top: 1.25rem; }
h5 { font-size: 1.125rem; margin-top: 1rem; }
h6 { font-size: 1rem; margin-top: 1rem; }

p {
  margin-bottom: 1.25rem;
  font-size: 1.125rem;
  line-height: 1.7;
}

/* Links */
a {
  color: #8b4513;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

a:hover {
  border-bottom-color: #8b4513;
}

/* Lists */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
  line-height: 1.6;
}

/* Blockquotes */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem;
  border-left: 4px solid #8b4513;
  background-color: #f9f6f0;
  font-style: italic;
  font-size: 1.2rem;
}

/* Code */
code {
  font-family: 'Source Code Pro', 'Courier New', monospace;
  background-color: #f9f6f0;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

pre {
  background-color: #f9f6f0;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

/* Grid System */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  width: 100%;
}

/* Grid Utilities */
.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* Images and media */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Responsive Grid */
@media (max-width: 768px) {
  html {
    width: 100vw;
  }
  
  body {
    width: 100%;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
  }
  
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    grid-column: span 1;
  }
  
  .container {
    padding: 0 1rem;
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
  }
  
  /* Ensure all elements stay within viewport */
  * {
    max-width: 100%;
    word-wrap: break-word;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.375rem; }
  
  p, li {
    font-size: 1rem;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.text-muted {
  color: #6b6356;
  font-size: 0.95rem;
}