/* Home: apple.com's page structure (full-bleed tiles stacked 12px apart, the same tiles two to a row, a timed gallery and a
   link directory above the footer) set in Chrome's colours, type scale, pill buttons and 24px card corners. */
.home {
    width: 100%;
}

.tile-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--tile-gap);

    margin-bottom: var(--tile-gap);

    text-align: center;
}

.tile-section-promo {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    padding-inline:
        max(var(--tile-gap), env(safe-area-inset-left, 0px))
        max(var(--tile-gap), env(safe-area-inset-right, 0px));
}

/* Tile: copy and calls to action at the top, artwork resting on the bottom edge. */
.tile {
    --tile-background: var(--color-surface);
    --tile-muted: var(--color-text-muted);
    --tile-min-height: 580px;
    --tile-padding-top: 48px;
    --tile-padding-bottom: 56px;

    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;

    min-height: var(--tile-min-height);
    padding:
        var(--tile-padding-top)
        max(var(--gutter), env(safe-area-inset-right, 0px))
        0
        max(var(--gutter), env(safe-area-inset-left, 0px));
    overflow: clip;

    color: var(--color-text);
    background-color: var(--tile-background);

    container-type: inline-size;
}

.tile-promo {
    --tile-padding-top: 53px;
    --tile-padding-bottom: 60px;

    padding-inline: var(--space-6);

    border-radius: var(--radius-card);
}

.tile-blue-dark {
    --tile-background: var(--color-blue-900);
    --tile-muted: var(--color-blue-100);

    color: var(--color-button-text);
}

.tile-blue {
    --tile-background: var(--color-blue-600);
    --tile-muted: var(--color-button-text);

    color: var(--color-button-text);
}

.tile-blue-light {
    --tile-background: var(--color-blue-50);
}

.tile-yellow-light {
    --tile-background: var(--color-yellow-50);
}

.tile-green-light {
    --tile-background: var(--color-green-50);
}

.tile-white {
    --tile-background: var(--color-background);

    box-shadow: inset 0 0 0 1px var(--color-border);
}

/* The whole tile leads to its first guide; the copy lets clicks through and the buttons sit above. */
.tile-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tile-content {
    position: relative;
    z-index: 2;

    display: flex;
    flex-direction: column;
    align-items: center;

    pointer-events: none;
}

.tile-eyebrow {
    margin-bottom: var(--space-1);

    font-size: var(--font-size-eyebrow);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-eyebrow);
    letter-spacing: var(--letter-spacing-eyebrow);
    text-transform: uppercase;

    color: var(--tile-muted);
}

.tile-headline {
    max-width: 880px;

    font-size: var(--headline-2-size);
    font-weight: var(--font-weight-strong);
    line-height: var(--headline-2-line);
    letter-spacing: var(--headline-2-tracking);
    text-wrap: balance;
}

h1.tile-headline {
    font-size: var(--headline-1-size);
    line-height: var(--headline-1-line);
    letter-spacing: var(--headline-1-tracking);
}

.tile-promo .tile-headline {
    font-size: var(--headline-3-size);
    line-height: var(--headline-3-line);
    letter-spacing: var(--headline-3-tracking);
}

.tile-subhead {
    max-width: 600px;
    margin-top: 6px;

    font-size: var(--font-size-text);
    line-height: var(--line-height-text);
    text-wrap: pretty;

    color: var(--tile-muted);
}

.tile-promo .tile-subhead {
    max-width: 400px;
    margin-top: 3px;

    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
}

.tile-ctas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3) 17px;

    margin-top: 17px;

    pointer-events: auto;
}

.tile-promo .tile-ctas {
    column-gap: 14px;
    margin-top: var(--space-3);
}

/* Artwork: three tilted icon chips, the middle one largest and dipping below the tile's edge. */
.tile-art {
    --chip-large: clamp(116px, 30cqw, 220px);

    position: relative;
    z-index: 2;

    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: calc(var(--chip-large) * 0.12);

    margin-top: auto;
    margin-bottom: calc(var(--chip-large) * -0.16);
    padding-top: var(--space-8);

    pointer-events: none;
}

