/* --- 1. Setup --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

/* --- 2. Backgrounds (Standard Mode) --- */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: #0a0a0a;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: radial-gradient(circle at top left, rgba(92, 156, 233, 0.75), transparent 100%), radial-gradient(circle at bottom right, rgba(202, 129, 247, 0.8), transparent 100%), linear-gradient(180deg, #f7f8fb, #eef1f6);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  min-height: 100vh;
}

/* --- 3. Header --- */
#main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 55px;
  background: rgba(81, 122, 205, 0.9);
  backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  align-items: center;
  padding: 0 10%;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header-nav {
  width: 100%;
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 4 px;
}

.logo-area .header-logo {
  font-family: 'Rouge Script', cursive;
  font-size: 1.9rem;
  width:130px;
  font-weight: bolder;
}

.nav-links {
  display: flex;
  gap: 15px;
}

.nav-links a {
  text-decoration: none;
  color: black;
  font-weight:bold;
  font-size: 14px;
}

.nav-links a:hover {
  opacity: 1;
  font-weight:bold;
  color: #faf611;
}

/* --- 4. Main Layout --- */
#wpmapp {
  max-width: 750px;
  margin: 80px auto 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

section {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 10px;
}

/* --- 5. Inputs & Word Display --- */
textarea {
  width: 100%;
  min-height: 120px;
  padding: 5px;
  font-family: inherit;
  font-size: 1rem;
  margin-top: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: none;
}

textarea:focus {
  outline: none;
  border-color: #4a90e2;
}

#wpm-controls {
  display: flex;
  flex-direction: column;
  font-weight: bold;
  gap: 4px;
  max-height: 90%;
}

#wpm-controls input[type="number"] {
  width: 100px;
  padding: 3px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#display {
  display: none;
  justify-content: center;
  align-items: center;
}

#word-display {
  width: 100%;
  min-height: 120px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 600;
  text-align: center;
  border: 2px solid #222;
  border-radius: 8px;
  background-color: #fff;
  user-select: none;
}

/* --- 6. Buttons --- */
button {
  min-width: 100px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background-color: #222;
  color: #fff;
}

button:disabled {
  background-color: #aaa;
  cursor: not-allowed;
}

/* --- 7. Share Menu --- */
#share-container {
  position: fixed;
  bottom: 30px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 5px;
}

#share-main-btn {
  width: 70px;
  height: 40px;
  background-color: #4a90e2;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

#share-main-btn:hover {
  background-color: #357abd;
}

#share-menu {
  display: none;
  flex-direction: column;
  min-width: 140px;
  padding: 5px 0;
  background: #fff;
  border-radius: 8px;
  z-index: 3001;
}

#share-main-btn.active {
  background-color: #ff4d4d;
}

#share-menu a {
  display: block;
  padding: 5px 10px;
  text-decoration: none;
  font-size: 0.9rem;
  color: #222;
}

#share-menu a:hover {
  background: #f0f0f0;
}

/* --- 8. Reading Mode (Active) --- */
body.reading-mode {
  overflow: hidden;
}

body.reading-mode #main-header, 
body.reading-mode #userinput, 
body.reading-mode #start-btn-container, 
body.reading-mode #wpmdetails, 
body.reading-mode #testimonial-section, 
body.reading-mode #faqAccordion {
  display: none !important;
}

#start-btn-container{
  padding: 0px;
}

body.reading-mode #display {
  display: flex;
  position: fixed;
  inset: 0;
  background-color: rgba(245,246,248,1); /* Fully opaque */
  z-index: 10;
}

body.reading-mode #wpm-controls {
  display: flex !important;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  padding: 5px;
  border-radius: 12px;
}

#btns {
  display: none;
}

body.reading-mode #btns {
  display: flex;
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  gap: 10px;
}

#timer-display {
  display: none;
  position: fixed;
  top: 80px;
  width: 100%;
  text-align: center;
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  z-index: 20;
}

body.reading-mode #timer-display {
  display: block;
}

