/*
 * studio — landing page.
 *
 * Served on / only, never on /content/*. Raw colour is permitted here because
 * the blast radius is one page (docs/dev/marketing-design-system.md).
 *
 * Every size resolves to a named text style and every gap to a spacing step,
 * so values below come from the two token blocks and nowhere else.
 */

.studio {
    /* Text styles: weight size/line-height family */
    --heading-1: 600 3.75rem/1 var(--m-font-display);
    --heading-2: 600 3rem/1 var(--m-font-display);
    --heading-3: 600 2.25rem/2.5rem var(--m-font-display);
    --heading-4: 600 1.875rem/2.25rem var(--m-font-display);
    --heading-5: 600 1.5rem/2rem var(--m-font-display);
    --heading-6: 600 1.25rem/1.75rem var(--m-font-display);
    --title-1: 500 1.25rem/1.75rem var(--m-font-body);
    --title-2: 500 1.125rem/1.75rem var(--m-font-body);
    --title-3: 500 1rem/1.5rem var(--m-font-body);
    --title-4: 500 0.875rem/1.25rem var(--m-font-body);
    --body-3: 400 1rem/1.5rem var(--m-font-body);
    --body-5: 500 0.875rem/1.25rem var(--m-font-body);
    --body-6: 400 0.875rem/1.25rem var(--m-font-body);
    --button-md: 600 1rem/1.5rem var(--m-font-body);
    --button-sm: 600 0.875rem/1.25rem var(--m-font-body);
    --caption-2: 400 0.875rem/1.25rem var(--m-font-body);
    --caption-3: 600 0.75rem/1rem var(--m-font-body);
    --caption-4: 500 0.75rem/1rem var(--m-font-body);
    --caption-5: 400 0.75rem/1rem var(--m-font-body);

    /* Spacing steps */
    --space-25: 0.125rem;
    --space-50: 0.25rem;
    --space-75: 0.5rem;
    --space-100: 0.75rem;
    --space-200: 1rem;
    --space-300: 1.5rem;
    --space-400: 2rem;
    --space-500: 2.5rem;
    --space-600: 3rem;
    --space-700: 4rem;
    --space-800: 5rem;
    --space-900: 6rem;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --header-room: 6rem;
}

.studio .icon { width: 1.25rem; height: 1.25rem; flex: none; }

/* --- Buttons ------------------------------------------------------------- */

.studio .button {
    min-height: 0;
    gap: var(--space-75);
    padding: var(--space-75) var(--space-100);
    border-radius: 0.5rem;
    font: var(--button-md);
    letter-spacing: 0;
    box-shadow: none;
    transition: background-color 300ms var(--ease), color 300ms var(--ease), border-color 300ms var(--ease),
                transform 300ms var(--ease);
}
.studio .header-actions .button { font: var(--button-sm); }
.studio .button--primary { box-shadow: none; }
.studio .button--primary:hover { background: var(--m-accent-deep); box-shadow: none; transform: translateY(-1px); }
.studio .button--secondary { border-color: var(--m-line); }
.studio .button--secondary:hover { background: var(--m-surface-raised); box-shadow: none; transform: translateY(-1px); }
.studio .button:active { transform: scale(0.98); }
.studio .button .icon { transition: transform 300ms var(--ease); }
.studio .button:hover .icon { transform: translateX(var(--space-50)); }

/* --- Book section: plain sections first --------------------------------- */

.book { background: var(--m-surface-alt); }
.book__canvas { display: none; }

.beat { padding: var(--space-800) 0; }
.beat--start { padding-top: calc(var(--header-room) + var(--space-400)); }
.beat__inner { display: grid; gap: var(--space-600); align-items: center; }
.beat__copy { max-width: 42.5rem; }

.beat__title { margin: 0; font: var(--heading-3); letter-spacing: -0.02em; text-wrap: balance; color: var(--m-ink); }
.beat--start .beat__title { font: var(--heading-2); letter-spacing: -0.02em; }
.beat__line { margin: var(--space-200) 0 0; color: var(--m-ink-muted); font: var(--title-1); text-wrap: pretty; }
.beat__actions { display: flex; flex-wrap: wrap; gap: var(--space-100); margin-top: var(--space-400); }
.beat__note { margin: var(--space-300) 0 0; font: var(--body-6); color: var(--m-ink-muted); }
.beat__note a { text-decoration: underline; text-underline-offset: 0.2em; }
.beat__note a:hover { color: var(--m-ink); }

