/*
 * trimash.app shares the app's look by copying, not linking: block 1 of the app's
 * src/styles/tokens.css (the palette and the construction parameters), the semantic tokens
 * the site reads, and the two constructions every raised and recessed object is built from.
 * When the app's theme changes, this block is copied again.
 */

@font-face {
    font-family: "Baloo 2";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url(/fonts/baloo-2-latin-700-normal.woff2) format("woff2");
}
@font-face {
    font-family: "Baloo 2";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url(/fonts/baloo-2-latin-800-normal.woff2) format("woff2");
}
@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url(/fonts/nunito-latin-500-normal.woff2) format("woff2");
}
@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url(/fonts/nunito-latin-600-normal.woff2) format("woff2");
}

:root {
    /* ------------------------------------------------- 1. The app's palette, verbatim */
    --ink: #0b2b34;
    --cream: #fff6e3;
    --amber: #ffc93c;
    --mint: #12e0a4;
    --card-red: #ff3b57;
    --card-blue: #2f7bff;
    --card-yellow: #ffc93c;
    --ground-1: #07293a;
    --ground-2: #0d4356;
    --ground-3: #156b80;
    --ground-4: #1c7a8c;
    --ground-5: #2393a5;
    --ground-glow-color: rgba(120, 240, 255, 0.16);
    --ground-pattern-opacity: 0.085;
    --lift-raised: 4px;
    --border-raised: 3px;
    --radius-raised: 16px;
    --radius-recess: 18px;
    --radius-card: 14px;
    --radius-pill: 999px;
    --shade-recess: rgba(0, 0, 0, 0.28);

    /* ------------------------------------------------- 2. The semantic tokens the site reads */
    --ground: linear-gradient(
        180deg,
        var(--ground-1) 0%,
        var(--ground-2) 34%,
        var(--ground-3) 68%,
        var(--ground-4) 88%,
        var(--ground-5) 100%
    );
    --ground-glow: radial-gradient(120% 40% at 50% 100%, var(--ground-glow-color), transparent 70%);
    --color-text-on-ground: var(--cream);
    --color-text-on-raised: var(--ink);
    --color-text-muted-on-raised: rgba(11, 43, 52, 0.64);
    --color-text-on-recess: var(--cream);
    --color-text-muted-on-recess: rgba(255, 246, 227, 0.74);
    --color-raised: var(--cream);
    --color-recess: var(--ink);
    --color-outline: var(--ink);
    --color-raised-primary: var(--amber);

    /* ------------------------------------------------- 3. Scales */
    --font-family: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
    --font-family-text: "Nunito", system-ui, sans-serif;
    --leading-text: 1.45;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-heavy: 800;
    --font-meta: 0.7rem;
    --font-label: 0.85rem;
    --font-sentence: 0.95rem;
    --font-title: 1.4rem;
    --font-heading: 1.6rem;
    --font-callout: 2rem;
    --size-tap-min: 44px;
    --size-menu-button: 56px;
    --size-screen-max-width: 450px;
    --space-xs: 8px;
    --space-sm: 10px;
    --space-md: 20px;
    --space-gutter: 16px;
    --space-fluid-xs: 2vh;
    --space-fluid-sm: 3vh;
    font-size: 20px;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-family);
    color: var(--color-text-on-ground);
    background-color: var(--ground-1);
    -webkit-font-smoothing: antialiased;
}

/* The ground: the gradient, the glow off the foot, and the shape scatter as a mask so its
   colour is a token. */
.ground {
    position: relative;
    isolation: isolate;
    min-height: 100dvh;
    background-color: var(--ground-1);
    background-image: var(--ground-glow), var(--ground);
    background-repeat: no-repeat;
    background-size: cover;
}

.ground::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: var(--cream);
    opacity: var(--ground-pattern-opacity);
    -webkit-mask-image: url("/img/ground-pattern.svg");
    mask-image: url("/img/ground-pattern.svg");
    -webkit-mask-size: cover;
    mask-size: cover;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    pointer-events: none;
}

