/**
 * The Stoic Wire - Optimized Main Stylesheet
 * Version: 3.2 - Search styles moved to search.css
 * Clean, optimized, and fully functional
 */

/* ========================================= */
/* 1. CSS CUSTOM PROPERTIES                  */
/* ========================================= */

:root {
  /* Color Palette */
  --color-paper: #f9f7f1;
  --color-paper-light: #fcfaf5;
  --color-ink: #33302e;
  --color-ink-light: #635f5c;
  --color-accent: #9c6644;
  --color-accent-light: #c8a99a;
  --color-border: #d4ccb9;
  --color-shadow: rgba(0, 0, 0, 0.1);
  --color-bg-alt: #f4f1e9;
  --color-white: #ffffff;
  --color-error: #e74c3c;
  --color-success: #2ecc71;
  --color-footer: #212121;
  --color-bronze: #a67c52;

  /* Typography */
    /*--font-serif: 'EB Garamond', Georgia, serif;*/
  --font-serif: 'Cormorant Garamond', serif';
  --font-mono: 'Roboto Mono', monospace, sans-serif;
  /*--font-mono: 'Cormorant Garamond', serif';*/

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-xxl: 5rem;

  /* Layout */
  --container-max: 1200px;
  --content-max: 900px;
  --sidebar-width: 300px;
  --header-height: 70px;
  
  /* Design Tokens */
  --border-radius: 4px;
  --transition: 0.3s ease;
  --border-light: 1px solid var(--color-border);
  
  /* Z-index Scale */
  --z-overlay: 80;
  --z-header: 85;
  --z-mobile-nav: 90;
  --z-menu-toggle: 95;
  --z-progress: 1000;
}

/* ========================================= */
/* 2. RESET & BASE STYLES                    */
/* ========================================= */

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

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

body {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--color-ink);
  /*background-color: var(--color-paper-light);*/
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========================================= */
/* 3. TYPOGRAPHY                             */
/* ========================================= */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--color-ink);
  font-feature-settings: "liga" 1, "dlig" 1, "kern" 1;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.8rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.1rem; }

p {
  margin-bottom: var(--space-md);
  font-size: 1.25rem;
}

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

a:hover {
  color: var(--color-accent-light);
}

ul, ol {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

blockquote {
  font-style: italic;
  border-left: 3px solid var(--color-accent-light);
  padding-left: var(--space-md);
  margin: var(--space-md) 0 var(--space-lg) var(--space-md);
}

blockquote cite,
.attribution {
  display: block;
  font-style: normal;
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: var(--space-xs);
}

/* ========================================= */
/* 4. LAYOUT COMPONENTS                      */
/* ========================================= */

.container {
  width: 90%;
  max-width: var(--container-max);
  margin: 0 auto;
}

section {
  margin: var(--space-md) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-xl);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background-color: var(--color-accent);
  margin: 0.5rem auto 0;
}

/* ========================================= */
/* 5. HEADER & NAVIGATION                    */
/* ========================================= */

.site-header {
  border-bottom: var(--border-light);
  padding: var(--space-md) 0;
  background-color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo h1 {
  margin: 0;
  font-size: 1.94rem;
  font-weight: 500;
}

.tagline {
  font-size: 0.875rem;
  color: var(--color-ink-light);
  margin: 0;
}

/* Desktop Navigation */
.main-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  gap: var(--space-lg);
}

.main-nav a {
  color: var(--color-ink);
  font-size: 1rem;
  text-transform: lowercase;
  letter-spacing: 0.5px;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  border-color: var(--color-accent);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: var(--z-menu-toggle);
}

.hamburger {
  display: block;
  position: relative;
  width: 24px;
  height: 18px;
}

.hamburger span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--color-ink);
  border-radius: 2px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: 0.25s ease-in-out;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2),
.hamburger span:nth-child(3) { top: 8px; }
.hamburger span:nth-child(4) { top: 16px; }

.menu-open .hamburger span:nth-child(1) {
  top: 8px;
  width: 0%;
  left: 50%;
}

.menu-open .hamburger span:nth-child(2) {
  transform: rotate(45deg);
}

.menu-open .hamburger span:nth-child(3) {
  transform: rotate(-45deg);
}

.menu-open .hamburger span:nth-child(4) {
  top: 8px;
  width: 0%;
  left: 50%;
}

