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

html, body { 
    height: 100%; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background: #fff; 
    color: #1a1a1a; 
}

h1, h2, h3, .brand { 
    font-family: 'Inter', sans-serif; 
}

/* Header */
header {
    padding: 20px 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 48px;
    right: 48px;
    height: 1px;
    background: #f0f0f0;
}

.brand { 
    font-weight: 700; 
    font-size: 20px;
    color: #1a1a1a; 
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.brand img {
    height: 35px;
    width: auto;
    display: block;
}

nav ul {
    display: flex;
    gap: 24px;
    list-style: none;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

nav a:hover {
    color: #1a1a1a;
}

nav a.active {
    background: #e0e0e0;
    color: #1a1a1a;
    padding: 8px 16px;
    border-radius: 6px;
}

nav a.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 8px;
}

nav a.contact-icon svg {
    color: #888;
    transition: color 0.2s;
}

nav a.contact-icon:hover svg {
    color: #1a1a1a;
}

.btn-contact {
    background: #1a1a1a;
    color: #fff !important;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #1a1a1a;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Footer */
footer {
    padding: 20px 48px;
    text-align: center;
    border-top: none;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 48px;
    right: 48px;
    height: 1px;
    background: #f0f0f0;
}

footer span { 
    font-size: 12px; 
    color: #aaa; 
}

/* Page wrapper for min-height */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HOME */
.home main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 48px;
}

.home h1 { 
    font-size: 44px; 
    font-weight: 700; 
    color: #1a1a1a; 
    margin-bottom: 16px; 
    line-height: 1.1;
}

.home main > p {
    font-size: 16px;
    color: #666;
    margin-bottom: 32px;
    max-width: 600px;
}

.home .btn-main {
    background: #1a1a1a;
    color: #fff;
    padding: 12px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { 
    color: #333; 
}

.modal h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a1a;
    text-align: center;
}

.modal > p {
    font-size: 15px;
    color: #666;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 8px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: #1a1a1a;
    -webkit-text-fill-color: #1a1a1a;
}

.form-group select {
    background-color: white;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20'%3E%3Cpath d='M5 7l5 5 5-5' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 16px 16px;
    background-position: right 16px center;
    padding-right: 44px;
}

/* Hide legacy IE/Edge dropdown arrow */
.form-group select::-ms-expand {
    display: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a1a1a;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.captcha-container {
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    min-height: 0;
}

.form-group input.error,
.form-group textarea.error,
.form-group select.error {
    border-color: #dc2626;
}

.form-submit {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.form-submit:hover { 
    background: #333; 
}

/* CONTENT PAGES */
.content-page {
    background: #fff;
}

/* LISTING PAGES */
.page-wrapper.listing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-wrapper.listing-page main {
    padding: 24px 80px 2px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .page-wrapper.listing-page main {
        padding: 32px 60px;
    }
}

@media (max-width: 768px) {
    .page-wrapper.listing-page main {
        padding: 24px 20px;
        min-height: auto;
    }
}

/* ARTICLE PAGES */
.page-wrapper.article-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-wrapper.article-page main {
    padding: 24px 80px 2px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.page-wrapper.article-page .article-content-section {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px 0 18px 0;
}

.page-wrapper.article-page .article-container {
    max-width: 890px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Shared article template (hero + typography) */
.page-wrapper.article-page .article-hero {
    width: 100%;
    max-width: 100%;
    margin-bottom: 40px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.page-wrapper.article-page .article-hero-img {
    width: 100%;
    max-width: 640px;
    max-height: 220px;
    height: auto;
    display: block;
    object-fit: contain;
    padding: 10px 0;
}

/* Larger hero images for select lab articles */
.page-wrapper.article-page.article-aftercheck .article-hero-img,
.page-wrapper.article-page.article-openbounty .article-hero-img {
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-sizing: border-box;
}

.page-wrapper.article-page.article-aftercheck .article-hero-img {
    max-width: 860px;
    max-height: clamp(260px, 32vw, 440px);
}

.page-wrapper.article-page.article-openbounty .article-hero-img {
    max-width: 100%;
    max-height: clamp(360px, 44vw, 720px);
}

/* Try-yourself CTA: improve small-screen layout for select lab articles */
@media (max-width: 520px) {
    .page-wrapper.article-page.article-aftercheck .try-yourself-cta,
    .page-wrapper.article-page.article-openbounty .try-yourself-cta {
        display: block !important;
        padding: 16px 18px !important;
        margin: 22px 0 !important;
        text-align: left;
    }

    .page-wrapper.article-page.article-aftercheck .try-yourself-cta h3,
    .page-wrapper.article-page.article-openbounty .try-yourself-cta h3,
    .page-wrapper.article-page.article-aftercheck .try-yourself-cta p,
    .page-wrapper.article-page.article-openbounty .try-yourself-cta p {
        display: inline !important;
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }

    .page-wrapper.article-page.article-aftercheck .try-yourself-cta h3,
    .page-wrapper.article-page.article-openbounty .try-yourself-cta h3 {
        margin-right: 10px !important;
    }

    .page-wrapper.article-page.article-aftercheck .try-yourself-cta .try-yourself-copy,
    .page-wrapper.article-page.article-openbounty .try-yourself-cta .try-yourself-copy {
        display: none !important;
    }
}

.page-wrapper.article-page.article-aftercheck .article-hero,
.page-wrapper.article-page.article-openbounty .article-hero {
    border: 0;
    background: transparent;
}

.page-wrapper.article-page .article-header {
    margin-bottom: 26px;
}

.page-wrapper.article-page .article-header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin: 0;
}

.page-wrapper.article-page .article-body {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
}

.page-wrapper.article-page .article-body p {
    margin-bottom: 24px;
    color: #333;
}

.page-wrapper.article-page .article-body h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 48px;
    margin-bottom: 24px;
    line-height: 1.3;
}

.page-wrapper.article-page .article-body h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-top: 36px;
    margin-bottom: 20px;
    line-height: 1.3;
}

.page-wrapper.article-page .article-body > h2:first-child,
.page-wrapper.article-page .article-body > h3:first-child {
    margin-top: 0;
}

.page-wrapper.article-page .article-body strong,
.page-wrapper.article-page .article-body b {
    font-weight: 600;
    color: #1a1a1a;
}

.page-wrapper.article-page .article-body ul,
.page-wrapper.article-page .article-body ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.page-wrapper.article-page .article-body li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.page-wrapper.article-page .article-body a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid #93c5fd;
    transition: border-color 0.2s;
}

.page-wrapper.article-page .article-body a:hover {
    border-bottom-color: #2563eb;
}

.page-wrapper.article-page .article-divider {
    border: 0;
    border-top: 1px solid #e5e5e5;
    margin: 36px 0;
}

/* Shared article component: image placeholder blocks */
.page-wrapper.article-page .article-image-placeholder {
    margin: 40px 0;
    text-align: center;
}

.page-wrapper.article-page .article-image-placeholder img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Shared article component: in-progress gate (blurred preview + GIF) */
.page-wrapper.article-page .article-inprogress {
    position: relative;
    padding-bottom: 18px;
}

.page-wrapper.article-page .inprogress-preview {
    position: relative;
    margin-top: 6px;
    pointer-events: none;
    user-select: none;
    filter: blur(2px);
    opacity: 0.7;
}

.page-wrapper.article-page .inprogress-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.35) 35%,
        rgba(255, 255, 255, 0.9) 75%,
        rgba(255, 255, 255, 1) 100%
    );
}