/* The wordmark's letters are SVG text. Its own font-family attribute, "Baloo 2, sans-serif"
   unquoted, is invalid CSS and is dropped, so the letters inherit the face around them.
   Set it here so the mark reads the same inside Nunito prose as on the title screen. */
.wordmark {
    display: block;
    width: 100%;
    height: auto;
    font-family: var(--font-family);
}

/* Raised is anything you can touch: cream, outlined in ink, lifted. Recess is anything
   that holds something: flat ink, no outline. */
.raised {
    background-color: var(--color-raised);
    color: var(--color-text-on-raised);
    border: var(--border-raised) solid var(--color-outline);
    border-radius: var(--radius-raised);
    box-shadow: 0 var(--lift-raised) 0 var(--color-outline);
}

.recess {
    background-color: var(--color-recess);
    color: var(--color-text-on-recess);
    border-radius: var(--radius-recess);
    box-shadow: 0 var(--lift-raised) 0 var(--shade-recess);
}

.sentence {
    margin: 0;
    font-family: var(--font-family-text);
    font-weight: var(--weight-medium);
    font-size: var(--font-sentence);
    line-height: var(--leading-text);
}

.meta {
    margin: 0;
    font-family: var(--font-family-text);
    font-weight: var(--weight-semibold);
    font-size: var(--font-meta);
    line-height: var(--leading-text);
}

/* A store control: a raised tile with a disc for its mark. */
.store {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--size-menu-button);
    padding: var(--space-xs) var(--space-md) var(--space-xs) var(--space-sm);
    text-decoration: none;
    font-size: var(--font-sentence);
    font-weight: var(--weight-bold);
    cursor: pointer;
}

.store.primary {
    --color-raised: var(--color-raised-primary);
}

.store .disc {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: var(--cream);
}

.store .glyph {
    width: 17px;
    height: 17px;
}

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

.store .soon small {
    font-family: var(--font-family-text);
    font-size: var(--font-meta);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted-on-raised);
}

.store.muted {
    color: var(--color-text-muted-on-raised);
    cursor: default;
}

.store.muted .disc {
    background: var(--color-text-muted-on-raised);
}

a:focus-visible {
    outline: 3px solid var(--cream);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
    .store {
        transition: transform 0.12s;
    }
    a.store:active {
        transform: translateY(var(--lift-raised));
        box-shadow: none;
    }
}

/* A card as the board draws it: the cream tile, and inside it the face, the app's 4x4 grid
   with its figure placements. The face fills the card so that its percentage inset and gap
   resolve against the card, not against whatever holds the card. */
.card {
    width: var(--size-card, 104px);
    aspect-ratio: 1;
    background: var(--cream);
    border-radius: var(--radius-card);
    box-shadow: 0 4px 0 3px var(--ink);
}

.card .face {
    width: 100%;
    height: 100%;
    padding: 9.8%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 3.7%;
}

.card .figure {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.card.red {
    color: var(--card-red);
}
.card.blue {
    color: var(--card-blue);
}
.card.yellow {
    color: var(--card-yellow);
}

.one .figure {
    grid-area: 2 / 2 / 4 / 4;
}
.two .figure:nth-child(1) {
    grid-area: 3 / 1 / 5 / 3;
}
.two .figure:nth-child(2) {
    grid-area: 1 / 3 / 3 / 5;
}
.three .figure:nth-child(1) {
    grid-area: 2 / 1 / 4 / 3;
}
.three .figure:nth-child(2) {
    grid-area: 1 / 3 / 3 / 5;
}
.three .figure:nth-child(3) {
    grid-area: 3 / 3 / 5 / 5;
}
.two .square:nth-child(1) {
    transform: translate(0, -7.78%);
}
.two .square:nth-child(2) {
    transform: translate(0, 7.78%);
}
.three .triangle:nth-child(1) {
    transform: translate(3.8%, 0);
}
.three .triangle:nth-child(2),
.three .triangle:nth-child(3) {
    transform: translate(-3.8%, 0);
}

/* ------------------------------------------------------------------ The landing page */

/* The title screen fills the first viewport; the shop follows. */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.hero {
    min-height: 100dvh;
    display: flex;
    align-items: center;
}

.column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-fluid-sm);
    padding: var(--space-gutter);
    width: 100%;
    max-width: var(--size-screen-max-width);
    margin: 0 auto;
}

.menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    width: 100%;
    max-width: 300px;
}

.menu .store {
    width: 100%;
}

.lead {
    text-align: center;
    max-width: 34ch;
}

.phone {
    justify-self: center;
    width: min(78vw, 300px);
    padding: 10px;
    background: var(--ink);
    border-radius: 36px;
    box-shadow: 0 var(--lift-raised) 0 var(--shade-recess);
}

.phone img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 28px;
}

.pitch {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md) var(--space-gutter);
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

.pitch h2 {
    margin: 0;
    font-size: var(--font-callout);
    font-weight: var(--weight-heavy);
    line-height: 1.05;
    text-wrap: balance;
}

.pitch .copy {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 38ch;
}

.triple {
    padding: var(--space-md) var(--space-gutter) calc(var(--space-md) * 2);
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    align-items: center;
    text-align: center;
}

.triple h2 {
    margin: 0;
    font-size: var(--font-heading);
    font-weight: var(--weight-heavy);
}

.cards {
    display: flex;
    gap: 18px;
    --size-card: min(26vw, 110px);
}

.triple .sentence {
    max-width: 44ch;
}

/* The foot of the page is a recess, and on ink a control takes a cream edge and no lift. */
footer {
    margin-top: auto;
    background: var(--ink);
    color: var(--cream);
    padding: var(--space-md) var(--space-gutter);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm) var(--space-md);
}

footer .meta {
    color: var(--color-text-muted-on-recess);
}

footer .store {
    min-height: var(--size-tap-min);
    border: 2.5px solid var(--cream);
    border-radius: var(--radius-pill);
    background: none;
    color: var(--cream);
    box-shadow: none;
    padding: 4px 18px 4px 12px;
    font-size: var(--font-label);
}

footer .store .disc {
    background: var(--cream);
    color: var(--ink);
    width: 24px;
    height: 24px;
}

@media (min-width: 860px) {
    .pitch {
        grid-template-columns: 1.1fr 0.9fr;
        padding: 40px;
        gap: 40px;
    }
    .pitch h2 {
        font-size: 2.7rem;
    }
    .phone {
        width: 320px;
        transform: rotate(-3deg);
    }
    .triple {
        padding: 20px 40px 60px;
    }
}

/* ----------------------------------------------------------------- The privacy policy */

/* Cream prose on the ground, at reading width. Headings keep the display face. */
.policy {
    max-width: 70ch;
    margin: 0 auto;
    padding: var(--space-md) var(--space-gutter) calc(var(--space-md) * 2);
    font-family: var(--font-family-text);
    font-weight: var(--weight-medium);
    font-size: var(--font-sentence);
    line-height: var(--leading-text);
    color: var(--color-text-on-ground);
    /* The policy quotes long URLs, which cannot break on their own and would otherwise
       set the column's minimum width past a phone's. */
    overflow-wrap: anywhere;
}

/* The wordmark at the app's secondary size: 72% of the screen column, as the About
   screen draws it, not of the prose column. */
.policy .home {
    display: block;
    width: 72%;
    max-width: calc(var(--size-screen-max-width) * 0.72);
    margin: var(--space-fluid-xs) auto var(--space-fluid-sm);
}

.policy h1,
.policy h2,
.policy h3,
.policy h4 {
    font-family: var(--font-family);
    font-weight: var(--weight-heavy);
    line-height: 1.15;
    margin: 1.4em 0 0.5em;
    text-wrap: balance;
}

.policy h1 {
    font-size: var(--font-callout);
    margin-top: 0;
}
.policy h2 {
    font-size: var(--font-heading);
}
.policy h3 {
    font-size: var(--font-title);
}
.policy h4 {
    font-size: var(--font-label);
}

.policy p,
.policy ul {
    margin: 0 0 1em;
}

.policy a {
    color: var(--cream);
    font-weight: var(--weight-semibold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* A page with nothing on it but the mark and a way home. */
.lost {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-gutter);
    max-width: var(--size-screen-max-width);
    margin: 0 auto;
    text-align: center;
}
