/**
 * Styles for the public site.
 *
 * The palette is the app's own (`frontend/src/theme/colors.ts`): the burgundy and
 * the sand are what someone sees in the screenshots right below, and a site in
 * different colours would look like a different product.
 *
 * No framework and no reset library: this is one page and four documents, and a
 * CSS file small enough to read top to bottom is easier to keep correct than a
 * build step that reorders a hundred utilities.
 */

:root {
    --burgundy: #800020;
    --burgundy-dark: #5a0017;
    --sand: #f3e6d5;
    --ivory: #fff9f2;
    --rose: #d45060;
    --rose-dark: #b4384a;
    --ink: #2b1418;
    --ink-soft: #6b4a50;
    --line: rgba(128, 0, 32, 0.14);
    --radius: 14px;
    --shadow: 0 1px 2px rgba(43, 20, 24, 0.06), 0 8px 24px rgba(43, 20, 24, 0.06);
    --width: 1080px;
    --measure: 68ch;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--ivory);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue',
        Arial, sans-serif;
    font-size: 17px;
    line-height: 1.65;
    /* Room for the sticky header when following an in-page link. */
    scroll-padding-top: 5rem;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--burgundy);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--rose-dark);
}

:focus-visible {
    outline: 3px solid var(--rose);
    outline-offset: 2px;
    border-radius: 4px;
}

h1,
h2,
h3 {
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 0.6em;
}

h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.9rem);
}

h2 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
}

h3 {
    font-size: 1.05rem;
}

p {
    margin: 0 0 1em;
}

.wrap {
    width: 100%;
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.wrap.narrow {
    max-width: 46rem;
}

/* ---------------------------------------------------------------- header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 249, 242, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand img {
    border-radius: 8px;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
    /* The brand sits on the left, so the links and the language pill travel to
       the right edge together. */
    margin-left: auto;
}

.site-header nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.94rem;
}

.site-header nav a:hover,
.site-header nav a[aria-current='page'] {
    color: var(--burgundy);
}

.site-header nav a[aria-current='page'] {
    font-weight: 600;
}

/*
 * Outside the `nav` on purpose: it is a page-level control, not one of the
 * legal documents. Keeping it in the nav meant that on a narrow screen — where
 * the links have to scroll — the pill either wrapped onto its own line or
 * covered "Atribuciones".
 */
.site-header .lang {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    text-decoration: none;
}

.site-header .lang:hover {
    color: var(--burgundy);
    border-color: var(--burgundy);
}

/* ------------------------------------------------------------------ hero */

.hero {
    padding: clamp(2.5rem, 7vw, 5rem) 0 0;
    background: radial-gradient(circle at 20% 0%, rgba(212, 80, 96, 0.16), transparent 55%),
        radial-gradient(circle at 90% 10%, rgba(128, 0, 32, 0.12), transparent 45%);
    text-align: center;
}

.hero-icon {
    margin: 0 auto 1.5rem;
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.hero h1 {
    margin-bottom: 1rem;
}

.hero p {
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
    color: var(--ink-soft);
    font-size: 1.06rem;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    justify-content: center;
    align-items: stretch;
    margin-top: 1.9rem;
}

.button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.button.primary {
    background: var(--burgundy);
    color: var(--ivory);
    box-shadow: var(--shadow);
}

.button.primary:hover {
    background: var(--burgundy-dark);
    color: var(--ivory);
    transform: translateY(-1px);
}

/* ---------------------------------------------------------- store badges */

/*
 * The store badges are the one place the site goes dark on purpose. A light
 * pill around the word "Descargar" is a text link in disguise; the stores both
 * ship dark badges, so the dark surface is what tells the eye it can be tapped.
 * The Google Play one keeps the brand burgundy, the App Store one is ink — and
 * dimmed, because there is no listing yet.
 */
.store-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.15rem 0.5rem 0.8rem;
    border-radius: 10px;
    background: var(--burgundy);
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.store-badge:hover {
    background: var(--burgundy-dark);
    color: #fff;
    transform: translateY(-1px);
}

.store-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
}

.store-badge-icon svg {
    width: 100%;
    height: 100%;
}

.store-badge-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}

.store-badge-small {
    font-size: 0.6rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    opacity: 0.78;
}

.store-badge-brand {
    font-size: 1.18rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.store-badge--soon {
    background: var(--ink);
    opacity: 0.55;
    cursor: default;
}

.store-badge--soon:hover {
    background: var(--ink);
    transform: none;
}

/* A seismogram line under the hero: the one mark that says "this is about the
   ground moving" without a word or a map. */
.seismo {
    display: block;
    width: 100%;
    height: 46px;
    margin-top: 2.5rem;
    color: var(--rose);
    opacity: 0.5;
}

/* ------------------------------------------------------------------ stats */

.stats {
    padding: 1.9rem 0;
    background: var(--burgundy);
    color: var(--ivory);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem 2rem;
    text-align: center;
}

.stat strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ivory);
}

.stat span {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--sand);
    opacity: 0.92;
}

