/* Custom styling for Salt's Fault - enhanced visual appeal */

/* Hero image for posts */
.post-hero {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.post-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-hero:hover img {
  transform: scale(1.02);
}

.post-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 2rem;
  color: white;
}

.post-hero-overlay h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.post-hero-overlay .meta {
  margin-top: 0.5rem;
  font-size: 1rem;
  opacity: 0.9;
}

/* Enhanced post layout */
.post {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.post-header {
  text-align: center;
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.post-header .meta {
  color: #666;
  font-size: 1rem;
}

.post-header .categories a {
  color: #2c5f2d;
  text-decoration: none;
  background: #e8f5e9;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.post-header .categories a:hover {
  background: #2c5f2d;
  color: white;
}

/* Content enhancements */
.content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #333;
}

.content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e8f5e9;
}

.content h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #2c5f2d;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.content p {
  margin-bottom: 1.25rem;
}

.content strong {
  color: #1a1a1a;
  font-weight: 600;
}

.content ul, .content ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

/* Table styling */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.content th {
  background: #2c5f2d;
  color: white;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

.content td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e8f5e9;
}

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

.content tr:nth-child(even) td {
  background: #f9fdf9;
}

.content tr:hover td {
  background: #f0f7f0;
}

/* Callout boxes */
.callout {
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.callout-tip {
  background: #e8f5e9;
  border-color: #2c5f2d;
}

.callout-tip strong {
  color: #2c5f2d;
}

.callout-warning {
  background: #fff8e1;
  border-color: #f57f17;
}

.callout-warning strong {
  color: #f57f17;
}

.callout-info {
  background: #e3f2fd;
  border-color: #1565c0;
}

.callout-info strong {
  color: #1565c0;
}

/* Links */
.content a {
  color: #2c5f2d;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.content a:hover {
  color: #1b3d1c;
}

/* Footer enhancements */
.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e8f5e9;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.tags a {
  background: #f0f7f0;
  color: #2c5f2d;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid #e8f5e9;
}

.tags a:hover {
  background: #2c5f2d;
  color: white;
  border-color: #2c5f2d;
}

/* Homepage hero */
.home-hero {
  text-align: center;
  padding: 4rem 1rem;
  background: linear-gradient(135deg, #1b4d1c 0%, #2c5f2d 100%);
  color: white;
  margin: -2rem -1rem 3rem -1rem;
  border-radius: 0 0 24px 24px;
}

.home-hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.home-hero p {
  font-size: 1.25rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
}

/* Card grid for post listings */
.post-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.post-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f7f0;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.post-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.post-card-content {
  padding: 1.5rem;
}

.post-card-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.post-card-content h2 a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card-content h2 a:hover {
  color: #2c5f2d;
}

.post-card-meta {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.75rem;
}

.post-card-excerpt {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Amazon disclosure enhancement */
.amazon-disclosure {
  background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
  border: none;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.15);
}

.amazon-disclosure strong {
  color: #e65100;
}

.amazon-disclosure code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .post-hero {
    height: 250px;
    border-radius: 8px;
  }
  
  .post-hero-overlay h1 {
    font-size: 1.75rem;
  }
  
  .post-header h1 {
    font-size: 2rem;
  }
  
  .home-hero {
    padding: 3rem 1rem;
  }
  
  .home-hero h1 {
    font-size: 2.25rem;
  }
  
  .post-cards {
    grid-template-columns: 1fr;
  }
}

/* Navigation enhancements */
.header {
  padding: 1rem 0;
}

.nav a {
  color: #333;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav a:hover {
  background: #e8f5e9;
  color: #2c5f2d;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c5f2d;
  text-decoration: none;
}

/* Footer */
.footer {
  background: #f9fdf9;
  border-top: 1px solid #e8f5e9;
  margin-top: 4rem;
  padding: 2rem 1rem;
}

.footer p {
  color: #888;
  font-size: 0.9rem;
  margin: 0;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
a:focus, button:focus {
  outline: 3px solid #2c5f2d;
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: #2c5f2d;
  color: white;
}

/* ============================================================
   Mobile responsiveness overrides
   NOTE: Homepage hero / post-preview styling is applied via
   INLINE styles in theme layouts (height:400px, font-size:3rem),
   so overrides below need !important to win the cascade.
   Desktop appearance is untouched: all overrides live inside
   the max-width:768px media query.
   ============================================================ */

/* Global guards (harmless at every width) */
img, video { max-width: 100%; height: auto; }
body { overflow-x: hidden; }

@media (max-width: 768px) {

  /* Homepage hero: shrink the fixed inline 400px height & 3rem fonts */
  .hero {
    height: 260px !important;
    padding: 1rem !important;
    background-position: center !important;
  }
  .hero h1 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    line-height: 1.25;
  }
  .hero p {
    font-size: 1rem !important;
    max-width: 100% !important;
  }
  .hero > div {
    padding: 1rem !important;
  }

  /* Post-page hero image card */
  .post-hero {
    height: 240px !important;
    border-radius: 8px;
  }
  .post-hero img {
    height: 100%;
    object-fit: cover;
  }
  .post-hero-overlay { padding: 1.25rem; }
  .post-hero-overlay h1 { font-size: 1.5rem !important; }

  /* Headings scale fluidly instead of fixed rem */
  h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
  h2 { font-size: clamp(1.25rem, 4.5vw, 1.5rem); }
  .post-header h1,
  .post-card-content h2 { font-size: clamp(1.35rem, 5vw, 1.75rem) !important; }

  /* Header nav: stack logo above links, let links wrap */
  .header .container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .nav a { white-space: normal; }
  .logo { font-size: 1.25rem; }

  /* Post list/previews fit narrow screens */
  .posts {
    width: 100%;
    max-width: 100%;
    padding: 1rem !important;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .post-preview {
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
  }
  .post-cards { grid-template-columns: 1fr; }
}

/* --- Subscribe page --- */
.subscribe-page { max-width: 640px; margin: 0 auto; padding: 3rem 1rem; text-align: center; }
.subscribe-page h1 { font-size: 2rem; margin-bottom: .75rem; }
.subscribe-page .sub-lede { font-size: 1.05rem; opacity: .85; margin-bottom: 2rem; }
.ml-embed { min-height: 220px; display: flex; flex-direction: column; justify-content: center; }
.fallback-note { margin-top: 1.5rem; font-size: .9rem; opacity: .8; }
.privacy-note { font-size: .8rem; opacity: .6; margin-top: 2rem; }
