/* ===========================================================
   Insight — Case File
   Palette:  --in-bg #0D1210     --in-panel #141B17
             --in-green #2FD6A0  --in-green-deep #1FA37A
             --in-paper #F3F1E9  --in-ink #1B1F1A
             --in-cream #EAF2EC  --in-muted #7C9088
   Type:     Fraunces — the ledger's human voice (display,
             headline, anything meant to read warmly)
             Inter — studio UI voice + reading copy
             IBM Plex Mono — figures, line-items, anything
             that has to line up in a column
   Signature: the receipt — an itemised paper slip with a
             torn edge, sitting on the dark page the way a
             receipt sits on a desk after closing the books
=============================================================== */

.in-page {
    background: var(--in-bg);
    color: var(--in-cream);
    overflow-x: clip;
}

.in-page * {
    box-sizing: border-box;
}

.in-page ::selection {
    background: var(--in-green);
    color: #0d1210;
}

.in-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 500 .72rem "IBM Plex Mono", monospace;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--in-green);
}

.in-eyebrow::before {
    content: "";
    width: 14px;
    height: 1px;
    background: var(--in-green);
}

/* ===========================
   Hero
=========================== */

.in-hero {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: flex-end;
    padding: 120px 64px 72px;
    border-bottom: 1px solid var(--in-line);
    overflow: hidden;
}

/* Same atmosphere as the Insight chapter on the projects page:
   faint ledger-ruled paper behind an upward sparkline, rather
   than a new motif invented just for this page. */
.in-hero-ledger {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(to bottom,
            /* horizontal rules — unchanged */
            var(--in-line) 0px,
            var(--in-line) 1px,
            transparent 1px,
            transparent 40px),
        repeating-linear-gradient(to right,
            /* NEW: vertical rules, same rhythm */
            var(--in-line) 0px,
            var(--in-line) 1px,
            transparent 1px,
            transparent 40px),
        linear-gradient(to right,
            /* red margin rule — kept, painted on top */
            transparent 0,
            transparent 63px,
            rgba(255, 138, 128, .3) 63px,
            rgba(255, 138, 128, .3) 64px,
            transparent 64px);
    mask-image: radial-gradient(ellipse 72% 62% at 76% 24%, #000 0%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 72% 62% at 76% 24%, #000 0%, transparent 78%);
    opacity: .75;
}

.in-hero-sparkline {
    position: absolute;
    right: 4%;
    bottom: 14%;
    width: min(42vw, 480px);
    z-index: 0;
    pointer-events: none;
}

.in-hero-sparkline path {
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    animation: inDraw 2.4s cubic-bezier(.19, 1, .22, 1) .3s forwards;
}

@keyframes inDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.in-hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.in-hero-title {
    margin: 18px 0 22px;
    font: 500 clamp(3rem, 8vw, 6.6rem) "Fraunces", serif;
    line-height: .98;
    color: var(--in-cream);
    letter-spacing: -.01em;
}

.in-hero-sub {
    max-width: 46ch;
    font: 400 1.05rem/1.6 "Inter", sans-serif;
    color: var(--in-muted);
}

.in-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--in-line);
}

.in-hero-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.in-hero-meta-item dt {
    font: 500 .66rem "Inter", sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--in-muted);
}

.in-hero-meta-item dd {
    margin: 0;
    font: 400 .9rem "IBM Plex Mono", monospace;
    color: var(--in-cream);
}

.in-status-dot {
    margin-bottom: 2px;
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--in-green);
    margin-right: 6px;
    box-shadow: 0 0 0 3px rgba(47, 214, 160, .18);
}

/* ===========================
   Shared section rhythm
=========================== */

.in-section {
    padding: 96px 64px;
    border-bottom: 1px solid var(--in-line);
}

.in-section-head {
    max-width: 640px;
    margin-bottom: 48px;
}

.in-section-title {
    margin: 14px 0 0;
    font: 500 clamp(1.7rem, 3.2vw, 2.4rem) "Inter", sans-serif;
    letter-spacing: -.01em;
    color: var(--in-cream);
}

.in-section-title em {
    font-family: "Fraunces", serif;
    font-style: italic;
    color: var(--in-green);
}

/* ===========================
   The Brief
=========================== */

.in-brief {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 64px;
    align-items: start;
}

.in-brief-copy p {
    margin: 0 0 18px;
    font: 400 1.02rem/1.7 "Inter", sans-serif;
    color: var(--in-muted);
    max-width: 56ch;
}

.in-brief-copy p:last-child {
    margin-bottom: 0;
}

.in-brief-copy strong {
    color: var(--in-cream);
    font-weight: 500;
}

/* --- The Receipt: the signature element --- */

.in-receipt {
    position: relative;
    background: var(--in-paper);
    color: var(--in-ink);
    padding: 28px 26px 34px;
    max-width: 320px;
    justify-self: end;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .5);
    transform: rotate(-1deg);
}

.in-receipt-head {
    text-align: center;
    margin-bottom: 18px;
}

.in-receipt-head b {
    display: block;
    font: 600 .82rem "IBM Plex Mono", monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.in-receipt-head span {
    display: block;
    margin-top: 4px;
    font: 400 .68rem "IBM Plex Mono", monospace;
    color: #5a6058;
    letter-spacing: .04em;
}

.in-receipt-rows {
    margin: 0 0 14px;
    border-top: 1px dashed rgba(27, 31, 26, .35);
    border-bottom: 1px dashed rgba(27, 31, 26, .35);
    padding: 6px 0;
}

.in-receipt-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    font: 400 .78rem "IBM Plex Mono", monospace;
}