.chip {
    --chip-size: calc(var(--chip-large) * 0.6);

    display: grid;
    place-items: center;
    flex: none;

    width: var(--chip-size);
    height: var(--chip-size);

    font-size: calc(var(--chip-size) * 0.44);
    font-weight: var(--font-weight-strong);
    line-height: 1;
    letter-spacing: -0.04em;

    color: var(--color-button-text);
    background-color: var(--color-blue-600);
    border-radius: 28%;
    box-shadow: var(--shadow-raised);
}

.chip::before {
    content: '';

    width: 54%;
    height: 54%;

    background-color: currentColor;
    -webkit-mask: var(--glyph, none) center / contain no-repeat;
    mask: var(--glyph, none) center / contain no-repeat;
}

.tile-hero .tile-art {
    --chip-large: clamp(116px, 30cqw, 288px);
}

.tile-art .chip:nth-child(1) {
    transform: translateY(-34%) rotate(-9deg);
}

.tile-art .chip:nth-child(2) {
    --chip-size: var(--chip-large);
}

.tile-art .chip:nth-child(3) {
    transform: translateY(-34%) rotate(9deg);
}

.chip-white {
    color: var(--color-blue-700);
    background-color: var(--color-background);
}

.chip-blue-dark {
    background-color: var(--color-blue-900);
}

.chip-blue-light {
    color: var(--color-blue-700);
    background-color: var(--color-blue-100);
}

.chip-yellow {
    color: var(--color-text);
    background-color: var(--color-yellow-500);
}

.chip-yellow-light {
    color: var(--color-text);
    background-color: var(--color-yellow-200);
}

.chip-green {
    background-color: var(--color-green-700);
}

.chip-green-light {
    color: var(--color-green-700);
    background-color: var(--color-green-100);
}

.chip-red-light {
    color: var(--color-text);
    background-color: var(--color-red-200);
}

/* Glyphs: 48px line icons used as masks, so each chip tints its own. */
.glyph-bitcoin {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='24' cy='24' r='19'/%3E%3Cpath d='M19 15.5h6.5a4.25 4.25 0 0 1 0 8.5H19zm0 8.5h7.5a4.25 4.25 0 0 1 0 8.5H19zM22 12v3.5M22 32.5V36M26 12v3.5M26 32.5V36'/%3E%3C/svg%3E");
}

.glyph-coin {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='24' cy='24' r='19'/%3E%3Ccircle cx='24' cy='24' r='9'/%3E%3C/svg%3E");
}

.glyph-wallet {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='13' width='36' height='26' rx='6'/%3E%3Cpath d='M11 13l19-6a3.5 3.5 0 0 1 4.5 3.3V13M42 22h-9a4 4 0 0 0 0 8h9M33.5 26h.01'/%3E%3C/svg%3E");
}

.glyph-key {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='15.5' cy='32.5' r='8.5'/%3E%3Cpath d='M21.5 26.5 41 7M33 15l5.5 5.5M27.5 20.5l4.5 4.5'/%3E%3C/svg%3E");
}

.glyph-seed {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 13h.01M8 24h.01M8 35h.01M27 13h.01M27 24h.01M27 35h.01M14 13h7M14 24h7M14 35h7M33 13h7M33 24h7M33 35h7'/%3E%3C/svg%3E");
}

.glyph-shield {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 5l16 6v11c0 10-6.6 17.6-16 21-9.4-3.4-16-11-16-21V11zM17 24l5 5 9-10'/%3E%3C/svg%3E");
}

.glyph-warning {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 7l19 32H5zM24 19v9M24 33.5h.01'/%3E%3C/svg%3E");
}

.glyph-lock {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='10' y='21' width='28' height='20' rx='5'/%3E%3Cpath d='M16 21v-6a8 8 0 0 1 16 0v6M24 29.5v3'/%3E%3C/svg%3E");
}

.glyph-checklist {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 12l3 3 5.5-6M7 24l3 3 5.5-6M7 36l3 3 5.5-6M23 12h18M23 24h18M23 36h18'/%3E%3C/svg%3E");
}

.glyph-search {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='21' cy='21' r='13'/%3E%3Cpath d='M31 31l11 11'/%3E%3C/svg%3E");
}

.glyph-percent {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='14' cy='14' r='6'/%3E%3Ccircle cx='34' cy='34' r='6'/%3E%3Cpath d='M39 9L9 39'/%3E%3C/svg%3E");
}

