/* ---
 AdTech Update - Light Theme Stylesheet
 --- */

/* 1. BRANDING & TYPOGRAPHY */
/* Global CSS variables for branding and type */
:root {
    --brand-bg-light: #f0f4ff;
    --brand-card-bg: rgba(255, 255, 255, 0.95);
    --brand-border: rgba(102, 126, 234, 0.15);
    --brand-primary: #667eea;
    --brand-primary-hover: #5568d3;
    --brand-secondary: #f093fb;
    --brand-accent: #4facfe;
    --brand-text-main: #2d3748;
    --brand-text-secondary: #718096;
    --brand-heading: #1a365d;
    --font-sans: 'Source Sans 3', sans-serif;
    --glow-primary: 0 0 20px rgba(102, 126, 234, 0.3);
    --glow-accent: 0 0 30px rgba(79, 172, 254, 0.4);
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--brand-heading);
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 {
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

h2 {
    font-weight: 700;
}

h3 {
    font-weight: 600;
}

/* Responsive base type and readable line-height */
html {
    /* Fluid font sizing: min 15px, preferred relative to viewport, max 18px */
    font-size: clamp(13px, 1.2vw + 10px, 15px);
}

body {
    font-family: var(--font-sans, 'Source Sans 3', sans-serif);
    color: var(--brand-text-main, #2d3748);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. HEADER & NAVIGATION */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.95);
    /* dark slate for mobile visibility */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Reserve space for sticky header to avoid content overlap. The JS sets --site-header-height dynamically
   after header injection; fallback defaults to 72px. */
:root {
    --site-header-height: 96px;
}

/* Stronger selector and !important fallback to ensure main has top padding equal to header height */
/* Only add top padding to <main> when the header immediately precedes it.
   Avoid the overly-broad `body main` selector which forces padding on all pages
   and causes a visible gap beneath the header (especially on pages with
   their own hero or top visual). */
body>header.sticky-nav+main,
body>header#global-header+main {
    padding-top: var(--site-header-height) !important;
}

.nav-link {
    color: var(--brand-text-main);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
}

.nav-link:hover {
    color: var(--brand-primary);
    transform: translateY(-2px);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-link.active::after {
    width: 100%;
}

/* 3. HOMEPAGE HERO & VIDEO */
.hero-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(79, 172, 254, 0.1) 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.15) 0%, transparent 70%);
    opacity: 0.3;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.1) rotate(180deg);
        opacity: 0.5;
    }
}

/* Styles for a contained video with a forced aspect ratio */
.video-aspect-container {
    position: relative;
    width: 100%;
    /* Default aspect ratio (16:9) — override with classes below or CSS variables */
    padding-top: 56.25%;
    /* 9 / 16 = 0.5625 */
}

.video-aspect-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensures the video fills the container, cropping if necessary */
}

/* Optional fixed-size hero video container — set in pixels or use CSS variables */
.hero-video-fixed {
    position: relative;
    width: var(--hero-video-width, 100%);
    max-width: var(--hero-video-max-width, 1200px);
    height: var(--hero-video-height, 420px);
    /* default height; change as needed */
    margin-left: auto;
    margin-right: auto;
}

.hero-video-fixed video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}


/* 4. CONTENT & ARTICLE STYLING */
.article-body h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--brand-border);
}

.article-body p,
.article-body ul {
    color: var(--brand-text-main);
    margin-bottom: 1.5rem;
}

.article-body a {
    color: var(--brand-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--brand-primary);
    transition: all 0.2s;
}

.article-body a:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.article-body ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}

.article-body blockquote {
    border-left: 4px solid var(--brand-primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--brand-text-secondary);
}

/* 5. GENERAL CARD STYLE */
.content-card {
    background: var(--brand-card-bg);
    border: 1px solid var(--brand-border);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent), var(--brand-secondary));
    transform: scaleX(0);
}

.content-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2), var(--glow-primary);
    border-color: var(--brand-primary);
}

.content-card:hover::before {
    transform: scaleX(1);
}

