/* Homepage "Point of view" (right after the hero), after design-refs/section2.png.
   A large centered heading naming the problem (two or three lines on desktop), then three light-grey cards on
   what we do: an icon in a grey circle at the top, the title and text at the bottom.
   Mobile-first: the cards stack; three side by side from 1024px. */

:root {
    --principles-ink: #0a0a0a;
    --principles-ink-2: #595959;
    --principles-muted: #767676;
    --principles-card-bg: #f2f0f0;  /* the reference's warm light grey */
    --principles-icon-bg: #d5d4d4;
    --principles-card-radius: 1.25rem;
}

.principles {
    padding: clamp(3rem, 2.5rem + 2.5vw, 5rem) max(var(--gutter), env(safe-area-inset-right)) clamp(4rem, 3rem + 4vw, 7rem) max(var(--gutter), env(safe-area-inset-left)); /* less space above: it follows the hero closely */
    background-color: #ffffff; /* covers the page's grey wash behind it */
    color: var(--principles-ink);
    font-family: "Geist", -apple-system, system-ui, sans-serif;
}

/* The heading: about 15 words in large type, one dark color, two lines on desktop. Centered at every size. */
.principles__statement {
    max-width: 24em; /* two balanced lines on desktop */
    margin: 0 auto;
    text-align: center;
    color: #26262c;
    font-size: var(--section-title); /* every section heading: 28px on phones to 55px from 1440px (site-header.css) */
    font-weight: 400;
    line-height: 1.05; /* Palantir-tight; the lines open out from here as it comes into view */
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}


/* Settling on scroll, after palantir.com (static/principles.js). The script splits the statement into its
   lines and sets --loose from 1 (the statement is just coming into view) to 0 (all of it is on screen): at 1
   the statement sits 1.2em lower, at 40% opacity, with its lines spread 0.2em further apart; at 0 it's the
   normal setting above. The spread is done with transforms on each line rather than by changing the line
   height, so the page below never shifts and nothing re-wraps. */
.principles__statement[data-settle] {
    opacity: calc(1 - var(--loose, 0) * 0.6);
}

.principles__line {
    display: block;
    white-space: nowrap;
    transform: translate3d(0, calc(var(--loose, 0) * (1.2em + var(--i) * 0.2em)), 0);
    will-change: transform;
}

/* While the heading settles, the cards ride along with it (static/principles.js sets --settle-push), so the
   space between them stays the same and the heading's lines never run into the cards */
.principles__cards {
    transform: translate3d(0, calc(var(--loose, 0) * var(--settle-push, 0px)), 0);
    will-change: transform;
    display: grid;
    gap: 0.75rem; /* the reference's 12px between cards */
    margin: clamp(3rem, 2rem + 3vw, 5rem) 0 0;
    padding: 0;
    list-style: none;
}

.principle {
    display: flex;
    flex-direction: column;
    padding: clamp(1.25rem, 1rem + 0.75vw, 1.5rem);
    border-radius: var(--principles-card-radius);
    background: var(--principles-card-bg);
}

.principle__icon {
    display: grid;
    place-items: center;
    width: clamp(3.5rem, 2.75rem + 2vw, 4.5rem); /* 56px on phones, 72px on desktop */
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--principles-icon-bg);
    color: #ffffff;
}

.principle__icon svg {
    width: 50%;
    height: 50%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The title and text sit at the bottom of the card, well clear of the icon */
.principle__title {
    margin: clamp(2.5rem, 1.5rem + 4vw, 5rem) 0 0;
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); /* 24px on phones, 32px from about 1280px */
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.principle__text {
    max-width: 40ch;
    margin: 1rem 0 0;
    color: #525252;
    font-size: 1rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

@media (min-width: 768px) {
    .principle__text {
        font-size: 1.0625rem;
    }
}

/* Desktop: three cards side by side. The cards share rows (subgrid), so the titles start on one line and
   the texts on another even when one title wraps to two lines. */
@media (min-width: 1024px) {
    .principles__cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: auto auto 1fr;
        row-gap: 0;
    }

    .principle {
        display: grid;
        grid-row: span 3;
        grid-template-rows: subgrid;
        align-content: start;
        padding-bottom: 3rem;
    }

    .principle__icon {
        align-self: start;
    }

    .principle__title {
        margin-top: 6.5rem;
        align-self: end;
    }

    .principle__text {
        align-self: start;
    }
}
