/* === UNIVERSAL TAP & FOCUS FIX === */
*:focus, *:active, button:focus, button:active, a:focus, a:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Existing CSS starts below */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
...
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* Remove blue highlight on tap for all buttons and clickable elements */
button, a {
    -webkit-tap-highlight-color: transparent; /* Chrome, Safari, iOS */
    outline: none; /* remove focus outline if needed */
}
body {
 /* === HEADER & THEME TOGGLE POSITIONING === */
.header {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center; /* keeps the title centered */
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 3rem; /* increased spacing from top / menu button */
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem; /* pushes title lower */
}

.theme-toggle {
    position: fixed; /* moves to top-right */
    top: 1.5rem; /* same vertical as menu button */
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.8;
    z-index: 1510; /* above everything else */
    -webkit-tap-highlight-color: transparent;
    outline: none;
    padding: 0.3rem;
}

.theme-toggle:hover {
    transform: scale(1.1);
    opacity: 1;
}

body.dark .theme-toggle {
    color: #f0f0f0;
}

body.light .theme-toggle {
    color: #121212;
}

/* Ensure header title does not overlap menu or theme button on small screens */
@media (max-width: 768px) {
    .header h1 {
        margin-top: 2rem;
        font-size: 1.8rem;
    }

    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }
} 
    font-family: 'Inter', sans-serif;
    transition: background-color 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(5px);
    z-index: -1;
    pointer-events: none;
}

body.dark {
    background-color: #121212;
    color: #f0f0f0;
}

body.light {
    background-color: #f5f5f5;
    color: #121212;
}

.gradient-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
    transition: background 0.4s ease;
}

body.dark .gradient-bg {
    background: radial-gradient(circle, rgba(139, 0, 0, 0.15), transparent 70%);
}

body.light .gradient-bg {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.08), transparent 70%);
}

.header {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.header.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.8;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    padding: 0.3rem;
    margin-left: 0.5rem;
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle:hover {
    transform: scale(1.1);
    opacity: 1;
}

body.dark .theme-toggle {
    color: #f0f0f0;
}

body.light .theme-toggle {
    color: #121212;
}

.container {
    max-width: 1200px;
    width: 100%;
    z-index: 1;
    position: relative;
}

h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: visible;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    border-radius: 20px;
    z-index: -1;
    transition: opacity 0.3s ease;
}

body.dark .book-card::before {
    background: radial-gradient(circle, rgba(139, 0, 0, 0.075), transparent 70%);
    opacity: 1;
}

body.light .book-card::before {
    background: radial-gradient(circle, rgba(139, 0, 0, 0.045), transparent 70%);
    opacity: 1;
}

.book-card:hover::before {
    opacity: 1.5;
}

