/*
 * Colours come from src/client/src/styles.css, which measured them from docs/koncept.png, so the site
 * and the app read as one thing. Morning is linen and evening is sea blue, as in docs/grafisk-profil.md.
 */
@font-face {
    font-family: "Fraunces";
    src: url("/assets/fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "DM Sans";
    src: url("/assets/fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 1000;
    font-display: swap;
}

:root {
    color-scheme: light;

    --linen: #f7e8d8;
    --paper: #fbf1e6;
    --warm-paper: #e9d7c3;
    --falu-red: #a84231;
    --falu-red-dark: #8f3628;
    --sea-blue: #345c68;
    --honey: #d8aa65;
    /* Plain honey is too faint for small text on sea blue. */
    --honey-light: #f0d2a0;
    --forest-ink: #343b36;
    --muted: #5a615a;
    --line: #e0cbb3;

    --font-heading: "Fraunces", Georgia, serif;
    --font-ui: "DM Sans", system-ui, sans-serif;
    --gutter: clamp(1.25rem, 5vw, 4rem);
    --section: clamp(4rem, 10vw, 8rem);
    --radius: 20px;

    --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .4 0 0 0 0 .25 0 0 0 .03 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
}

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

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 1.5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--linen);
    background-image: var(--paper-grain);
    color: var(--forest-ink);
    font: 400 1.0625rem/1.55 var(--font-ui);
    overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
    margin: 0;
}

ul,
ol {
    padding: 0;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--falu-red);
}

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

h1,
h2 {
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-weight: 500;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

h2 {
    font-size: clamp(2.125rem, 6vw, 3.75rem);
    line-height: 1.08;
}

.eyebrow {
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sea-blue);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -4rem;
    z-index: 2;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--forest-ink);
    color: var(--linen);
}

.skip-link:focus {
    top: 0.75rem;
    color: var(--linen);
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 84rem;
    margin-inline: auto;
    padding: 1.25rem var(--gutter);
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    font-family: var(--font-heading);
    font-size: 1.625rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--falu-red);
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.875rem, 3vw, 2rem);
    font-size: 0.9375rem;
    font-weight: 500;
}

.site-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
}

.site-nav a:hover {
    text-decoration: underline;
}

.language {
    padding-inline: 0.875rem;
    border: 1px solid var(--line);
    border-radius: 999px;
}

/* The how-link is the first to go when a phone runs out of room. */
@media (max-width: 26rem) {
    .nav-how {
        display: none !important;
    }
}

/* The tilted card behind the hero may stick out, but must not make the page scroll sideways. */
main {
    overflow-x: clip;
}

/* Hero */
.hero {
    display: grid;
    gap: clamp(3rem, 8vw, 5rem);
    max-width: 84rem;
    margin-inline: auto;
    padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) var(--section);
}

/*
 * Fraunces turns thin and glossy at its largest optical size. The big lines hold it back, to stay
 * as sturdy and bookish as docs/koncept.png.
 */
.hero h1,
.between-you h2 {
    font-variation-settings: "opsz" 40;
}

.hero h1 {
    margin-top: 1rem;
    font-size: clamp(2.75rem, 12.5vw, 5.75rem);
    line-height: 1;
    letter-spacing: -0.03em;
}

.hero h1 span {
    display: block;
}

.hero h1 span:last-child {
    color: var(--falu-red);
}

.lead {
    max-width: 30rem;
    margin-top: 1.75rem;
    font-size: clamp(1.1875rem, 2.2vw, 1.375rem);
    line-height: 1.45;
}

.hero .store-soon,
.hero .stores {
    margin-top: 2rem;
}

.stores {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem 1rem;
}

.store-icon {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    fill: currentColor;
}

/* The label sits across the badge, so it stays clear that the badge is not a link yet. */
.store-ios {
    position: relative;
    display: inline-flex;
}

.store-ios img {
    display: block;
}

.store-ios-soon {
    position: absolute;
    top: -0.75rem;
    right: -0.5rem;
    color: var(--forest-ink);
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--honey-light);
    box-shadow: 0 0 0 2px var(--linen);
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
    transform: rotate(-3deg);
}

.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    min-height: 52px;
    padding: 0.625rem 1.75rem;
    border-radius: 999px;
    background: var(--falu-red);
    color: #fff;
    font-weight: 500;
    font-size: 1.0625rem;
    text-decoration: none;
}

.action:hover {
    background: var(--falu-red-dark);
    color: #fff;
}