.glyph-versus {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 16h30M30 8l8 8-8 8M40 32H10M18 24l-8 8 8 8'/%3E%3C/svg%3E");
}

.glyph-cube {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 5l17 9.5v19L24 43 7 33.5v-19zM7 14.5L24 24l17-9.5M24 24v19'/%3E%3C/svg%3E");
}

.glyph-hash {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 7l-4 34M34 7l-4 34M9 17h33M6 31h33'/%3E%3C/svg%3E");
}

.glyph-contract {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5h16l10 10v24a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4zM28 5v10h10M20 26l-4 4 4 4M26 26l4 4-4 4'/%3E%3C/svg%3E");
}

.glyph-layers {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 6l18 10-18 10L6 16zM6 24l18 10 18-10M6 32l18 10 18-10'/%3E%3C/svg%3E");
}

.glyph-book {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M24 12c-4-3-9-4-16-4v28c7 0 12 1 16 4 4-3 9-4 16-4V8c-7 0-12 1-16 4zm0 0v28'/%3E%3C/svg%3E");
}

.glyph-check {
    --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 25l9 9 17-19'/%3E%3C/svg%3E");
}

/* Hero artwork: four blocks joined into a chain, the newest one arriving unconfirmed and then being accepted. */
.chain {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;

    margin-bottom: 0;
    padding-bottom: var(--tile-padding-bottom);

    font-size: min(1.09cqw, 10.9px);
    text-align: left;
}

.chain > :nth-child(2) { --chain-step: 1; }
.chain > :nth-child(3) { --chain-step: 2; }
.chain > :nth-child(4) { --chain-step: 3; }
.chain > :nth-child(5) { --chain-step: 4; }
.chain > :nth-child(6) { --chain-step: 5; }
.chain > :nth-child(7) { --chain-step: 6; }

.chain-block {
    --block-color: var(--color-blue-600);
    --block-on-color: var(--color-button-text);
    --block-tint: var(--color-blue-50);
    --block-ink: var(--color-blue-700);

    position: relative;

    display: flex;
    flex-direction: column;
    flex: none;

    width: 17.5em;
    height: 17.5em;
    padding: 2.2em;

    background-color: var(--color-background);
    border-radius: 3.6em;
    box-shadow: var(--shadow-card);

    outline: 0.25em dashed transparent;
    outline-offset: -0.25em;
}

.chain-block-yellow {
    --block-color: var(--color-yellow-500);
    --block-on-color: var(--color-text);
    --block-tint: var(--color-yellow-50);
    --block-ink: var(--color-text);
}

.chain-block-green {
    --block-color: var(--color-green-700);
    --block-tint: var(--color-green-50);
    --block-ink: var(--color-green-700);
}

.chain-block-red {
    --block-color: var(--color-red-200);
    --block-on-color: var(--color-text);
    --block-tint: var(--color-red-50);
    --block-ink: var(--color-text);
}

.chain-block-head {
    display: flex;
    align-items: center;
    gap: 1.1em;
}

.chain-block-icon {
    display: grid;
    place-items: center;
    flex: none;

    width: 4.8em;
    height: 4.8em;

    color: var(--block-on-color);
    background-color: var(--block-color);
    border-radius: 1.5em;
}

.chain-block-icon::before {
    content: '';

    width: 58%;
    height: 58%;

    background-color: currentColor;
    -webkit-mask: var(--glyph) center / contain no-repeat;
    mask: var(--glyph) center / contain no-repeat;
}

.chain-block-number {
    font-size: 1.55em;
    font-weight: var(--font-weight-medium);
    line-height: 1;

    color: var(--color-text-muted);
}

.chain-block-line {
    height: 1.15em;
    margin-top: 1.3em;

    background-color: var(--color-surface-strong);
    border-radius: 1em;
}

.chain-block-line + .chain-block-line {
    width: 64%;
    margin-top: 0.9em;
}

.chain-block-hash {
    align-self: flex-start;

    margin-top: auto;
    padding: 0.4em 0.95em;

    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 1.35em;
    font-weight: var(--font-weight-medium);
    line-height: 1.4;

    color: var(--block-ink);
    background-color: var(--block-tint);
    border-radius: 2em;
}