/* Style the X button when menu is open */
.menu-open .menu-toggle {
  background-color: var(--color-white);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Mobile Navigation */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--color-paper-light);
  z-index: var(--z-mobile-nav);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  padding-top: 20px;
  display: none;
}

/* Style the close button inside mobile nav */
.mobile-nav-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: all var(--transition);
}

.mobile-nav-close:hover {
  background-color: var(--color-ink);
  transform: scale(1.1);
}

.menu-open .mobile-nav {
  transform: translateX(0);
}

.mobile-nav ul {
  list-style: none;
  padding: 80px 30px 30px; /* Add top padding to avoid close button */
}

.mobile-nav li {
  margin: 15px 0;
}

.mobile-nav a {
  font-size: 1.25rem;
  padding: 5px 0;
  display: block;
  color: var(--color-ink);
}

.mobile-nav a.active {
  color: var(--color-accent);
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.menu-open .menu-overlay {
  opacity: 1;
  visibility: visible;
}

body.menu-open {
  overflow: hidden;
}

/* Move hamburger to right on mobile when menu is open */
@media (max-width: 768px) {
  /* Hide the header when menu is open to prevent overlap */
  .menu-open .site-header {
    opacity: 0.2;
    pointer-events: none;
  }
  
  /* Hide the original hamburger when menu is open */
  .menu-open .menu-toggle {
    opacity: 0;
    pointer-events: none;
  }
  
  /* Ensure mobile nav has proper z-index */
  .mobile-nav {
    z-index: 998 !important;
  }
}

/* ========================================= */
/* 6. FEATURED SECTION                       */
/* ========================================= */

.featured-reflection {
  padding: var(--space-lg) 0;
  border-bottom: var(--border-light);
  margin-bottom: var(--space-lg);
}

.featured-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  align-items: center;
}

.featured-content h2 {
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: var(--space-md);
}

.featured-visual {
  text-align: center;
}

.featured-visual svg {
  max-width: 100%;
  height: auto;
  max-height: 350px;
}

.featured-excerpt-container {
  position: relative;
  margin-bottom: var(--space-md);
  max-height: 4.8em;
  overflow: hidden;
}

.featured-excerpt {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blur-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 1.6em;
  background: linear-gradient(to right, transparent, white 70%);
  pointer-events: none;
}

/* ========================================= */
/* 7. METADATA STYLES                        */
/* ========================================= */

.meta-info,
.article-meta-top {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-info {
  margin-bottom: var(--space-md);
}

.article-meta-top {
  margin-bottom: var(--space-xs);
}

.meta-info .source,
.article-meta-top .source {
  background-color: var(--color-accent);
  color: var(--color-white);
  padding: 4px 8px;
  border-radius: var(--border-radius);
}

.meta-info .separator,
.article-meta-top .separator {
  opacity: 0.5;
}

.meta-info .date,
.article-meta-top .article-date {
  color: var(--color-accent);
}

/* ========================================= */
/* 8. MAIN CONTENT LAYOUT                    */
/* ========================================= */

.main-content .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  align-items: start;
}

@media (min-width: 769px) {
  .main-content .container {
    grid-template-columns: 3fr 1fr;
  }
}

.content-main {
  width: 100%;
}


.theme-section {
  margin-bottom: var(--space-lg);
}

.theme-section:last-child {
  margin-bottom: var(--space-md);
}

.theme-section-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-md);
  border-bottom: var(--border-light);
  padding-bottom: var(--space-xs);
}

.theme-section-title {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
}

.view-all-theme {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========================================= */
/* 9. ARTICLE CARDS                          */
/* ========================================= */

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

.article-card {
  background-color: transparent;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition);
  height: 100%;
  text-decoration: none;
}

.article-card:hover {
  transform: translateY(-3px);
}

.article-visual {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--border-radius);
  background-color: var(--color-bg-alt);
  margin-bottom: var(--space-sm);
}

.article-visual svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.article-headline {
  font-size: 1.8rem;
  margin-bottom: var(--space-xs);
  line-height: 1.2;
  color: var(--color-ink);
}

.article-excerpt {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--color-ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Card Sizes */
.article-large {
  grid-column: span 8;
}

.article-large .article-headline {
  font-size: 2rem;
}

.article-medium {
  grid-column: span 4;
}

.article-small {
  grid-column: span 12;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-md);
}

.article-small .article-visual {
  width: 100px;
  height: 100px;
  margin-bottom: 0;
}

