/* =========================================================
   Global Variables & Reset
   ========================================================= */
:root {
    /* Morandi Palette & Theme Colors */
    --color-bg-body: #F9F7F5;
    --color-bg-surface: #FFFFFF;
    --color-bg-secondary: #EBEAE6;

    --color-text-primary: #2D2C2A;
    --color-text-secondary: #5A5853;
    --color-text-tertiary: #85837D;

    /* Brand Color - Soft Green/Teal */
    --color-brand-main: #5E8E7E;
    --color-brand-light: #DFECE8;
    --color-brand-dark: #406A5B;

    /* Accents - Muted Clay */
    --color-accent: #C49A8A;
    --color-accent-light: #F4EBE7;

    /* Typography */
    --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
    --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Spacing & Layout */
    --container-max: 1120px;
    --section-spacing: clamp(4rem, 8vw, 6rem);
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;

    /* Shadows */
    --shadow-card: 0 4px 20px rgba(45, 44, 42, 0.04);
    --shadow-hover: 0 10px 30px rgba(45, 44, 42, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background-color: var(--color-bg-body);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* Container Utility */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* =========================================================
   Typography
   ========================================================= */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.3;
    text-wrap: balance;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-top: 0; }
h3 { font-size: 1.25rem; color: var(--color-text-secondary); margin-bottom: 0.5rem; }

p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    max-width: 70ch;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--color-text-tertiary);
    max-width: 60ch;
    margin-bottom: 3rem;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--color-brand-main);
    outline-offset: 4px;
    border-radius: 4px;
}

/* =========================================================
   Header & Navigation
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(249, 247, 245, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    position: relative;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--color-brand-main);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-brand-main);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.nav-link:hover::after, .nav-link[aria-current="page"]::after {
    transform: scaleX(1);
    transform-origin: left;
}

@media (max-width: 768px) {
    .nav-links { display: none; } /* Simplified for mobile */
}

/* =========================================================
   Components (Buttons, Cards, Table)
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-brand-main);
    color: #fff;
    box-shadow: 0 4px 12px rgba(94, 142, 126, 0.3);
}

.btn-primary:hover {
    background-color: var(--color-brand-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(94, 142, 126, 0.4);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-text-tertiary);
    color: var(--color-text-secondary);
}

.btn-outline:hover {
    border-color: var(--color-brand-main);
    color: var(--color-brand-main);
    background-color: var(--color-bg-surface);
}

.card {
    background: var(--color-bg-surface);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.02);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Table Styles */
	.styled-table {
		width: 100%;
		max-width: 100%;
		border-collapse: collapse;
		background: var(--color-bg-surface);
		border-radius: var(--border-radius-md);
		overflow: hidden;
		box-shadow: var(--shadow-card);
		margin-bottom: 2rem;
		table-layout: auto;
	}

	.styled-table th, .styled-table td {
		padding: 1rem 1.5rem;
		text-align: left;
		border-bottom: 1px solid var(--color-bg-secondary);
		word-break: break-word;
		min-width: 0;
	}

.styled-table th {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.styled-table tr:last-child td { border-bottom: none; }

/* Blog/Latest Updates Card */
.update-card {
    background: var(--color-bg-surface);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.update-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.update-date { font-size: 0.8rem; color: var(--color-text-tertiary); margin-bottom: 0.5rem; }
.update-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.75rem; line-height: 1.4; }
.update-excerpt { font-size: 0.9rem; color: var(--color-text-secondary); flex-grow: 1; margin-bottom: 1rem; }
.link-btn { font-size: 0.85rem; font-weight: 600; color: var(--color-brand-main); display: inline-flex; align-items: center; gap: 4px; }

/* Related Reading */
.related-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.related-link { font-weight: 500; color: var(--color-text-primary); }
.related-link:hover { color: var(--color-brand-main); }
.related-arrow { opacity: 0.3; transition: transform 0.2s; }
.related-list li:hover .related-arrow { transform: translateX(4px); opacity: 1; color: var(--color-brand-main); }

/* FAQ */
details {
    background: var(--color-bg-surface);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.03);
}

summary {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    padding-right: 3rem;
}

summary::-webkit-details-marker { display: none; }

summary::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--color-brand-main);
    transition: transform 0.3s;
}

details[open] summary::after {
    content: '−';
}

.faq-answer {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    border-top: 1px solid var(--color-bg-secondary);
    margin-top: 0;
    padding-top: 1rem;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
    background-color: var(--color-bg-secondary);
    padding: 4rem 0 2rem;
    margin-top: var(--section-spacing);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 { margin-top: 0; font-size: 1rem; margin-bottom: 1.5rem; }
.footer-links li { margin-bottom: 0.75rem; }
.footer-links a { color: var(--color-text-secondary); font-size: 0.9rem; }
.footer-links a:hover { color: var(--color-brand-main); }

.footer-bottom {
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
}

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}

/* =========================================================
   SVG Animations (Data Flow Style)
   ========================================================= */
@keyframes dash-flow {
    to { stroke-dashoffset: -24; } /* Moves continuously */
}

@keyframes dot-flow {
    0% { offset-distance: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

svg.flow-graphic path.line-path {
    stroke-dasharray: 12 12;
    animation: dash-flow 1.5s linear infinite;
}

svg.flow-graphic circle.dot {
    fill: var(--color-brand-main);
    offset-path: path("M0,50 Q100,0 200,50 T400,50"); /* Needs matching path string */
    animation: dot-flow 3s ease-in-out infinite alternate;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .flow-graphic { display: none; } /* Hide complex graphs if reduced motion is preferred */
}