.store-soon {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    background: var(--warm-paper);
    font-weight: 500;
}

/* Cards */
.card {
    border-radius: var(--radius);
    background-color: var(--paper);
    background-image: var(--paper-grain);
    box-shadow: 0 1px 0 #fff8 inset, 0 0 0 1px var(--line), 0 14px 30px -18px #5a3f2666;
}

.card-question {
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-weight: 500;
    line-height: 1.14;
    letter-spacing: -0.01em;
}

.hero-play {
    display: grid;
    justify-items: center;
    gap: 1.5rem;
}

.card-stack {
    position: relative;
    width: min(21rem, 80vw);
}

.card-peek {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--line), 0 14px 30px -18px #5a3f2666;
    transform: translate(9%, 2%) rotate(7deg);
}

.flip {
    position: relative;
    perspective: 1400px;
    cursor: pointer;
}

.flip-inner {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 480ms cubic-bezier(0.3, 0.9, 0.35, 1);
}

.is-flipped .flip-inner {
    transform: rotateY(180deg);
}

.face {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    aspect-ratio: 3 / 4;
    min-height: 100%;
    padding: clamp(1.25rem, 5vw, 1.75rem);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.face-morning .card-question {
    margin-top: 0.75rem;
    font-size: clamp(1.75rem, 7vw, 2.25rem);
}

.card-sprig {
    width: 82%;
    margin: auto auto 0;
    padding-top: 0.5rem;
}

.card-note {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--muted);
    text-align: center;
}

.face-evening {
    gap: 0.625rem;
    transform: rotateY(180deg);
    background-color: var(--sea-blue);
    color: var(--linen);
    box-shadow: 0 0 0 1px #2a4a54, 0 14px 30px -18px #5a3f2666;
}

.face-evening .eyebrow {
    color: var(--honey-light);
}

.evening-line {
    margin-bottom: auto;
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 5.4vw, 1.5rem);
    line-height: 1.18;
}

.slip {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: var(--paper);
    color: var(--forest-ink);
}

.slip-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--falu-red);
}

.slip:last-child .slip-label {
    color: var(--sea-blue);
}

.slip-text {
    margin-top: 0.125rem;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    line-height: 1.25;
}

.flip-button {
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    border: 0;
    background: none;
    color: inherit;
    font: 500 1rem var(--font-ui);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
    cursor: pointer;
}

.flip-button:hover {
    color: var(--falu-red);
}

/* How a day goes. The colours walk from morning to evening. */
.how {
    max-width: 84rem;
    margin-inline: auto;
    padding: 0 var(--gutter) var(--section);
}

.how h2 {
    max-width: 18em;
}

.day {
    display: grid;
    gap: 1rem;
    margin-top: clamp(2rem, 5vw, 3.5rem);
    list-style: none;
}

.day-part {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    border-radius: var(--radius);
}

.day-morning {
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--line);
}

.day-midday {
    background: var(--warm-paper);
}

.day-evening {
    background: var(--sea-blue);
    color: var(--linen);
}

.day-icon {
    width: 48px;
    height: 32px;
    margin-bottom: 0.5rem;
}