/* --- 9. Theme Toggle & Home Button --- */
#theme-toggle-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
}

#home-button-container {
  display: none;
  position: fixed;
  top: 40px;
  right: 20px;
  z-index: 9999;
}

body.reading-mode #home-button-container {
  display: block;
}

#custom-settings {
  display: flex;
  gap: 5px;
  align-items: center;
  background: #eee;
  font-weight: bold;
  padding: 5px;
  border-radius: 8px;
}

body.reading-mode #custom-settings {
  position: fixed;
  top: 85px;
  left: 20px;
  flex-direction: column;
  height: auto;
  z-index: 3000;
}

/* --- 10. Dark Theme Overrides --- */
body.dark-theme {
  background-color: #1a1a1a;
  background-image: radial-gradient(circle at top left, rgba(64, 200, 242, 0.3), transparent 100%), radial-gradient(circle at bottom right, rgba(235, 136, 15, 0.4), transparent 100%), linear-gradient(180deg, #121212, #1c1c1c);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  color: #f5f6f8;
}

body.dark-theme #main-header {
  background: rgba(26, 26, 26, 0.9);
}

body.dark-theme .nav-links a {
  color: #f5f6f8;
}

body.dark-theme section {
  background: rgba(40, 40, 40, 0.9);
}

body.dark-theme #word-display, 
body.dark-theme textarea, 
body.dark-theme #wpm-number, 
body.dark-theme .accordion-content {
  background-color: #2a2a2a;
  color: #fff;
  border-color: #444;
}

body.dark-theme #custom-settings {
  background: #333;
  color: #fff;
}

body.dark-theme .accordion-header {
  background: #333;
  color: #fff;
}

body.dark-theme .thought-bubble {
  background: #333;
  color: #fff;
}

body.dark-theme #share-menu {
  background: #333;
}

body.dark-theme #share-menu a {
  color: #f5f6f8;
}

body.dark-theme #share-menu a:hover {
  background: #444;
}

body.dark-theme button:not(#theme-toggle):not(#home-btn) {
  background-color: #4a90e2;
}

body.reading-mode.dark-theme #display {
  background-color: rgba(26,26,26,1); /* Fully opaque */
}

body.reading-mode.dark-theme #wpm-controls {
  background: rgba(40,40,40,0.85);
}

/* --- 11. Progress Bar --- */
#progress-container {
  display: none;
  position: fixed;
  top: 500px;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.1);
  z-index: 3000;
}

body.reading-mode #progress-container {
  display: block;
}

#progress-bar {
  height: 100%;
  width: 0;
  background: #4a90e2;
}

/* --- 12. FAQ Accordion --- */
.accordion {
  /* This centers the container and sets the boundary */
  max-width: 700px;
  margin: 30px auto; 
  border-radius: 8px;
  overflow: hidden;
  width: 95%; /* Ensures it doesn't hit screen edges on mobile */
}

.accordion-header {
  background: #f7f7f7;
  padding: 20px;
  cursor: pointer;
  font-size: 20px;
  font-family: inter;
  display: flex;
  /* Removed max-width here so it fills the 700px parent */
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  font-weight: 500px;
  padding: 0 20px;
  font-size: large;
  background: #fff;
  transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
  min-height: 50px;
  max-height: 200px;
  /* Removed max-width here */
  padding: 15px 20px;
}

/* --- 13. Testimonials --- */
#testimonial-section {
  background: transparent;
  padding: 20px 0;
  display: flex;
  gap:40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.thought-bubble {
  width: 400px;
  padding: 20px;
  background: #fff;
  border-radius: 40px;
  font-family: merriweather;
  font-size: 20px;
  margin: 0 auto 30px auto;
  transition: opacity 0.5s;
  text-align: center;
}

/* --- 14. Footer --- */
#app-footer {
  margin-top: 0px;
  min-width: 100px;
  padding-top: 10px;
  padding-bottom: 30px;
  display: flex;
  font-size: 0.93rem;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #080808;
  position: relative;
}

#app-footer nav {
  display: flex;
  gap: 15px;
}