.chain-block-check {
    position: absolute;
    top: -1.3em;
    right: -1.3em;

    display: grid;
    place-items: center;

    width: 4.6em;
    height: 4.6em;

    color: var(--color-button-text);
    background-color: var(--color-green-700);
    border-radius: 50%;
    box-shadow: 0 0 0 0.5em var(--tile-background);
}

.chain-block-check::before {
    content: '';

    width: 60%;
    height: 60%;

    background-color: currentColor;
    -webkit-mask: var(--glyph) center / contain no-repeat;
    mask: var(--glyph) center / contain no-repeat;
}

/* The link tucks under both blocks, so it reads as a bar holding them together. */
.chain-link {
    flex: none;

    width: 5em;
    height: 1.2em;
    margin: 0 -1em;

    background-color: var(--color-blue-300);

    transform-origin: left center;
}

.chain-block {
    z-index: 1;
}

@media (prefers-reduced-motion: no-preference) {
    .chain-block {
        animation: chain-block-in 0.5s var(--ease-out) calc(var(--chain-step, 0) * 170ms + 250ms) both;
    }

    .chain-link {
        animation: chain-link-in 0.3s var(--ease-standard) calc(var(--chain-step, 0) * 170ms + 250ms) both;
    }

    .chain-block-new {
        animation-name: chain-block-new;
        animation-duration: 1.5s;
        animation-timing-function: linear;
    }

    .chain-block-check {
        animation: chain-check-in 0.45s var(--ease-out) 2.75s both;
    }

    /* The replay button drops every animation for a frame so they all start over. */
    .chain.is-reset * {
        animation: none;
    }
}

@keyframes chain-block-in {
    from {
        opacity: 0;
        transform: translateY(1.6em) scale(0.92);
    }
}

@keyframes chain-link-in {
    from {
        transform: scaleX(0);
    }
}

@keyframes chain-block-new {
    0% {
        opacity: 0;
        transform: translateY(1.6em) scale(0.92);
        background-color: transparent;
        box-shadow: none;
        outline-color: var(--color-text-disabled);
    }

    25%,
    75% {
        opacity: 1;
        transform: none;
        background-color: transparent;
        box-shadow: none;
        outline-color: var(--color-text-disabled);
    }
}

@keyframes chain-check-in {
    from {
        opacity: 0;
        transform: scale(0.4);
    }
}

/* Media control in the tile's top corner, where apple.com and Chrome both keep theirs. */
.tile-control {
    position: absolute;
    top: var(--space-4);
    right: max(var(--space-4), env(safe-area-inset-right, 0px));
    z-index: 3;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 5px 12px 5px 8px;

    font-size: var(--font-size-caption);
    line-height: var(--line-height-caption);
    letter-spacing: var(--letter-spacing-caption);

    color: var(--color-text);
    background-color: var(--color-surface-strong);
    border: none;
    border-radius: var(--radius-pill);

    cursor: pointer;

    transition: background-color 0.1s linear;
}

.tile-control[hidden] {
    display: none;
}