.day-time {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.day-evening .day-time {
    color: var(--honey-light);
}

.day-part h3 {
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 500;
    line-height: 1.15;
}

/* A look in the deck. On a phone the cards are held in a row you can swipe. */
.peek {
    max-width: 84rem;
    margin-inline: auto;
    padding: 0 var(--gutter) var(--section);
}

.peek-head p {
    max-width: 30rem;
    margin-top: 1rem;
    font-size: 1.1875rem;
}

.peek-cards {
    display: flex;
    gap: 1rem;
    margin: clamp(2rem, 5vw, 3.5rem) calc(-1 * var(--gutter)) 0;
    padding: 0.5rem var(--gutter) 1.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    list-style: none;
}

.mini {
    display: flex;
    flex: 0 0 min(16rem, 68vw);
    flex-direction: column;
    gap: 0.875rem;
    aspect-ratio: 3 / 4;
    padding: 1.5rem;
    scroll-snap-align: start;
}

.mini .card-question {
    font-size: 1.5rem;
}

/* The botanical mark from the card, printed in the colour of the card's own text. */
.mini::after {
    content: "";
    width: 72%;
    aspect-ratio: 300 / 140;
    margin: auto 0 0 auto;
    background: currentColor;
    opacity: 0.22;
    -webkit-mask: url("/assets/sprig.svg") center / contain no-repeat;
    mask: url("/assets/sprig.svg") center / contain no-repeat;
}

.mini-spark {
    background-color: var(--falu-red);
    color: #fff;
    box-shadow: 0 14px 30px -18px #5a3f2666;
}

.mini-spark .eyebrow {
    color: var(--linen);
}

.mini-deep {
    background-color: var(--sea-blue);
    color: var(--linen);
    box-shadow: 0 14px 30px -18px #5a3f2666;
}

.mini-deep .eyebrow {
    color: var(--honey-light);
}

.mini-challenge {
    background-color: var(--honey);
    box-shadow: 0 14px 30px -18px #5a3f2666;
}

.mini-challenge .eyebrow {
    color: var(--forest-ink);
}

/* Promises */
.gift {
    max-width: 84rem;
    margin-inline: auto;
    padding: 0 var(--gutter) var(--section);
}

.promises {
    display: grid;
    gap: 0 clamp(2rem, 6vw, 5rem);
    margin-top: clamp(1.5rem, 4vw, 3rem);
}

.promises > div {
    padding-block: 1.5rem;
    border-top: 1px solid var(--forest-ink);
}

.promises dt {
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-size: clamp(1.375rem, 2.6vw, 1.75rem);
    font-weight: 500;
    line-height: 1.2;
}

.promises dd {
    max-width: 30rem;
    margin-top: 0.5rem;
    color: var(--muted);
}

/* The evening: the one place the whole page turns dark. */
.between-you {
    background-color: var(--sea-blue);
    background-image: var(--paper-grain);
    color: var(--linen);
}

.between-you-inner {
    display: grid;
    gap: 1.25rem;
    max-width: 84rem;
    margin-inline: auto;
    padding: var(--section) var(--gutter);
}

.between-you .eyebrow {
    color: var(--honey-light);
}

.between-you h2 {
    color: var(--honey-light);
    font-size: clamp(2.5rem, 7.5vw, 5.25rem);
    line-height: 1.04;
}

.between-you-text {
    display: grid;
    gap: 1rem;
    max-width: 38rem;
    margin-top: 1rem;
    font-size: 1.125rem;
}

.between-you a:hover {
    color: var(--honey-light);
}

/* Start */
.start {
    display: flex;
    flex-direction: column;
    padding-top: var(--section);
}

.start-text {
    display: grid;
    justify-items: start;
    gap: 1rem;
    width: 100%;
    max-width: 84rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.start-text p:not(.store-soon) {
    max-width: 38rem;
    font-size: 1.125rem;
}

.start-text .stores,
.start-text .store-soon {
    margin-top: 0.75rem;
}

/* Shown whole, edge to edge. The top of the picture is open sky, so it can tuck under the text. */
.landscape {
    width: 100%;
    margin-top: clamp(1rem, 2vw, 2rem);
}

@media (min-width: 68rem) {
    .landscape {
        margin-top: -4rem;
    }
}

/* Footer */
.site-footer {
    display: grid;
    gap: 1.75rem;
    padding: 3rem var(--gutter);
    background: var(--forest-ink);
    color: var(--linen);
    font-size: 0.9375rem;
}

.site-footer a:hover {
    color: var(--honey-light);
}

.footer-name {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 500;
    line-height: 1.2;
}

.footer-age,
.footer-owner {
    color: #d3cabd;
}

.footer-links {
    display: grid;
    gap: 0.25rem;
    list-style: none;
}

.footer-links li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25em;
    min-height: 32px;
}

/* Text pages */
.prose {
    max-width: 44rem;
    margin-inline: auto;
    padding: clamp(1.5rem, 4vw, 3.5rem) var(--gutter) var(--section);
}

.prose h1 {
    margin-top: 0.75rem;
    font-size: clamp(2.5rem, 8vw, 4rem);
    line-height: 1.05;
}

.prose h2 {
    margin-top: 3rem;
    font-size: clamp(1.625rem, 4vw, 2.125rem);
    line-height: 1.15;
}

.prose h2 + * {
    margin-top: 1rem;
}

.prose p + p,
.prose ul + p,
.prose .data-list + p {
    margin-top: 1rem;
}

.prose-meta {
    margin-top: 1rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

.prose-lead {
    margin-top: 1.5rem !important;
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-size: clamp(1.375rem, 3.4vw, 1.75rem);
    line-height: 1.28;
}

.prose ul,
.prose ol {
    display: grid;
    gap: 0.5rem;
    padding-left: 1.375rem;
}

.prose li::marker {
    color: var(--falu-red);
    font-weight: 500;
}

.prose a {
    color: var(--falu-red-dark);
}

.todo {
    padding: 0 0.3em;
    border-radius: 4px;
    background: var(--honey);
    color: var(--forest-ink);
    font-family: var(--font-ui);
    font-size: 0.875em;
}

.deletion {
    display: grid;
    gap: 1rem;
    margin-block: 1.25rem;
}

.deletion [data-step="start"] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.deletion button {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.deletion [hidden] {
    display: none;
}

.data-list {
    display: grid;
    gap: 0.875rem;
}

.data-list section {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--line);
}

.data-list h3 {
    font-family: var(--font-heading);
    font-optical-sizing: auto;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.25;
}

.data-list p {
    margin-top: 0.375rem;
}

.data-list dl {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--line);
    font-size: 0.9375rem;
}

.data-list dt {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sea-blue);
}

