/* Memento vs Apple Reminders: one section per difference, the two apps side by side under its words, then a table,
   when to stay with Apple's app, and questions. The FAQ's styles come from support.css. */

.compare-header {
    padding-bottom: var(--space-2xl);
}

.compare-header .page-subtitle {
    max-width: var(--max-width-narrow);
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* The two apps' icons side by side, above the headline. */
.compare-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.compare-icon {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.compare-icon img {
    display: block;
    width: 128px;
    height: 128px;
    border-radius: 22.37%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.compare-vs {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-tertiary);
}

/* Jump links to each difference. */
.compare-toc {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.compare-toc a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    padding: 0.375rem 0.875rem;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.compare-toc a:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

/* Differences: the words beside the two phones, alternating sides. */
.difference {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: var(--space-3xl);
    align-items: center;
    padding: var(--space-3xl) 0;
    scroll-margin-top: calc(var(--nav-height) + var(--banner-height));
}

.difference + .difference {
    border-top: 1px solid var(--color-border);
}

/* The phones' column keeps its width when it moves to the left, so every screenshot is the same size. */
.difference:nth-child(even) {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.difference:nth-child(even) .difference-text {
    order: 2;
}

.difference-text h2 {
    margin-bottom: var(--space-md);
}

.difference-text p {
    font-size: 1.0625rem;
    line-height: 1.7;
}

.difference-memento {
    color: var(--color-text-secondary);
}

/* What Apple's app does instead, set apart in a quiet box. */
.difference-apple {
    margin-top: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text-secondary);
    font-size: 0.9375rem !important;
}

.difference-apple strong {
    color: var(--color-text);
    font-weight: 600;
}

.difference-shots {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.875rem;
}

/* A single phone, the size of one of a pair, centred where the pair would be. */
.difference-shots.is-single {
    grid-template-columns: calc((100% - 1.875rem) / 2);
    justify-content: center;
}

/* The section's colour, glowing softly behind Memento's phone. */
.difference-shots::before {
    content: '';
    position: absolute;
    inset: 10% 0 10% 40%;
    background: radial-gradient(ellipse, var(--difference-tint) 0%, transparent 70%);
    opacity: 0.2;
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
}

.shot {
    margin: 0;
    text-align: center;
}

.shot img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.3));
    /* Its own layer, shadow and all: painted in the page's tiles, a lazily loaded image repaints only its own box
       when it arrives, and the shadow outside it stays cut off where a tile was drawn before it loaded. */
    transform: translateZ(0);
}

/* A video laid over a screenshot, on the band of the screen it films: in the framed phone's 1470×3000 pixels, x 74,
   y 2140, 1322 wide and 488 tall (SpeakVideoBand in the Memento repo's ScreenshotComposer). Its top and bottom fade
   into the still, so no seam shows. The still shows through until it plays, and instead of it for anyone who prefers
   less motion. */
.shot-screen {
    position: relative;
}

/* A block, so the box is exactly the image (an inline one leaves a gap under it, which would shift the video). */
.shot-screen img {
    display: block;
}

.shot-video {
    position: absolute;
    left: calc(74 / 1470 * 100%);
    top: calc(2140 / 3000 * 100%);
    width: calc(1322 / 1470 * 100%);
    height: calc(488 / 3000 * 100%);
    object-fit: fill;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

/* A recording of the whole screen, on the screen's rect in the framed phone (the screen inset 1470 / 20.01 from the
   sides, 1320×2868 scaled to fit, centred; ScreenshotComposer's FramedScreenshot), under the bare bezel, which hides
   its corners. */
.screen-video {
    position: absolute;
    left: calc(73.4633 / 1470 * 100%);
    top: calc(62.665 / 3000 * 100%);
    width: calc(1323.0735 / 1470 * 100%);
    height: calc(2874.67 / 3000 * 100%);
    object-fit: cover;
    border-radius: 13.98% / 6.43%;
}

.shot .shot-bezel {
    position: absolute;
    inset: 0;
    filter: none;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .shot-video,
    .screen-video,
    .shot .shot-bezel {
        display: none;
    }
}

/* The app's icon, with its name under it, below each screenshot: clear of the phone's shadow, which would grey the
   icons' white. */
.shot figcaption,
.shots-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin-top: 1.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--color-text);
}

