/* ===================================================
   OnlineInvoicesMaker.com — Fully Responsive CSS
   Hamburger RIGHT, Logo LEFT, Left-side Drawer
   Breakpoints:
     xs  : ≤ 360px
     sm  : ≤ 480px
     md  : ≤ 768px  (mobile header/drawer activates)
     lg  : ≤ 1024px (tablet)
     xl  : ≤ 1280px
     2xl : > 1280px (desktop — baseline)
   =================================================== */


/* =====================================================
   0. GLOBAL RESET & BASE
===================================================== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

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

body {
  min-width: 320px;           /* never shrink below 320px */
  overflow-x: hidden;         /* kill horizontal scroll globally */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: break-word;     /* prevent long words blowing layout */
}

img, video, iframe, svg, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

table {
  border-collapse: collapse;
  width: 100%;
}

input, button, select, textarea {
  font: inherit;
  max-width: 100%;
}

a, button, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Minimum 44×44 touch target for all interactive elements */
a, button, [role="button"], input[type="submit"],
input[type="button"], input[type="checkbox"], input[type="radio"],
select, label[for] {
  min-height: 44px;
  min-width: 44px;
}

/* Fluid container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(12px, 4vw, 32px);
  padding-right: clamp(12px, 4vw, 32px);
}


/* =====================================================
   1. DRAWER OVERLAY — NO DARK BACKDROP
      Kept in DOM for JS "tap-outside-to-close" logic,
      but fully transparent — no visual dimming.
===================================================== */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: transparent;   /* ← no dark tint */
  z-index: 2000;
}
.mobile-nav-overlay.active {
  display: block;
  background: transparent;   /* ← stays transparent */
}


/* =====================================================
   2. LEFT DRAWER
===================================================== */
.main-nav.mobile-open {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  right: auto !important;
  width: clamp(240px, 72vw, 300px) !important;
  max-width: 82vw !important;
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
  box-shadow: 6px 0 32px rgba(0,0,0,0.18) !important;
  z-index: 3000 !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  transform: translateX(0) !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: all !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  animation: oim-drawer-in 0.28s ease-out both !important;
}

[data-theme="dark"] .main-nav.mobile-open {
  background-color: #1e293b !important;
  border-right-color: #334155 !important;
}