.data-list dd + dt {
    margin-top: 0.5rem;
}

/* Page not found */
.not-found {
    display: grid;
    justify-items: start;
    gap: 2rem;
    max-width: 44rem;
    margin-inline: auto;
    padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) var(--section);
}

.not-found img {
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--line);
    transform: rotate(-4deg);
}

.not-found h1,
.not-found h2 {
    font-size: clamp(1.875rem, 6vw, 3rem);
    line-height: 1.1;
}

.not-found p {
    margin-top: 0.75rem;
}

/* Invitation page: one address, so language and device pick what shows (see invitation.js) */
.invitation {
    display: grid;
    justify-items: start;
    gap: 2rem;
    max-width: 44rem;
    margin-inline: auto;
    padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) var(--section);
}

.invitation img {
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--line);
    transform: rotate(-4deg);
}

.invitation h1 {
    font-size: clamp(1.875rem, 6vw, 3rem);
    line-height: 1.1;
}

.invitation .lead,
.invitation-case p {
    margin-top: 1rem;
}

.invitation-case .action,
.invitation-case .store-soon {
    margin-top: 1rem;
}

html[lang="sv"] .invitation-version[lang="en"],
html[lang="en"] .invitation-version[lang="sv"],
.invitation-case {
    display: none;
}

.invitation:not([data-device]) .invitation-case[data-device="android"],
.invitation[data-device="android"] .invitation-case[data-device="android"],
.invitation[data-device="iphone"] .invitation-case[data-device="iphone"],
.invitation[data-device="computer"] .invitation-case[data-device="computer"] {
    display: block;
}

.invitation-code {
    width: min(18rem, 100%);
}

@media (min-width: 40rem) {
    .promises {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-list dl {
        grid-template-columns: 6.5rem 1fr;
        gap: 0.5rem 1rem;
    }

    .data-list dt {
        padding-top: 0.2em;
    }

    .data-list dd + dt {
        margin-top: 0;
    }
}

@media (min-width: 56rem) {
    .hero {
        grid-template-columns: 1.15fr 1fr;
        align-items: center;
    }

    /* Sized to the column now, so each sentence of the headline keeps its own line. */
    .hero h1 {
        font-size: clamp(3.25rem, 6.4vw, 5.75rem);
    }

    .day {
        grid-template-columns: repeat(3, 1fr);
    }

    .between-you-inner {
        grid-template-columns: 1.15fr 1fr;
        gap: 1.25rem clamp(2rem, 6vw, 6rem);
    }

    .between-you .eyebrow {
        grid-column: 1 / -1;
    }

    .between-you-text {
        margin-top: 0.5rem;
    }

    .site-footer {
        grid-template-columns: 1fr auto;
        padding-inline: max(var(--gutter), calc((100% - 84rem) / 2 + var(--gutter)));
    }

    .footer-owner {
        grid-column: 1 / -1;
    }
}

/* Wide enough to lay the whole hand on the table, a little askew. */
@media (min-width: 68rem) {
    .peek-cards {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
        margin-inline: 0;
        padding-inline: 0;
        overflow: visible;
    }

    .mini {
        transition: transform 300ms cubic-bezier(0.3, 0.9, 0.35, 1);
    }

    .mini:nth-child(odd) {
        transform: rotate(-1.2deg);
    }

    .mini:nth-child(even) {
        transform: rotate(1deg) translateY(0.75rem);
    }

    .mini:hover {
        transform: translateY(-0.375rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .flip-inner,
    .mini {
        transition: none;
    }
}
