/* =====================================================================
   MyMathsClub Website Theme & Page Stylesheet
   Color Palette: #36003F Imperial Purple Theme with High-Contrast Gradients
   ===================================================================== */

:root {
  --theme-main: #36003f;
  --theme-deep: #1c0021;
  --theme-light: #5c0b6b;
  --theme-glow: rgba(192, 132, 252, 0.35);
  
  --card-bg: linear-gradient(180deg, rgba(65, 5, 77, 0.78) 0%, rgba(38, 2, 45, 0.92) 100%);
  --card-border: rgba(216, 180, 254, 0.22);
  --card-border-hover: rgba(251, 191, 36, 0.6);
  
  --site-text: #ffffff;
  --site-body: #f3e8ff;
  --site-muted: #d8b4fe;
  
  --accent-gold: #fbbf24;
  --accent-amber: #f59e0b;
  --accent-cyan: #38bdf8;
  --accent-lilac: #e879f9;

  /* Header & Floating Dock Clearance Tokens for Tablet/Mobile */
  --site-header-clearance-desktop: 50px;
  --site-header-clearance-tablet: 165px;
  --site-header-clearance-mobile: 195px;
  --site-dock-clearance-mobile: 180px;
}

/* Base resets & typography */
body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--theme-deep);
  background-image: 
    radial-gradient(circle at 50% 0%, #5c0b6b 0%, #36003f 42%, #1c0021 100%),
    linear-gradient(180deg, #36003f 0%, #1c0021 100%);
  background-attachment: fixed;
  color: var(--site-body);
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #fde047;
}

/* Hero Section */
.hero-section {
  text-align: center;
  position: relative;
  z-index: 1;
  padding: var(--site-header-clearance-desktop) 20px 24px;
  max-width: 960px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--accent-gold);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 9999px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.15);
}

.hero-pill svg {
  color: var(--accent-gold);
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 16px;
  letter-spacing: -1px;
  color: #ffffff;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #ffffff 25%, #fde047 70%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(251, 191, 36, 0.3));
}

.hero-desc {
  font-size: 17.5px;
  color: var(--site-body);
  max-width: 740px;
  margin: 0 auto 26px;
  line-height: 1.65;
}

.hero-features-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.chip-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(54, 0, 63, 0.65);
  border: 1px solid rgba(216, 180, 254, 0.25);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: #ffffff;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.chip-item svg {
  color: var(--accent-gold);
}

/* Calculator Section & Viewport */
.calculator-section {
  position: relative;
  padding: 10px 16px 48px;
  display: flex;
  justify-content: center;
}

#calculator-viewport {
  background: transparent;
  padding: 0;
  min-height: auto;
}

/* Quick Mode Bar */
.quick-modes-card {
  background: linear-gradient(180deg, rgba(65, 5, 77, 0.85) 0%, rgba(42, 2, 49, 0.95) 100%);
  border: 1px solid rgba(216, 180, 254, 0.25);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.quick-modes-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.quick-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.btn-quick-mode {
  background: rgba(54, 0, 63, 0.85);
  border: 1px solid rgba(216, 180, 254, 0.22);
  color: #f3e8ff;
  border-radius: 8px;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-quick-mode:hover {
  background: #5c0b6b;
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
  transform: translateY(-1px);
}

/* Content Sections Container */
.content-wrapper {
  max-width: 1200px;
  margin: 30px auto 70px;
  padding: 0 24px;
}

.section-header {
  text-align: center;
  margin-bottom: 44px;
}

.section-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
  display: inline-block;
}

.section-title {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 14px;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.section-desc {
  font-size: 16.5px;
  color: var(--site-body);
  max-width: 720px;
  margin: 0 auto;
}

/* 8 Modes Grid */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 22px;
  margin-bottom: 70px;
}

.mode-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(84, 9, 96, 0.2);
}

.mode-card:hover {
  transform: translateY(-5px);
  border-color: var(--card-border-hover);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(251, 191, 36, 0.25);
}

.mode-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mode-card-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
}

.mode-card-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(216, 180, 254, 0.18);
  padding: 3px 9px;
  border-radius: 4px;
}

.mode-card-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px;
}

.mode-card-desc {
  font-size: 14px;
  color: var(--site-body);
  line-height: 1.6;
  margin-bottom: 18px;
}