.article-small .article-headline {
  font-size: 1.4rem;
}

.article-small .article-excerpt {
  display: none;
}

/* Hide themes on article cards */
.article-card .themes {
  display: none;
}

/* ========================================= */
/* 10. SIDEBAR                               */
/* ========================================= */

.sidebar {
  background-color: var(--color-paper-light);
  padding: var(--space-md);
  border-radius: var(--border-radius);
  border: var(--border-light);
}

@media (min-width: 769px) {
  .sidebar {
    position: sticky;
    top: 100px;
  }
}

.sidebar-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: var(--border-light);
}

.sidebar-title:first-child {
  margin-top: 0;
}

.trending-item {
  display: flex;
  align-items: flex-start;
  padding: var(--space-md) 0;
  border-bottom: var(--border-light);
  cursor: pointer;
  transition: background-color var(--transition);
  text-decoration: none;
  color: inherit;
}

.trending-item:hover {
  background-color: rgba(156, 102, 68, 0.05);
}

.trending-item:last-child {
  border-bottom: none;
}

.ranking-number {
  font-size: 3rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-right: var(--space-md);
  min-width: 2rem;
  line-height: 1;
}

.trending-headline {
  flex: 1;
  font-size: 1.15rem;
  line-height: 1.4;
}

/* ========================================= */
/* 11. THEME TAGS                            */
/* ========================================= */

.theme-tag {
  display: inline-block;
  /*font-family: var(--font-mono);*/
  font-size: 0.85rem;
  background-color: transparent;
  color: var(--color-accent);
  padding: 3px 8px;
  border: 1px solid var(--color-accent);
  border-radius: var(--border-radius);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: all var(--transition);
}

.theme-tag:hover {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.focused-theme {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background-color: var(--color-accent);
  color: var(--color-white);
  padding: 3px 8px;
  border-radius: var(--border-radius);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.theme-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-tags li {
  display: inline-block;
  margin: 0;
}

/* Theme Navigation Specific */
.theme-navigation .theme-tags {
  display: flex !important;
  gap: 0.75rem;
}

.theme-navigation .theme-tag {
  display: inline-flex !important;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: 50px;
  font-size: 0.875rem;
  color: var(--color-ink);
  font-weight: 400;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
}

.theme-navigation .theme-tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(156, 102, 68, 0.1), transparent);
  transition: left 0.5s ease;
}

.theme-navigation .theme-tag:hover::before {
  left: 100%;
}

.theme-navigation .theme-tag:hover {
  background: rgba(156, 102, 68, 0.05);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ========================================= */
/* 12. FORMS & INPUTS                        */
/* ========================================= */

/* Newsletter Section */
.newsletter-section {
  /*background-color: var(--color-bg-alt);*/
  padding: var(--space-xl) var(--space-lg);
  margin: var(--space-xl) 0;
  border-radius: var(--border-radius);
  text-align: center;
}

.newsletter-section h2 {
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: var(--space-md);
}

.newsletter-section > p {
  font-size: 1.25rem;
  color: var(--color-ink-light);
  margin-bottom: var(--space-lg);
}

.newsletter-form {
  max-width: 520px;
  margin: 0 auto;
}

.form-group {
  background: var(--color-white);
  padding: 4px;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  margin-bottom: var(--space-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(156, 102, 68, 0.1);
}

.newsletter-input {
  flex: 1;
  border: none;
  padding: 12px 16px;
  font-family: var(--font-serif);
  font-size: 1rem;
  background: transparent;
  color: var(--color-ink);
}

.newsletter-input:focus {
  outline: none;
}

.newsletter-input::placeholder {
  color: #999;
}

.newsletter-button {
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  padding: 10px 24px;
  margin-right: 2px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.newsletter-button:hover {
  background-color: var(--color-ink);
  transform: translateY(-1px);
}

.newsletter-button:active {
  transform: translateY(0);
}

.form-note {
  font-size: 0.875rem;
  color: var(--color-ink-light);
  margin: 0;
}

.error-message {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
  text-align: left;
}

/* Newsletter States */
.newsletter-success,
.newsletter-pending {
  text-align: center;
  padding: var(--space-lg);
  animation: fadeIn 0.5s ease-out;
}

.success-icon {
  margin-bottom: var(--space-md);
}

.newsletter-success p {
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

.return-button {
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color var(--transition);
  margin-top: var(--space-md);
}

.return-button:hover {
  background-color: var(--color-ink);
}

.pending-note {
  font-size: 0.875rem;
  color: var(--color-ink-light);
  margin-top: var(--space-xs);
}

/* ========================================= */
/* 13. BUTTONS & INTERACTIVE ELEMENTS        */
/* ========================================= */

.read-more-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color var(--transition);
}

.read-more-btn:hover {
  background-color: var(--color-ink);
}

.back-to-top-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background-color: var(--color-accent);
  color: var(--color-white);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition), background-color var(--transition);
  z-index: 10;
}

.back-to-top-button:hover {
  opacity: 1;
  background-color: var(--color-ink);
}

/* ========================================= */
/* 14. UTILITY CLASSES                       */
/* ========================================= */

/* Loading States */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.reflection-loading,
.theme-loading,
.archive-loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-ink-light);
}