/* Animation removed */
.animated-card {
    opacity: 1;
    transform: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 6. RESPONSIVE HELPERS */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

.aspect-video-container,
.aspect-w-16 {
    position: relative;
    width: 100%;
}

.aspect-video-container img,
.aspect-w-16 iframe {
    width: 100%;
    height: auto;
}

/* Blog card image styling: ensure consistent aspect and cover behavior */
.blog-card-image {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

/* Mobile-friendly touch targets: ensure all interactive elements meet 44px minimum */
a,
button,
input,
select,
textarea,
[role="button"],
[tabindex]:not([tabindex="-1"]) {
    min-height: 44px;
    min-width: 44px;
}

/* Radios and checkboxes should remain compact and not inherit large min-height used for other inputs
   Keep them visually small while remaining keyboard-accessible. This overrides the global min-height
   applied above which caused overly-large radio circles on MCQ pages. */
input[type="radio"],
input[type="checkbox"] {
    min-height: 0 !important;
    min-width: 0 !important;
    width: 1rem !important;
    /* ~16px */
    height: 1rem !important;
    vertical-align: middle;
    appearance: auto;
    -webkit-appearance: radio;
    -moz-appearance: radio;
}

/* Slight spacing when radios/checkboxes appear inside labels */
label input[type="radio"],
label input[type="checkbox"] {
    margin-right: 0.75rem;
}

/* Ensure focus ring is not oversized but remains accessible. Reduce the default heavy outline
   that some utility classes may apply when inputs are focused inside padded label blocks. */
input[type="radio"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    /* subtle blue focus */
    outline-offset: 2px;
    box-shadow: none !important;
}

/* When labels are heavily padded for touch, keep the visible circle small but increase the
   clickable area via inline padding on the label (visual circle unaffected). */
label.flex.items-center.p-4 input[type="radio"],
label.flex.items-center.p-4 input[type="checkbox"] {
    /* no-op selector to target the MCQ markup pattern; keep circle small but clickable area large */
    width: 1rem !important;
    height: 1rem !important;
}

/* If any utility class accidentally scales radios (e.g., w-6, h-6), force them back */
input[type="radio"].w-5,
input[type="radio"].h-5,
input[type="checkbox"].w-5,
input[type="checkbox"].h-5 {
    width: 1rem !important;
    height: 1rem !important;
}

/* Make content cards and grids stack on small screens */
@media (max-width: 767px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .content-card {
        padding: 1rem;
    }

    /* Slightly larger nav links and reduced header height on mobile for better touch targets */
    :root {
        --site-header-height: 72px;
    }

    .nav-link {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }

    .hero-section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Improve mobile typography */
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.375rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.125rem;
        line-height: 1.4;
    }

    p,
    li {
        font-size: 14px;
        line-height: 1.6;
    }

    /* Better mobile spacing */
    .glass {
        padding: 1.5rem;
    }

    .btn,
    button {
        padding: 0.75rem 1.5rem;
        font-size: 14px;
    }

    /* Mobile-optimized hero */
    .hero-section h1 {
        font-size: 2.25rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    /* Improve mobile forms */
    input,
    textarea,
    select {
        font-size: 14px;
        padding: 0.75rem;
    }

    .flex-col.sm\\:flex-row {
        flex-direction: column;
    }

    .gap-2 {
        gap: 0.5rem;
    }
}

/* touch targets and buttons */
button,
.thumb-card {
    touch-action: manipulation;
}

/* Enhanced button styles */
button,
.btn,
a.btn {
    position: relative;
    overflow: hidden;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 16px;
    border-radius: 0.375rem;
}

/* Mobile-specific button improvements */
@media (max-width: 767px) {

    button,
    .btn,
    a.btn {
        padding: 0.75rem 1.5rem;
        font-size: 14px;
        min-height: 48px;
        width: 100%;
        justify-content: center;
    }

    /* Stack buttons vertically on mobile */
    .button-group,
    .flex.gap-4 {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Improve mobile navigation spacing */
    nav a,
    .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        display: block;
        text-align: center;
    }
}

button::before,
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before,
.btn:hover::before {
    width: 300px;
    height: 300px;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* Form improvements for mobile */
input,
textarea,
select {
    font-size: 16px;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--brand-border);
    min-height: 44px;
    touch-action: manipulation;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Mobile form layouts */
@media (max-width: 767px) {
    form {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    input[type="email"],
    input[type="text"],
    textarea {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Newsletter forms on mobile */
    #footer-newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Better spacing for content sections */
    section {
        padding: 2rem 0;
    }

    .hero-section {
        padding: 3rem 0;
    }

    /* Improve grid layouts on mobile */
    .grid {
        gap: 1rem;
    }

    .grid-cols-1.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .grid-cols-1.md\\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    /* Better card spacing */
    .content-card,
    .glass {
        margin-bottom: 1rem;
        padding: 1.5rem;
    }

    /* Mobile-optimized text sizes */
    .text-4xl {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .text-3xl {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .text-2xl {
        font-size: 1.375rem;
        line-height: 1.4;
    }

    .text-xl {
        font-size: 1.125rem;
        line-height: 1.4;
    }

    /* Improve link spacing */
    a {
        padding: 0.25rem 0;
        display: inline-block;
    }

    /* Mobile footer improvements */
    footer .grid {
        gap: 2rem;
    }

    footer .space-y-2>*+* {
        margin-top: 0.75rem;
    }
}

/* Link enhancements */

.item-link:hover {
    color: var(--brand-primary);
}

/* Glassmorphism utilities */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Gradient text utility */
.gradient-text {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow effect */
.glow {
    box-shadow: var(--glow-primary);
}

.glow-accent {
    box-shadow: var(--glow-accent);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Form input enhancements */
input[type="text"],
input[type="email"],
input[type="search"],
textarea,
select {
    border: 1px solid var(--brand-border);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Status message animations removed */
.status-message {
    opacity: 1;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ads: keep ad slots hidden unless an ad provider is configured. Providers can inject markup client-side */
.odra-ad-slot {
    display: none;
}

.odra-ad-slot[data-has-ad="1"] {
    display: block;
}

/* Content Pages Styles */

/* Content typography normalization
   Ensure content cards, article bodies and prose blocks share a consistent
   readable base font-size and line-height so Blog / News / Topics look the same
   regardless of per-page classes or Tailwind rem scaling. */
.content-card,
.article-body,
.prose,
.cs-article {
    font-size: 0.875rem;
    /* 14px baseline */
    line-height: 1.6;
    color: var(--brand-text-main);
}

.content-card .item-main,
.content-card .item-main p,
.article-body p,
.prose p {
    font-size: 0.875rem;
    line-height: 1.6;
}

.content-card .item-main .content-preview-text {
    /* previews remain slightly smaller */
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.item-side {
    /* make metadata slightly smaller but legible */
    font-size: 0.8125rem;
    /* 13px */
}

/* Make topic read buttons match read-more (blog/news) sizing */
.topic-read {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    /* match px-4 py-2 */
    background-color: #4f46e5;
    /* indigo-600 fallback */
    color: #ffffff;
    border-radius: 0.375rem;
    /* rounded-md */
    font-size: 1rem;
}

.topic-read:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.12);
    background-color: #4338ca;
    /* indigo-700 - match slightly darker hover like read-more */
}

.topic-read:active {
    transform: translateY(0) scale(0.99);
    background-color: #3730a3;
    /* indigo-800 pressed */
}

.topic-read:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* Standardize actionable button appearance used across content pages */
.read-more,
.topic-read {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    /* px-4 py-2 equivalent */
    background-color: #4f46e5;
    /* indigo-600 */
    color: #ffffff;
    border-radius: 0.375rem;
    /* rounded-md */
    font-size: 1rem;
    text-decoration: none;
}

.read-more:hover {
    background-color: #4338ca;
    /* indigo-700 */
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.12);
}

.read-more:active {
    transform: translateY(0) scale(0.99);
    background-color: #3730a3;
    /* indigo-800 */
}

.read-more:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}


/* Content Controls */
.controls-container {
    background: var(--brand-card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border: 1px solid var(--brand-border);
}

.content-search {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--brand-border);
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--brand-text-main);
    background-color: white;
    transition: all 0.15s ease-in-out;
}

.content-search:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Filter Container */
.filter-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-container select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--brand-border);
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--brand-text-main);
    background-color: white;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7280'%3e%3cpath fill-rule='evenodd' d='M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    appearance: none;
    transition: all 0.15s ease-in-out;
}

.filter-container select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Content Cards */
.qa-item,
.case-study,
.glossary-item,
.content-card {
    background: var(--brand-card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    border: 1px solid var(--brand-border);
    margin-bottom: 1.5rem;
    /* unified padding so cards align visually across pages */
    padding: 1rem;
}

.qa-item:hover,
.case-study:hover,
.glossary-item:hover,
.content-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-primary);
}

/* Content Headers */
.qa-item h2,
.case-study h2,
.glossary-item h2 {
    color: var(--brand-heading);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Content Tags */
.metadata span {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.5rem;
    background: var(--brand-bg-light);
    color: var(--brand-primary);
}

/* Technical Details */
.technical-details {
    background: var(--brand-bg-light);
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--brand-border);
}

/* Example Sections */
.example {
    background: var(--brand-bg-light);
    border-left: 4px solid var(--brand-primary);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 0.375rem 0.375rem 0;
}

/* Content Lists */
.steps,
.key-points,
.best-practices {
    list-style-position: inside;
    padding-left: 1rem;
}

.steps li,
.key-points li,
.best-practices li {
    margin-bottom: 0.5rem;
    color: var(--brand-text-main);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .controls-container {
        flex-direction: column;
    }

    .filter-container {
        margin-top: 1rem;
    }

    .filter-container select {
        width: 100%;
    }

    .qa-item,
    .case-study,
    .glossary-item {
        padding: 1rem;
    }
}

/* Content Animation */
@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qa-item,
.case-study,
.glossary-item {
    animation: contentFadeIn 0.3s ease-out forwards;
}

/* Status Messages */
.error-message {
    text-align: center;
    padding: 2rem;
    background: #fee2e2;
    border-radius: 0.5rem;
    color: #991b1b;
    animation: contentFadeIn 0.3s ease-out forwards;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--brand-text-secondary);
}

.loading::after {
    content: '';
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--brand-border);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Compact item row: two-column layout to show content and metadata side-by-side (flex fallback) */
.item-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.item-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding-right: 1rem;
    /* space for meta on wide screens */
}

.item-main .item-footer {
    margin-top: auto;
    /* push to bottom */
}

.item-side {
    flex: 0 0 160px;
    width: 160px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--brand-text-secondary);
}

