/* Case study pages.
   The layout is the original one — title with a facts cluster, two-up prose
   sections, figure plates, two-up figure rows, "other projects" cards. Only the
   skin changes: Commit Mono, the near-black/cream palette, em spacing and
   hairlines from site.css, square corners instead of the 16px radius.

   Loaded after styles.css and site.css, so it overrides the original px/Geist
   values. Rules are scoped with .site where the shared reset in site.css would
   otherwise win on specificity. */

/* The original .main-content carried a max-width, 64px padding and an 87px top
   margin for the old fixed navbar. The new header is absolute, and site.css
   already owns page padding. */
.site main.main-content {
    max-width: none;
    margin: 0;
    padding: calc(var(--base-padding-y) * 2 + 1em) var(--base-padding-x);
}

.case-study {
    max-width: none;
    margin: 0;
    padding: 0 0 4em;
}

/* ------------------------------------------------------------------ Header */

.cs-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2em;
    padding-bottom: 2em;
    border-bottom: 1px solid var(--hairline);
}

.site .cs-header h1 {
    font-size: clamp(1.6em, 4.2vw, 3.6em);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin: 0;
}

/* Title and its outbound link travel together as the left half of the header,
   so the facts cluster keeps the right */
.cs-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1em;
}

/* Out to the live project. Sits at the dim tier so it reads as a companion to
   the title rather than competing with it, and comes up to full strength on
   hover along with the rule underneath. */
.site .cs-visit {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    position: relative;
    padding-bottom: 0.25em;
    color: var(--color-dim);
    text-decoration: none;
    cursor: none;
    transition: color 0.35s ease;
}

.site .cs-visit::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.site .cs-visit:hover {
    color: var(--color-primary);
}

.site .cs-visit:hover::after {
    transform: scaleX(1);
    transform-origin: left center;
}

.cs-visit-arrow {
    width: 0.8em;
    height: 0.8em;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The arrow leaves in the direction it points */
.cs-visit:hover .cs-visit-arrow {
    transform: translate(0.2em, -0.2em);
}

.cs-facts {
    display: flex;
    gap: 2.5em;
    flex-shrink: 0;
    margin: 0.4em 0 0;
}

.site .cs-facts dt {
    color: var(--color-faint);
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 0.3em;
}

.site .cs-facts dd {
    color: var(--color-primary);
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
    max-width: 14em;
}

/* ---------------------------------------------------------------- Sections */

.site .cs-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2em;
    margin: 5em 0;
}

.site .cs-section h2 {
    font-size: 1em;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.4;
    margin: 0;
}

/* The Wildlife Warfare overview uses its otherwise open left column as a
   stage for the supplied lying-elephant model. The model remains transparent
   so it belongs to the page rather than reading as another media card. */
.cs-overview-visual {
    min-width: 0;
}

.cs-elephant-stage {
    position: relative;
    width: 100%;
    height: clamp(18em, 22vw, 23em);
    margin-top: 1.25em;
}

.cs-elephant-model {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    --poster-color: transparent;
}

/* Body copy sits at full strength. List items share the tier — they run in the
   same flow as the paragraphs, so splitting them would read as a bug. */
.site .cs-body p,
.site .cs-body li {
    color: var(--color-primary);
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 1em;
}

.site .cs-body > *:last-child,
.site .cs-body li:last-child {
    margin-bottom: 0;
}

.site .cs-body strong {
    font-weight: 700;
    color: var(--color-primary);
}

.site .cs-body ul {
    list-style: none;
    margin: 0 0 1em;
    padding: 0;
}

/* Hanging marker, echoing the arrow icons elsewhere on the site */
.site .cs-body li {
    position: relative;
    padding-left: 1.5em;
}

.site .cs-body li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--color-faint);
}

/* ----------------------------------------------------------------- Figures */

.cs-figure {
    margin: 5em 0;
}

/* Square rather than the original 16px radius — the new design has no rounding */
.cs-figure-media {
    border-radius: 0;
    overflow: hidden;
    background: rgba(255, 255, 227, 0.06);
}

.cs-figure img {
    display: block;
    width: 100%;
    height: auto;
    -webkit-user-drag: none;
    user-select: none;
}

.cs-figure--phone .cs-figure-media {
    max-width: 18em;
    margin: 0 auto;
}

.cs-figure--tall .cs-figure-media {
    max-width: 34em;
    margin: 0 auto;
}

.site .cs-figure figcaption {
    color: var(--color-dim);
    line-height: 1.4;
    margin-top: 1em;
    max-width: 46em;
}

.cs-figure--phone figcaption,
.cs-figure--tall figcaption {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Two-up figure row */
.cs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
    margin: 5em 0;
}

.cs-grid .cs-figure {
    margin: 0;
}

/* --------------------------------------------------------- Other projects */

.site .cs-more {
    margin-top: 6em;
    padding-top: 3em;
    border-top: 1px solid var(--hairline);
}

.site .cs-more h2 {
    font-size: 1em;
    font-weight: 700;
    color: var(--color-faint);
    line-height: 1.4;
    letter-spacing: normal;
    margin: 0 0 1em;
}

.cs-more-card {
    display: block;
    padding: 1.5em 0;
    border-bottom: 1px solid var(--hairline);
    text-decoration: none;
    cursor: none;
}

.cs-more-card:first-of-type {
    border-top: 1px solid var(--hairline);
}

.site .cs-more-card h3 {
    font-size: clamp(1.3em, 2.4vw, 2em);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.05;
    margin: 0 0 0.4em;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.site .cs-more-card p {
    color: var(--color-primary);
    line-height: 1.4;
    margin: 0 0 1em;
    max-width: 40em;
}

/* The card already reads at full strength, so hover is carried by the title
   shifting rather than a colour change that would have nowhere to go */
.cs-more-card:hover h3 {
    transform: translateX(0.6em);
}

.cs-more-card .cs-facts {
    margin: 0;
}

/* -------------------------------------------------------------- Responsive */

@media only screen and (max-width: 1024px) {
    .cs-header {
        flex-direction: column;
        gap: 1.5em;
    }

    .cs-facts {
        margin: 0;
        gap: 2em;
        flex-wrap: wrap;
    }

    .site .cs-section {
        grid-template-columns: 1fr;
        gap: 1em;
        margin: 3.5em 0;
    }

    .cs-elephant-stage {
        height: clamp(17em, 48vw, 22em);
        margin-top: 0.75em;
    }

    .cs-figure,
    .cs-grid {
        margin: 3.5em 0;
    }

    .site .cs-more {
        margin-top: 4em;
    }
}


@media only screen and (max-width: 620px) {
    /* Two-up rows stack rather than squeezing */
    .cs-grid {
        grid-template-columns: 1fr;
        gap: 2em;
    }

    .cs-figure,
    .cs-grid {
        margin: 2.5em 0;
    }
}