/* Animations */
@keyframes fadeIn {
  from { 
    opacity: 0;
    transform: translateY(10px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus Styles */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--color-accent);
  z-index: var(--z-progress);
  transition: width 0.1s ease;
}

/* ========================================= */
/* 15. ARCHIVE & PAGINATION                  */
/* ========================================= */

.archive-header {
  background-color: var(--color-bg-alt);
  padding: var(--space-lg) 0;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.archive-card {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.archive-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.archive-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  padding: var(--space-lg) 0;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-xl) 0;
}

.pagination-btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  margin: 0 var(--space-xs);
  color: var(--color-ink-light);
  text-decoration: none;
  background-color: var(--color-paper);
  transition: background-color 0.2s ease, color 0.2s ease;
  min-width: 40px;
  text-align: center;
  font-size: 0.9em;
  border-radius: var(--border-radius);
}

.pagination-btn:not(.disabled):hover {
  background-color: var(--color-accent-light);
  color: var(--color-ink);
}

.pagination-btn.active {
  background-color: var(--color-accent);
  color: var(--color-white);
  font-weight: bold;
  cursor: default;
}

.pagination-btn.disabled {
  color: var(--color-ink-light);
  background-color: #eee;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ========================================= */
/* 16. FOOTER                                */
/* ========================================= */

footer {
  border-top: var(--border-light);
  padding: var(--space-lg) 0;
  margin-top: var(--space-xxl);
  text-align: center;
  background-color: black;
  color: white;
}

footer p {
  max-width: 600px;
  margin: 0 auto var(--space-lg);
  font-style: italic;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.copyright {
  font-size: 0.875rem;
  color: white;
}

/* ========================================= */
/* 17. ARTWORK STYLES                        */
/* ========================================= */

.artwork-container,
.featured-artwork-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #f0f0f0;
}

.artwork-image,
.featured-artwork-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition);
}

.article-card:hover .artwork-image {
  transform: scale(1.05);
}

.artwork-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: var(--color-white);
  padding: 8px 12px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.article-card:hover .artwork-info {
  opacity: 1;
}

.artwork-title {
  font-weight: bold;
  margin: 0 0 4px 0;
}

.artwork-artist {
  margin: 0;
  font-style: italic;
}

.reflection-artwork {
  margin: 0 auto;
  max-width: 100%;
}

.reflection-artwork img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.reflection-artwork figcaption {
  padding: 12px 10px;
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
  color: #666;
  margin-top: 10px;
}

.reflection-artwork figcaption cite {
  font-style: normal;
  font-weight: 500;
  display: inline;
  margin-left: 5px;
}

.artwork-source-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.8rem;
  font-style: normal;
}

.artwork-source-link:hover {
  text-decoration: underline;
}

/* ========================================= */
/* 18. RESPONSIVE DESIGN                     */
/* ========================================= */

@media (max-width: 1024px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }
  
  .featured-visual {
    display: none;
  }
  
  .articles-grid {
    gap: var(--space-md);
  }
}