.in-receipt-row dt {
    color: #3d423e;
}

.in-receipt-row dd {
    margin: 0;
    color: var(--in-ink);
}

.in-receipt-total {
    display: flex;
    justify-content: space-between;
    font: 600 .92rem "IBM Plex Mono", monospace;
    letter-spacing: .02em;
}

.in-receipt-total dd {
    margin: 0;
    color: var(--in-green-deep);
}

/* torn/perforated bottom edge */
.in-receipt::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -11px;
    height: 22px;
    background:
        linear-gradient(-45deg, var(--in-paper) 11px, transparent 0),
        linear-gradient(45deg, var(--in-paper) 11px, transparent 0);
    background-size: 22px 22px;
    background-position: left bottom;
    background-repeat: repeat-x;
}

/* ===========================
   Pull quote
=========================== */

.in-quote {
    text-align: center;
    padding: 110px 64px;
}

.in-quote blockquote {
    margin: 0 auto;
    max-width: 780px;
    font: 500 clamp(1.4rem, 2.8vw, 2.1rem) "Fraunces", serif;
    line-height: 1.45;
    color: var(--in-cream);
}

.in-quote cite {
    display: block;
    margin-top: 24px;
    font: 500 .72rem "IBM Plex Mono", monospace;
    font-style: normal;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--in-muted);
}

/* ===========================
   Chapter nav (prev/next + back)
=========================== */

.in-chapternav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 64px;
    gap: 24px;
    flex-wrap: wrap;
}

.in-chapternav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--in-muted);
    font: 400 .85rem "Inter", sans-serif;
    transition: color .25s ease;
}

.in-chapternav-link:hover {
    color: var(--in-green);
}

.in-chapternav-link svg {
    width: 16px;
    height: 16px;
    transition: transform .25s ease;
}

.in-chapternav-link.next:hover svg {
    transform: translateX(3px);
}

.in-chapternav-link.back:hover svg {
    transform: translateX(-3px);
}

/* ===========================
   Focus visibility
=========================== */

.in-page a:focus-visible,
.in-page button:focus-visible {
    outline: 2px solid var(--in-green);
    outline-offset: 3px;
}

/* ===========================
   Sidebar offset — matches every other page on the site
=========================== */

@media (min-width: 1025px) {

    .in-hero,
    .in-section,
    .in-quote,
    .in-chapternav {
        margin-left: var(--sidebar-w);
    }
}

/* ===========================
   Responsive
=========================== */

@media (max-width: 1024px) {

    .in-hero,
    .in-section,
    .in-quote,
    .in-chapternav {
        padding-left: 28px;
        padding-right: 28px;
    }

    .in-brief {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .in-receipt {
        justify-self: start;
        transform: rotate(0);
    }
}

@media (max-width: 640px) {
    .in-hero {
        min-height: auto;
        padding-top: 96px;
        padding-bottom: 48px;
    }

    .in-hero-meta {
        gap: 20px;
    }

    .in-hero-sparkline {
        width: min(60vw, 320px);
        bottom: 8%;
        opacity: .7;
    }
}

/* ===========================
   Dashboard screen frame
=========================== */

.in-screen {
    border: 1px solid var(--in-line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--in-panel);
    box-shadow: 0 24px 48px rgba(0, 0, 0, .5);
}

.in-screen-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .03);
    border-bottom: 1px solid var(--in-line);
}

.in-screen-dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--in-muted);
    opacity: .4;
}

.in-screen-url {
    flex: 1;
    min-width: 0;
    margin-left: 10px;
    font: 400 .78rem "IBM Plex Mono", monospace;
    color: var(--in-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.in-screen-body {
    line-height: 0;
}

.in-screen-body img {
    width: 100%;
    height: auto;
    display: block;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: rgba(0, 0, 0, .82);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}

.lightbox-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
    transform: scale(.96);
    transition: transform .25s ease;
}

.lightbox-overlay.is-open .lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}

.lightbox-close svg {
    width: 18px;
    height: 18px;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, .16);
}

/* ===========================
   Visit button — "settle the ledger"
=========================== */

.in-visit-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 36px;
    padding: 13px 22px 13px 18px;
    background: rgba(47, 214, 160, .08);
    border: 1px solid rgba(47, 214, 160, .35);
    border-radius: 6px;
    color: var(--in-cream);
    font: 500 .82rem "IBM Plex Mono", monospace;
    letter-spacing: .04em;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .25s ease, background .25s ease, transform .2s ease;
}

.in-visit-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent, rgba(47, 214, 160, .18), transparent);
    transform: translateX(-120%);
    transition: transform .5s ease;
}

.in-visit-btn:hover {
    background: rgba(47, 214, 160, .14);
    border-color: var(--in-green);
    transform: translateY(-1px);
}

.in-visit-btn:hover::before {
    transform: translateX(120%);
}

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

.in-visit-btn .in-visit-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--in-green);
    box-shadow: 0 0 0 3px rgba(47, 214, 160, .18);
    flex-shrink: 0;
}

.in-visit-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--in-green);
    transition: transform .25s ease;
}

.in-visit-btn:hover svg {
    transform: translateX(3px);
}

.in-visit-btn:focus-visible {
    outline: 2px solid var(--in-green);
    outline-offset: 3px;
}