.beat__page {
    justify-self: center;
    width: min(100%, 26rem);
    height: auto;
    border-radius: 0.25rem;
    box-shadow: 0 1.5rem 3rem -1rem var(--m-shadow), 0 0.25rem 0.75rem var(--m-shadow);
}
.beat__page--cover { border-radius: 0.125rem 0.5rem 0.5rem 0.125rem; }


@media (min-width: 768px) {
    .beat__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .beat__title { font: var(--heading-2); }
    .beat--start .beat__title { font: var(--heading-1); }
}

/* --- The rest of the page ------------------------------------------------ */

.studio main { padding-top: 0; } /* the book section makes its own room under the header */

.studio-section { padding: var(--space-900) 0; }
.studio-section--alt { background: var(--m-surface-alt); }
.studio-section__title {
    max-width: 42.5rem;
    margin: 0 0 var(--space-700);
    font: var(--heading-3);
    letter-spacing: -0.02em;
    text-wrap: balance;
    color: var(--m-ink);
}

/* A section's head: kicker, heading and an optional plain line, one under another. */
.section-head { margin-bottom: var(--space-700); }
.section-head .studio-section__title { margin: var(--space-200) 0 0; }
.section-head__intro { max-width: 42.5rem; margin: var(--space-300) 0 0; color: var(--m-ink-muted); font: var(--title-2); text-wrap: pretty; }

/* Benefits: numbered columns between thin rules, as on the classic landing;
   stacked rows on phones. */
.numbered { display: grid; margin: 0; padding: 0; border-top: 1px solid var(--m-line); list-style: none; }
.numbered__item {
    display: grid;
    grid-template-columns: var(--space-700) minmax(0, 1fr);
    gap: var(--space-75) var(--space-200);
    padding: var(--space-300) 0;
    border-bottom: 1px solid var(--m-line);
}
.numbered__number { grid-row: span 2; color: var(--m-highlight); font: var(--heading-4); }
.numbered__title { margin: 0; font: var(--heading-6); letter-spacing: -0.01em; text-wrap: balance; }
.numbered__text { margin: 0; color: var(--m-ink-muted); font: var(--body-3); text-wrap: pretty; }

/* The team: three portraits side by side, name and role under each. */
.team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-200); margin: 0; padding: 0; list-style: none; }
.team__photo {
    display: block;
    width: 100%;
    height: auto; /* the width and height attributes would otherwise win over the ratio */
    aspect-ratio: 4 / 5;
    margin-bottom: var(--space-200);
    border-radius: 1rem;
    background: var(--m-surface-sunken);
    object-fit: cover;
}
.team__name { margin: 0; font: var(--title-4); text-wrap: balance; }
.team__role { margin: var(--space-25) 0 0; color: var(--m-ink-muted); font: var(--caption-5); text-wrap: balance; }

/* Hover: a soft panel rises behind a benefit and its number lifts; a portrait
   lifts; a question's border darkens. Reduced motion stills them (marketing.css). */
.numbered__item { position: relative; isolation: isolate; }
.numbered__item::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: var(--space-75) calc(-1 * var(--space-100));
    border-radius: 1rem;
    background: var(--m-surface-sunken);
    opacity: 0;
    transform: scale(0.97);
    transition: opacity 300ms var(--ease), transform 500ms var(--ease);
}
.numbered__item:hover::before { opacity: 1; transform: scale(1); }
.numbered__number { transition: transform 500ms var(--ease); }
.numbered__item:hover .numbered__number { transform: translateY(calc(-1 * var(--space-50))); }
.team__photo { transition: transform 500ms var(--ease); }
.team__person:hover .team__photo { transform: translateY(calc(-1 * var(--space-75))); }
.faq__item { transition: border-color 300ms var(--ease); }
.faq__item:hover { border-color: var(--m-ink-muted); }

