:root {
    --ink: #1C2526;
    --teal: #4CAAA1;
    --violet: #A78BFA;
    --slate: #E2E8F0;
    --pink: #F472B6;
    --dark-0: #0f1415;
    --dark-1: #111827;
    --dark-2: #162022;
    --light-0: #ffffff;
    --light-1: #f8fafc;
    --light-2: #f3f4f6;
    --text-dark: #0f172a;
    --text-dim: #334155;
    --border-dark: rgba(255, 255, 255, .12);
    --border-light: rgba(0, 0, 0, .12);
    
    /* Animation Timing */
    --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    /* background: var(--ink); Remove solid background */
    background-color: transparent; /* Allow ::before to show */
    color: var(--slate);
    line-height: 1.8;
    margin: 0;
    overflow-x: hidden;
    font-size: 1.125rem;
    -webkit-font-smoothing: antialiased;
}

/* Base background layer to prevent transparency to browser default */
html {
    background-color: var(--ink);
}

/* Ambient Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 20% 50%, rgba(76, 170, 161, 0.25), transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(167, 139, 250, 0.25), transparent 50%),
        var(--ink); /* Fallback base color */
    z-index: -1;
    pointer-events: none;
    background-size: 150% 150%;
    animation: ambientShift 8s ease-in-out infinite alternate;
    will-change: transform, background-position;
}

@keyframes ambientShift {
    0% { transform: scale(1); background-position: 0% 0%; }
    100% { transform: scale(1.1); background-position: 100% 50%; }
}

::selection {
    background: rgba(76, 170, 161, 0.3);
    color: #fff;
}

body.light ::selection {
    background: rgba(76, 170, 161, 0.2);
    color: var(--teal);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

header.sticky {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(28, 37, 38, .8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-dark);
    transition: all 0.3s ease;
}

.blog-hero {
    padding: 100px 0 80px;
    text-align: center;
    background: transparent;
    position: relative;
    overflow: hidden;
}

/* Typography Polish */
h1 {
    font-size: 3.5rem;
    margin-bottom: 24px;
    color: #fff;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    /* Subtle Gradient Text */
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 2rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--teal);
    font-weight: 700;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    color: #fff;
}

p {
    margin-bottom: 1.5rem;
    max-width: 70ch; /* Optimal reading length */
}

.muted {
    color: rgba(226, 232, 240, .7);
}

/* Meta & Pills */
.post-meta {
    font-size: 0.875rem;
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    font-weight: 700;
    display: inline-block;
}

.pill {
    display: inline-block;
    border: 1px solid var(--teal);
    border-radius: 999px;
    padding: .35rem .8rem;
    font-size: .8rem;
    color: var(--slate);
    margin: 0 6px 8px 0;
    transition: all 0.2s ease;
    cursor: default;
}

.pill:hover {
    background: rgba(76, 170, 161, 0.1);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    display: inline-flex;
    padding: .85rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    background: var(--teal);
    color: #0b1112;
    font-weight: 600;
    margin-top: 24px;
    transition: all 0.3s var(--ease-out-quart);
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 170, 161, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--teal);
    color: var(--teal);
}

.btn-outline:hover {
    background: rgba(76, 170, 161, 0.1);
}

.btn--sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .6rem;
    min-height: 32px;
    font-size: 12px;
    line-height: 1;
    margin-top: 0;
}

/* Images & Parallax Sections */
.img-placeholder {
    width: 100vw;
    height: 250px; /* Reduced height for strip effect */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
    margin-bottom: 60px;
    color: var(--slate);
    overflow: hidden; /* Mask for parallax image */
    box-shadow: none;
    position: relative;
    background: var(--dark-2);
}

/* Inner Shadow for Cut-out look */
.img-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
}

.img-placeholder:hover {
    transform: none;
}

.img-placeholder img {
    width: 100%;
    height: 150%; /* Taller for parallax movement */
    object-fit: cover;
    position: absolute;
    top: -25%; /* Center start */
    left: 0;
    border-radius: 0;
    will-change: transform;
    transition: transform 0.1s linear; 
}

