* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    scroll-padding-top: 50px;
}

/* MathJax: scroll wide equations sideways instead of pushing page width out */
.MathJax_Display,
mjx-container[display="true"],
mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

body {
    font-family: Roboto, 'Selawik', Tahoma, Geneva, Verdana, sans-serif;
}

header {
    background: #ff7f50;
    padding: 1rem 0rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: padding 0.3s ease;
}

header.scrolled {
    padding: 0.5rem 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.3s ease, font-size 0.3s ease;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

header.scrolled .logo {
    font-size: 1.2rem;
}

.logo:hover {
    transform: scale(1.1);
}

.desktop-nav {
    display: flex;
    flex: 1;
    max-width: 400px; /* Adjust this value to control max spread */
    margin: 0 2rem;
}

.desktop-nav ul {
    list-style: none;
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.desktop-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: opacity 0.3s ease;
    position: relative;
}

header.scrolled .desktop-nav a {
    font-size: 1rem;
}

.desktop-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.desktop-nav a:hover::after {
    width: 100%;
}

/* Hamburger Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 28px;
    height: 3px;
    background: white;
    position: relative;
    transition: all 0.3s ease;
    left: 0;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 28px;
    height: 3px;
    background: white;
    transition: all 0.3s ease;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.menu-toggle.active .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    background: #ff7f50;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

header.scrolled .mobile-menu {
    margin-top: -21px;
}
  
.mobile-menu.active {
    max-height: 500px;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
}

.mobile-nav li {
    border-top: 1px solid rgba(255,255,255,0.2);
}

.mobile-nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    font-weight: bold;
    font-size: 1.1rem;
    transition: background 0.3s ease;
}

.mobile-nav a:hover {
    background: rgba(255,255,255,0.1);
}

.page-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    gap: 2rem;
    flex-direction: row-reverse;
}

.primer-section {
    padding: 2rem;
}

.primer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.primer-box {
    background: #ffd7c8;
    padding: 1.5rem;
    border-radius: 12px;
}

.primer-box h2 {
    margin-top: 0;
    color: #ff7f50;
}

.primer-box ul {
    color: #333;
    line-height: 1.8;
    margin-left: 2rem;
}

.hero-section {
    margin-top: 80px;
    padding: 3rem 2rem;
    background: #ffd7c8;
    color: black;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
  	color: #ff7f50;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 700px;
}

.hero-content p a {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 700px;
    color: #ff7f50;;
}
    
.main-content {
    flex: 1;
    min-width: 0;
    margin-top:-28px;
}

.main-content a {
    color:#ff7f50;
    font-weight:bold;
}

.content-section {
    margin: 3rem 0;
}

.content-section h2 {
    color: #ff7f50;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.content-section h3 {
    color: black;
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-section p {
    color: #333;
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.content-section ul {
    color: #333;
    line-height: 1.8;
    margin-left: 2rem;
    margin-bottom: 1rem;
}

img {
    max-width: 50%;
    height: auto;
    border:#eee 1px solid;
    border-radius: 8px;
    padding: 8px;
    display: block;
    margin: auto;
    font-family: Roboto, 'Selawik', Tahoma, Geneva, Verdana, sans-serif;
}

figcaption {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 2rem;
    font-style: italic;
    font-weight: bold;
    max-width: 50%;
    display: block;
    margin: auto auto 1rem auto;
    text-align: center;
}

.tg  {
    border-collapse:collapse;
    border-spacing:0;
    margin-bottom: 1rem;
    display: block;
    overflow-x: auto;
}

.tg td{
    border-color:black;
    border-style:solid;
    border-width:1px;
    padding: 0.4rem;
    overflow:hidden;
    word-break:normal;
}

.tg th{
    border-color:black;
    background-color: #ffd7c8;
    border-style:solid;
    border-width:1px;
    font-weight:normal;
    overflow:hidden;
    padding:0.4rem;
    word-break:normal;
}

.tg .tg-baqh{ 
    text-align:left;
    vertical-align:center;
    padding:0.5rem;
}

.tg ul {
    text-align:left;
}

caption {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.2rem;
    font-style: italic;
    font-weight: bold;
    text-align: left;
}

.table-of-contents {
    width: 250px;
    position: sticky;
    top: 40px;
    height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    border-right: 1px solid #eee;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
}

.table-of-contents li {
    margin: 10px 0;
}

.table-of-contents li.toc-h3 {
    margin-left: 15px;
    font-size: 0.9rem;
}

.table-of-contents a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
}

.table-of-contents a:hover {
    color: #ff7f50;
}

.section-title {
    color: #ff7f50;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.topic-card {
    background: white;
    border: 3px solid #ffd7c8;
    border-radius: 12px;
    padding: 2.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.topic-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(255, 125, 25, 0.25);
    border-color: #ff7f50;
}

.topic-card h2 {
    color: #ff7f50;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.topic-card p {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

footer {
    background: #ff7f50;
    color: white;
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
}

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

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: white;
}

.footer-description {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

.footer-disclaimer {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.footer-disclaimer p {
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    font-size: 0.9rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

/* Quiz Styles */
.quiz-container {
    background: white;
    border: 3px solid #ffd7c8;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.quiz-container h2 {
    color: #ff7f50;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.quiz-progress {
    margin-bottom: 2rem;
}

.progress-text {
    display: block;
    color: #666;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff7f50, #ffd7c8);
    width: 0%;
    transition: width 0.5s ease;
}

.quiz-questions {
    display: flex;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
}

.quiz-question {
    min-width: 100%;
    padding: 0 1rem;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.quiz-question.active {
    opacity: 1;
}

.quiz-question h3 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.quiz-option * {
    pointer-events: none;
}

.quiz-option {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
    color: #333;
}

.quiz-option:hover:not(:disabled) {
    border-color: #ff7f50;
    background: #FFF5EE;
    transform: translateX(5px);
}

.quiz-option:disabled {
    cursor: not-allowed;
}

.quiz-option.correct {
    background: #F0FFE9;
    border-color: #42CE00;
    color: #1F6300;
}

.quiz-option.incorrect {
    background: #FFD9D9;
    border-color: #FF0000;
    color: #6B0000;
}

.quiz-next-btn {
    background: #ff7f50;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    opacity: 1;
    pointer-events: auto;

}

.quiz-next-btn:hover {
    background: #f57546;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 125, 25, 0.3);
}

.quiz-results {
    min-width: 100%;
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #ff7f50 0%, #ffd7c8 100%);
    border-radius: 12px;
    color: white;
}

.quiz-results h3 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.score-display {
    margin: 2rem 0;
}

.score-number {
    font-size: 3rem;
    font-weight: bold;
}

.score-message {
    font-size: 1.2rem;
    margin: 1.5rem 0;
    color: white;
}

.quiz-restart {
    background: white;
    color: #ff7f50;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Search Page Styles */
.search-page {
    max-width: 900px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

#searchInput {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #ff7f50;
}

#searchButton {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    background: #ff7f50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#searchButton:hover {
    background: #f57546;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 125, 25, 0.3);
}

.search-stats {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.search-prompt {
    color: #999;
    text-align: center;
    font-size: 1.1rem;
    padding: 3rem 1rem;
}

.search-result {
    background: white;
    border: 2px solid #FFDCC1;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.search-result:hover {
    border-color: #ff7f50;
    box-shadow: 0 4px 12px rgba(255, 125, 25, 0.15);
    transform: translateY(-2px);
}

.search-result h3 {
    margin: 0 0 0.5rem 0;
}

.search-result h3 a {
    color: #ff7f50;
    text-decoration: none;
    font-size: 1.5rem;
}

.search-result h3 a:hover {
    text-decoration: underline;
}

.search-result-url {
    color: #785EF0;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.search-result-snippet {
    color: #333;
    line-height: 1.6;
    margin: 0;
}

.search-result-snippet mark {
    background: #FFDCC1;
    padding: 0 0.2rem;
    font-weight: bold;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
}

.no-results h3 {
    color: #ff7f50;
    margin-bottom: 1rem;
}

.no-results p {
    color: #666;
    font-size: 1.1rem;
}


/* mobile styles */
@media (max-width: 1024px) {
    header.menu-open {
        padding: 1rem 0rem !important;
    }
    
    header.menu-open .logo {
        font-size: 1.8rem !important;
    }
    
    header.menu-open .desktop-nav a {
        font-size: 1.1rem !important;
    }
    
    header.menu-open .mobile-menu {
        top: 65px !important;
        margin-top: 0 !important;
    }

    .header-container {
        flex-wrap: nowrap;
        padding: 0 1rem;
        gap: 1rem;
    }

    .logo {
        font-size: 1.8rem;
        flex-shrink: 0;
    }

    header.scrolled .logo {
        font-size: 1rem;
    }

    .desktop-nav {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .mobile-menu {
        display: block;
    }

    header.scrolled .mobile-menu {
        top: 56px;
    }
  
	.hero-section {
    margin-top: 65px;
	}
  
    .primer-section {
        padding-right: 0.1rem;
        padding-left: 0.1rem;
    }
    
    .table-of-contents {
        display: none;
    }

    .hero-section {
        padding: 3rem 1rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    img {
        max-width: 100%;
    }

    figcaption {
        max-width: 100%;
    }

    .topics-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .topic-card {
        padding: 2rem;
    }

    .topic-card h2 {
        font-size: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
    }

    .quiz-container {
        padding: 1.5rem;
    }
    
    .quiz-question h3 {
        font-size: 1.1rem;
    }
    
    .quiz-option {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .score-number {
        font-size: 2.5rem;
    }

    .search-box {
        flex-direction: column;
    }
    
    #searchButton {
        width: 100%;
    }
}