/*
 * The start page for the public (home.html.twig) in the neutral look of app.css: Lexend, light grey, white, button
 * blue, without a theme. The gradient and the sparkle of the app icon (#33) mark the two large surfaces, the picture
 * in the hero and the ways in at the end. The installed app (display-mode: standalone) shows the ways in only, as
 * before (#34).
 */
.home {
    --violet: #7048e8;
    --sparkle: #ffd43b;
    --secure: #2e9e4f;
    --shaky: #f0a43a;
    --correct: #1d7a39;
    --brand-gradient: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.home-inner { width: min(1120px, 100% - 48px); margin-inline: auto; }

/* The header and footer are those of every page for the public (app.css). */
@media (prefers-reduced-motion: no-preference) {
    html:has(.home) { scroll-behavior: smooth; }
}

/* ---------- hero ---------- */
.hero {
    width: min(1120px, 100% - 48px);
    margin-inline: auto;
    padding: 56px 0 88px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;
}
.hero h1 {
    margin: 0;
    font-size: clamp(44px, 6.4vw, 76px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -.04em;
    text-wrap: balance;
}
.hero-lead { max-width: 30em; margin: 24px 0 0; font-size: clamp(18px, 1.7vw, 20px); line-height: 1.55; color: var(--muted); }
.hero-choices { margin-top: 32px; display: grid; gap: 12px; }
.hero-choice {
    padding: 20px 22px 22px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
}
.hero-choice > svg {
    grid-row: span 2;
    width: 44px;
    height: 44px;
    padding: 10px;
    border-radius: 12px;
    background: var(--accent-background);
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.hero-choice p { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.hero-choice .hero-choice-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.hero-choice .button { grid-column: 2; justify-self: start; min-height: 48px; margin-top: 14px; padding: 10px 20px; font-size: 16px; }
.hero-choice .button-secondary { background: var(--accent-background); border-color: transparent; }

.hero-picture {
    position: relative;
    aspect-ratio: 1 / 1;
    width: min(100%, 540px);
    justify-self: center;
    display: grid;
    place-items: center;
    border-radius: 44px;
    background: var(--brand-gradient);
}
.hero-sparkle { position: absolute; top: 8%; right: 8%; width: 11%; fill: var(--sparkle); }

.hero-screen {
    width: 76%;
    padding: 22px 24px 24px;
    border-radius: 26px;
    background: var(--card);
    box-shadow: 0 32px 64px -24px rgba(24, 22, 74, .55);
}
.hero-screen-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.hero-progress { height: 6px; margin: 10px 0 30px; border-radius: 3px; background: var(--line); overflow: hidden; }
.hero-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hero-word {
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
}
.hero-speaker { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); }
.hero-speaker svg { width: 22px; height: 22px; }
/* On the start page the speaker plays «la gomme» (speaker_controller.js). */
button.hero-speaker { padding: 0; background: var(--card); font: inherit; cursor: pointer; transition: transform .1s; }
button.hero-speaker:hover { border-color: var(--accent); background: var(--accent-background); }
button.hero-speaker:active { transform: scale(.92); }
button.hero-speaker:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hero-answer {
    margin: 0;
    min-height: 58px;
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 2px solid var(--secure);
    border-radius: 14px;
    background: #f0f8f2;
    font-size: clamp(18px, 1.8vw, 21px);
}
.hero-answer-text { white-space: nowrap; overflow: hidden; }
.hero-answer-check { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--secure); color: #fff; }
.hero-answer-check svg { width: 18px; height: 18px; stroke-width: 3; }
.hero-verdict { margin: 14px 0 0; font-size: 18px; font-weight: 700; color: var(--correct); }

.hero-state {
    position: absolute;
    left: -28px;
    bottom: 40px;
    width: 220px;
    padding: 14px 16px 16px;
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 20px 44px -18px rgba(24, 22, 74, .45);
}
.hero-state p { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.hero-state b { font-size: 17px; color: var(--ink); }

/* The learning state as in the app: secure, shaky, new. */
.learning-segments { display: flex; gap: 2px; height: 12px; overflow: hidden; background: var(--ink); border: 1.5px solid var(--ink); border-radius: 6px; }
.learning-segments > i { display: block; min-width: 0; }
.learning-segments > .secure, .dot.secure { background: var(--secure); }
.learning-segments > .shaky, .dot.shaky { background: var(--shaky); }
.learning-segments > .new { background: var(--card); }
.dot { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 50%; }
.dot.new { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* The one moment of motion: the answer is typed, then it is right. */
@media (prefers-reduced-motion: no-preference) {
    .hero-answer-text { animation: hero-type 1s steps(15, end) .6s both; }
    .hero-answer { animation: hero-right .25s ease-out 1.75s both; }
    :is(.hero-answer-check, .hero-verdict) { animation: hero-pop .4s cubic-bezier(.2, .9, .3, 1.4) 1.75s both; }
}
@keyframes hero-type { from { max-width: 0; } to { max-width: 100%; } }
@keyframes hero-right { from { border-color: var(--line); background: var(--card); } }
@keyframes hero-pop { from { opacity: 0; transform: scale(.5); } }

/* ---------- how a child learns ---------- */
.home-band { padding: 96px 0; background: var(--card); border-block: 1px solid var(--line); }
.home h2 {
    max-width: 18em;
    margin: 0 0 48px;
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.03em;
    text-wrap: balance;
}
.home h3 { margin: 0 0 8px; font-size: 21px; font-weight: 700; line-height: 1.25; }
.home :is(.step, .facts) p { margin: 0; color: var(--muted); }

.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 48px; counter-reset: step; }
.step { counter-increment: step; }
.step h3 { display: flex; align-items: center; gap: 10px; }
.step h3::before {
    content: counter(step);
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
}
.step-picture {
    position: relative;
    height: 220px;
    margin-bottom: 24px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 24px;
    background: var(--accent-background);
}

/* 1: a page of the book, three word pairs read, in the frame of the camera. */
.mini-page {
    width: 56%;
    padding: 16px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 10px 24px -12px rgba(24, 22, 74, .35);
    transform: rotate(-3deg);
}
.mini-page > span { display: flex; justify-content: space-between; gap: 10px; padding: 3px 4px; border-radius: 4px; }
.mini-page > span > i { display: block; height: 7px; border-radius: 4px; background: #d6d9e0; }
.mini-page > .is-read { background: var(--accent-background); }
.mini-page > .is-read > i { background: var(--accent); opacity: .55; }
.mini-page-title { width: 46%; height: 10px; margin-bottom: 4px; background: var(--ink); opacity: .75; }
.mini-frame {
    --corner: var(--accent);
    position: absolute;
    inset: 26px 18%;
    background:
        linear-gradient(var(--corner) 0 0) top left / 24px 4px,
        linear-gradient(var(--corner) 0 0) top left / 4px 24px,
        linear-gradient(var(--corner) 0 0) top right / 24px 4px,
        linear-gradient(var(--corner) 0 0) top right / 4px 24px,
        linear-gradient(var(--corner) 0 0) bottom left / 24px 4px,
        linear-gradient(var(--corner) 0 0) bottom left / 4px 24px,
        linear-gradient(var(--corner) 0 0) bottom right / 24px 4px,
        linear-gradient(var(--corner) 0 0) bottom right / 4px 24px;
    background-repeat: no-repeat;
}

/* 2: a learning package before the Voci-Test, practice or mock test. */
.mini-modes { width: 78%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home .mini-modes p { grid-column: 1 / -1; margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--ink); }
.mini-modes span {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    font-size: 13px;
    color: var(--muted);
}
.mini-modes b { font-size: 18px; color: var(--ink); }
.mini-modes .is-on { border: 2px solid var(--accent); }
.mini-modes .is-on b { color: var(--accent); }

/* 3: the learning state of every word. */
.mini-state {
    width: 76%;
    padding: 16px 16px 8px;
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 10px 24px -12px rgba(24, 22, 74, .35);
}
.mini-state .learning-segments { height: 10px; margin-bottom: 6px; }
.mini-state > span {
    padding: 8px 0;
    display: grid;
    grid-template-columns: 11px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--muted);
}
.mini-state > span + span { border-top: 1px solid var(--line); }
.mini-state b { color: var(--ink); }

/* ---------- for families ---------- */
.home-facts { padding: 96px 0 24px; }
.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.facts li { padding: 24px 0; display: grid; grid-template-columns: 48px 1fr; align-items: start; gap: 20px; border-top: 1px solid var(--line); }
.facts li:last-child { border-bottom: 1px solid var(--line); }
.facts svg {
    width: 48px;
    height: 48px;
    padding: 11px;
    border-radius: 14px;
    background: var(--accent-background);
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- the ways in ---------- */
.welcome {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: max(48px, env(safe-area-inset-top)) 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}
.welcome-icon { width: 112px; height: 112px; box-shadow: 0 6px 20px rgba(47, 91, 211, .25); }
.home .welcome-title { max-width: none; margin: 4px 0 0; font-size: 44px; letter-spacing: 0; }
.welcome-lead { margin: 0 0 8px; color: var(--muted); }

.ways-in { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.way-in {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
}
.way-in[href] { cursor: pointer; }
.way-in[href]:hover { border-color: var(--accent); }
.way-in strong { font-weight: 700; }
.way-in span { color: var(--muted); font-size: 15px; }
.way-in-primary { border: 2px solid var(--accent); }

/* The installed app keeps its own cookies (iPadOS), so «Anmelden» comes first there (#34, story 22). */
.way-in-app-only { display: none; }
@media (display-mode: standalone) {
    .way-in-app-only { display: flex; border: 2px solid var(--accent); }
    .way-in-browser-only { display: none; }
    .way-in-primary { border: 1px solid var(--line); }
    .public-only { display: none; }
}

/* In the browser the ways in close the page, on the gradient of the app icon. */
@media (display-mode: browser) {
    .welcome {
        width: min(1120px, 100% - 48px);
        margin: 72px auto 48px;
        padding: 72px 24px 80px;
        border-radius: 44px;
        background: var(--brand-gradient);
        color: #fff;
    }
    .welcome > :not(.ways-in) { max-width: 472px; }
    .welcome-icon { width: 88px; height: 88px; box-shadow: 0 10px 30px rgba(24, 22, 74, .35); }
    .welcome-title .wordmark, .welcome-title .wordmark b { color: #fff; }
    .welcome-lead { color: rgba(255, 255, 255, .85); font-size: 19px; }
    .ways-in { width: min(472px, 100%); }
    .way-in { border-color: transparent; }
    .way-in-primary { border: 2px solid var(--sparkle); }
    .welcome a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
}

@media (min-width: 600px) and (max-width: 899px) {
    /* Picture and text side by side, the text around the middle of the picture. */
    .step { display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: 1fr 1fr; column-gap: 32px; }
    .step-picture { grid-row: span 2; margin: 0; }
    .step h3 { align-self: end; }
    .step p { align-self: start; }
}

@media (min-width: 900px) {
    .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
    .home-facts .home-inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
    .home-facts h2 { margin: 0; }
}

@media (min-width: 960px) {
    .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 64px; padding: 72px 0 112px; }
    .hero-picture { width: 100%; }
}

@media (max-width: 599px) {
    .hero { padding: 40px 0 72px; gap: 48px; }
    .hero-choice { padding: 18px; column-gap: 14px; }
    .hero-choice .button { grid-column: 1 / -1; justify-self: stretch; text-align: center; }
    .hero-screen { width: 84%; padding: 18px 18px 20px; }
    .hero-progress { margin-bottom: 22px; }
    .hero-answer { padding-left: 14px; font-size: clamp(15px, 4.6vw, 18px); }
    .hero-state { left: 12px; bottom: -28px; width: 190px; }
    .hero-picture { margin-bottom: 28px; border-radius: 32px; }
    .hero-sparkle { top: 3.5%; right: 4.5%; width: 8%; }
    .home-band { padding: 72px 0; }
    .home-facts { padding-top: 72px; }
    .welcome { border-radius: 32px; }
}

/* ---------- error pages (error/_layout.html.twig): the hero of the start page, a word to learn as the picture ---------- */
.error-hero { padding-bottom: 96px; }
.error-hero h1 { font-size: clamp(36px, 4.8vw, 58px); -webkit-hyphens: auto; hyphens: auto; }
.error-code { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--accent); }
.error-actions { margin-top: 32px; }
.error-actions .button { min-height: 56px; padding: 14px 28px; }
