@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Lora:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #fdfdfd;
  --bg2: #f4f7f9;
  --card: #ffffff;
  --primary: #0f172a;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  --violet: #7c3aed;
  --violet-light: #f5f3ff;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --solved-bg: #f0fdf4;
  --solved: #16a34a;
  --fail-bg: #fef2f2;
  --fail: #dc2626;
  --fail-bd: #fecaca;
  --warn-bg: #fefce8;
  --warn: #ca8a04;
  --warn-bd: #fef08a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04);
  --radius: 12px;
  --sidebar-w: 280px;
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

main {
  display: block;
}

/* ── HEADER ── */
#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

#header-brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

#page-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#main-nav {
  display: flex;
  gap: 1.5rem;
  margin-right: auto;
}

#main-nav a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}

#main-nav a:hover {
  color: #fff;
}

#main-nav a.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

#nav-toggle-btn {
  display: none;
}

#tabs {
  display: flex;
  gap: .25rem;
  margin-left: auto;
  background: rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: 4px;
}

.page-tabs {
  display: flex;
  gap: .25rem;
  justify-content: center;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 10px;
  padding: 4px;
  margin: 0 auto 2rem;
  max-width: max-content;
}

.tab-btn {
  padding: .4rem 1rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  transition: all .2s;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── HERO (Common) ── */
.hero {
  padding: 2rem 2rem 2rem;
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
}

.hero-logo {
  height: 200px;
  width: auto;
  margin-bottom: 2rem;
}

.hero h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.04em;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text2);
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── FOOTER ── */
#main-footer {
  margin-top: 4rem;
  padding: 3rem 2rem;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-container {
  max-width: 800px;
  margin: 0 auto;
}

#main-footer p {
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.5rem;
  border-radius: 50%;
  background: var(--border);
}

.github-link:hover {
  color: var(--primary);
  background: var(--border2);
  transform: translateY(-2px);
}

.github-link svg {
  display: block;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #header {
    padding: 0 1rem;
    gap: 1rem;
    justify-content: space-between;
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  #page-subtitle {
    display: none;
  }

  /* Hide desktop nav links inside header on mobile */
  header #main-nav {
    display: none;
  }

  /* Mobile Nav Drawer */
  #main-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #111827; /* Darker variant for menu */
    z-index: 2000;
    padding: 5rem 2rem;
    gap: 2rem;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  }

  #main-nav.open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Mobile Nav Drawer (new element for mobile) */
  #mobile-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #111827;
    z-index: 2000;
    padding: 5rem 2rem;
    gap: 2rem;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  }

#mobile-nav.open {
    transform: translateX(0);
    visibility: visible;
  }

  #mobile-nav a {
    font-size: 1.25rem;
    padding: 0;
    border-bottom: none;
    color: rgba(255, 255, 255, 0.8);
  }

  #mobile-nav a.active {
    color: #fff;
    font-weight: 700;
  }

  #nav-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 2100;
  }

  #nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1900;
  }

  #nav-overlay.open {
    display: block;
  }

  .hero h2 {
    font-size: 2.5rem;
  }
}

@media (max-width: 600px) {
  #tabs {
    display: none;
  }
}

/* ── PRINT STYLES ── */
@media print {
  @page {
    margin: 2cm;
  }

  #header,
  .hero,
  #main-footer {
    display: none !important;
  }

  body {
    background: white !important;
    padding: 0 !important;
    color: black !important;
    line-height: 1.5;
  }
}

/* MathJax inline fix */
mjx-container {
  overflow-x: auto;
  max-width: 100%;
}
