* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-pulse-glow {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.group {
    position: relative;
}

.group:hover {
    --hover-state: 1;
}

a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

input, textarea, select {
    transition: all 0.2s ease-out;
}

input:focus, textarea:focus, select:focus {
    outline: none;
}

header {
    background-color: rgba(255, 255, 255, 0.98);
}

html.dark header {
    background-color: rgba(15, 20, 25, 0.98);
}

header a:hover {
    color: var(--primary-blue-light) !important;

}

header.transparent {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent) !important;
    border: none !important;
    box-shadow: none !important;
}

header.transparent a,
header.transparent button svg, 
header.transparent .logo-text{
    color: #ffffff !important;
}

header.transparent a:hover{
    color: var(--primary-blue-light) !important;
}

header.transparent button:hover svg {
    color: var(--text-primary) !important;
}

#search-icon-toggle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#search-icon-toggle:hover {
    color: #808080 !important;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@supports (backdrop-filter: blur(1px)) {
    .backdrop-blur-md {
        backdrop-filter: blur(12px);
    }
}

@supports not (backdrop-filter: blur(1px)) {
    .backdrop-blur-md {
        background-color: rgba(255, 255, 255, 0.9);
    }
}

.prose {
    line-height: 1.75;
}

.prose p {
    margin-bottom: 1em;
}

.prose li {
    margin-bottom: 0.5em;
}

.prose strong {
    font-weight: 700;
    color: inherit;
}

.prose ul {
    list-style-position: inside;
}

/* Dark mode support with improved contrast */
:root {
    /* Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-light: #ffffff;
    --primary-blue: #0066cc;
    --primary-blue-light: #4d94ff;
    --accent-color: #ff5722;
    --border-light: #e0e0e0;
    
    /* Dark Mode */
    --bg-dark: #171a1b;
    --bg-darker: #0f1419;
    --bg-lighter: #21272e;
    --text-muted: #e8eef7;
    --primary-ice-blue: #668eab;
    --primary-ice-blue-light: #88aacc;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: var(--bg-primary);
        --bg-secondary: var(--bg-secondary);
        --text-primary: var(--text-primary);
        --text-secondary: var(--text-secondary);
        --border-color: var(--border-light);
        --button-text: var(--text-primary);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: var(--bg-dark);
        --bg-secondary: var(--bg-lighter);
        --text-primary: var(--text-light);
        --text-secondary: var(--text-muted);
        --border-color: var(--primary-ice-blue);
        --button-text: var(--bg-dark);
    }
}

html {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Ensure smooth transitions between modes */
html, body, * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html.dark {
    --bg-primary: var(--bg-dark);
    --bg-secondary: var(--bg-lighter);
    --text-primary: var(--text-light);
    --text-secondary: var(--text-muted);
    --border-color: var(--primary-ice-blue);
    --button-text: var(--bg-dark);
}

html.dark .bg-white {
    background-color: var(--bg-dark);
}

html.dark .bg-gray-50 {
    background-color: var(--bg-lighter);
}

html.dark .bg-gray-100 {
    background-color: #354555;
}

html.dark .bg-gray-200 {
    background-color: #405565;
}

html.dark .text-gray-900 {
    color: var(--text-light);
}

html.dark .text-gray-800 {
    color: var(--text-muted);
}

/* Catalog variant selection modal */
.catalog-variant-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.catalog-variant-modal.catalog-variant-modal--open {
    display: flex;
}

.catalog-variant-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.catalog-variant-modal__panel {
    position: relative;
    width: min(520px, calc(100% - 32px));
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.18);
    z-index: 1;
}

.catalog-variant-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.08);
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.catalog-variant-modal__header {
    margin-bottom: 18px;
}

.catalog-variant-modal__header h2 {
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.catalog-variant-modal__header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.catalog-variant-options {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.catalog-variant-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.catalog-variant-option.active,
.catalog-variant-option:hover {
    border-color: var(--primary-blue);
    background: rgba(102, 142, 171, 0.12);
}

.catalog-variant-option-label {
    font-weight: 600;
}

.catalog-variant-option-price {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.catalog-variant-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.catalog-variant-modal__price {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-blue);
}

.variant-change-select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Ensure variant selects appear white in cart contexts (side cart and cart page) */
.side-cart .variant-change-select,
.cart-items-section .variant-change-select,
.cart-items-list .variant-change-select {
    background: #ffffff;
    color: #111111;
    border-color: #e6e6e6;
}

.cart-item__variant-select,
.cart-item-variant-select {
    margin-bottom: 0.75rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cart-item__variant,
.cart-item-variant {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

html.dark .text-gray-700 {
    color: var(--text-muted);
}

html.dark .text-gray-600 {
    color: var(--primary-ice-blue);
}

html.dark .text-gray-500 {
    color: #5a7f9a;
}

html.dark .border-gray-200 {
    border-color: var(--primary-ice-blue);
}

html.dark .border-gray-300 {
    border-color: #7a9cba;
}

html.dark .hover\:text-blue-700:hover {
    color: var(--text-muted);
}

html.dark .hover\:border-blue-600:hover {
    border-color: var(--primary-ice-blue);
}

/* Ensure the site-footer dark styling is preserved */
html.dark .site-footer {
    background-color: var(--bg-dark);
    color: var(--text-muted);
}

html.dark .footer-heading {
    color: var(--text-light);
}

html.dark .footer-links a:hover,
html.dark .footer-contact-list a:hover {
    color: var(--primary-ice-blue);
}

/* Force blog pages to white reading background and dark text, overriding dark mode */
/* Targets only the blog main area so header/footer still respond to dark mode */
body.blog-page main {
    background-color: #ffffff !important;
    color: #0f172a !important; /* slate-900 */
}

body.blog-page main .prose,
body.blog-page main .prose * {
    color: #0f172a !important;
    background: transparent !important;
}

/* Normalize common blog card/containers to white */
body.blog-page main .overflow-hidden,
body.blog-page main .rounded-[2rem],
body.blog-page main .rounded-[1.75rem],
body.blog-page main .rounded-3xl,
body.blog-page main .bg-slate-950,
body.blog-page main .bg-slate-900,
body.blog-page main .bg-slate-100,
body.blog-page main .bg-slate-50 {
    background-color: #ffffff !important;
    border-color: #e6edf6 !important;
    color: #0f172a !important;
}

body.blog-page main blockquote {
    background-color: #f7fafc !important; /* light blockquote */
    color: #0f172a !important;
}

/* Remove any dark-mode overlays inside blog main */
html.dark body.blog-page main::before,
html.dark body.blog-page main::after {
    display: none !important;
}

/* Section map (blog table of contents) */
body.blog-page #section-map {
    position: fixed;
    left: 2rem;
    top: 140px;
    width: 220px;
    max-height: calc(100vh - 160px);
    overflow: auto;
    padding: 12px 14px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(15,23,42,0.08);
    font-size: 0.95rem;
    z-index: 1050;
}

body.blog-page #section-map h4 {
    margin: 0 0 8px 0;
    font-weight: 700;
    color: var(--text-primary);
}

body.blog-page #section-map ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.blog-page #section-map li {
    margin: 6px 0;
}

body.blog-page #section-map a {
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-block;
}

body.blog-page #section-map a.active {
    color: var(--primary-ice-blue);
    font-weight: 700;
}

body.blog-page #section-map .sub { padding-left: 10px; font-size: 0.93rem; }

@media (max-width: 1024px) {
    body.blog-page #section-map { display: none; }
}