.steps-section { height: 360vh; background: var(--m-surface-alt); } /* long pin: the line moves slowly */
.steps-section__pin { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; padding: var(--space-800) 0 var(--space-400); }
.steps-track { position: relative; }
.steps__line {
    position: absolute;
    height: 2px;
    margin-top: -1px;
    border-radius: 1px;
    background: var(--m-accent);
    transform: scaleX(0);
    transform-origin: left center;
}
.steps__line.is-vertical { width: 2px; height: auto; margin: 0 0 0 -1px; transform: scaleY(0); transform-origin: center top; }
.steps { position: relative; display: grid; gap: var(--space-400); margin: 0; padding: 0; list-style: none; }
.steps__number {
    display: grid;
    place-items: center;
    width: var(--space-600);
    height: var(--space-600);
    margin-bottom: var(--space-300);
    border-radius: 9999px;
    background: var(--m-accent);
    box-shadow: 0 0 0 var(--space-75) var(--m-surface-alt); /* a gap where the line meets it */
    color: var(--m-accent-contrast);
    font: var(--title-1);
    font-weight: 600;
}
/* Phones: the number sits left of its text, so the line runs down a clear gutter. */
.steps__item { display: grid; grid-template-columns: var(--space-600) minmax(0, 1fr); column-gap: var(--space-200); align-items: start; }
.steps__item .steps__number { grid-row: span 2; margin-bottom: 0; }
.steps__title { margin: 0; font: var(--heading-5); letter-spacing: -0.01em; }
.steps__text { max-width: 20rem; margin: var(--space-100) 0 0; color: var(--m-ink-muted); font: var(--body-3); text-wrap: pretty; }

/* Hidden until the line reaches them (the inline script adds .is-on). */
.js .steps__number { opacity: 0; transform: scale(0.4); transition: opacity 400ms var(--ease), transform 500ms var(--ease); }
.js .steps__title, .js .steps__text { opacity: 0; transform: translateY(var(--space-200)); transition: opacity 600ms var(--ease) 150ms, transform 600ms var(--ease) 150ms; }
.js .steps__item.is-on .steps__number { opacity: 1; transform: scale(1); }
.js .steps__item.is-on .steps__title, .js .steps__item.is-on .steps__text { opacity: 1; transform: none; }

.faq { max-width: 48rem; }
.faq__list { display: grid; gap: var(--space-100); }
.faq__item { border: 1px solid var(--m-line); border-radius: 1rem; background: var(--m-surface-raised); }
.faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-200);
    padding: var(--space-300);
    font: var(--title-2);
    cursor: pointer;
    list-style: none;
}
.faq__question::-webkit-details-marker { display: none; }
.faq__toggle { position: relative; flex: none; width: var(--space-200); height: var(--space-200); }
.faq__toggle::before, .faq__toggle::after {
    content: "";
    position: absolute;
    top: calc(50% - 1px);
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    background: var(--m-accent);
    transition: transform 300ms var(--ease);
}
.faq__toggle::after { transform: rotate(90deg); }
.faq__item[open] .faq__toggle::after { transform: rotate(0deg); }
.faq__answer { margin: 0; padding: 0 var(--space-300) var(--space-300); color: var(--m-ink-muted); font: var(--body-3); text-wrap: pretty; }

