/* Homepage phone composition. Every rule is gated, including when imported elsewhere. */
@media (max-width: 767px) {
    body[data-page="home"] { --home-side: clamp(20px, 6.15vw, 36px); --home-heading: clamp(34px, 9.8vw, 48px); }
    [data-page="home"] main > section:not(.story-hero) { padding: 64px var(--home-side); overflow-wrap: normal; }
    [data-page="home"] main > section:not(.story-hero) h2 { line-height: 1.04; letter-spacing: -.05em; text-wrap: balance; }
    [data-page="home"] .brand-nav { top: max(10px, env(safe-area-inset-top)); width: calc(100% - 24px); border-radius: 16px; background: #102b39f5; box-shadow: 0 6px 24px #102b3918; }
    [data-page="home"] .brand-nav .wordmark { font-size: 11px; letter-spacing: -.025em; }
    [data-page="home"] .brand-nav .key-control { border-radius: 10px; background: #d2edf016; }

    /* The scene stays native-scroll driven. Its invitation occupies the lower third. */
    [data-page="home"] .home-mobile-intro { display: grid !important; position: absolute; z-index: 8; left: var(--home-side); right: var(--home-side); bottom: max(24px, 4svh); gap: 0; color: #17313f; pointer-events: auto; }
    [data-page="home"] .home-mobile-intro__eyebrow { margin: 0 0 12px; font: 500 10px/1.5 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
    [data-page="home"] .home-mobile-intro__title { margin: 0; font-size: clamp(36px, 10.5vw, 48px); font-weight: 500; line-height: 1.03; letter-spacing: -.05em; }
    [data-page="home"] .home-mobile-intro__cta { display: flex; align-items: center; justify-content: space-between; min-height: 56px; margin-top: 22px; padding: 14px 20px; border-radius: 12px; background: #17313f; color: #effcff; font-size: 16px; font-weight: 500; text-decoration: none; }
    .home-mobile-intro__cta span { font-size: 24px; }
    [data-page="home"] .home-mobile-intro__explore { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 6px; color: inherit; font-size: 12px; text-decoration: none; }
    .home-mobile-intro__explore span { font-size: 18px; }
    body[data-page="home"][data-hero-theme="night"] .home-mobile-intro { color: #effcff; }
    body[data-page="home"][data-hero-theme="night"] .home-mobile-intro__cta { background: #d3eef1; color: #102b39; }
    body[data-page="home"][data-hero-theme="dawn"] .home-mobile-intro { color: #fff7f3; }
    body[data-page="home"][data-hero-theme="dawn"] .home-mobile-intro__cta { background: #ffe0d6; color: #3d2948; }
    :is(.no-js body, body.no-webgl)[data-page="home"] .story-hero__stage { min-height: min(800px, 100svh); padding: 92px var(--home-side) 24px; gap: 4px; grid-template-rows: minmax(190px, 1fr) auto; background: radial-gradient(ellipse at 80% 12%, #f7fcff, transparent 50%), linear-gradient(#dbe9ef, #c1d6dd); }
    :is(.no-js body, body.no-webgl)[data-page="home"] .story-hero__content { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    :is(.no-js body, body.no-webgl)[data-page="home"] .story-hero__fallback-art { grid-row: 1; width: min(100%, 390px); max-height: 36svh; object-fit: contain; justify-self: center; }
    :is(.no-js body, body.no-webgl)[data-page="home"] .home-mobile-intro { position: relative; grid-row: 2; left: auto; right: auto; bottom: auto; }
    body.no-webgl[data-page="home"][data-hero-theme="night"] .story-hero__stage { background: linear-gradient(#071427, #304e68); }
    body.no-webgl[data-page="home"][data-hero-theme="dawn"] .story-hero__stage { background: linear-gradient(#30284f, #684c73 38%, #c47b8c 72%, #f0b19f); }

    /* The five steps as a run of keys, borrowing the keycap the hero builds its igloo from: a
       numbered face with a pressed edge, each one stepping in from the last and joined by a
       hairline elbow, so the column reads as one path rather than five rows. */
    [data-page="home"] main > .service-journey { padding-top: 50px; background: linear-gradient(#c1d6dd, #edf2f3 170px); }
    .service-journey::before { content: none; }
    [data-page="home"] .service-journey h2 { max-width: 12ch; font-size: clamp(38px, 11vw, 50px); }
    [data-page="home"] .service-journey .story-services__list { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 34px; padding: 0; gap: 12px; }
    [data-page="home"] .service-journey .story-services__list::before,
    [data-page="home"] .service-journey .story-services__list::after { display: none; content: none; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(n) { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto; align-items: center; min-height: 76px; gap: 0 16px; padding: 14px 18px; border: 1px solid #a9c3cd; border-radius: 18px; background: linear-gradient(162deg, #fff, #e3eef1); box-shadow: inset 0 1px 0 #fff, 0 4px 0 #bdd0d8, 0 18px 26px -22px #22485a; text-align: left; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(2) { margin-left: 9px; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(3) { margin-left: 18px; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(4) { margin-left: 27px; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(5) { margin-left: 36px; }
    /* The elbow leaves the key above at its own left edge and turns in to meet this one. */
    [data-page="home"] .service-journey .story-services__list > li:nth-child(n)::before { display: none; content: none; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(n + 2)::before { display: block; content: ''; position: absolute; left: -9px; top: -8px; width: 9px; height: 22px; border: 0; border-left: 1px solid #93b5c1; border-bottom: 1px solid #93b5c1; border-bottom-left-radius: 9px; border-radius: 0 0 0 9px; background: none; box-shadow: none; }
    [data-page="home"] .service-journey .story-services__list > li:nth-child(n)::after { display: grid; content: counter(service, decimal-leading-zero); position: static; grid-column: 3; grid-row: 1; place-items: center; width: auto; height: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: #86a7b4; font: 500 11px/1 var(--font-accent); letter-spacing: .12em; }
    [data-page="home"] .service-journey .story-services__list .service-symbol { grid-column: 1; grid-row: 1; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid #c3d7de; border-radius: 50%; background: #f8fbfc; box-shadow: none; color: #3f697c; }
    [data-page="home"] .service-journey .service-symbol svg { width: 25px; height: 25px; }
    [data-page="home"] .service-journey .story-services__list h3 { grid-column: 2; grid-row: 1; margin: 0; font-size: clamp(20px, 5.4vw, 24px); line-height: 1.15; letter-spacing: -.035em; }

    /* Native horizontal project browsing, if the portfolio section is enabled. */
    [data-page="home"] .home-selected__grid { display: grid; grid-auto-flow: column; grid-auto-columns: 86%; grid-template-columns: none; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: var(--home-side); margin: 28px calc(-1 * var(--home-side)) 0; padding: 0 var(--home-side) 20px; scrollbar-width: thin; }
    .home-selected__project { scroll-snap-align: start; }
    .home-selected__frame { border-radius: 12px; }
    .home-selected__caption { margin-top: 16px; padding-top: 13px; }
    .home-selected__caption strong { font-size: 24px; }

    /* Dark, tactile search chapter: oversized data beside short, readable copy. */
    [data-page="home"] main > #discovery { padding-block: 48px 40px; border-radius: 28px 28px 0 0; background: radial-gradient(ellipse at 100% 0%, #2b5360, transparent 55%), #102b39; }
    [data-page="home"] #discovery h2 { padding-bottom: 0; font-size: clamp(36px, 10vw, 48px); max-width: 14ch; }
    .discovery-chapter__heading h2 .discovery-chapter__term { position: static; }
    .discovery-chapter__heading h2 small { position: static; margin-top: 8px; white-space: normal; font-size: 11px; }
    .discovery-chapter__body { margin-top: 32px; gap: 24px; }
    .discovery-statistic { display: grid; grid-template-columns: 46% minmax(0, 1fr); align-items: center; column-gap: 16px; }
    .discovery-statistic > strong { font-size: clamp(70px, 22vw, 96px); white-space: nowrap; }
    [data-page="home"] .discovery-statistic > p { margin: 0; font-size: 14px; line-height: 1.5; color: #bcd4dd; }
    .discovery-statistic > p b { display: inline-block; color: #f2fbff; font-weight: 500; font-size: 18px; line-height: 1.2; margin-bottom: 7px; }
    .discovery-statistic__track { grid-column: 1 / -1; margin-top: 20px; height: 2px; }
    .discovery-statistic details { grid-column: 1 / -1; }
    [data-page="home"] #discovery summary { min-height: 44px; font-size: 12px; }
    .discovery-preview { padding: 18px 16px; border-radius: 20px; background: #ffffff06; box-shadow: 0 16px 32px -24px #020e18; }
    [data-page="home"] .discovery-preview__query p { font-size: 12px; line-height: 1.6; }
    .discovery-preview__result { border-radius: 12px; padding: 16px 12px; gap: 12px; background: linear-gradient(130deg, #315c6a, #234756); }
    .discovery-preview__mark { height: 44px; }
    .discovery-preview__result h3 { font-size: 23px; }
    [data-page="home"] .discovery-preview__result p { font-size: 14px; line-height: 1.5; }
    .discovery-preview__cta { min-height: 44px; }
    [data-page="home"] .discovery-preview__caption { text-align: right; font-size: 10px; margin-top: 10px; }
    [data-page="home"] .discovery-chapter__explanation { font-size: 15px; line-height: 1.6; }

    /* One card per quality: marked icon, the word, and the line that earns it. No flip on a
       phone, where there is no hover to invite it and the description has to be readable at rest. */
    [data-page="home"] main > .quality-section { background: #dfe9ec; }
    [data-page="home"] #quality h2 { max-width: 12ch; }
    [data-page="home"] .quality-section__strip { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 26px; border: 0; }
    [data-page="home"] .quality-section__strip > div,
    [data-page="home"] .quality-section__strip > div + div { min-width: 0; min-height: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; column-gap: 16px; row-gap: 5px; padding: 18px; border: 1px solid #c6d7dd; border-radius: 20px; background: #f8fbfb; box-shadow: 0 12px 26px -24px #23485a; }
    [data-page="home"] .quality-section__strip svg { grid-column: 1; grid-row: 1 / span 2; box-sizing: border-box; width: 54px; height: 54px; padding: 9px; border: 1px solid #d4e4e9; border-radius: 16px; background: #fff; stroke-width: 2; }
    [data-page="home"] .quality-section__strip strong { grid-column: 2; grid-row: 1; align-self: end; font-size: clamp(24px, 6.8vw, 30px); line-height: 1.05; letter-spacing: -.04em; }
    [data-page="home"] .quality-section__strip p { grid-column: 2; grid-row: 2; align-self: start; position: static; max-width: none; margin: 0; font-size: 14px; line-height: 1.5; text-align: left; }

    /* With the script in place the three panels become one dark stage, lit from the corner, showing
       a single quality at a time with the three names set under it. The cards give up their boxes
       (display: contents) so their parts can be placed straight into this grid: every icon in the
       stage, every sentence beneath it, and each word in the row of names. */
    [data-page="home"] .quality-section__strip[data-quality-cards="interactive"] { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; column-gap: 6px; row-gap: 0; margin-top: 28px; isolation: isolate; }
    [data-page="home"] [data-quality-cards="interactive"]::before { content: ""; z-index: -1; grid-area: 1 / 1 / 3 / -1; border-radius: 26px; background: radial-gradient(120% 90% at 82% 6%, #2d6a85, #123342 58%, #0c2330); box-shadow: 0 24px 44px -32px #0c2330; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card,
    [data-page="home"] [data-quality-cards="interactive"] .quality-card__face { display: contents; }

    [data-page="home"] [data-quality-cards="interactive"] .quality-card svg { grid-area: 1 / 1 / 2 / -1; pointer-events: none; justify-self: center; align-self: end; box-sizing: content-box; width: 60px; height: 46px; margin: 38px 0 0; padding: 0; border: 0; border-radius: 0; background: none; stroke: #b9e2f0; stroke-width: 1.5; opacity: 0; transform: translateY(10px); transition: opacity 300ms ease, transform 520ms cubic-bezier(.2, .75, .25, 1); }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card p { grid-area: 2 / 1 / 3 / -1; pointer-events: none; justify-self: center; align-self: center; max-width: 22ch; margin: 18px 26px 40px; color: #e9f5fa; font: 500 clamp(18px, 5.1vw, 22px)/1.36 var(--font-brand); letter-spacing: -.025em; text-align: center; text-wrap: balance; opacity: 0; transform: translateY(10px); transition: opacity 300ms ease, transform 520ms cubic-bezier(.2, .75, .25, 1); }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card[data-quality-open] :is(svg, p) { opacity: 1; transform: none; transition-delay: 90ms; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card__kicker { display: none; }

    /* The names double as the control: the chosen one is a pale key, the others are quiet. */
    [data-page="home"] [data-quality-cards="interactive"] .quality-card strong { grid-row: 3; display: grid; place-items: center; min-height: 46px; margin-top: 12px; padding: 0 4px; border: 1px solid #bacdd4; border-radius: 13px; color: #3a6272; font: 500 clamp(13px, 3.7vw, 15px)/1.2 var(--font-brand); letter-spacing: -.02em; transition: color 260ms ease, background 260ms ease, border-color 260ms ease; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card:nth-child(1) strong { grid-column: 1; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card:nth-child(2) strong { grid-column: 2; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card:nth-child(3) strong { grid-column: 3; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card[data-quality-open] strong { border-color: #12333f; background: #12333f; color: #dff2f9; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card strong { cursor: pointer; -webkit-tap-highlight-color: transparent; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card strong:focus-visible { outline: 2px solid var(--home-accent); outline-offset: 3px; }

[data-page="home"] main > .home-services-more { gap: 28px; background: #edf2f3; }
    [data-page="home"] .home-services-more h2 { max-width: 12ch; }
    [data-page="home"] .home-services-more .services-more__list a { min-height: 88px; font-size: 26px; padding: 18px 0; }
    .home-services-more .services-more__list b { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #b6cbd3; border-radius: 50%; font-size: 24px; }
    [data-page="home"] main > .closing-cta { padding: 56px var(--home-side) 36px; background: radial-gradient(ellipse at 100% 0, #34525c, transparent 65%), #102b39; }
    [data-page="home"] #contact h2 { max-width: 10ch; font-size: clamp(48px, 14vw, 64px); line-height: .98; letter-spacing: -.055em; }
    [data-page="home"] .closing-cta .closing-cta__actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 30px; }
    [data-page="home"] .closing-cta .button { width: 100%; min-height: 56px; border-radius: 12px; }
    [data-page="home"] .closing-cta .button--quiet { margin: 0; min-height: 48px; }
    [data-page="home"] .brand-footer { padding: 32px var(--home-side) max(100px, env(safe-area-inset-bottom)); }
    [data-page="home"] .brand-footer > div > span { max-width: 30ch; font-size: 12px; line-height: 1.6; }
    [data-page="home"] .brand-footer nav a { font: 400 14px/1.4 "Inter Tight", sans-serif; }
    [data-page="home"] .bys-quick-answers__trigger { width: 48px; min-height: 48px; height: 48px; border-radius: 16px; box-shadow: 0 5px 16px #102b3922; }
    [data-page="home"] .bys-quick-answers__trigger .bys-quick-answers__mascot { width: 36px; height: 36px; }
    [data-page="home"] a:active { filter: brightness(.94); }
}
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
    [data-page="home"] [data-home-reveal].is-visible { animation: mobile-home-arrive 650ms cubic-bezier(.2,.7,.2,1) both; }
    /* The keys settle one after another, the way a key returns after it is pressed. */
    .service-journey.is-in-view .story-services__list > li { animation: mobile-service-key 620ms cubic-bezier(.22, .74, .26, 1) both; }
    .service-journey.is-in-view .story-services__list > li:nth-child(2) { animation-delay: 80ms; }
    .service-journey.is-in-view .story-services__list > li:nth-child(3) { animation-delay: 160ms; }
    .service-journey.is-in-view .story-services__list > li:nth-child(4) { animation-delay: 240ms; }
    .service-journey.is-in-view .story-services__list > li:nth-child(5) { animation-delay: 320ms; }
    @keyframes mobile-service-key { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
    @keyframes mobile-home-arrive { from { opacity: .35; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    [data-page="home"] [data-quality-cards="interactive"] .quality-card :is(svg, p) { transform: none; transition: opacity 140ms ease; }
    [data-page="home"] [data-quality-cards="interactive"] .quality-card[data-quality-open] :is(svg, p) { transform: none; transition-delay: 0ms; }
}
@media (max-width: 767px) and (max-height: 540px) and (orientation: landscape) {
    [data-page="home"] .home-mobile-intro { left: 50%; bottom: 20px; }
    [data-page="home"] .home-mobile-intro__title { font-size: 30px; }
    .home-mobile-intro__eyebrow, .home-mobile-intro__explore { display: none !important; }
    :is(.no-js body, body.no-webgl)[data-page="home"] .story-hero__stage { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
    :is(.no-js body, body.no-webgl)[data-page="home"] .home-mobile-intro { grid-row: 1; left: auto; }
}