.mode-card-examples {
  background: rgba(26, 0, 32, 0.7);
  border: 1px solid rgba(216, 180, 254, 0.18);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #fef08a;
}

.mode-card-examples span {
  color: var(--site-muted);
  display: block;
  font-size: 11px;
  margin-bottom: 3px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* Constants & Conversions Tables */
.ref-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 26px;
  margin-bottom: 70px;
}

.ref-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.ref-card-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ref-card-table-wrap {
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(216, 180, 254, 0.15);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: #5c0b6b transparent;
}

.ref-card-table-wrap::-webkit-scrollbar { width: 5px; height: 5px; }
.ref-card-table-wrap::-webkit-scrollbar-thumb { background: #5c0b6b; border-radius: 3px; }

.ref-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 13px;
}

.ref-table th {
  background: #36003f;
  color: #ffffff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid rgba(216, 180, 254, 0.2);
}

.ref-table td {
  padding: 10px 14px;
  border-top: 1px solid rgba(216, 180, 254, 0.08);
  color: var(--site-body);
}

.ref-table tr:hover td {
  background: rgba(92, 11, 107, 0.35);
  color: #ffffff;
}

.ref-code {
  font-family: 'Share Tech Mono', monospace;
  font-weight: 700;
  color: var(--accent-gold);
}

/* Guaranteed Visibility for Documentation Sections on all Devices */
#shortcuts,
#faq {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 5 !important;
  clear: both !important;
  margin-bottom: 70px !important;
}

/* FAQ Accordion */
.faq-grid {
  display: grid;
  gap: 16px;
  max-width: 860px;
  margin: 0 auto 60px;
}

.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.faq-item:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.faq-question {
  width: 100%;
  padding: 18px 22px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}

.faq-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: var(--accent-gold);
  font-size: 20px;
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  color: var(--site-body);
  font-size: 14.5px;
  line-height: 1.65;
  padding: 0 22px;
}

.faq-item.active .faq-answer {
  max-height: 450px;
  padding: 0 22px 20px;
}

/* =====================================================================
   Comprehensive Responsive Overrides: Tablet & Mobile
   ===================================================================== */

/* Tablet View (e.g. 768px - 1024px) */
/* Tablet View (e.g. 768px - 1024px) */
@media (max-width: 1024px) {
  .hero-section {
    padding-top: var(--site-header-clearance-tablet) !important;
    margin-top: 10px !important;
  }

  .hero-title {
    font-size: 38px;
  }
}

/* Small Tablet & Standard Mobile (max-width: 768px) */
@media (max-width: 768px) {
  .hero-section {
    padding-top: var(--site-header-clearance-mobile) !important;
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 24px !important;
    margin-top: 15px !important;
  }

  .hero-pill {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.45;
    padding: 7px 14px;
    font-size: 11.5px;
  }

  .hero-title {
    font-size: 32px;
    letter-spacing: -0.5px;
  }

  .hero-desc {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .chip-item {
    font-size: 12px;
    padding: 5px 11px;
  }

  /* Force clean 1-column layouts to prevent horizontal blowout */
  .modes-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 45px;
  }

  .ref-tables-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 50px;
  }

  /* Clear the floating circular bottom action dock (e.g. +, power, trash, X, gear) */
  .content-wrapper {
    padding: 0 16px var(--site-dock-clearance-mobile) !important;
    margin-top: 20px !important;
    margin-bottom: 50px !important;
    overflow: visible !important;
  }

  .section-title {
    font-size: 28px;
  }

  .section-desc {
    font-size: 15px;
  }

  .ref-card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .ref-card-title {
    font-size: 17px;
  }

  .faq-grid {
    margin-bottom: 40px;
  }

  .faq-question {
    font-size: 15px;
    padding: 16px 18px;
  }

  .faq-answer {
    font-size: 14px;
    padding: 0 18px;
  }

  .faq-item.active .faq-answer {
    padding: 0 18px 18px;
  }
}

/* Extra Small Phones (max-width: 480px) */
@media (max-width: 480px) {
  .hero-section {
    padding-top: 215px !important;
    margin-top: 20px !important;
  }

  .hero-title {
    font-size: 27px;
  }

  .hero-desc {
    font-size: 14.5px;
  }

  .section-title {
    font-size: 24px;
  }

  .section-desc {
    font-size: 14px;
  }

  .ref-card {
    padding: 16px 12px;
  }

  .ref-table th,
  .ref-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}