body.dark .book-card {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light .book-card {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.book-card:hover {
    transform: translateY(-5px);
}

body.dark .book-card:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

body.light .book-card:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

.book-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.book-description {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.8;
    font-weight: 400;
}

.coming-soon-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
    backdrop-filter: blur(10px);
}

body.dark .coming-soon-badge {
    background: #333333;
    color: #fcfcfc;
}

body.light .coming-soon-badge {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.book-subtitle {
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 2rem;
    opacity: 0.7;
    font-weight: 400;
}
/* UNIVERSAL PAGE SUBTITLE */
.page-subtitle {
  margin-top: -5px;       /* pull subtitle slightly up */
  margin-bottom: 1rem;    /* small gap below subtitle */
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.2;       /* tighter line-height */
  text-align: center;
  opacity: 0.7;
  transform: translateY(0);
  transition: opacity 0.28s ease-out, transform 0.28s ease-out;

  pointer-events: none;   /* avoids weird interaction during fade */
}

/* Fade out when header hides */
.header.hide .page-subtitle {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

/* Light and Dark mode styling */
body.dark .page-subtitle {
  color: #ffffff;
}

body.light .page-subtitle {
  color: #000000;
}

/* Header layout */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header, 
.header h1, 
.header .page-subtitle {
  font-family: 'Inter', sans-serif;  /* matches your site */
}

/* UNIVERSAL HEADER + SUBTITLE SPACING */
.header h1 {
  margin-bottom: 0.2rem;   /* small gap below h1 */
}

.header .page-subtitle {
  margin-top: 0.4rem;           /* hugs h1 tightly */
  margin-bottom: 1.5rem;   /* optional, small gap after subtitle */
  font-size: 1rem;
  line-height:0.7;
  text-align: center;
  font-weight: 400;
}
/* Small screens improvement */
@media (max-width: 450px) {
  .page-subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
}
  /* Override header margins only on index page */
  .header {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  
  .header h1 {
    margin-bottom: 0.0rem !important; /* This is the key one! */
  }
    /* Continue Reading Card (styled like book-card) */
    .continue-card {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 0px auto 3px;
      width: 85%;
      max-width: 520px;
      padding: 18px 22px;
      border-radius: 14px;
      border: 1px solid var(--border-color, #333);
      background-color: var(--card-bg, rgba(0,0,0,0.6));
      color: var(--text-color, #fff);
      transition: all 0.3s ease;
      cursor: pointer;
    }

    body.dark .continue-card {
      --card-bg: rgba(32,32,32,.7);
      --text-color: #fff;
      --border-color: #444;
    }

    body.light .continue-card {
      --card-bg: rgba(255,255,255,0.8);
      --text-color: #000;
      --border-color: #ccc;
    }

    .continue-card:hover {
      transform: scale(1.02);
      border-color: #2c2c2c;
      box-shadow: 0 0 12px rgba(34, 1, 2, .3);
    }

    .continue-text {
      flex: 1;
    }

    .continue-text h3 {
      margin: 0;
      font-size: 0.85rem;
    }

    .continue-text p {
      margin: 0px 0 0;
      font-size: 0.7rem;
      opacity: 0.5;
    }

    .continue-icon {
      width: 45px;
      height: 45px;
      border-radius: 50%;
      background: #343434;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-left: 15px;
      box-shadow: 0 0 5px rgba(108,108,108,0.4);
    }

    body.light .continue-icon {
      background: #ffffff;
    }

    .continue-icon span {
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(1px, -4px); /* Adjust Y position */
  line-height: 1;
}
body.light .continue-icon span {
      color: #000000;
    }
/* Buttons*/
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    backdrop-filter: blur(10px);
    overflow: visible;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 10px;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(20px);
}

body.dark .btn {
    background: rgba(27,27,27,.9);
    color: #fff;
    border: 1px solid #444; /* Add border for dark mode */
}

body.light .btn {
    background: #ffffff;
    color: #000000;
    border: 1px solid #ccc; /* Add border for light mode */
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn:hover::before {
    opacity: 0.2;
}

body.dark .btn:hover {
    background: #000000;
}

body.light .btn:hover {
    background: #000000;
}

.read-short-section {
    margin-top: 3rem;
    text-align: center;
}

.read-short-btn {
    padding: 1rem 7rem;
    font-size: 1.1rem;
}

.contact-section {
    text-align: center;
    margin-top: 4rem;
    opacity: 0.8;
}

/* Download Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup {
    background: inherit;
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popup-overlay.show .popup {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    color: inherit;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close:hover {
    opacity: 1;
}

.popup-message {
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

/* Instagram Button Styles */
.instagram-btn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 100;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: visible;
}

.instagram-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 50%;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(20px);
}

body.dark .instagram-btn {
    background: #8B0000;
    color: #fff;
}

body.dark .instagram-btn::before {
    background: #8B0000;
    opacity: 0.125;
}

body.light .instagram-btn {
    background: #000;
    color: #fff;
}

body.light .instagram-btn::before {
    background: #8B0000;
    opacity: 0.075;
}

.instagram-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.instagram-btn:hover::before {
    opacity: 0.2;
}

body.dark .instagram-btn:hover {
    background: #A00000;
}

body.light .instagram-btn:hover {
    background: #333;
}

/* Instagram Popup Styles */
.instagram-popup {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: inherit;
    padding: 1.5rem;
    border-radius: 15px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.instagram-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.instagram-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.instagram-handle {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

.copy-btn {
    background: #8B0000;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    animation: heartbeat-glow 2s ease-in-out infinite;
}

.copy-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 10px;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(20px);
    background: #8B0000;
    opacity: 0.3;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.copy-btn:hover::before {
    opacity: 0.5;
}

.copy-btn:active {
    transform: translateY(0);
}

@keyframes heartbeat-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 0, 0, 0.6), 0 0 30px rgba(139, 0, 0, 0.4);
    }
}

.copy-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

.contact-section a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.contact-section a:hover {
    opacity: 0.6;
}

/* Writing Page Styles */
.writing-page {
    display: none;
    min-height: 100vh;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    position: relative;
}

.writing-page.active {
    display: block;
}

.close-btn {
    position: fixed;
    top: 2rem;
    left: 2rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
    color: inherit;
    line-height: 1;
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.close-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.writing-content {
    margin-top: 4rem;
}

.writing-title {
    font-family: 'Times New Roman', Times, serif;
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 3rem;
}

.writing-text {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.2rem;
    line-height: 1.9;
    margin-bottom: 4rem;
    white-space: pre-wrap;
}

.writing-attribution {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 3rem;
}

.attribution-written {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.attribution-by {
    font-family: 'Dancing Script', cursive;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.attribution-author {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.read-another-btn {
    display: block;
    margin: 0 auto;
    padding: 0.75rem 2rem;
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .book-card {
        padding: 2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .writing-title {
        font-size: 2rem;
    }

    .writing-text {
        font-size: 1.1rem;
    }

    .close-btn {
        top: 1rem;
        left: 1rem;
        font-size: 2rem;
    }
    html, body {
  width: 100%;
  overflow-x: hidden !important;
}
}
/* Quick-fix: hide-on-scroll targets actually used in your HTML */
.header.hide,
.menu-toggle.hide,
.menu-wrapper.hide,
.theme-toggle.hide,
.menu-wrapper.hide {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