/* One caption under both of Memento's screenshots, across the two columns. */
.shots-caption {
    grid-column: 1 / -1;
    /* The grid's row gap, less this much, leaves the same space as under a single screenshot. */
    margin-top: calc(1.75rem - 1.875rem);
    margin-bottom: 0;
}

.shot figcaption picture,
.shots-caption picture {
    display: contents;
}

/* Laid out by its image alone: the light-mode source would otherwise count as an empty item, and add a gap. */
.shot figcaption source,
.shots-caption source {
    display: none;
}

/* Both icons are mostly white, so a hairline edge and a soft shadow keep them from melting into the page. */
.difference-shots .shot-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 22.37%;
    filter: none;
    box-shadow: 0 0 0 1px var(--color-border), 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* At a glance */
.compare-table-section,
.compare-stay,
.compare-faq {
    padding: var(--space-3xl) 0;
    border-top: 1px solid var(--color-border);
}

.compare-table-section h2,
.compare-stay h2,
.compare-faq h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.compare-table-wrap {
    max-width: 880px;
    margin: 0 auto;
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.compare-table th,
.compare-table td {
    padding: var(--space-md);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--color-border);
}

.compare-table thead th {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}

.compare-table thead th:nth-child(2) {
    color: var(--color-accent);
}

.compare-table tbody th {
    font-weight: 600;
    width: 36%;
}

.compare-table td {
    color: var(--color-text-secondary);
}

.compare-table td:nth-child(2) {
    color: var(--color-text);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* When Apple's app is the better fit */
.compare-stay .container {
    max-width: var(--max-width-narrow);
}

.compare-stay p,
.compare-stay li {
    color: var(--color-text-secondary);
    font-size: 1.0625rem;
    line-height: 1.7;
}

.compare-stay ul {
    margin: var(--space-md) 0 var(--space-lg);
    padding-left: 1.25rem;
}

.compare-stay li + li {
    margin-top: var(--space-sm);
}

/* Closing call to action, as on the home page. */
.cta {
    text-align: center;
    padding: var(--space-4xl) 0;
    border-top: 1px solid var(--color-border);
}

.cta h2 {
    margin-bottom: var(--space-xl);
}

/* Memento's icon over the closing line, like the pair at the top. */
.cta-icon img {
    display: block;
    width: 112px;
    height: 112px;
    margin: 0 auto var(--space-lg);
    border-radius: 22.37%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.app-store-badge img {
    display: inline-block;
    height: 54px;
    width: auto;
    transition: opacity var(--transition-fast);
}

.app-store-badge:hover img {
    opacity: 0.85;
}

@media (max-width: 860px) {
    .difference {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        padding: var(--space-2xl) 0;
    }

    .difference:nth-child(even) {
        grid-template-columns: 1fr;
    }

    .difference:nth-child(even) .difference-text {
        order: 0;
    }

    .difference-shots.is-single {
        grid-template-columns: calc((100% - 1.25rem) / 2);
    }

    .difference-shots {
        gap: 1.25rem;
        max-width: 520px;
        margin: 0 auto;
        width: 100%;
    }

    .compare-table th,
    .compare-table td {
        padding: var(--space-sm);
    }

    /* Two phones side by side leave little room: a smaller icon and name. */
    .shot figcaption,
    .shots-caption {
        gap: var(--space-xs);
        margin-top: var(--space-md);
        font-size: 1.125rem;
    }

    .shots-caption {
        margin-top: calc(var(--space-md) - 1.25rem);
    }

    .difference-shots .shot-icon {
        width: 40px;
        height: 40px;
    }
}