.tile-control::before {
    content: '';

    width: 14px;
    height: 14px;

    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M38 16A16 16 0 1 0 39.5 28M38 6v10H28'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M38 16A16 16 0 1 0 39.5 28M38 6v10H28'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tile-control:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .tile-control:hover {
        background-color: var(--color-border);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile-control {
        display: none;
    }
}

/* Gallery: apple.com's wide cards that slide on a timer, a second row of small cards moving with them, and timed dots. */
.gallery-section {
    --gallery-gap: 13px;

    display: flex;
    flex-direction: column;

    padding-top: 36px;
    overflow: clip;

    text-align: center;

    background-color: var(--color-surface);
}

.gallery-header {
    margin-bottom: 26px;
    padding-inline:
        max(var(--gutter), env(safe-area-inset-left, 0px))
        max(var(--gutter), env(safe-area-inset-right, 0px));
}

.gallery-header h2 {
    font-size: var(--headline-2-size);
    font-weight: var(--font-weight-strong);
    line-height: var(--headline-2-line);
    letter-spacing: var(--headline-2-tracking);
    text-wrap: balance;
}

.gallery-intro {
    max-width: 640px;
    margin: 6px auto 0;

    font-size: var(--font-size-text);
    line-height: var(--line-height-text);
    text-wrap: pretty;

    color: var(--color-text-muted);
}

.gallery {
    --gallery-item-width: 930px;
    --gallery-item-height: 523px;
}

.gallery-small {
    --gallery-item-width: 417px;
    --gallery-item-height: 234px;

    margin-top: var(--gallery-gap);
}

/* Without JavaScript the rows scroll sideways and snap; with it they are moved by transforms instead. */
.gallery-viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.gallery-viewport::-webkit-scrollbar {
    display: none;
}

.gallery-track {
    display: flex;

    width: max-content;
    padding-inline: var(--gutter);

    list-style: none;
}

.gallery-item {
    display: flex;
    justify-content: center;
    flex: none;

    width: calc(var(--gallery-item-width) + var(--gallery-gap));
    height: var(--gallery-item-height);

    scroll-snap-align: center;
}

.is-enhanced .gallery-viewport {
    overflow: hidden;

    touch-action: pan-y;
}

.is-enhanced .gallery-track {
    margin-left: 50%;
    padding-inline: 0;

    transform: translateX(calc((var(--gallery-position, 0) + 0.5) * (var(--gallery-item-width) + var(--gallery-gap)) * -1 + var(--gallery-drag, 0px)));
}

.is-enhanced .gallery-track.is-animated {
    transition: transform 1s ease-in-out;
}

.gallery-card {
    --card-muted: var(--color-text-muted);

    position: relative;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);

    width: var(--gallery-item-width);
    height: 100%;
    padding: var(--space-10);
    overflow: hidden;

    text-align: left;
    text-decoration: none;

    color: var(--color-text);
    background-color: var(--color-background);
    border-radius: var(--radius-card);

    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

.gallery-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: -4px;
}

.gallery-card-yellow {
    background-color: var(--color-yellow-200);
}

.gallery-card-blue {
    --card-muted: var(--color-button-text);

    color: var(--color-button-text);
    background-color: var(--color-blue-600);
}

.gallery-card-green {
    --card-muted: var(--color-button-text);
    --card-ink: var(--color-green-700);

    color: var(--color-button-text);
    background-color: var(--color-green-700);
}

.gallery-card-blue-dark {
    --card-muted: var(--color-blue-100);
    --card-ink: var(--color-blue-900);

    color: var(--color-button-text);
    background-color: var(--color-blue-900);
}

/* White chips and buttons on a coloured card pick up the card's own colour. */
.gallery-card .chip-white,
.gallery-card .button-inverted {
    color: var(--card-ink, var(--color-blue-700));
}

.gallery-card-outline {
    box-shadow: inset 0 0 0 1px var(--color-border);
}

.gallery-card-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    max-width: 30rem;

    transition: opacity 0.4s;
}

/* Only the card in the middle shows its copy; its neighbours peek in as plain colour and artwork. */
.is-enhanced .gallery-item:not(.is-current) .gallery-card-copy {
    opacity: 0;
}

/* When the row jumps from a copy back to its original, the swap must not fade. */
.gallery-track:not(.is-animated) .gallery-card-copy {
    transition: none;
}

.gallery-card-eyebrow {
    font-size: var(--font-size-eyebrow);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-eyebrow);
    letter-spacing: var(--letter-spacing-eyebrow);
    text-transform: uppercase;

    color: var(--card-muted);
}

.gallery-card-title {
    margin-top: var(--space-1);

    font-size: var(--headline-3-size);
    font-weight: var(--font-weight-strong);
    line-height: var(--headline-3-line);
    letter-spacing: var(--headline-3-tracking);
    text-wrap: balance;
}

.gallery-card-text {
    margin-top: var(--space-2);

    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    text-wrap: pretty;

    color: var(--card-muted);
}

.gallery-card-cta {
    margin-top: var(--space-6);
}

.gallery-card .chip {
    --chip-size: calc(var(--gallery-item-height) * 0.5);

    align-self: center;
}

/* Small cards: topic chip and label on top, title and a compact button below. */
.gallery-card-small {
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);

    padding: var(--space-6);
}

.gallery-card-small .gallery-card-copy {
    transition: none;
}

.is-enhanced .gallery-item:not(.is-current) .gallery-card-small .gallery-card-copy {
    opacity: 1;
}

