:root {
    --bg-color: #171717;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #262626;
    --card-bg: #171717;
    --accent-color: #f9fafb;
    --transition: all 0.2s ease;
}

body.light-theme {
    --bg-color: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --accent-color: #111827;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Home Layout --- */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 120px 24px;
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.header,
.section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo-link {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
    display: block;
}

.intro h1,
.section h2 {
    font-size: 1rem;
    font-weight: 500;
}

.section p,
.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.link-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inline-link,
.list-link {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: var(--transition);
}

.inline-link:hover,
.list-link:hover {
    color: var(--text-primary);
}

/* Left Column Grouping */
.left-col {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

/* Case Cards on Homepage */
.cases-list {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.case-card-link {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.case-image-container {
    width: 100%;
    aspect-ratio: 16/10;
    background-color: #222222;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    transition: var(--transition);
}

body.light-theme .case-image-container {
    background-color: #f3f4f6;
}

.case-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.case-card-link:hover .case-image-container img {
    transform: scale(1.02);
}

.case-card-link:hover .case-info h3 {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.case-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-info h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.case-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Desktop / Tablet layout override */
@media (min-width: 600px) {
    .container {
        max-width: 1200px;
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 48px;
        padding: 80px 32px;
    }

    .left-col {
        position: sticky;
        top: 80px;
        align-self: start;
    }
}

@media (min-width: 1024px) {
    .container {
        grid-template-columns: 380px 1fr;
        gap: 96px;
        padding: 120px 48px;
    }

    .left-col {
        top: 120px;
    }
}

/* --- Case Study Layout (samwill.is style) --- */
.case-outer {
    width: 100%;
    padding: 120px 24px;
}

.case-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    /* 1fr on left, 480px center text, 1fr on right for sidebar */
    grid-template-columns: 1fr 480px 1fr;
    gap: 80px;
    align-items: start;
}

.case-main {
    grid-column: 2;
    /* Force to center column */
    display: flex;
    flex-direction: column;
    gap: 120px;
}

/* Header inside case */
.case-header {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-bottom: -60px;
    /* Pulls context section closer to the title */
}

.case-title-block h1 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.case-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Images & Cards */
.image-showcase {
    background-color: #222222;
    /* Lighter grey requested by user */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px 24px;
    display: flex;
    justify-content: center;
    align-items: center;

    /* Make container wider than text */
    width: calc(100% + 120px);
    margin-left: -60px;

    margin-top: 32px;
    margin-bottom: 32px;
}

body.light-theme .image-showcase {
    background-color: #e5e7eb;
}

.image-showcase img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    /* Shadow removed as requested */
}

.logos {
    display: flex;
    gap: 40px;
    opacity: 0.5;
    filter: grayscale(1);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.caption {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 32px;
}

/* Content Sections */
.content-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Reduced from 32px for tighter paragraph spacing */
    scroll-margin-top: 100px;
}

.content-section h2 {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 8px;
    /* Ensures the header still feels a bit detached */
}

.content-section p {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.content-section ul {
    list-style-type: disc;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.content-section li {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.content-section strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Sidebar Nav */
.sidebar {
    grid-column: 3;
    /* Force to right column */
    position: sticky;
    top: 120px;
}

.sticky-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 200px;
    /* Optional constraint so links don't stretch */
}

.nav-link {
    display: block;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding-left: 16px;
    border-left: 2px solid transparent;
    transition: var(--transition);
}

.nav-link.active {
    color: var(--text-primary);
    border-left: 2px solid var(--text-primary);
}

.nav-link:hover {
    color: var(--text-primary);
}

/* --- Footer & Theme --- */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-top: 64px;
    width: 100%;
}

.theme-btns {
    display: flex;
    gap: 12px;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 0;
    transition: var(--transition);
}

.theme-btn.active {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1080px) {
    .case-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        gap: 0;
    }

    .case-main {
        grid-column: 1;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .image-showcase {
        width: 100%;
        margin-left: 0;
        padding: 24px 16px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.left-col>*,
.container>.cases,
.case-main>* {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.anim-1 {
    animation-delay: 0.1s;
}

.anim-2 {
    animation-delay: 0.2s;
}

.anim-3 {
    animation-delay: 0.3s;
}

.anim-4 {
    animation-delay: 0.4s;
}

/* Impact Bento Grid */
.impact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.impact-col-small {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.impact-card-bento {
    background-color: var(--card-bg);
    /* MATCHES THE REST */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body.light-theme .impact-card-bento {
    background-color: #f3f4f6;
}

.impact-metric {
    font-size: 1.8rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 24px;
    display: block;
    line-height: 1;
}

.impact-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.impact-card-large {
    padding: 40px 32px;
    justify-content: space-between;
}

.impact-quote {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    margin-bottom: 32px;
    display: block;
}

.impact-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.author-avatar {
    width: 36px;
    height: 36px;
    background-color: #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.author-role {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .impact-grid {
        grid-template-columns: 1fr;
    }
}

/* 4-Column Screenshot Row Gallery (No Scroll) */
.screenshot-row {
    aspect-ratio: auto !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    padding: 22px 24px 26px 24px !important;
    height: 310px !important;
    align-items: start !important;
    justify-items: center !important;
}

.screenshot-row img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px !important;
    object-fit: contain !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Ploxto Side-by-Side Preview Layout */
.ploxto-preview-row {
    aspect-ratio: auto !important;
    display: grid !important;
    grid-template-columns: 1.3fr 1fr !important;
    gap: 20px !important;
    padding: 22px 24px 26px 24px !important;
    height: 310px !important;
    align-items: start !important;
    overflow: hidden !important;
}

.ploxto-img-wrapper {
    height: 262px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden;
    width: 100%;
}

.ploxto-img-wrapper img,
.ploxto-preview-video {
    max-height: 100% !important;
    max-width: 48% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px !important;
    object-fit: contain !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.ploxto-chart-wrapper {
    height: 262px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* RevenueCat Card Widget (Identical replica) */
.revenuecat-card {
    background-color: #151516 !important; /* Authentic RevenueCat dark grey */
    border: 1px solid #242426 !important; /* Subtle dark border */
    border-radius: 12px !important;
    padding: 24px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    color: #ffffff !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

body.light-theme .revenuecat-card {
    background-color: #f4f4f5 !important;
    border: 1px solid #e4e4e7 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

.rc-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 20px !important;
}

.rc-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
}

body.light-theme .rc-title {
    color: #18181b !important;
}

.rc-icon {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #8e8e93 !important;
}

.rc-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    margin-bottom: auto !important;
}

.rc-value {
    font-size: 2.75rem !important; /* Large, bold dollar value */
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1 !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.03em !important;
}

body.light-theme .rc-value {
    color: #18181b !important;
}

.rc-label-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.rc-label {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: #8e8e93 !important;
}

.rc-clock-icon {
    width: 14px !important;
    height: 14px !important;
    color: #8e8e93 !important;
}

.rc-chart {
    width: calc(100% + 48px) !important; /* Stretch chart to edge of card */
    margin-left: -24px !important;
    margin-right: -24px !important;
    height: 60px !important;
    margin-top: 16px !important;
    margin-bottom: -24px !important; /* Align bottom to the card boundary */
    overflow: hidden !important;
    border-bottom-left-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

.rc-chart svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

@media (max-width: 600px) {
    .ploxto-preview-row {
        grid-template-columns: 1fr !important;
        height: auto !important;
        gap: 16px !important;
    }
    .ploxto-img-wrapper {
        height: 220px !important;
    }
    .ploxto-img-wrapper img,
    .ploxto-preview-video {
        max-height: 100% !important;
        max-width: 47% !important;
    }
    .rc-chart {
        height: 50px !important;
    }
}

/* Stacked Stats Column and Compact Widgets */
.ploxto-chart-wrapper-stacked {
    height: 262px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
}

.stacked-card {
    padding: 12px 16px !important;
    border-radius: 10px !important;
}

.stacked-card .rc-header {
    margin-bottom: 8px !important;
}

.stacked-card .rc-title {
    font-size: 0.9rem !important;
}

.stacked-card .rc-icon {
    font-size: 0.95rem !important;
}

.stacked-card .rc-icon-download {
    width: 15px !important;
    height: 15px !important;
}

.stacked-card .rc-value {
    font-size: 1.6rem !important;
    margin-bottom: 4px !important;
}

.stacked-card .rc-label {
    font-size: 0.76rem !important;
}

.stacked-card .rc-chart {
    height: 36px !important;
    margin-top: 4px !important;
    margin-bottom: -12px !important;
    width: calc(100% + 32px) !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}

/* Pull Quote Style */
.pull-quote {
    font-size: 1.35rem !important;
    font-style: italic !important;
    color: var(--text-primary) !important;
    border-left: 3px solid #ff9f0a !important; /* RevenueCat Orange accent color */
    padding-left: 20px !important;
    margin: 32px 0 !important;
    line-height: 1.5 !important;
    font-weight: 500 !important;
}

body.light-theme .pull-quote {
    border-left-color: #ff9f0a !important;
}

/* Download Button CTA */
.download-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background-color: var(--text-primary) !important;
    color: var(--bg-color) !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    transition: var(--transition) !important;
    width: fit-content !important;
    margin-top: 16px !important;
}

body.light-theme .download-btn {
    color: #ffffff !important;
}

.download-btn:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px) !important;
}

.download-btn svg {
    width: 16px !important;
    height: 16px !important;
    fill: currentColor !important;
}

/* Browser Mockup styling for iframe embedding */
.browser-mockup {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background-color: var(--card-bg) !important;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5) !important;
    width: calc(100% + 120px) !important;
    margin-left: -60px !important;
    margin-top: 32px !important;
    margin-bottom: 32px !important;
}

.browser-header {
    height: 36px !important;
    background-color: #1a1a1a !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 16px !important;
    gap: 8px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.browser-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
}

.browser-dot.red { background-color: #ff5f56 !important; }
.browser-dot.yellow { background-color: #ffbd2e !important; }
.browser-dot.green { background-color: #27c93f !important; }

.browser-address {
    margin-left: auto !important;
    margin-right: auto !important;
    background-color: #2a2a2a !important;
    color: #a0a0a0 !important;
    font-size: 0.75rem !important;
    padding: 4px 32px !important;
    border-radius: 6px !important;
    min-width: 240px !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

body.light-theme .browser-header {
    background-color: #e5e7eb !important;
}

body.light-theme .browser-address {
    background-color: #f3f4f6 !important;
    color: #4b5563 !important;
}

.browser-body {
    height: 380px !important;
    background-color: #ffffff !important;
    position: relative !important;
}

.browser-body iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    background-color: #ffffff !important;
    display: block !important;
}

@media (max-width: 768px) {
    .browser-mockup {
        width: 100% !important;
        margin-left: 0 !important;
    }
    .browser-body {
        height: 260px !important;
    }
}

/* Recognition Grid */
.recognition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 24px;
}
.recognition-grid img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}
@media (max-width: 768px) {
    .recognition-grid {
        grid-template-columns: 1fr;
    }
    .screenshot-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: start !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 16px !important;
        height: auto !important;
        gap: 16px !important;
    }
    .screenshot-row img {
        scroll-snap-align: center !important;
        height: 240px !important;
        width: auto !important;
        flex-shrink: 0 !important;
    }
    .case-main {
        gap: 64px !important;
    }
    .case-outer {
        padding: 64px 24px !important;
    }
    .case-header {
        margin-bottom: -20px !important;
    }
    .impact-col-small {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 600px) {
    .ploxto-preview-row {
        grid-template-columns: 1fr !important;
        height: auto !important;
        aspect-ratio: auto !important;
        gap: 16px !important;
    }
}