@media (max-width: 768px) {
  /* Base adjustments */
  html {
    font-size: 15px;
  }
  
  .container {
    width: 94%;
  }
  
  /* Typography */
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.6rem; }
  p { font-size: 1.25rem; }
  
  /* Header */
  .site-header {
    padding: 15px 0;
  }
  
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }
  
  .main-nav {
    display: none;
  }
  
  .menu-toggle {
    display: block;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .mobile-nav,
  .menu-overlay {
    display: block;
  }
  
  /* Main Content */
  .main-content .container {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .content-main {
    margin-bottom: var(--space-sm);
  }
  
  .theme-section {
    margin-bottom: var(--space-lg);
  }
  
  .theme-section:last-child {
    margin-bottom: var(--space-sm);
  }
  
  /* Articles */
  .articles-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .article-large,
  .article-medium {
    grid-column: span 1;
  }
  
  .article-small {
    grid-template-columns: 80px 1fr;
    gap: var(--space-sm);
  }
  
  .article-small .article-visual {
    width: 80px;
    height: 80px;
  }
  
  .article-headline {
    font-size: 1.5rem;
  }
  
  .article-small .article-headline {
    font-size: 1.2rem;
  }
  
  .article-excerpt {
    font-size: 1.2rem;
  }
  
  /* Featured */
  .featured-content h2 {
    font-size: 2rem;
  }
  
  .featured-excerpt {
    font-size: 1.2rem;
  }
  
  .featured-reflection {
    padding: var(--space-md) 0;
  }
  
  /* Metadata */
  .meta-info,
  .article-meta-top {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .meta-info .source,
  .article-meta-top .source {
    padding: 3px 6px;
    font-size: 0.7rem;
  }
  
  .meta-info .date,
  .article-meta-top .article-date {
    font-size: 0.7rem;
  }
  
  /* Sidebar */
  .sidebar {
    margin-top: var(--space-sm);
  }
  
  .ranking-number {
    font-size: 2.5rem;
    margin-right: var(--space-sm);
  }
  
  .trending-headline {
    font-size: 1.1rem;
  }
  
  /* Newsletter */
  .newsletter-section {
    padding: var(--space-lg) var(--space-md);
  }
  
  .newsletter-section h2 {
    font-size: 1.75rem;
  }
  
  .newsletter-section > p {
    font-size: 1.1rem;
  }
  
  .form-group {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }
  
  .newsletter-input {
    width: 100%;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
  }
  
  .newsletter-button {
    width: 100%;
    padding: 14px;
    margin-right: 0;
    font-size: 0.875rem;
  }
  
  /* Artwork */
  .artwork-info {
    opacity: 1;
    padding: 5px 8px;
    font-size: 0.75rem;
  }
  
  .reflection-artwork figcaption {
    padding: 8px 5px;
    font-size: 0.85rem;
  }
  
  /* Touch targets */
  button,
  .btn,
  .pagination-btn,
  select,
  input[type="submit"] {
    min-height: 44px;
  }
  
  /* Theme Navigation Mobile */
  .theme-navigation .theme-tag {
    padding: 0.5rem 0.8rem;
    font-size: 0.875rem;
  }
  
  /* Prevent horizontal scroll */
  body,
  html {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 480px) {
  .article-small {
    grid-template-columns: 70px 1fr;
  }
  
  .article-small .article-visual {
    width: 70px;
    height: 70px;
  }
  
  .article-headline {
    font-size: 1.4rem;
  }
  
  .article-small .article-headline {
    font-size: 1.1rem;
  }
  
  .ranking-number {
    font-size: 2rem;
    min-width: 1.5rem;
  }
  
  .trending-headline {
    font-size: 1.2rem;
  }
  
  .pagination-btn {
    padding: 4px 8px;
    min-width: 30px;
    font-size: 0.8em;
  }
}

/* ========================================= */
/* 19. PRINT STYLES                          */
/* ========================================= */

@media print {
  body {
    background-color: white;
    color: var(--color-footer);
    font-size: 12pt;
  }
  
  .site-header,
  .menu-toggle,
  .mobile-nav,
  .menu-overlay,
  .theme-navigation,
  .sidebar,
  .newsletter-section,
  .search-section,
  .footer-links,
  .back-to-top-button,
  .reading-progress {
    display: none !important;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  
  .main-content .container {
    display: block;
  }
  
  .content-main {
    width: 100%;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  h1 {
    font-size: 24pt;
    margin-bottom: 1cm;
  }
  
  h2 {
    font-size: 18pt;
    margin-top: 1cm;
  }
  
  h3 {
    font-size: 14pt;
  }
  
  p {
    font-size: 12pt;
    line-height: 1.5;
    margin-bottom: 0.5cm;
  }
  
  footer {
    border-top: 1pt solid #999;
    margin-top: 1cm;
    padding-top: 0.5cm;
  }
  
  footer p {
    font-size: 10pt;
  }
  
  /* Ensure page breaks don't occur inside elements */
  .article-card,
  .theme-section,
  blockquote {
    page-break-inside: avoid;
  }
}

/* ========================================= */
/* 20. ACCESSIBILITY & PERFORMANCE           */
/* ========================================= */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --color-paper: #ffffff;
    --color-ink: #000000;
    --color-accent: #0066cc;
    --color-border: #000000;
  }
}

/* Dark mode preparation (for future implementation) */
@media (prefers-color-scheme: dark) {
  /* Dark mode variables can be added here when needed */
}

/* Performance optimizations */
.theme-navigation {
  transform: translateZ(0);
  will-change: transform;
  contain: layout;
}

.article-card {
  contain: layout style;
}

/* Lazy loading preparation */
img[loading="lazy"] {
  background-color: var(--color-bg-alt);
}


/* ========================================= */
/* STOIC THEMES LAYOUT IMPROVEMENTS          */
/* ========================================= */

/* Enhanced Theme Section Spacing and Separation */
.theme-section {
  margin-bottom: 1.5rem; /* Very compact spacing between sections */
  padding-bottom: 0.75rem; /* Minimal padding */
  position: relative;
}

/* Enhanced section headers */
.theme-section-header {
  margin-bottom: 0.4rem; /* Reduced spacing */
  padding-bottom: 0.5rem; /* Less padding */
  border-bottom: 2px solid var(--color-border);
}

/* Remove alternating backgrounds for cleaner look */
.theme-section:nth-child(even) {
  background-color: transparent; /* Remove background */
  padding: 0; /* No extra padding */
  margin-left: 0;
  margin-right: 0;
}

/* Enhanced article cards within theme sections */
.theme-section .articles-grid {
  margin-top: 0.75rem; /* Minimal top margin */
  gap: 0.75rem; /* Reduce gap between cards */
}

/* Add visual hierarchy to theme titles */
.theme-section-title {
  font-size: 1.75rem;
  color: var(--color-ink);
  position: relative;
  padding-left: 2rem;
}

/* Add accent mark to section titles */
.theme-section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.2em;
  background-color: var(--color-accent);
  border-radius: 2px;
}

/* Improve "VIEW ALL" link styling */
.view-all-theme {
  padding: 0.25rem 0.75rem;
  border-radius: 3px;
  transition: all var(--transition);
  background-color: transparent;
  border: 1px solid transparent;
}

.view-all-theme:hover {
  background-color: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}

/* Remove hover effect on entire section */
.theme-section {
  transition: none;
  transform: none;
}

/* Enhance visual separation of article cards - make them extend fuller width */
.theme-section .article-card {
  /*background-color: var(--color-paper-light);*/
  padding: 1rem; /* Compact padding */
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition);
  margin-bottom: 0; /* Remove bottom margin */
}

.theme-section .article-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Make the white boxes extend to full width */
.theme-section .articles-grid {
  margin-left: 0;
  margin-right: 0;
}

/* Remove container padding for maximum width */
.content-main {
  padding: 0;
}

/* Adjust specific card types for tighter layout */
.article-small {
  padding: 0.75rem; /* Less padding for small cards */
}

.article-large,
.article-medium {
  padding: 1rem; /* Standard padding for larger cards */
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .theme-section {
    margin-bottom: 1rem; /* Even less space on mobile */
    padding-bottom: 0.5rem;
  }
  
  .theme-section-title {
    font-size: 1.5rem;
  }
  
  .theme-section .articles-grid {
    gap: 0.5rem; /* Tighter gap on mobile */
  }
  
  .theme-section .article-card {
    padding: 0.75rem; /* Smaller padding on mobile */
  }
  
  /* Ensure all section titles are left-aligned */
  .theme-section-header {
    flex-direction: row !important;
  }
  
  .theme-section-title {
    padding-left: 2rem !important;
    padding-right: 0 !important;
  }
  
  .theme-section-title::before {
    left: 0 !important;
    right: auto !important;
  }
}

/* Override any existing margins on article containers */
.articles-grid {
  margin: 0 !important;
}

/* Ensure theme sections take full available width */
.theme-section {
  width: 100%;
}

/* Tighten up the overall content area */
.main-content {
  padding-top: 1rem;
  padding-bottom: 1rem;
}