.gallery-card-topic {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.gallery-card-small .chip {
    --chip-size: 36px;

    align-self: auto;

    box-shadow: none;
}

.gallery-card-small .gallery-card-title {
    margin-top: 0;

    font-size: var(--headline-5-size);
    line-height: var(--headline-5-line);
    letter-spacing: var(--headline-5-tracking);
}

.gallery-card-small .gallery-card-cta {
    margin-top: var(--space-3);
}

/* Dots: the current one stretches into a track that fills while its card is on show. */
.gallery-dotnav {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 36px;
    margin: var(--space-3) 0 var(--space-6);
}

.gallery-dotnav[hidden] {
    display: none;
}

.gallery-dots {
    display: flex;
    align-items: center;
}

.gallery-dot {
    position: relative;

    box-sizing: content-box;
    width: 8px;
    height: 8px;
    padding: 8px;

    background: none;
    border: none;
    border-radius: var(--radius-pill);

    cursor: pointer;

    transition: width 0.25s linear;
}

.gallery-dot::before,
.gallery-dot::after {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 8px;

    border-radius: var(--radius-pill);
}

.gallery-dot::before {
    right: 8px;

    background-color: var(--color-text-disabled);

    transition: background-color 0.1s linear;
}

.gallery-dot::after {
    width: 8px;

    opacity: 0;
    background-color: var(--color-blue-600);
}

.gallery-dot:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: -2px;
}

@media (hover: hover) and (pointer: fine) {
    .gallery-dot:hover::before {
        background-color: var(--color-text-muted);
    }
}

.gallery-dot.is-current {
    width: 32px;

    pointer-events: none;
}

.gallery-dot.is-current::before {
    background-color: var(--color-blue-200);
}

.gallery-dot.is-current::after {
    opacity: 1;
}

/* With reduced motion nothing is timed, so the current dot is simply full. */
.gallery-section:not(.is-playing) .gallery-dot.is-current::after {
    width: calc(100% - 16px);
}

.is-playing .gallery-dot.is-current::after {
    animation: gallery-dot-fill 4.16s linear 0.84s both;
}

.is-playing.is-held .gallery-dot.is-current::after {
    animation-play-state: paused;
}

@keyframes gallery-dot-fill {
    to {
        width: calc(100% - 16px);
    }
}

.gallery-control {
    position: absolute;
    top: 50%;
    right: max(var(--gutter), env(safe-area-inset-right, 0px));

    display: grid;
    place-items: center;

    width: 36px;
    height: 36px;
    margin-top: -18px;
    padding: 0;

    color: var(--color-blue-700);
    background-color: var(--color-blue-50);
    border: none;
    border-radius: 50%;

    cursor: pointer;

    transition: background-color 0.1s linear;
}

.gallery-control::before {
    content: '';

    width: 16px;
    height: 16px;

    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='7' stroke-linecap='round'%3E%3Cpath d='M16 11v26M32 11v26'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='black' stroke-width='7' stroke-linecap='round'%3E%3Cpath d='M16 11v26M32 11v26'/%3E%3C/svg%3E") center / contain no-repeat;
}

.gallery-control[hidden] {
    display: none;
}

.gallery-control.is-paused::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M17 9.5v29a2 2 0 0 0 3.1 1.7l22-14.5a2 2 0 0 0 0-3.4l-22-14.5A2 2 0 0 0 17 9.5z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M17 9.5v29a2 2 0 0 0 3.1 1.7l22-14.5a2 2 0 0 0 0-3.4l-22-14.5A2 2 0 0 0 17 9.5z'/%3E%3C/svg%3E");
}

.gallery-control:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .gallery-control:hover {
        background-color: var(--color-blue-100);
    }
}

.gallery-control:active {
    background-color: var(--color-blue-200);
}

/* Closing band, laid out like apple.com's footer: small print first, then the directory of every guide in five columns. */
.home-notes,
.home-directory {
    padding-inline:
        max(var(--gutter), env(safe-area-inset-left, 0px), calc((100% - var(--page-max-width)) / 2))
        max(var(--gutter), env(safe-area-inset-right, 0px), calc((100% - var(--page-max-width)) / 2));

    background-color: var(--color-surface-strong);
}