@keyframes oim-drawer-in {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* Drawer header bar */
.main-nav.mobile-open::before {
  content: 'Menu';
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  min-height: 60px;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 1;
}
[data-theme="dark"] .main-nav.mobile-open::before {
  color: #f1f5f9;
  background-color: #0f172a;
  border-bottom-color: #334155;
}

/* Drawer nav links */
.main-nav.mobile-open a {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 16px 24px !important;
  font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  background: transparent !important;
  text-decoration: none !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: 0 !important;
  width: 100% !important;
  min-height: 52px !important;
  transition: background 0.15s, color 0.15s, padding-left 0.15s !important;
}
[data-theme="dark"] .main-nav.mobile-open a {
  color: #f1f5f9 !important;
  border-bottom-color: #334155 !important;
}

.main-nav.mobile-open a::before {
  content: '›' !important;
  font-size: 1.3rem !important;
  color: #94a3b8 !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  transition: color 0.15s !important;
}

.main-nav.mobile-open a:hover,
.main-nav.mobile-open a.active {
  background: rgba(99,102,241,0.08) !important;
  color: #6366f1 !important;
  padding-left: 30px !important;
}
.main-nav.mobile-open a:hover::before,
.main-nav.mobile-open a.active::before {
  color: #6366f1 !important;
}
.main-nav.mobile-open a:last-child {
  border-bottom: none !important;
}

/* CTA button inside drawer */
.main-nav.mobile-open a.mobile-cta-link {
  margin: 20px 16px 16px !important;
  padding: 14px 20px !important;
  background: #6366f1 !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  border: none !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  justify-content: center !important;
  text-align: center !important;
  width: calc(100% - 32px) !important;
}
.main-nav.mobile-open a.mobile-cta-link::before {
  display: none !important;
}
.main-nav.mobile-open a.mobile-cta-link:hover {
  background: #4f46e5 !important;
  color: #ffffff !important;
  padding-left: 20px !important;
}


/* =====================================================
   3. SITE HEADER — DESKTOP BASELINE (> 768px)
===================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 16px;
}

/* Hide hamburger on desktop */
.mobile-menu-btn {
  display: none;
}


/* =====================================================
   4. RESPONSIVE BREAKPOINTS
===================================================== */

/* ---------- XL: ≤ 1280px ---------- */
@media (max-width: 1280px) {
  .container {
    max-width: 1100px;
  }
  .hero-title {
    font-size: clamp(2rem, 4vw, 3rem) !important;
  }
}

/* ---------- LG / TABLET: ≤ 1024px ---------- */
@media (max-width: 1024px) {
  .container {
    padding-left: clamp(16px, 3vw, 24px);
    padding-right: clamp(16px, 3vw, 24px);
  }

  .features-grid        { grid-template-columns: repeat(2, 1fr) !important; }
  .testimonials-grid    { grid-template-columns: repeat(2, 1fr) !important; }
  .footer-grid          { grid-template-columns: 1fr 1fr !important; gap: 32px; }
  .pricing-grid         { grid-template-columns: 1fr !important; max-width: 480px; margin: 0 auto; }
  .pricing-card.featured-pricing { transform: none; }
  .seo-grid             { grid-template-columns: 1fr !important; gap: 40px; }
  .hero-section .container { gap: 40px; }
  .contact-grid         { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* Nav links compress a bit on tablet */
  .main-nav a {
    font-size: 0.9rem;
    padding: 6px 10px;
  }
}


/* ---------- MD / MOBILE HEADER: ≤ 768px ---------- */
@media (max-width: 768px) {

  /* ── CSS custom property ── */
  :root { --header-height: 60px; }

  /* ── Header: fixed, solid, no backdrop-filter ── */
  .site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    z-index: 1000 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08) !important;
  }
  [data-theme="dark"] .site-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
  }

  /* ── Header inner ── */
  .header-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 14px !important;
    height: 60px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    gap: 0 !important;
    position: static !important;
  }

  /* ── Logo: left ── */
  .logo {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    order: 1 !important;
    text-decoration: none !important;
    min-height: 44px !important;
  }
  .logo-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.85rem !important;
    flex-shrink: 0 !important;
  }
  .logo-text {
    font-size: clamp(0.78rem, 3.5vw, 0.92rem) !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
  }

  /* ── Desktop nav: hidden ── */
  #mainNav:not(.mobile-open) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
  }

  /* ── Header actions: right ── */
  .header-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    order: 2 !important;
  }

  /* Hide desktop-only CTA buttons */
  .header-actions .btn-primary,
  .header-actions a.btn-primary,
  .header-actions [class*="btn-primary"],
  .header-actions .toolbar-btn,
  .header-actions [class*="toolbar-btn"],
  .header-actions a[href*="invoice-generator"] {
    display: none !important;
  }

  /* ── Theme toggle ── */
  .theme-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    flex-shrink: 0 !important;
  }

  /* ── Hamburger button: right, always visible ── */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 8px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    cursor: pointer !important;
    font-size: 1.1rem !important;
    flex-shrink: 0 !important;
    order: 3 !important;
  }
  [data-theme="dark"] .mobile-menu-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
  }
  .mobile-menu-btn:active {
    background: rgba(99,102,241,0.12) !important;
    border-color: #6366f1 !important;
    color: #6366f1 !important;
  }

  /* ── Push page content below fixed header ── */
  body {
    padding-top: 60px !important;
  }

  /* ── Section padding ── */
  .hero-section {
    padding-top: clamp(28px, 6vw, 48px) !important;
    min-height: auto !important;
  }
  .blog-hero   { padding-top: 40px !important; }
  .policy-hero { padding-top: 40px !important; }

  /* ── Container ── */
  .container { padding: 0 16px; }

  /* ── Hero ── */
  .hero-section .container {
    grid-template-columns: 1fr !important;
    text-align: center;
    gap: clamp(20px, 5vw, 32px);
  }
  .hero-visual    { display: none !important; }
  .hero-badge     { justify-content: center; }
  .hero-title     { font-size: clamp(1.75rem, 7vw, 2.6rem) !important; text-align: center; }
  .hero-subtitle  { font-size: clamp(0.9rem, 3vw, 1rem) !important; text-align: center; max-width: 480px; margin: 0 auto; }
  .hero-actions   {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 12px;
  }
  .btn-hero-primary,
  .btn-hero-secondary {
    justify-content: center;
    width: 100%;
    max-width: 380px;
    min-height: 50px;
    font-size: clamp(0.9rem, 3vw, 1rem) !important;
  }
  .hero-stats    { justify-content: center; gap: 16px; flex-wrap: wrap; }
  .stat-divider  { display: none; }

  /* ── Section grids ── */
  .features-grid     { grid-template-columns: 1fr !important; }
  .testimonials-grid { grid-template-columns: 1fr !important; }
  .seo-grid          { grid-template-columns: 1fr !important; }
  .templates-grid    { flex-wrap: wrap; justify-content: center; }

  .steps-grid {
    flex-direction: column !important;
    align-items: center;
  }
  .step-card   { max-width: 100%; min-width: unset; width: 100%; }
  .step-arrow  { transform: rotate(90deg); }

  /* ── Section padding ── */
  .features-section,
  .how-it-works,
  .templates-section,
  .testimonials-section,
  .pricing-section,
  .seo-section {
    padding: clamp(36px, 8vw, 64px) 0 !important;
  }

  /* ── Footer ── */
  .footer-grid   { grid-template-columns: 1fr 1fr !important; gap: 28px; }
  .footer-bottom { flex-wrap: wrap; gap: 8px; }

  /* ── Articles ── */
  article[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
  }
  article[style*="grid-template-columns"] > div:first-child {
    min-height: 160px !important;
    font-size: 3rem !important;
  }
  article[style*="grid-template-columns"] > div:last-child {
    padding: 20px !important;
  }
  .articles-grid { grid-template-columns: repeat(2, 1fr) !important; }
  div[style*="repeat(3,1fr)"],
  div[style*="repeat(3, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Newsletter ── */
  .newsletter-flex { flex-direction: column !important; gap: 12px !important; }
  .newsletter-flex input,
  .newsletter-flex button { width: 100% !important; }

  /* ── Misc ── */
  .launch-banner      { font-size: 0.78rem !important; padding: 10px 16px !important; }
  .feature-compare-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Contact ── */
  .contact-grid       { grid-template-columns: 1fr !important; gap: 28px !important; }
  .contact-body       { padding: 48px 0 !important; }
  .form-row           { grid-template-columns: 1fr !important; gap: 0 !important; }
  .contact-form-card  { padding: 28px 20px !important; }

  /* ── Section headings ── */
  .section-title {
    font-size: clamp(1.4rem, 5.5vw, 2rem) !important;
    line-height: 1.25 !important;
  }
  .section-subtitle {
    font-size: clamp(0.88rem, 2.8vw, 1rem) !important;
  }

  /* ── General buttons ── */
  .btn-primary,
  .btn-outline,
  .btn-secondary {
    min-height: 46px !important;
    padding: 12px 20px !important;
    font-size: clamp(0.88rem, 3vw, 0.95rem) !important;
    border-radius: 8px !important;
    width: 100%;
    max-width: 100%;
    justify-content: center !important;
  }

  /* ── Cards ── */
  .feature-card,
  .testimonial-card,
  .pricing-card {
    padding: clamp(16px, 4vw, 24px) !important;
  }
}


