:root {
  --ink: #0f172a;
  --muted: #475569;
  --accent: #10b981;
  --bg: #ffffff;
  --card: #f8fafc;
  --border: #e2e8f0;
  --shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  --fs-body: clamp(14px, 3.2vw, 16px);
  --fs-small: clamp(12px, 2.6vw, 14px);
  --fs-h1: clamp(22px, 5vw, 30px);
  --fs-h2: clamp(18px, 4vw, 24px);
  --radius: 14px;
}


/* 💥 Kill mobile cutoff once and for all */
html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}
.wrap,
.container,
.content-area,
.sidebar,
.right-panel {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Header */
header {
  padding: 14px 16px;
  text-align: center;
  background: linear-gradient(90deg, #10b98122, #06b6d422);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: var(--fs-h1);
  margin: 0 0 6px;
  color: #0f172a;
  font-weight: 700;
}

header .subtitle {
  font-size: var(--fs-small);
  color: var(--muted);
}

/* Navigation */
.navbar {
  background: #2c3e50;
  color: #fff;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
}

.nav-logo {
  font-weight: bold;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.2rem;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
}

.nav-links a:hover {
  color: var(--accent);
}

/* Layout */
.container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1.5rem;
  max-width: 100%;
  margin: auto;
}

.sidebar,
.right-panel {
  flex: 0 0 250px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
}

.content-area {
  flex: 1;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  padding: 1.5rem;
}

/* Typography */
h2 {
  font-size: var(--fs-h2);
  margin-bottom: 0.75rem;
  color: #333;
}

p, li {
  font-size: var(--fs-body);
  line-height: 1.6;
  margin: 0.5rem 0;
}

ul {
  padding-left: 1.25rem;
}

code, pre {
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
}

/* Buttons */
.next-button,
.previous-button,
.contact-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  font-size: 1rem;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.next-button {
  background: #1abc9c;
}
.next-button:hover {
  background: #16a085;
}

.previous-button {
  background: #3498db;
}
.previous-button:hover {
  background: #2980b9;
}

.contact-btn {
  background: #0d6efd;
}
.contact-btn:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}
.contact-btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Figures */
.quad-img,
#quad-img,
#trig-diagram {
  display: block;
  margin: 10px auto;
  max-width: 140px;
  width: 100%;
  height: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}
.quad-img:hover,
#quad-img:hover,
#trig-diagram:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* MathJax */
.mathjax,
.mjx-chtml {
  font-size: 1.2em;
  color: #222 !important;
  line-height: 1.5;
  overflow-x: auto;
  display: block;
}

/* Back to Top Button */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 25px;
  background-color: #f8f9fa;
  border: 1px solid #ccc;
  padding: 10px 15px;
  border-radius: 25px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
  z-index: 1000;
}

#backToTop a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
  font-size: 14px;
}

#backToTop:hover {
  background-color: #e2e6ea;
}

/* Grid helpers */
.grid {
  display: grid;
  gap: 16px;
}
.grid.two-col {
  grid-template-columns: 1fr 1fr;
}
/* Layout: Fluid and Edge-to-Edge */
.container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1rem 1.2rem;
  margin: 0 auto;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Content spans full available width */
.content-area {
  flex: 1 1 0%;
  width: 100%;
  min-width: 0;
  background: #fff;
  color: #222;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* Sidebars — collapsible or stacked */
.sidebar,
.right-panel {
  flex: 1 1 250px;
  min-width: 240px;
  max-width: 300px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: var(--radius);
  box-sizing: border-box;
}

/* Responsive: stack layout on smaller screens */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
    padding: 1rem;
  }

  .sidebar,
  .right-panel {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }

  .content-area {
    width: 100%;
  }
}

/* Make sure images and content don’t overflow */
img, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.wrap {
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  max-width: 100%;
  width: 100%;
}

/* Mobile Optimization */
@media (max-width: 1024px) {
  .grid.two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /*.container {*/
  /*  flex-direction: column;*/
  /*  padding: 1rem;*/
  /*}*/
    .wrap, .container {
    padding: 0 !important;
  }
  
  .content-area, .sidebar, .right-panel {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .sidebar,
  .right-panel,
  .content-area {
    width: 100%;
    flex: unset;
  }
  .wrap {
    padding: 0 12px;
  }
  section {
    padding: 10px;
  }
  h2 {
    margin-bottom: 8px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 12px;
  }
  h1 {
    font-size: 1.4rem;
  }
  .nav-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  body {
    background: #0b1220;
    color: #e5e7eb;
  }

  .content-area,
  .sidebar,
  .right-panel {
    background: #0f172a;
    border-color: #233044;
  }

  header {
    border-bottom-color: #334155;
  }

  .quad-img,
  #quad-img,
  #trig-diagram {
    background-color: #0f172a;
    border-color: #334155;
  }

  .nav-links a:hover,
  .contact-btn:hover {
    color: #34d399;
  }
}

/* Print Styles */
@media print {
  header,
  footer,
  .navbar,
  #backToTop {
    display: none;
  }

  .content-area {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .wrap {
    padding: 0;
  }
}
.site-header {
  background: radial-gradient(1000px circle at 50% 0, #ecfdf5, #ffffff 60%);
  border-bottom: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: radial-gradient(1000px circle at 50% 0, #0b1220, #0f172a 60%);
  }
}
/* 📱 Mobile fix: stack layout vertically */
@media (max-width: 1024px) {
  .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 1rem;
  }

  .sidebar,
  .right-panel,
  .content-area {
    width: 100% !important;
    max-width: 100% !important;
    flex: unset !important;
    margin: 0 !important;
  }

  .content-area {
    order: 2;
  }

  .sidebar {
    order: 1;
  }

  .right-panel {
    order: 3;
  }
}