/* Medium-style Sticky Cover */
.case-cover {
    width: 100%;
    height: 85vh; /* Full viewport height initially */
    position: sticky;
    top: 0;
    z-index: 0; /* Behind main content */
    overflow: hidden;
    margin-bottom: 0;
}

.case-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    /* transition: transform 0.1s linear; Removed to let JS handle it strictly or CSS */
}

/* Main content must cover the sticky image */
main {
    position: relative;
    z-index: 10;
    background-color: var(--ink); /* Match body bg */
    padding-bottom: 120px; /* Increased to compensate for removed footer margin */
}

body.light main {
    background-color: var(--light-0);
}

@keyframes zoomIn {
    from { transform: scale(1.1); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

section {
    padding: 80px 0;
}

ul {
    padding-left: 24px;
    margin-bottom: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

footer {
    position: relative;
    z-index: 10;
    background-color: var(--ink);
    border-top: 1px solid var(--border-dark);
    padding: 60px 0;
    margin-top: 0; /* Removed transparent margin */
}

body.light footer {
    background-color: var(--light-0);
    border-top-color: var(--border-light); 
}

/* Layout Utilities */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.row { display: flex; align-items: center; gap: 16px; }

/* Navigation */
header nav { display: flex; align-items: center; }
header nav a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    color: var(--slate);
    margin-left: 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

header nav a:hover {
    color: var(--teal);
}

/* Light Theme */
body.light {
    background: var(--light-0);
    color: var(--text-dark);
}

body.light::before {
    background: 
        radial-gradient(circle at 15% 50%, rgba(76, 170, 161, 0.2), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(167, 139, 250, 0.2), transparent 40%),
        var(--light-0); /* Light base color */
}

body.light header.sticky {
    background: rgba(255, 255, 255, .85);
    border-bottom-color: var(--border-light);
}

body.light header nav a { color: var(--text-dark); }
body.light header nav a:hover { color: var(--teal); }

body.light .blog-hero { background: transparent; }
body.light h1, body.light h3 { 
    color: var(--text-dark);
    background: linear-gradient(to right, #0f172a, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
body.light .muted { color: var(--text-dim); }

body.light::-webkit-scrollbar-track {
    background: var(--light-0);
}
body.light::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
body.light::-webkit-scrollbar-thumb:hover {
    background: var(--teal);
}

body.light .pill {
    color: var(--text-dim);
    border-color: var(--border-light);
}
body.light .pill:hover {
    background: rgba(0,0,0,0.05);
}

body.light .img-placeholder {
    background: var(--light-2);
    border-color: var(--border-light);
    color: var(--text-dim);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

body.light .btn-outline {
    color: var(--teal);
    border-color: var(--teal);
}

/* Theme Icons */
.icon-sun { display: none; }
body.light .icon-sun { display: inline-block; }
body.light .icon-moon { display: none; }

/* Mobile Helpers */
.show-mobile { display: none; }
.hide-mobile { display: flex; }

@media (max-width: 900px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: inline-flex; }
    header .row { gap: 8px; }
    
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }
    .container { padding: 0 20px; }
    section { padding: 60px 0; }
    
    .case-cover { height: 300px; }
}

/* Mobile Nav */
.mobile-menu {
    display: none;
    position: sticky;
    top: 64px;
    z-index: 39;
    background: rgba(17, 20, 24, .98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dark);
    transform-origin: top;
    animation: menuSlide 0.3s ease-out;
}

@keyframes menuSlide {
    from { opacity: 0; transform: scaleY(0.95); }
    to { opacity: 1; transform: scaleY(1); }
}

body.light .mobile-menu {
    background: rgba(255, 255, 255, .98);
    border-color: var(--border-light);
}

.mobile-menu a {
    display: block;
    height: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border-dark);
    text-decoration: none;
    color: inherit;
    font-weight: 500;
}

body.light .mobile-menu a {
    border-color: var(--border-light);
    color: var(--text-dark);
}

/* Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out-quart), transform 0.8s var(--ease-out-quart);
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
