/* Custom styling for The Qualified Astronaut - Space/Dark theme */

/* 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.2);
}

.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.8));
  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: #f0f0f0;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

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

.post-header .categories a {
  color: #4da6ff;
  text-decoration: none;
  background: rgba(77, 166, 255, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid rgba(77, 166, 255, 0.3);
}

.post-header .categories a:hover {
  background: #4da6ff;
  color: #0a0a0a;
  border-color: #4da6ff;
}

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

.content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #f0f0f0;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(77, 166, 255, 0.3);
}

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

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

.content strong {
  color: #f0f0f0;
  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.3);
  border-radius: 8px;
  overflow: hidden;
}

.content th {
  background: #1a1a2e;
  color: #4da6ff;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid rgba(77, 166, 255, 0.3);
}

.content td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.content tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

.content tr:hover td {
  background: rgba(77, 166, 255, 0.08);
}

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

.callout-tip {
  background: rgba(77, 166, 255, 0.1);
  border-color: #4da6ff;
}

.callout-tip strong {
  color: #4da6ff;
}

.callout-warning {
  background: rgba(245, 127, 23, 0.1);
  border-color: #f57f17;
}

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

.callout-info {
  background: rgba(21, 101, 192, 0.1);
  border-color: #1565c0;
}

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

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

.content a:hover {
  color: #7ab8ff;
}

/* Footer enhancements */
.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tags a {
  background: rgba(77, 166, 255, 0.1);
  color: #4da6ff;
  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 rgba(77, 166, 255, 0.3);
}

.tags a:hover {
  background: #4da6ff;
  color: #0a0a0a;
  border-color: #4da6ff;
}

/* Homepage hero */
.home-hero {
  text-align: center;
  padding: 4rem 1rem;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0f0f23 100%);
  color: white;
  margin: -2rem -1rem 3rem -1rem;
  border-radius: 0 0 24px 24px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, #4da6ff, transparent),
    radial-gradient(1px 1px at 90px 40px, #fff, transparent),
    radial-gradient(1px 1px at 130px 80px, #fff, transparent),
    radial-gradient(2px 2px at 160px 30px, #fff, transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  opacity: 0.6;
  pointer-events: none;
}

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

.home-hero p {
  font-size: 1.25rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* 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: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(77, 166, 255, 0.2);
  border-color: rgba(77, 166, 255, 0.3);
}

.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;
  color: #f0f0f0;
}

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

.post-card-content h2 a:hover {
  color: #4da6ff;
}

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

.post-card-excerpt {
  color: #aaa;
  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, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.08) 100%);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.1);
}

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

.amazon-disclosure code {
  background: rgba(255, 255, 255, 0.1);
  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;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.nav a:hover {
  background: rgba(77, 166, 255, 0.15);
  color: #4da6ff;
}

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

/* Footer */
.footer {
  background: #0a0a1a;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 4rem;
  padding: 2rem 1rem;
}

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

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

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

/* Selection color */
::selection {
  background: #4da6ff;
  color: #0a0a0a;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a1a;
}

::-webkit-scrollbar-thumb {
  background: #4da6ff;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #7ab8ff;
}

/* ============================================================
   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; }
