/* css/components/typography.css */

/* --- General Headings --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    line-height: 1.3;
    margin-top: 1.5em; /* Add space above new sections */
    margin-bottom: 0.75em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Remove top margin for the very first element */
h1:first-child, h2:first-child {
    margin-top: 0;
}

h1 { font-size: 2.2em; }
h2 { font-size: 1.8em; color: var(--primary-accent); } /* Highlights H2s */
h3 { font-size: 1.5em; }
h4 { font-size: 1.25em; }

/* Main Section Titles (e.g., "Featured Insights", "About") */
h1.section-title,
.page-header h1 {
    font-size: 2em;
    color: var(--primary-accent);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-accent);
    display: inline-block;
}

/* --- Body Text --- */
p {
    margin-bottom: 1.2em;
    font-size: 1.05rem; /* Slightly larger for better readability */
    color: var(--text-color);
    line-height: 1.7;
}

/* --- Links --- */
a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, opacity 0.2s ease;
}
a:hover {
    color: var(--primary-accent-darker);
    text-decoration: underline;
}

/* --- Lists --- */
ul, ol {
    margin-bottom: 1.5em;
    padding-left: 25px;
    color: var(--text-color);
}
li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}
/* Nested lists */
ul ul, ol ol, ul ol, ol ul {
    margin-bottom: 0;
    margin-top: 0.5em;
}

/* --- Formatting --- */
strong, b { 
    font-weight: 700; 
    color: var(--text-color); /* Ensures bold text isn't grayed out */
}
em, i { 
    font-style: italic; 
}
small {
    font-size: 0.85em;
    color: var(--subtle-text);
}

/* --- Blockquotes --- */
blockquote {
    border-left: 4px solid var(--primary-accent);
    padding: 15px 25px;
    margin: 2em 0;
    background-color: rgba(var(--primary-accent-rgb, 59, 130, 246), 0.05); /* Subtle tint based on primary color */
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--subtle-text);
}
blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Code Blocks (Great for Engineering Formulas/Snippets) --- */
code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: rgba(125, 125, 125, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--primary-accent-darker);
}

pre {
    background-color: #1e293b; /* Always dark bg for code blocks */
    color: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5em;
    border: 1px solid rgba(0,0,0,0.1);
}
pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.95em;
}

/* --- TABLES (New Additions) --- */
.table-responsive {
    width: 100%;
    overflow-x: auto; /* Scroll horizontally on small screens */
    margin-bottom: 2em;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid var(--glass-card-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    min-width: 600px; /* Forces scroll on mobile if content is wide */
    background-color: transparent;
}

thead {
    background-color: rgba(var(--primary-accent-rgb, 59, 130, 246), 0.08);
    border-bottom: 2px solid var(--primary-accent);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-accent);
    white-space: nowrap; /* Keeps headers on one line */
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--glass-card-border);
    color: var(--text-color);
    vertical-align: top;
}

/* Striped rows for better readability */
tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}
/* Dark mode adjustment for stripes */
html[data-theme="dark"] tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

tbody tr:hover {
    background-color: rgba(var(--primary-accent-rgb, 59, 130, 246), 0.05);
}

/* Remove border from last row */
tbody tr:last-child td {
    border-bottom: none;
}

/* --- Hero Section Overrides --- */
.hero h1 {
    font-size: 2.8em;
    margin-bottom: 15px;
    margin-top: 0;
    color: var(--primary-accent);
    /* Optional: Gradient Text Effect */
    background: linear-gradient(135deg, var(--primary-accent), var(--primary-accent-darker));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero p {
    font-size: 1.25em;
    color: var(--subtle-text);
    max-width: 750px;
    margin: 0 auto 30px auto;
    font-weight: 400;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    h1 { font-size: 2em; }
    h1.section-title, .page-header h1 { font-size: 1.7em; }
    
    .hero h1 { font-size: 2.2em; }
    .hero p { font-size: 1.1em; }
    
    th, td { padding: 10px; font-size: 0.9em; }
    
    blockquote {
        padding: 15px;
        margin: 1.5em 0;
    }
}