.home-notes {
    padding-top: var(--space-8);
}

.home-notes-inner {
    padding-bottom: var(--space-6);

    border-bottom: 1px solid var(--color-border);
}

.home-notes h2,
.home-directory h2 {
    font-size: var(--headline-6-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--headline-6-line);
    letter-spacing: var(--headline-6-tracking);
}

.home-notes p,
.home-directory-intro {
    font-size: var(--font-size-small);
    line-height: var(--line-height-small);

    color: var(--color-text-muted);
}

.home-notes p {
    max-width: 760px;
    margin-top: var(--space-2);
}

.home-notes a {
    color: var(--color-link);
    text-decoration: none;
}

.home-notes a:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.home-notes a:focus-visible,
.home-directory-list a:focus-visible,
.home-directory-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.home-directory {
    padding-top: var(--space-6);
}

.home-directory-inner {
    padding-bottom: var(--space-8);

    border-bottom: 1px solid var(--color-border);
}

.home-directory-intro {
    margin-top: var(--space-1);
}

/* Five equal columns; the titles share one row, so every list starts on the same line however a title wraps. */
.home-directory-columns {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: 20px;

    margin-top: var(--space-6);
}

.home-directory-column {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;

    min-width: 0;
}

.home-directory-title {
    font-size: var(--headline-6-size);
    font-weight: var(--font-weight-medium);
    line-height: var(--headline-6-line);
    letter-spacing: var(--headline-6-tracking);
    text-wrap: balance;
}

.home-directory-toggle {
    display: contents;

    font: inherit;
    letter-spacing: inherit;
    text-align: inherit;

    color: inherit;
    background: none;
    border: none;
}

.home-directory-list {
    list-style: none;
}

.home-directory-list li {
    margin-top: 10px;
}

.home-directory-list a {
    font-size: var(--font-size-small);
    line-height: var(--line-height-small);

    color: var(--color-text-muted);
    text-decoration: none;

    transition: color 0.3s;
}

.home-directory-list a:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* apple.com's tile heights and paddings at its own breakpoints. */
.tile-hero {
    --tile-min-height: 580px;
    --tile-padding-top: 48px;
    --tile-padding-bottom: 56px;
}

@media (min-width: 1069px) and (min-height: 776px) {
    .tile-hero {
        --tile-min-height: 692px;
        --tile-padding-top: 56px;
        --tile-padding-bottom: 63px;
    }
}

/* The widest cards carry a larger title and lead, so the copy holds its own against the artwork. */
@media (min-width: 1069px) {
    .gallery-main .gallery-card {
        padding: var(--space-12);
    }

    .gallery-main .gallery-card-copy {
        max-width: 36rem;
    }

    .gallery-main .gallery-card-title {
        font-size: var(--headline-2-size);
        line-height: var(--headline-2-line);
        letter-spacing: var(--headline-2-tracking);
    }

    .gallery-main .gallery-card-text {
        font-size: var(--font-size-text);
        line-height: var(--line-height-text);
    }
}

@media (min-width: 1441px) {
    .gallery {
        --gallery-item-width: 1250px;
        --gallery-item-height: 668px;
    }

    .gallery-small {
        --gallery-item-width: 470px;
        --gallery-item-height: 264px;
    }
}

@media (max-width: 1068px) {
    .tile-hero {
        --tile-min-height: 570px;
        --tile-padding-top: 54px;
        --tile-padding-bottom: 61px;
    }

    .tile-promo {
        --tile-min-height: 490px;
        --tile-padding-top: 44px;
        --tile-padding-bottom: 48px;
    }

    .tile-subhead {
        margin-top: 4px;
    }

    .tile-ctas {
        margin-top: 16px;
    }

    .gallery-header {
        margin-bottom: 17px;
    }

    .gallery {
        --gallery-item-width: 688px;
        --gallery-item-height: 367px;
    }

    .gallery-small {
        --gallery-item-width: 188px;
        --gallery-item-height: 254px;
    }

    .gallery-card-small {
        padding: 20px;
    }

    .gallery-card-small .gallery-card-title {
        font-size: var(--headline-6-size);
        font-weight: var(--font-weight-strong);
        line-height: var(--headline-6-line);
        letter-spacing: var(--headline-6-tracking);
    }

    .gallery-card-small .gallery-card-eyebrow {
        font-size: var(--font-size-caption);
        line-height: var(--line-height-caption);
    }

    .gallery-card-small .chip {
        display: none;
    }
}