.item-side .meta-top {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.item-side .meta-date {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.68rem;
    color: #9ca3af;
}

.item-side .meta-publisher {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.68rem;
    color: #9ca3af;
}

.item-side .read-more {
    display: inline-block;
}

@media (max-width: 768px) {
    .item-row {
        display: block;
    }

    .item-side {
        width: auto;
        text-align: left;
        margin-bottom: 0.5rem;
    }

    .item-main {
        padding-right: 0;
    }
}

/* ===== PERFORMANCE & ACCESSIBILITY ENHANCEMENTS ===== */

/* Lazy Loading Styles */
img[data-src] {
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

img.lazy {
    filter: blur(1px);
    transform: scale(1.02);
}

img.error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Skip Links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007bff;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Focus Management */
*:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Screen Reader Only */
.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;
}

.focus:not-sr-only,
.focus:not(.sr-only) {
    position: static;
    width: auto;
    height: auto;
    padding: initial;
    margin: initial;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Loading States */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Enhanced micro-interactions */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.form-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Stagger animations for lists */
.stagger-children>* {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 0.5s;
}

/* Page transition effects */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    animation: pageEnter 0.5s ease-out forwards;
}

@keyframes pageEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Success/error states */
.success-message {
    animation: slideInFromTop 0.5s ease-out;
}

.error-message {
    animation: shake 0.5s ease-in-out;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Enhanced hover states */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Pulse animation for important elements */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }

    to {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .animate-in {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --brand-primary: #0000ff;
        --brand-accent: #0066ff;
        --brand-border: #000000;
    }
}

/* Print styles */
@media print {

    .skip-link,
    button,
    nav,
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }

    .card {
        border: 1px solid #000;
        break-inside: avoid;
    }
}