/* -------------------------------------------------------------- gallery */

.gallery {
    padding: 0 0 clamp(2rem, 5vw, 3.5rem);
}

.shots {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 1fr);
    gap: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 1.25rem;
    scroll-snap-type: x mandatory;
}

/*
 * A phone frame, not a bare screenshot. A floating rectangle of pixels reads as
 * a cropped wallpaper; the bezel is what tells the eye it is a screen in a
 * hand, which is the point the reference page makes without a word.
 */
.shots .phone {
    margin: 0;
    scroll-snap-align: center;
    text-align: center;
}

.phone {
    position: relative;
    display: inline-block;
    padding: 0.65rem;
    border-radius: 26px;
    background: #2b1418;
    box-shadow:
        0 0 0 1px rgba(43, 20, 24, 0.5),
        0 10px 30px rgba(43, 20, 24, 0.22);
}

.phone img {
    display: block;
    width: 100%;
    border-radius: 17px;
    background: var(--sand);
    aspect-ratio: 9 / 19.5;
    object-fit: cover;
}

/* The island, drawn with CSS so there is no second image to keep in sync. */
.phone-notch {
    position: absolute;
    top: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    width: 34%;
    height: 1.15rem;
    border-radius: 999px;
    background: #2b1418;
    z-index: 1;
}

.phone figcaption {
    margin: 0.7rem 0 0;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.fineprint {
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.86rem;
    margin: 0;
}

/* ------------------------------------------------------------- sections */

section {
    padding: clamp(2.5rem, 6vw, 4rem) 0;
}

section.alt {
    background: var(--sand);
}

section p {
    max-width: var(--measure);
    color: var(--ink-soft);
}

section.alt p {
    color: #4a2b31;
}

.features .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 1.75rem;
}

.features article {
    background: var(--ivory);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem 1.4rem;
    box-shadow: var(--shadow);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    margin-bottom: 0.9rem;
    border-radius: 12px;
    background: rgba(128, 0, 32, 0.08);
    color: var(--burgundy);
}

.feature-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.features article h3 {
    color: var(--burgundy);
    margin-bottom: 0.4em;
}

.features article p {
    margin: 0;
    font-size: 0.96rem;
}

.download {
    text-align: center;
}

.download p {
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------------------------- legal */

.legal {
    padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 6vw, 4rem);
}

.legal h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}

.legal article p {
    max-width: none;
    color: var(--ink);
}

.legal .meta {
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.legal .related {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 2rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------- earthquake */

.earthquake {
    padding: clamp(2rem, 5vw, 3.5rem) 0 4rem;
}

.crumb {
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.crumb a {
    text-decoration: none;
}

.quake {
    background: var(--ivory);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.quake-head {
    background: var(--burgundy);
    color: var(--ivory);
    padding: 1.5rem 1.4rem;
}

.quake-head .mag {
    font-size: clamp(2.4rem, 8vw, 3.4rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
}

.quake-head .mag-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.8;
    margin-bottom: 0.35rem;
}

.quake-head .place {
    margin: 0.75rem 0 0;
    font-size: 1.1rem;
}

.quake dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.6rem 1.25rem;
    margin: 0;
    padding: 1.4rem;
}

.quake dt {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.quake dd {
    margin: 0;
    font-weight: 600;
}

.quake-actions {
    padding: 0 1.4rem 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.92rem;
}

.loading,
.notice {
    color: var(--ink-soft);
}

.notice {
    background: var(--sand);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
}

/* --------------------------------------------------------------- footer */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 2.25rem 0 3rem;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-bottom: 1rem;
}

.footer-links a {
    text-decoration: none;
}

.site-footer p {
    margin: 0;
    max-width: var(--measure);
}

/* ---------------------------------------------------------------- 404 */

.center-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.center-page .wrap {
    text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    /*
     * Two tidy rows instead of one that overflows: the brand and the language
     * pill share the first, and the legal links get the second to themselves.
     *
     * Before this, all five sat in one wrapping row: the links did not fit next
     * to the brand, so the pill — being last — dropped onto a line of its own,
     * out of line with everything. Its own row is honest; a stray pill is not.
     */
    .site-header .wrap {
        flex-wrap: wrap;
        row-gap: 0.4rem;
        column-gap: 0.75rem;
        min-height: 0;
        padding-top: 0.65rem;
        padding-bottom: 0.6rem;
    }

    /* Pushes the pill to the far right of the first row. */
    .brand {
        margin-right: auto;
    }

    .site-header nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        flex-wrap: nowrap;
        gap: 0.95rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .site-header nav::-webkit-scrollbar {
        display: none;
    }

    .site-header nav a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .shots {
        grid-auto-columns: 72%;
    }

    .quake dl {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .quake dt:not(:first-of-type) {
        margin-top: 0.75rem;
    }
}

/*
 * Motion is decoration here; anyone who asked the system for less of it should
 * not get a hover that lifts a button.
 */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .button {
        transition: none;
    }

    .button.primary:hover {
        transform: none;
    }
}