@media (min-width: 735px) and (max-width: 1068px) and (min-height: 734px) {
    .tile-hero {
        --tile-min-height: 650px;
        --tile-padding-top: 61px;
        --tile-padding-bottom: 69px;
    }
}

@media (max-width: 833px) {
    .home-directory-columns,
    .home-directory-column {
        display: block;
    }

    .home-directory-column + .home-directory-column {
        margin-top: var(--space-6);
    }

    /* With JavaScript each topic folds into an accordion row, as apple.com's footer does on phones. */
    .is-collapsible .home-directory-column + .home-directory-column {
        margin-top: 0;

        border-top: 1px solid var(--color-border);
    }

    .is-collapsible .home-directory-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);

        width: 100%;
        padding: var(--space-3) 0;

        cursor: pointer;
    }

    .is-collapsible .home-directory-toggle::after {
        content: '';
        flex: none;

        width: 12px;
        height: 12px;
        margin-right: var(--space-1);

        background-color: var(--color-text-muted);
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 5 7 9.5 11.5 5'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 5 7 9.5 11.5 5'/%3E%3C/svg%3E") center / contain no-repeat;

        transition: transform 0.3s;
    }

    .is-collapsible .home-directory-toggle[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }

    .is-collapsible .home-directory-panel {
        display: grid;
        grid-template-rows: 0fr;

        visibility: hidden;

        transition: grid-template-rows 0.3s var(--ease-standard), visibility 0s linear 0.3s;
    }

    .is-collapsible .home-directory-column.is-open .home-directory-panel {
        grid-template-rows: 1fr;

        visibility: visible;

        transition: grid-template-rows 0.3s var(--ease-standard), visibility 0s;
    }

    .is-collapsible .home-directory-list {
        min-height: 0;
        overflow: hidden;
    }

    .is-collapsible .home-directory-list li {
        margin-top: 0;
    }

    .is-collapsible .home-directory-list li:last-child {
        padding-bottom: var(--space-3);
    }

    .is-collapsible .home-directory-list a {
        display: block;
        padding: 6px 14px;
    }
}

@media (max-width: 734px) {
    .tile-section-promo {
        grid-template-columns: minmax(0, 1fr);

        padding-inline: 0;
    }

    .tile-hero,
    .tile-promo {
        --tile-min-height: 500px;
        --tile-padding-top: 39px;
        --tile-padding-bottom: 43px;
    }

    .tile-promo {
        padding-inline:
            max(var(--gutter), env(safe-area-inset-left, 0px))
            max(var(--gutter), env(safe-area-inset-right, 0px));

        border-radius: 0;
    }

    .tile-ctas,
    .tile-promo .tile-ctas {
        column-gap: 14px;
        margin-top: 11px;
    }

    /* Three blocks fit a phone at a readable size; the first one steps aside. */
    .chain {
        font-size: min(1.7cqw, 10.9px);
    }

    /* Icon only, so the control stays clear of the headline. */
    .tile-control {
        top: var(--space-3);
        right: max(var(--space-3), env(safe-area-inset-right, 0px));

        gap: 0;

        padding: 8px;

        font-size: 0;
    }

    .chain > :nth-child(-n + 2) {
        display: none;
    }

    .gallery {
        --gallery-item-width: 275px;
        --gallery-item-height: 496px;
    }

    .gallery-small {
        --gallery-item-width: 188px;
        --gallery-item-height: 254px;
    }

    .gallery-card {
        flex-direction: column-reverse;
        align-items: flex-start;
        justify-content: space-between;

        padding: var(--space-6);
    }

    .gallery-card .chip {
        --chip-size: 120px;

        align-self: center;

        margin-top: var(--space-6);
    }

    .gallery-card-small {
        flex-direction: column;

        padding: 20px;
    }

    .gallery-card-title {
        font-size: var(--headline-4-size);
        line-height: var(--headline-4-line);
        letter-spacing: var(--headline-4-tracking);
    }

    .gallery-card-cta {
        margin-top: var(--space-4);
    }
}