.closing { position: relative; overflow: hidden; background: var(--m-highlight); color: var(--m-ink); }
.closing__shape {
    position: absolute;
    right: -10rem;
    bottom: -10rem;
    width: 32rem;
    height: 20rem;
    border: 1px solid var(--m-ink);
    border-radius: 50% 50% 0 0;
    transform: rotate(-17deg);
}
.closing__inner { position: relative; display: grid; gap: var(--space-400); align-items: end; }
.closing h2 { max-width: 42.5rem; margin: 0; padding-bottom: 0.12em; font: var(--heading-2); letter-spacing: -0.02em; text-wrap: balance; }
.closing p { max-width: 32rem; margin: var(--space-200) 0 0; color: #4a251e; font: var(--title-1); }
.closing .button--primary { background: var(--m-ink); }
.closing .button--primary:hover { background: #263a5b; }
.closing .button--secondary { border-color: var(--m-ink); }
.studio .site-footer { border-top: 0; }
.studio .footer__links { align-items: center; }
.footer__social { display: inline-flex; }

@media (min-width: 640px) {
    .closing__inner { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (min-width: 768px) {
    .studio-section__title { font: var(--heading-2); letter-spacing: -0.02em; }
    .closing h2 { font: var(--heading-1); letter-spacing: -0.02em; }
    .team { gap: var(--space-400); }
    .team__name { font: var(--title-2); }
    .team__role { font: var(--body-6); }
    .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-600); }
    .steps__item { display: block; }
    .steps__item .steps__number { margin-bottom: var(--space-300); }
}

@media (min-width: 1024px) {
    .numbered { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .numbered__item {
        display: flex;
        flex-direction: column;
        gap: var(--space-100);
        min-height: 15rem;
        padding: var(--space-400) var(--space-300);
        border-bottom: 0;
        border-left: 1px solid var(--m-line);
    }
    .numbered__item:first-child { border-left: 0; }
    .numbered__item::before { inset: var(--space-75); } /* inside its column */
    .numbered__number { margin-bottom: var(--space-200); }
    .numbered__title { min-height: 3.5rem; } /* two lines, so every column's text starts level */
}

@media (prefers-reduced-motion: reduce) {
    .steps-section { height: auto; padding: var(--space-900) 0; }
    .steps-section__pin { position: static; height: auto; }
    .js .steps__number, .js .steps__title, .js .steps__text { opacity: 1; transform: none; }
    .steps__line { display: none; }
}

/* --- Book section: 3D --------------------------------------------------------
   One screen of scrolling per step. The stage sticks to the viewport and holds
   the canvas and all five texts on top of each other; book.js keeps the current
   step sharp, the one before above it and the one after below it, both smaller
   and blurred. Stacked by default: book.js frames the book in the upper part of
   the screen and the texts sit low, small, clear of the language pill. From
   1024px the texts keep to the left third and the book to the other two. */

/* Scrolling for the four moves: 300vh on a phone, where a swipe already covers
   most of a screen, and 700vh on a desktop. */
.book-3d .book { height: 400vh; }
/* svh: a phone's toolbars never cover the bottom text, and the stage does not
   resize while they slide in and out. */
.book-3d .book__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip; }
.book-3d .book__canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 600ms var(--ease);
}
.book-3d .book.is-ready .book__canvas { opacity: 1; }
/* Until book.js has drawn its first frame (.is-ready), a plain closed book
   breathes where the 3D one will first lie. Spot, size and tilt are matched by
   eye to the first pose in book.js (POSES, STACKED_POSES): move them together.
   The perspective is the camera's, 30° of view across the stage height. It
   fades out as the canvas fades in. Only opacity and scale animate, so it stays
   smooth while the 3D code holds the main thread. If the 3D fails, .book-3d goes and
   the loader with it. */
.book-3d .book__stage::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 39.5%;
    width: min(70%, 31.5svh);
    aspect-ratio: 707 / 1000;
    translate: -50% -50%;
    transform: perspective(187svh) rotateX(54deg) rotateZ(-17deg);
    border-radius: var(--m-radius-sm) var(--m-radius) var(--m-radius) var(--m-radius-sm);
    background: linear-gradient(90deg, rgb(20 36 63 / 0.07) 0 7%, transparent 7%) var(--m-line); /* the spine */
    box-shadow: 0 var(--space-300) var(--space-600) calc(-1 * var(--space-200)) var(--m-shadow);
    animation: book-loading 0.9s ease-in-out infinite alternate;
    transition: opacity 600ms var(--ease);
}
.book-3d .book.is-ready .book__stage::before { opacity: 0; animation: none; }
@keyframes book-loading { from { opacity: 0.2; scale: 0.94; } }
.book-3d .book__steps { position: absolute; inset: 0; pointer-events: none; }
.book-3d .beat { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 0 0 var(--space-800); }
.book-3d .beat__inner { width: 100%; padding-inline: var(--space-200); grid-template-columns: minmax(0, 1fr); }
.book-3d .beat__copy { transform-origin: left bottom; will-change: transform, opacity, filter; }
.book-3d .beat:not(:first-child) .beat__copy { opacity: 0; } /* until book.js places them */
.book-3d .beat__title, .book-3d .beat--start .beat__title { font: var(--heading-4); letter-spacing: -0.02em; }
.book-3d .beat__line { margin-top: var(--space-75); font: var(--body-3); }
.book-3d .beat__actions { margin-top: var(--space-200); }
.book-3d .beat__note { margin-top: var(--space-100); }
.book-3d .beat__page { display: none; }

@media (min-width: 1024px) {
    .book-3d .book { height: 800vh; }
    .book-3d .book__stage::before { left: 67%; top: 49%; width: min(29%, 67svh); transform: perspective(187svh) rotateX(54deg) rotateZ(-22deg); }
    .book-3d .beat { align-items: center; padding: 0; }
    .book-3d .beat__inner { padding-inline: var(--space-600); grid-template-columns: minmax(0, 28rem); }
    .book-3d .beat__copy { transform-origin: left center; }
    .book-3d .beat__title, .book-3d .beat--start .beat__title { font: var(--heading-1); }
    .book-3d .beat__line { margin-top: var(--space-200); font: var(--title-1); }
    .book-3d .beat__actions { margin-top: var(--space-400); }
    .book-3d .beat__note { margin-top: var(--space-300); }
}