/*scify*/
/* --- Sci-Fi Glow Logo --- */
/* --- Sci-Fi Glow Logo --- */
.logo-glow {
  font-weight: 800;
  font-size: clamp(22px, 5vw, 30px);
  color: var(--accent);
  text-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  font-family: 'Orbitron', sans-serif;
}

.nav-sub {
  font-size: var(--fs-small);
  color: var(--muted);
  margin-left: 6px;
}

/* --- Menu toggle button --- */
.menu-toggle {
  display: none;
  font-size: 28px;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
}

/* --- Nav menu default --- */
.nav-menu {
  display: block;
}

/* Force visible nav links */
.nav-links {
  display: flex;
  gap: 1.2rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--accent);
}
/* --- Responsive behavior --- */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
  }

  .nav-menu.open {
    display: block;
  }

  .nav-links {
    flex-direction: column;
    background: var(--card);
    padding: 12px;
    border-radius: var(--radius);
    gap: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }

  .nav-links a {
    color: var(--ink);
  }
}
@media (max-width: 768px) {
  body, html {
    overflow-x: hidden !important;
  }

  .wrap, .container, .content-area, .sidebar, .right-panel {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }

  .content-area,
  .sidebar,
  .right-panel {
    padding: 1rem !important;
  }
}

/*footer */
/* ===== Sci-Fi Footer ===== */
.site-footer{
  width:100%;
  border-top:1px solid var(--border);
  background:
    radial-gradient(900px 500px at 50% 120%, rgba(16,185,129,0.08), transparent 60%),
    radial-gradient(600px 300px at 10% 100%, rgba(6,182,212,0.08), transparent 60%),
    var(--bg);
  padding: 24px 16px 18px;
}
@media (prefers-color-scheme: dark){
  .site-footer{
    background:
      radial-gradient(900px 500px at 50% 120%, rgba(52,211,153,0.12), transparent 60%),
      radial-gradient(600px 300px at 10% 100%, rgba(14,165,233,0.12), transparent 60%),
      #0f172a;
    border-top-color:#233044;
  }
}

.footer-wrap{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 18px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px){
  .footer-wrap{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px){
  .footer-wrap{ grid-template-columns: 1fr; }
}

.footer-brand .logo-glow{
  display:inline-block;
  line-height:1.1;
}
.footer-tag{
  margin:6px 0 12px;
  color:var(--muted);
  font-size: var(--fs-small);
}

.footer-col h3{
  margin:0 0 8px;
  font-size: clamp(14px,2.6vw,16px);
  color: var(--ink);
}
@media (prefers-color-scheme: dark){
  .footer-col h3{ color:#e5e7eb; }
}

.footer-col ul{
  list-style:none;
  margin:0; padding:0;
  display:grid; gap:8px;
}
.footer-col a{
  text-decoration:none;
  color: var(--ink);
  font-size: var(--fs-body);
  transition: color .2s ease, text-shadow .2s ease;
}
.footer-col a:hover{
  color: var(--accent);
  text-shadow: 0 0 6px rgba(16,185,129,.35);
}
@media (prefers-color-scheme: dark){
  .footer-col a{ color:#e5e7eb; }
}

/* social row */
.footer-social{
  display:flex; align-items:center; gap:10px;
  list-style:none; margin:10px 0 0; padding:0;
}
.footer-social a{
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 10px; border:1px solid var(--border);
  border-radius:10px; text-decoration:none;
  color: var(--ink); background: var(--card);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.footer-social a:hover{
  transform: translateY(-1px);
  border-color: rgba(16,185,129,.5);
  box-shadow: 0 4px 12px rgba(16,185,129,.15);
}
.footer-social svg{ fill: currentColor; display:block; }

.footer-small{ font-size: var(--fs-small); color: var(--muted); }

/* legal strip */
.footer-legal{
  max-width:1200px;
  margin:12px auto 0;
  padding-top:12px;
  border-top:1px dashed var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  flex-wrap:wrap;
}
.footer-legal p{ margin:0; color:var(--muted); font-size: var(--fs-small); }
.footer-top{
  text-decoration:none; font-weight:700; font-size: var(--fs-small);
  color: var(--ink); padding:6px 10px; border-radius:8px;
  border:1px solid var(--border); background: var(--card);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.footer-top:hover{
  transform: translateY(-1px);
  border-color: rgba(16,185,129,.5);
  box-shadow: 0 4px 12px rgba(16,185,129,.15);
}

/* mobile safety: no overflow from footer */
@media (max-width: 768px){
  .site-footer, .footer-wrap, .footer-legal{
    width:100%; max-width:100%; overflow-x:hidden;
  }
}

/*dropdown menu css */
/* Position dropdowns properly */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 0.5rem 0;
  z-index: 2000;
}

/* Show dropdown on hover (desktop) */
.dropdown:hover > .dropdown-menu {
  display: block;
}

/* Style dropdown links */
.dropdown-menu li {
  list-style: none;
}
.dropdown-menu li a {
  display: block;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.95rem;
  transition: background 0.2s ease;
}
.dropdown-menu li a:hover {
  background: rgba(16,185,129,0.08);
  color: var(--accent);
}