/* ---------- LANDSCAPE PHONE: ≤ 768px height ≤ 500px ---------- */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {

  body { padding-top: 52px !important; }

  .site-header { height: 52px !important; }
  .header-inner { height: 52px !important; }

  .main-nav.mobile-open::before { height: 52px !important; min-height: 52px !important; }

  .hero-section {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }
  .hero-title    { font-size: clamp(1.4rem, 5vw, 1.8rem) !important; }
  .hero-subtitle { font-size: 0.85rem !important; }

  .hero-visual { display: none !important; }
}


/* ---------- SM / SMALL MOBILE: ≤ 480px ---------- */
@media (max-width: 480px) {
  .container { padding: 0 14px; }

  .section-title   { font-size: clamp(1.35rem, 6vw, 1.75rem) !important; }
  .hero-title      { font-size: clamp(1.65rem, 8vw, 2.1rem) !important; }

  .btn-hero-primary,
  .btn-hero-secondary {
    padding: 14px 20px !important;
    font-size: 0.9rem !important;
    max-width: 100%;
  }

  .footer-grid   { grid-template-columns: 1fr !important; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .articles-grid { grid-template-columns: 1fr !important; }
  div[style*="repeat(3,1fr)"], div[style*="repeat(3, 1fr)"],
  div[style*="repeat(2,1fr)"], div[style*="repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  .pricing-card    { padding: 24px 18px !important; }
  .template-card   { width: 140px; }
  .template-thumb  { height: 160px; }

  .templates-cta { flex-direction: column; align-items: center; }
  .templates-cta .btn-primary,
  .templates-cta .btn-outline {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  .contact-form-card { padding: 22px 16px !important; }
  .team-grid         { grid-template-columns: 1fr !important; }

  .launch-banner {
    font-size: 0.72rem !important;
    padding: 8px 12px !important;
    line-height: 1.4;
  }

  /* Stack feature cards fully */
  .feature-card {
    flex-direction: column !important;
    text-align: center !important;
  }
  .feature-icon {
    margin: 0 auto 12px !important;
  }

  /* Testimonial cards */
  .testimonial-card {
    padding: 20px 16px !important;
  }
}


/* ---------- XS / EXTRA SMALL: ≤ 360px ---------- */
@media (max-width: 360px) {
  .container { padding: 0 12px; }

  .hero-title    { font-size: 1.6rem !important; }
  .section-title { font-size: 1.25rem !important; }
  .logo-text     { font-size: 0.8rem !important; }

  .btn-hero-primary,
  .btn-hero-secondary {
    font-size: 0.85rem !important;
    padding: 12px 14px !important;
  }

  .mobile-menu-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  .main-nav.mobile-open {
    width: clamp(220px, 88vw, 280px) !important;
  }

  /* Tighter section padding on tiny phones */
  .features-section,
  .how-it-works,
  .templates-section,
  .testimonials-section,
  .pricing-section,
  .seo-section {
    padding: 32px 0 !important;
  }
}


/* =====================================================
   5. INVOICE GENERATOR RESPONSIVE
===================================================== */
@media (max-width: 900px) {
  body.generator-body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  .generator-page {
    height: auto !important;
    min-height: calc(100vh - 60px);
    overflow: visible !important;
  }
  .generator-main {
    grid-template-columns: 1fr !important;
    height: auto !important;
    overflow: visible !important;
  }
  .mobile-tab-switcher { display: flex !important; }
  .generator-form-panel {
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    min-height: 50vh;
    overflow-y: visible !important;
  }
  .generator-preview-panel { display: none; height: auto !important; }
  .generator-preview-panel.mobile-active {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 16px;
  }
  .generator-toolbar {
    flex-wrap: wrap;
    height: auto !important;
    padding: 10px 16px;
    gap: 8px;
  }
  .toolbar-btn-text   { display: none; }
  .template-select-bar {
    padding: 8px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .toolbar-left,
  .toolbar-right { gap: 6px; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .generator-form-panel    { padding: 14px 14px 80px !important; }
  .generator-preview-panel { padding: 12px 10px !important; }
  .progress-steps  { display: none; }
  .generator-toolbar { padding: 8px 12px; gap: 6px; }
  .toolbar-btn { padding: 8px 10px; font-size: 0.8rem; }
  .invoice-preview-wrap {
    transform: scale(0.75);
    transform-origin: top center;
    width: 133%;
    margin-left: -16.5%;
  }
}

@media (max-width: 400px) {
  .generator-form-panel { padding: 10px 10px 80px !important; }
  .invoice-preview-wrap {
    transform: scale(0.62);
    transform-origin: top center;
    width: 161%;
    margin-left: -30.5%;
  }
}


/* =====================================================
   6. BLOG / ARTICLE PAGES RESPONSIVE
===================================================== */
@media (max-width: 768px) {
  .blog-wrap         { padding: 0 16px 60px !important; }
  .blog-wrap h2      { font-size: clamp(1.2rem, 4.5vw, 1.35rem) !important; }
  .blog-wrap h3      { font-size: clamp(1rem, 4vw, 1.12rem) !important; }
  .blog-toc          { padding: 16px !important; }
  .blog-cta-box      { padding: 20px 16px !important; }
  .blog-hero h1      { font-size: clamp(1.4rem, 6vw, 2.1rem) !important; }
  .blog-content-layout {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .blog-sidebar { display: none !important; }

  /* Make blog tables scrollable */
  .blog-wrap .table-wrap,
  .blog-wrap table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .blog-wrap { padding: 0 12px 48px !important; }
  .blog-wrap h2 { font-size: 1.15rem !important; }
  .blog-wrap table {
    font-size: 0.82rem !important;
  }
  .blog-wrap table th,
  .blog-wrap table td { padding: 8px !important; }
  .blog-wrap pre,
  .blog-wrap code {
    font-size: 0.78rem !important;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }
}


/* =====================================================
   7. UTILITY / ACCESSIBILITY
===================================================== */

/* Prevent body scroll when drawer is open */
body.drawer-open {
  overflow: hidden !important;
  /* keep page content visible behind transparent overlay */
}

/* Focus ring for keyboard nav */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive embed (video, maps, iframes) */
.embed-responsive {
  position: relative;
  display: block;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  overflow: hidden;
}
.embed-responsive iframe,
.embed-responsive video,
.embed-responsive embed,
.embed-responsive object {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* Responsive data tables */
@media (max-width: 600px) {
  .responsive-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }
}

/* Image with caption */
figure {
  margin: 0;
}
figure img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}
figcaption {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 6px;
  text-align: center;
}

/* Print: hide navigation */
@media print {
  .site-header,
  .mobile-menu-btn,
  .mobile-nav-overlay,
  .main-nav,
  .footer { display: none !important; }
  body    { padding-top: 0 !important; }
  *       { color: #000 !important; background: transparent !important; }
}