#app-footer a {
  color: inherit;
  text-decoration: none;
}

body.reading-mode #app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 47px;
  margin-top: 0;
  padding: 5px;
  background: rgba(255,255,255,0.08);
  font-size: 0.6rem;
  pointer-events: none;
  gap: 0px;
}

body.reading-mode #app-footer a, 
body.reading-mode #app-footer p {
  pointer-events: auto;
  padding: 0px 0px;
}

body.dark-theme #app-footer {
  color: #aaa;
}

body.reading-mode.dark-theme #app-footer a, 
body.reading-mode.dark-theme #app-footer p {
  background: rgba(26, 26, 26, 0.5);
}

/* --- 15. Media Queries & Mobile Fixes --- */
@media (max-width: 768px) {
  #main-header {
    padding: 0 15px;
  }
  #wpmapp {
    width: 95%;
    margin-top: 70px;
  }
  .nav-links {
    gap: 10px;
  }
  /* Reading Mode Mobile Enhancements */
  body.reading-mode #reader-logo {
    font-size: 1.5rem !important;
    top: 15px !important;
  }
  body.reading-mode #wpm-controls {
    left: 10px !important;
    bottom: 80px !important;
    width: calc(100% - 20px) !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    background: rgba(255, 255, 255, 0.95) !important;
  }
  body.reading-mode #custom-settings {
    left: 10px !important;
    top: 60px !important;
    padding: 5px !important;
    background: rgba(255,255,255,0.8) !important;
  }
  body.reading-mode #btns {
    bottom: 20px !important;
    width: 90% !important;
    justify-content: center !important;
  }
  #share-container {
    bottom: 50px !important;
    right: 10px !important;
  }
  #share-main-btn {
    min-width: 55px !important;
    height: 40x !important;
    font-size: 0.8rem !important;
  }
  body.reading-mode #app-footer {
    font-size: 0.6rem !important;
    background: rgba(245, 246, 248, 0.2) !important;
  }
}

#reader-logo {
  display: none;
}

body.reading-mode #reader-logo {
  display: block;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  font-family: 'Rouge Script', cursive;
  font-size: 3rem;
  font-weight: bolder;
  letter-spacing: 2px;
  opacity: 0.8;
  pointer-events: none;
}

body.reading-mode.dark-theme #reader-logo {
  color: #fff;
}

.home-box {
  background: var(--accent);
  color: white;
  padding: 5px;
  border-radius: 16px;
  text-align: center;
  margin-top: 60px;
}


#wpmdetails {
  max-width: 750px;
  margin: 10px auto;
  padding: 0 10px;
  font-weight: 500;
  line-height: 1.8;
  font-size: 1.05rem;
}

#wpmdetails p {
  text-align: justify;
  font-family: inter;
  margin-bottom: 1rem;
}

/* Dark Theme Support */
body.dark-theme #wpmdetails {
  color: #d1d1d1;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  #wpmdetails {
    max-width: 100%;
    margin: 20px auto;
    font-size: 1rem;
  }
}

#contact-section {
        padding: 60px 20px;
           background: linear-gradient(135deg, #79bbdb, #ad80da, #79bbdb);
        font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        color: #2d3436;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .contact-card {
        background-image: linear-gradient(to left, rgb(72, 157, 209), rgb(255, 255, 255), rgb(72, 157, 209));
        padding: 10px;
        border-radius: 20px;
        max-width: 700px;
        width: 100%;
    }

    #contact-head h2 {
        font-size: 3rem;
        font-family: 'Fraunces';
        margin-bottom: 20px;
        color: #1c70ee;
    }

    .contact-list {
        list-style: none;
        padding: 0;
        line-height: 1.5;
        font-size: 1.2rem;
        margin-bottom: 25px;
    }

    .email-link {
        display: inline-block;
        margin-top: 15px;
        padding: 10px 20px;
        background: #6d11c3;
        color: white;
        border-radius: 8px;
        text-decoration: none;
        font-family: 'Trebuchet MS', sans-serif;
        font-weight: bold;
    }

    .email-link:hover {
        background: #3c2bb3;
    }

    .linkedin-section {
        margin-top: 30px;
        font-weight: 1000px;
        font-size: larger;
        padding-top: 20px;
        border-top: 1px solid #ddd;
    }
  

    .linkedin-icon {
        transition: opacity 0.3s;
        margin-top: 10px;
    }

    .linkedin-icon:hover {
        opacity: 0.8;
    }