/* Line clamp utilities for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

/* Enhanced button glow effect */
.glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), 0 0 40px rgba(147, 51, 234, 0.3);
}

.glow:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.7), 0 0 60px rgba(147, 51, 234, 0.5);
}

/* --- Blog page specific background & glass container --- */
/* Target only pages that add the 'blog-page' class to <body> to avoid global side-effects */
body.blog-page {
    background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    color-scheme: light;
}

/* Subtle diagonal texture overlay (no images required) */
body.blog-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 14px);
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

/* Keep the actual content above the decorative overlay */
body.blog-page>header,
body.blog-page main,
body.blog-page section,
body.blog-page .container {
    position: relative;
    z-index: 1;
}

/* Give the blog cards a soft 'glass' feel on the light blog background */
body.blog-page .bg-gray-900 {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 30px rgba(13, 42, 75, 0.08);
    backdrop-filter: blur(6px) saturate(120%);
}

/* Dark mode fallback: when user's system prefers dark mode, use darker gradients */
@media (prefers-color-scheme: dark) {
    body.blog-page {
        background: linear-gradient(180deg, #071029 0%, #021221 100%);
    }

    body.blog-page::before {
        opacity: 0.12;
    }

    body.blog-page .bg-gray-900 {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
        border-color: rgba(255, 255, 255, 0.03);
    }
}

/* Small adjustments to ensure spacing and contrast for blog content */
body.blog-page .blog-post {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}