/* Dekripto landing page: "Pop", the app's own look.
   Fredoka titles, chunky buttons and cards on a solid edge (the "lip"), and the
   score colours (red = far, green = found) as the only decoration. Light and
   dark follow the system, like the app. */

@font-face {
    font-family: "Fredoka";
    src: url("fonts/Fredoka-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Fredoka";
    src: url("fonts/Fredoka-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    /* The app's palette (lib/palette.dart). */
    --ink: #1b1946;
    --midnight: #14122e;
    --gold: #ffc83d;
    --red: #f2445c;
    --purple: #9b4de0;
    --blue: #3d5afe;
    --green: #12a34c;

    --page: #f6f4ff;
    --text: var(--ink);
    --muted: #5f5c86;
    --card: #ffffff;
    --card-edge: #c9c5e3;
    --card-glow: rgba(52, 40, 140, 0.22);
    --button: var(--blue);
    --button-edge: #2339b9;
    --link: #2b45e0;
    --glow-strength: 1;

    --display: "Fredoka", ui-rounded, system-ui, sans-serif;
    --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page: var(--midnight);
        --text: #ffffff;
        --muted: #b8b5dc;
        --card: #1f1d45;
        --card-edge: #0a091f;
        --card-glow: rgba(0, 0, 0, 0.5);
        --button-edge: #1f2fa0;
        --link: #9fb0ff;
        --glow-strength: 0.55;
    }
}

* {
    margin: 0;
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-x: clip;
    color: var(--text);
    font-family: var(--body);
    /* The shorthand below is dropped by a browser that has no color-mix(): the
       themed colour stays. */
    background-color: var(--page);
    background:
        radial-gradient(46rem 30rem at 88% 8%, color-mix(in srgb, var(--green) calc(24% * var(--glow-strength)), transparent), transparent 70%),
        radial-gradient(40rem 30rem at 6% 78%, color-mix(in srgb, var(--blue) calc(20% * var(--glow-strength)), transparent), transparent 70%),
        radial-gradient(38rem 24rem at 52% -4%, color-mix(in srgb, var(--red) calc(16% * var(--glow-strength)), transparent), transparent 70%),
        var(--page);
    background-repeat: no-repeat;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
    border-radius: 12px;
}

::selection {
    background: var(--gold);
    color: var(--ink);
}

a {
    color: var(--link);
}

.undecorated {
    text-decoration: none;
}

/* The logo: a "d" drawn from the app's own geometry, then "ekripto" so that it
   spells the name. Everything is in ems of the font size. */
.brand {
    display: inline-block;
    color: inherit;
    text-decoration: none;
}

.wordmark {
    font: 600 clamp(36px, 5vw, 46px) / 1 var(--display);
    white-space: nowrap;
}

/* The "d", from the geometry of DekriptoLogo (1/1000 em: bowl radius 258.5,
   stroke 150, stem leaning 16 degrees), drawn as a mask so that it takes the
   text colour. */
.wordmark-d {
    --d: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 639.81 736'%3E%3Ccircle cx='258.5' cy='477.5' r='183.5' fill='none' stroke='%23000' stroke-width='150'/%3E%3Cline x1='434.89' y1='528.08' x2='564.81' y2='75' stroke='%23000' stroke-width='150' stroke-linecap='round'/%3E%3C/svg%3E");
    display: inline-block;
    width: 0.6398em;
    height: 0.736em;
    margin-right: -0.0818em;
    vertical-align: -0.018em;
    background: currentColor;
    -webkit-mask: var(--d) center / 100% 100% no-repeat;
    mask: var(--d) center / 100% 100% no-repeat;
}

@media (forced-colors: active) {
    .wordmark-d {
        forced-color-adjust: none;
    }
}

/* ---- Landing page ---- */

#wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 32px);
}

#title {
    padding: clamp(16px, 3vw, 28px) 0 0;
}

#content {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 5vw, 72px);
    padding: clamp(8px, 2vw, 24px) 0 clamp(24px, 4vw, 48px);
}

#tagline {
    font: 700 clamp(44px, 6.6vw, 88px) / 1 var(--display);
    letter-spacing: -0.01em;
    text-wrap: balance;
}

/* "articles" goes through the whole score scale, from far to found. */
.scale {
    background: linear-gradient(90deg, var(--red), var(--purple) 38%, var(--blue) 68%, #1fbf5f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#description-card {
    max-width: 34rem;
    margin-top: clamp(20px, 3vw, 32px);
    padding: 22px 26px;
    border-radius: 28px;
    background: var(--card);
    box-shadow: 0 6px 0 var(--card-edge), 0 20px 36px -14px var(--card-glow);
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.6;
}

#description-card p + p {
    margin-top: 0.7em;
    font: 600 1.12em / 1.4 var(--display);
}

#actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-top: clamp(24px, 3.4vw, 36px);
}

#app-store-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

#app-store-links a {
    display: block;
    transition: transform 0.12s ease;
}

#app-store-links a:hover {
    transform: translateY(-2px);
}

#app-store-links img {
    display: block;
    width: auto;
    height: 52px;
}