.page-wrapper.article-page .inprogress-line {
    height: 11px;
    border-radius: 999px;
    margin: 8px 0;
    background: linear-gradient(90deg, #f2f2f2 0%, #e9e9e9 35%, #f2f2f2 70%);
    background-size: 220% 100%;
    animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 0%; }
}

.page-wrapper.article-page .inprogress-toast {
    display: flex;
    justify-content: center;
    pointer-events: none;
    margin: 4px 0;
}

.page-wrapper.article-page .inprogress-stamp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-wrapper.article-page .inprogress-stamp img {
    display: block;
    height: clamp(220px, 26vw, 380px);
    width: auto;
    max-width: min(560px, 92vw);
    opacity: 0.92;
    filter: contrast(1.05);
    mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: reduce) {
    .page-wrapper.article-page .inprogress-line {
        animation: none;
    }
}

@media (max-width: 1200px) {
    .page-wrapper.article-page main {
        padding: 32px 60px 2px;
    }
}

.content-page main {
    flex: 1;
    padding: 48px;
}

.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Articles */
.articles-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.article-featured {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.article-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.article-featured-img {
    width: 100%;
    height: 280px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-featured-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-featured .tag {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    width: fit-content;
}

.article-featured h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.article-featured p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.articles-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.article-row {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.article-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.article-row-img {
    width: 100px;
    height: 70px;
    border-radius: 6px;
    background: #f5f5f5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-row-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-row-content { 
    flex: 1; 
}

.article-row .meta {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.article-row h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.articles-more {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.article-mini {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.article-mini .meta {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}

.article-mini h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Clean, responsive mobile article layout */
    .page-wrapper.article-page main {
        padding: 16px 24px 2px;
        padding-left: calc(24px + env(safe-area-inset-left));
        padding-right: calc(24px + env(safe-area-inset-right));
    }

    .page-wrapper.article-page .article-hero {
        margin-bottom: 30px;
    }

    .page-wrapper.article-page .article-header h1 {
        font-size: 1.875rem;
    }

    .page-wrapper.article-page .article-body h2 {
        font-size: 1.5rem;
        margin-top: 36px;
        margin-bottom: 20px;
    }

    .page-wrapper.article-page .article-body h3 {
        font-size: 1.25rem;
        margin-top: 28px;
        margin-bottom: 16px;
    }

    .page-wrapper.article-page .article-content-section {
        display: block;
        padding: 0;
        margin: 0;
    }

    .page-wrapper.article-page .article-container {
        max-width: 100%;
        width: 100%;
        padding: 0;
    }
    .hamburger {
        display: flex;
    }
    
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #fff;
        box-shadow: -2px 0 8px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        padding-top: 80px;
    }
    
    nav.active {
        right: 0;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        padding: 20px;
    }
    
    nav li {
        border-bottom: 1px solid #f0f0f0;
    }
    
    nav a {
        display: block;
        padding: 18px 12px;
        font-size: 16px;
    }
    
    nav a.active {
        background: none;
        color: #1a1a1a;
        font-weight: 600;
        padding: 18px 12px;
        border-radius: 0;
    }

    /* Show Contact text instead of icon in hamburger menu */
    nav a.contact-icon svg {
        display: none;
    }

    nav a.contact-icon::after {
        content: "Contact";
    }

    nav a.contact-icon {
        margin-left: 0;
    }
    
    /* Header adjustments */
    header {
        padding: 16px 24px;
    }

    header::after {
        left: 24px;
        right: 24px;
    }
    
    .brand {
        font-size: 18px;
    }
    
    /* Footer adjustments */
    footer {
        padding: 16px 24px;
    }

    footer::before {
        left: 24px;
        right: 24px;
    }
    
    /* Home page */
    .home main {
        padding: 40px 24px;
    }
    
    .home h1 {
        font-size: 32px;
    }
    
    .home main > p {
        font-size: 15px;
    }
    
    /* Content pages */
    
    /* Articles layout for insights and research */
    .articles-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Featured article - reduce image size */
    .article-featured-img {
        height: 100px;
    }
    
    .article-featured-body {
        padding: 20px;
    }
    
    .article-featured h3 {
        font-size: 18px;
    }
    
    .article-featured p {
        font-size: 13px;
        line-height: 1.6;
    }
    
    /* Article rows - smaller images, more content space */
    .article-row {
        padding: 14px;
        gap: 12px;
    }
    
    .article-row-img {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
    }
    
    .article-row-content h3 {
        font-size: 16px;
        margin-bottom: 4px;
    }
    
    .article-row-content p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .article-row-content .meta {
        font-size: 10px;
    }
    
    /* More articles grid */
    .articles-more {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .article-mini {
        padding: 16px;
    }
    
    .article-mini h4 {
        font-size: 15px;
    }
    
    .article-mini p {
        font-size: 13px;
    }
    
    /* Modal */
    .modal {
        padding: 32px 24px;
        margin: 20px;
    }
    
    .modal h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .page-wrapper.article-page main {
        padding: 12px 20px 2px;
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }

    .page-wrapper.article-page .article-container {
        padding: 0;
    }
    /* Even smaller screens */
    .home h1 {
        font-size: 28px;
    }
    
    /* Very compact layout for small screens */
    .article-featured-img {
        height: 80px;
    }
    
    .article-row-img {
        width: 45px;
        height: 45px;
    }
    
    .article-row-content h3 {
        font-size: 15px;
    }
    
    .article-row-content p {
        font-size: 13px;
    }
    
}