/* Custom styling for The Qualified Astronaut - Space/Dark theme (mirrors qualifiedastronaut.com) */

:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --accent: #fbbf24;
  --bg: #0f172a;
  --bg-light: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --card-bg: #1e293b;
  --border: #334155;
}

* { box-sizing: border-box; }

.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.3);
}

.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; }

.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: var(--text); margin-bottom: 0.5rem; line-height: 1.2; }
.post-header .meta { color: var(--text-muted); font-size: 1rem; }
.post-header .categories a { color: var(--primary-light); text-decoration: none; background: rgba(59, 130, 246, 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(59, 130, 246, 0.3); }
.post-header .categories a:hover { background: var(--primary-light); color: var(--bg); border-color: var(--primary-light); }

.content { font-size: 1.1rem; line-height: 1.8; color: var(--text); }
.content h2 { font-size: 1.75rem; font-weight: 700; color: var(--text); margin-top: 2.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid rgba(59, 130, 246, 0.3); }
.content h3 { font-size: 1.35rem; font-weight: 600; color: var(--primary-light); margin-top: 2rem; margin-bottom: 0.75rem; }
.content p { margin-bottom: 1.25rem; }
.content strong { color: var(--text); font-weight: 600; }
.content ul, .content ol { margin: 1rem 0 1.5rem 1.5rem; }
.content li { margin-bottom: 0.5rem; line-height: 1.7; }

.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: var(--primary); color: var(--accent); padding: 1rem; text-align: left; font-weight: 600; border-bottom: 2px solid rgba(251, 191, 36, 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(59, 130, 246, 0.1); }

.callout { padding: 1.25rem 1.5rem; border-radius: 8px; margin: 1.5rem 0; border-left: 4px solid; }
.callout-tip { background: rgba(59, 130, 246, 0.1); border-color: var(--primary-light); }
.callout-tip strong { color: var(--primary-light); }
.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; }

.content a { color: var(--primary-light); text-decoration: underline; text-underline-offset: 2px; transition: color 0.2s ease; }
.content a:hover { color: var(--accent); }

.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(59, 130, 246, 0.1); color: var(--primary-light); 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(59, 130, 246, 0.3); }
.tags a:hover { background: var(--primary-light); color: var(--bg); border-color: var(--primary-light); }

.home-hero { text-align: center; padding: 4rem 1rem; background: linear-gradient(135deg, #0a0a1a 0%, #1e3a8a 50%, #0f172a 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, #fbbf24, 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; }

.post-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.post-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); transition: all 0.3s ease; border: 1px solid var(--border); }
.post-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(59, 130, 246, 0.2); border-color: var(--primary-light); }
.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: var(--text); }
.post-card-content h2 a { color: var(--text); text-decoration: none; transition: color 0.2s ease; }
.post-card-content h2 a:hover { color: var(--primary-light); }
.post-card-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.post-card-excerpt { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.amazon-disclosure { background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.08) 100%); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: 12px; padding: 1.25rem 1.5rem; margin: 2rem 0; box-shadow: 0 4px 16px rgba(251, 191, 36, 0.1); }
.amazon-disclosure strong { color: #fbbf24; }
.amazon-disclosure code { background: rgba(255, 255, 255, 0.1); padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.9em; }

@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; }
}

.header { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.nav a { color: var(--text-muted); font-weight: 500; padding: 0.5rem 0.75rem; border-radius: 8px; transition: all 0.2s ease; }
.nav a:hover { background: rgba(59, 130, 246, 0.15); color: var(--primary-light); }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary-light); text-decoration: none; }

.footer { background: #0a0a1a; border-top: 1px solid var(--border); margin-top: 4rem; padding: 2rem 1rem; }
.footer p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

html { scroll-behavior: smooth; }
a:focus, button:focus { outline: 3px solid var(--primary-light); outline-offset: 2px; }
::selection { background: var(--primary-light); color: var(--bg); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

body { background: var(--bg); color: var(--text); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Responsive images */
img { max-width: 100%; height: auto; display: block; }
.post-hero img { width: 100%; height: auto; max-height: 400px; object-fit: cover; border-radius: 12px 12px 0 0; }
@media (max-width: 768px) { .post-hero { height: auto; max-height: 300px; border-radius: 8px; } .post-hero img { max-height: 300px; border-radius: 8px 8px 0 0; } .post-hero-overlay { padding: 1.5rem; } .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; } }

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