#play-now-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 30px;
    border-radius: 999px;
    background: var(--button);
    color: #fff;
    font: 700 21px / 1 var(--display);
    box-shadow: 0 5px 0 var(--button-edge);
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

#play-now-button:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 6px 0 var(--button-edge);
}

#play-now-button:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--button-edge);
}

/* The banner: three screens of the app, from far (red) to found (green). */
#cover {
    position: relative;
    container-type: inline-size;
    justify-self: center;
    width: max(300px, min(100%, 520px));
    width: max(300px, min(100%, 520px, calc((100svh - 150px) / 1.2)));
    aspect-ratio: 1 / 1.2;
}

.shot {
    position: absolute;
    display: block;
    height: auto;
    border-radius: 28px;
    border-radius: 6.4cqw;
    box-shadow: 0 7px 0 var(--lip), 0 18px 28px -5px rgba(30, 18, 110, 0.35);
    box-shadow: 0 1.6cqw 0 var(--lip), 0 4cqw 6cqw -1cqw rgba(30, 18, 110, 0.35);
    animation: bob 7s ease-in-out infinite;
}

.shot-center {
    --lip: #4a2a9c;
    z-index: 3;
    top: 0;
    left: 24%;
    width: 52%;
}

/* The side screens lean outwards from their bottom edge, so that their
   headlines stay readable next to the middle one. */
.shot-left {
    --lip: #a8263b;
    z-index: 1;
    top: 11.667%;
    left: 1%;
    width: 42%;
    transform-origin: 50% 100%;
    rotate: -9deg;
    animation-delay: -2.4s;
}

.shot-right {
    --lip: #0a6a47;
    z-index: 2;
    top: 11.667%;
    right: 1%;
    width: 42%;
    transform-origin: 50% 100%;
    rotate: 9deg;
    animation-delay: -4.6s;
}

@keyframes bob {
    0%,
    100% {
        translate: 0 0;
    }

    50% {
        translate: 0 -6px;
        translate: 0 -1.4cqw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shot {
        animation: none;
    }
}

#footer {
    padding: 8px 0 28px;
    color: var(--muted);
    font-size: 14px;
    line-height: 2;
    text-align: center;
}

#footer p {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 0.7em;
}

#footer a {
    color: inherit;
    text-underline-offset: 3px;
}

#footer a:hover {
    color: var(--text);
}

@media (max-width: 860px) {
    #title {
        text-align: center;
    }

    #content {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    /* The tagline, the banner and the buttons come first, so that the way in
       is on the first screen of a phone; the text of the card comes after. */
    #intro {
        display: contents;
    }

    #tagline {
        order: 1;
        text-align: center;
    }

    #cover {
        order: 2;
        width: min(74%, 330px);
        margin: 24px 0 28px;
    }

    #actions {
        order: 3;
        justify-content: center;
    }

    #description-card {
        order: 4;
        justify-self: center;
        margin-top: 32px;
    }
}

@media (max-width: 480px) {
    #footer .sep {
        display: none;
    }

    #footer p {
        gap: 0 1.2em;
    }

    #app-store-links {
        justify-content: center;
    }

    #app-store-links img {
        height: 46px;
    }

    #play-now-button {
        width: 100%;
    }
}

/* ---- Legal pages ---- */

.legal-page {
    padding: 0 clamp(12px, 4vw, 24px) 48px;
}

.legal-header {
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(16px, 3vw, 28px) 0 0;
}

.legal-header .wordmark {
    font-size: 36px;
}

.legal {
    max-width: 760px;
    margin: 20px auto 0;
    padding: clamp(20px, 4vw, 40px);
    border-radius: 28px;
    background: var(--card);
    box-shadow: 0 6px 0 var(--card-edge), 0 20px 36px -14px var(--card-glow);
    font-size: 16px;
    line-height: 1.65;
}

.legal .back {
    margin-bottom: 20px;
}

.legal .back a {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(128, 128, 140, 0.16);
    background: color-mix(in srgb, var(--text) 8%, transparent);
    color: var(--text);
    font: 600 15px / 1.4 var(--display);
    text-decoration: none;
}

.legal .back a:hover {
    background: rgba(128, 128, 140, 0.26);
    background: color-mix(in srgb, var(--text) 14%, transparent);
}

.legal h1 {
    margin-bottom: 0.6em;
    font: 700 clamp(30px, 5vw, 42px) / 1.1 var(--display);
    text-wrap: balance;
}

.legal h2 {
    margin: 1.8em 0 0.5em;
    font: 600 22px / 1.25 var(--display);
}

.legal h3 {
    margin: 1.4em 0 0.4em;
    font: 600 18px / 1.3 var(--display);
}

.legal p,
.legal ul {
    margin-bottom: 0.9em;
}

.legal ul {
    padding-left: 1.4em;
}

.legal li {
    margin-bottom: 0.4em;
}

.legal hr {
    margin: 2em 0 1.2em;
    border: 0;
    border-top: 2px solid rgba(128, 128, 140, 0.25);
    border-top: 2px solid color-mix(in srgb, var(--text) 12%, transparent);
}

.legal a {
    overflow-wrap: anywhere;
    text-underline-offset: 3px;
}