html {
  /* This prevents the fixed header from covering your section titles */
  scroll-padding-top: 80px; 
  scroll-behavior: smooth;
}
#backToTop {
  /* 1. Reset conflicts from your general 'button' styles */
  min-width: 0 !important; 
  padding: 0 !important;
  box-sizing: border-box;

  /* 2. Positioning - Placed above the share button */
  display: none; 
  position: fixed;
  bottom: 100px; 
  right: 24px;
  z-index: 3000;

  /* 3. Force Circle Shape */
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;

  /* 4. Visuals */
  background-color: #5d0f16;
  color: #ffffff;
  border: none;
  cursor: pointer;

  /* 5. Center the arrow/icon */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

#backToTop:hover {
  background-color: #80151e;
}

/* Mobile Fix */
@media (max-width: 768px) {
  #backToTop {
    bottom: 100px; 
    right: 10px;
    width: 35px;
    height: 35px;
  }
}

/* Hide in reading mode */
body.reading-mode #backToTop {
  display: none !important;
}

body.reading-mode #backToTop {
  display: none !important;
}
.cta-banner {
  background-color: #1a84e2e9;
  color: white;
  width: 100%;
  min-height: 100px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.cta-banner a {
  text-decoration: none;
  color: inherit;
}

.cta-banner h2 {
  font-size: 6vw; /* desktop: large but not huge */
  font-weight: 800;
  color: rgba(251, 179, 43, 0.966);
  margin: 0;
  line-height: 1;
  font-family: 'Rouge Script', cursive;
  text-align: center;

  /* Ensure single line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: make text fill width more aggressively */
@media (max-width: 768px) {
  .cta-banner h2 {
    font-size: 12vw; /* bigger on mobile */
  }
}

@media (max-width: 480px) {
  .cta-banner h2 {
    font-size: 14vw; /* even larger on very small screens */
  }
}

/*stat card*/

        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            margin: 40px 0;
        }

        .stat-card {
            background: var(--card-bg);
            padding: 25px;
            border-radius: 12px;
            text-align: center;
        }

        .stat-card h3 {
            margin: 0;
            color: var(--accent);
            font-size: 1.5rem;
        }

        .stat-card p {
            margin: 10px 0 0;
            font-size: 0.9rem;
            color: var(--secondary);
        }

/* -------------------- Tiny mobile left-stick fix (strict, targeted overrides only) -------------------- */

@media (max-width: 420px) {
  /* Respect device safe areas and remove accidental horizontal offsets */
  html, body {
    padding-left: env(safe-area-inset-left, 0px) !important;
    padding-right: env(safe-area-inset-right, 0px) !important;
  }

  /* Tighten header padding so header contents align with centered page content */
  #main-header {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Ensure header nav content stays centered */
  #main-header .header-nav {
    max-width: calc(100% - 24px) !important;
    margin: 0 auto !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Force primary page containers to use the full available width but remain centered */
  #wpmapp,
  #wpmdetails,
  .accordion,
  .contact-card,
  .cta-banner,
  .thought-bubble,
  .stat-card,
  #testimonial-section {
    width: calc(100% - 24px) !important;
    max-width: 750px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* Center the nav links row on tiny screens */
  .nav-links {
    justify-content: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Prevent fixed reading-mode controls from hugging the left edge */
  body.reading-mode #wpm-controls,
  body.reading-mode #btns,
  body.reading-mode #custom-settings {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
  }

  /* Small adjustments for floating action buttons */
  #share-container {
    right: 8px !important;
  }
  #backToTop {
    right: 8px !important;
  }
}
