/* General Body and Font Styles */
body {
    font-family: 'Nunito', sans-serif; /* Main paragraph content font */
    background-color: #e6e6fa; /* lavender-mist background [cite: 159] */
    color: #0a2e38; /* midnight-ocean for text [cite: 157] */
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styling */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: 2px dashed #4db6ac; /* light-aqua dashed line for blueprint feel [cite: 157] */
}

h1 {
    font-family: 'Indie Flower', cursive; /* Page titles and headers [cite: 161] */
    font-size: 3.5em;
    color: #1a3c5a; /* deep-ocean-blue [cite: 157] */
    margin-bottom: 10px;
}

.subtitle {
    font-family: 'Courier Prime', monospace; /* Scientific elements font [cite: 26] */
    font-size: 1.2em;
    color: #00796b; /* medium-teal [cite: 156] */
}

/* Main Content Area */
main {
    flex-grow: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: #FFFFFF; /* White background for the journal pages */
    border: 1px solid #8ca7a2; /* muted-teal border [cite: 159] */
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
    position: relative; /* For grid lines */
    overflow: hidden; /* Hide overflowing grid lines */
    padding-bottom: 60px; /* Space for footer/bottom grid */
}

/* Journal Grid Lines (subtle blueprint/notebook effect) */
main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(to bottom, transparent, transparent 19px, rgba(0,0,0,0.05) 20px),
        repeating-linear-gradient(to right, transparent, transparent 19px, rgba(0,0,0,0.03) 20px);
    background-size: 100% 20px, 20px 100%;
    z-index: 0; /* Place behind content */
}

.law-section {
    background-color: rgba(255, 255, 255, 0.95); /* Slightly transparent white over grid */
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #b39ddb; /* soft-lavender border [cite: 158] */
    border-radius: 8px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
    position: relative; /* For z-index over grid */
    z-index: 1; /* Ensure content is above grid */
}

.law-title {
    font-family: 'Indie Flower', cursive; /* Specific for law titles [cite: 161] */
    font-size: 2em;
    color: #673ab7; /* deep-lavender [cite: 158] */
    border-bottom: 1px solid #9e91b7; /* coastal-lavender for subtitle [cite: 159] */
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.law-title .formula {
    font-family: 'Courier Prime', monospace; /* Formula in titles [cite: 26] */
    font-size: 0.8em;
    color: #004d40; /* deep-sea-blue [cite: 156] */
}

p.law-explanation {
    font-family: 'Nunito', sans-serif; /* Main paragraph font [cite: 26] */
    font-size: 1.1em;
    margin-bottom: 15px;
}

.visual-formula {
    font-family: 'Courier Prime', monospace; /* Main formula display [cite: 26] */
    font-size: 1.8em;
    text-align: center;
    padding: 15px 0;
    margin: 20px 0;
    background-color: #f8f8f8; /* Light background for the formula block */
    border: 1px dashed #4a90e2; /* ocean-surface-blue dashed border [cite: 157] */
    border-radius: 5px;
    color: #1a237e; /* dark-navy [cite: 159] */
}

.visual-formula .element-label {
    color: #004d40; /* deep-sea-blue for element labels [cite: 156] */
    font-weight: bold;
}

.visual-formula .operator {
    color: #ff8a65; /* coral-reef for operators [cite: 158] */
    margin: 0 5px;
}

.visual-formula .fraction {
    font-size: 0.8em;
    vertical-align: super;
}

ul.components {
    list-style: none; /* Remove default bullet points */
    padding: 0;
    margin-top: 15px;
    border-top: 1px dashed #85d1c6; /* seafoam-green dashed line [cite: 157] */
    padding-top: 15px;
}

ul.components li {
    font-family: 'Nunito', sans-serif; /* Main paragraph font [cite: 26] */
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
    color: #0a2e38; /* midnight-ocean [cite: 157] */
}

ul.components li::before {
    content: '▪'; /* Custom bullet point (a filled square) */
    position: absolute;
    left: 0;
    color: #b39ddb; /* soft-lavender for bullet points [cite: 158] */
    font-weight: bold;
    font-size: 1.2em;
    line-height: 1;
}

/* Superscript styling for numbers like x² */
sup {
    font-size: 0.6em;
    vertical-align: super;
}

/* Footer Styling */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 2px dashed #4db6ac; /* light-aqua dashed line [cite: 157] */
    color: #a1887f; /* sandy-beige for footer text [cite: 159] */
    font-family: 'Nunito', sans-serif;
}

/* Specific emoji/icon styling for better alignment */
.visual-formula span,
ul.components li span {
    display: inline-block; /* Helps with vertical alignment of emojis */
    vertical-align: middle;
}

/* Style for Font Awesome icons if used */
.fas {
    color: #1a3c5a; /* deep-ocean-blue for FA icons [cite: 157] */
    font-size: 1.1em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5em;
    }
    .law-title {
        font-size: 1.8em;
    }
    .visual-formula {
        font-size: 1.5em;
    }
}