/*
 * The guide (guide.hugo*.zenep.eu). Every colour comes from the CSS variables the page
 * sets from the visitor's brand (App\Guide\GuideTheme::cssVariables), the same colours
 * the app paints with: --brand fills, --readable text accents, --secondary tiles and
 * cards, --chrome the bottom menu, --background the page.
 */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--background);
    color: #1d1b20;
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img { max-width: 100%; }
a { color: var(--readable); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 8px 16px 48px;
}

/* ---- top bar ---- */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--on-background);
    text-decoration: none;
    min-width: 0;
}
.brand .logo { height: 34px; width: auto; max-width: 160px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text small { opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--chrome);
    color: var(--on-chrome);
    font-weight: 700;
    flex: none;
}
.top-nav { display: flex; gap: 4px; }
.top-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--on-background);
    text-decoration: none;
    font-weight: 600;
}
.top-nav a.active { background: var(--secondary); color: var(--on-secondary); }

.devbar {
    background: #fff3cd;
    color: #5c4400;
    text-align: center;
    font-size: .875rem;
    padding: 6px 16px;
}

/* ---- index ---- */
.hero {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 16px 0 24px;
}
.hero-art { width: 200px; height: auto; flex: none; }
.lead { font-size: 1.1rem; margin: 0 0 .5em; color: color-mix(in srgb, var(--on-background) 75%, transparent); }

.news-teaser {
    background: var(--secondary);
    color: var(--on-secondary);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 28px;
}
.news-teaser h2 { font-size: 1.05rem; }
.news-teaser ul { list-style: none; margin: 0 0 8px; padding: 0; }
.news-teaser li { padding: 4px 0; }
.news-teaser li a { color: inherit; text-decoration: none; }
.news-teaser time { font-weight: 600; margin-right: 6px; }
.news-teaser .more { color: var(--readable); font-weight: 600; text-decoration: none; }

.section { margin: 28px 0; }
.section > h2 { margin-bottom: 12px; }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 12px;
}
.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 16px 14px;
    border-radius: 16px;
    background: var(--secondary);
    color: var(--on-secondary);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.tile img { width: 96px; height: 96px; object-fit: contain; }
.tile strong { font-size: 1.05rem; }
.tile .summary { font-size: .9rem; opacity: .8; }
.tile.off { opacity: .55; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 4px 0 0; }
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    vertical-align: middle;
    background: #fff;
    color: #1d1b20;
}
.badge.new { background: var(--brand); color: var(--on-brand); }
.badge.upcoming { background: #fff3cd; color: #5c4400; }
.badge.sales { background: #e3f2e1; color: #1e4620; }
.badge.off { background: rgba(0, 0, 0, .08); color: inherit; }

/* ---- feature page ---- */
.back {
    display: inline-block;
    margin: 4px 0 12px;
    color: var(--readable);
    font-weight: 600;
    text-decoration: none;
}
.page-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.page-art { width: 112px; height: 112px; object-fit: contain; flex: none; }
.page-head .badges { justify-content: flex-start; }
.note {
    background: var(--secondary);
    color: var(--on-secondary);
    border-left: 4px solid var(--readable);
    border-radius: 8px;
    padding: 12px 16px;
}
.prose p { margin: 0 0 .7em; }
.prose ul, .prose ol { margin: 0 0 .7em; padding-left: 1.3em; }
.prose li { margin: .2em 0; }
.prose strong { font-weight: 700; }
.prose :last-child { margin-bottom: 0; }
.intro { margin-bottom: 20px; max-width: 70ch; }

.walk {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .07);
    padding: 16px 20px 20px;
    margin: 8px 0 28px;
}
.walk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: .9rem;
    color: #5f5b66;
}
.walk-count { font-weight: 600; }
.link-button {
    background: none;
    border: 0;
    padding: 4px 0;
    color: var(--readable);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.steps { list-style: none; margin: 0; padding: 0; }
.step {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 32px;
    padding: 16px 0;
    border-top: 1px solid rgba(0, 0, 0, .07);
    scroll-margin-top: 16px;
}
.step:first-child { border-top: 0; }
.step-text { flex: 1 1 300px; min-width: 0; max-width: 62ch; }
.step-no {
    margin: 0 0 4px;
    color: var(--readable);
    font-weight: 700;
    font-size: .8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* One step at a time once the script runs; every step stays in the page without it. */
.walk.js-one .step { display: none; border-top: 0; }
.walk.js-one .step.current { display: flex; animation: step-in .25s ease; }
@keyframes step-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.walk-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.walk-nav[hidden] { display: none; }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .15);
    cursor: pointer;
}
.dots button[aria-current="step"] { background: var(--brand); width: 24px; border-radius: 6px; }
.button {
    border: 0;
    border-radius: 999px;
    padding: 10px 20px;
    background: var(--brand);
    color: var(--on-brand);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    min-width: 96px;
}
.button.ghost { background: var(--secondary); color: var(--on-secondary); }
.button:disabled { opacity: .35; cursor: default; }

/* ---- the phone picture ---- */
.phone {
    flex: none;
    width: 240px;
    margin: 0 auto;
    padding: 10px;
    border-radius: 34px;
    background: #1d1b20;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.phone-screen {
    display: flex;
    flex-direction: column;
    height: 440px;
    border-radius: 26px;
    overflow: hidden;
    background: var(--background);
    color: var(--on-background);
}
.phone-top { display: flex; align-items: center; gap: 8px; padding: 18px 12px 8px; font-size: .8rem; font-weight: 700; }
.phone-top .avatar { width: 26px; height: 26px; font-size: .75rem; }
.phone-company { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
    gap: 8px;
    padding: 6px 12px 12px;
}
.phone-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    border-radius: 12px;
    padding: 6px;
    background: var(--secondary);
    color: var(--on-secondary);
    font: inherit;
    font-size: .68rem;
    font-weight: 700;
    min-height: 0;
    overflow: hidden;
}
.phone-tile img { width: 100%; height: 0; flex: 1; object-fit: contain; }
.phone-tile > span:not(.tap) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.phone-tile.target {
    cursor: pointer;
    outline: 3px solid var(--readable);
    outline-offset: -3px;
    animation: pulse 1.6s ease-in-out infinite;
}
.phone-tile .tap {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: .62rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--readable) 45%, transparent); }
    50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--readable) 0%, transparent); }
}
.phone-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--chrome);
    color: var(--on-chrome);
    padding: 6px 4px 10px;
    font-size: .55rem;
    font-weight: 600;
}
.phone-nav span { display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: .8; }
.phone-nav span.active { opacity: 1; }
.phone-nav svg { width: 20px; height: 20px; fill: currentColor; padding: 2px 10px; box-sizing: content-box; border-radius: 999px; }
.phone-nav span.active svg { background: color-mix(in srgb, var(--on-chrome) 18%, transparent); }

/* ---- changelog ---- */
.changes { margin: 28px 0; }
.entry { padding: 14px 0; border-top: 1px solid rgba(0, 0, 0, .08); }
.entry.card {
    border: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    padding: 16px 20px;
    margin: 0 0 14px;
    scroll-margin-top: 16px;
}
.entry time { display: block; font-size: .85rem; font-weight: 600; color: #5f5b66; margin-bottom: 2px; }
.entry:target { outline: 3px solid var(--readable); }
.see-how { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 10px 0 0; font-size: .95rem; }
.see-how span { font-weight: 600; }
.see-how a {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--on-secondary);
    text-decoration: none;
    font-weight: 600;
}

/* ---- footer ---- */
.foot {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: .9rem;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.foot a { color: var(--on-background); opacity: .7; text-decoration: none; }
.foot a.active { opacity: 1; font-weight: 700; text-decoration: underline; }
.brands span { opacity: .7; }

@media (max-width: 600px) {
    .hero { flex-direction: column; align-items: flex-start; gap: 8px; }
    .hero-art { width: 150px; }
    .page-head { align-items: flex-start; }
    .page-art { width: 72px; height: 72px; }
    .walk { padding: 12px 14px 16px; margin-left: -4px; margin-right: -4px; }
    .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .tile { padding: 12px 8px; }
    .tile img { width: 72px; height: 72px; }
    .tile .summary { display: none; }
    .button { min-width: 0; padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- the real app beside the steps (docs/guide-app-contract.md) ---- */
.walk.with-app .walk-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px 36px;
    align-items: start;
}
.walk-app { position: sticky; top: 16px; }
/* The drawn Services tab gives way to the real app, and comes back if it never arrives. */
.walk.with-app .step .phone { display: none; }
.walk.with-app.app-failed .step .phone { display: block; }

/* The app renders at a real phone's width (390 px) and is scaled to 70%. */
.app-phone { width: 293px; }
.app-phone .phone-screen { position: relative; width: 273px; height: 546px; }
.app-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 390px;
    height: 780px;
    border: 0;
    transform: scale(.7);
    transform-origin: top left;
    background: var(--background);
}

.app-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--background);
    transition: opacity .35s ease;
}
.walk.app-ready .app-loader { opacity: 0; pointer-events: none; }
.sk-top { display: flex; align-items: center; gap: 8px; padding: 20px 14px 10px; }
.sk-top .avatar { width: 28px; height: 28px; font-size: .8rem; }
.sk-bar { height: 10px; width: 45%; border-radius: 5px; background: var(--secondary); }
.sk-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
    gap: 10px;
    padding: 6px 14px 14px;
    min-height: 0;
}
.sk-tile {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: var(--secondary);
}
.sk-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    animation: shimmer 1.6s ease-in-out infinite;
}
.sk-tile:nth-child(2n)::after { animation-delay: .2s; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px 18px 16px;
    background: var(--chrome);
}
.sk-nav span { height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--on-chrome) 22%, transparent); }

.app-loader-note {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    color: #1d1b20;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
    font-size: .82rem;
    text-align: center;
}
.app-dots { display: inline-flex; gap: 5px; }
.app-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    animation: dot 1.2s ease-in-out infinite;
}
.app-dots i:nth-child(2) { animation-delay: .15s; }
.app-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-6px); opacity: 1; } }
.app-progress { display: block; width: 100%; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .08); overflow: hidden; }
.app-progress[hidden] { display: none; }
.app-progress span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--brand); transition: width .5s ease; }
.app-loader-note .button { padding: 8px 18px; min-width: 0; }
.app-loader-note .button[hidden], .app-dots[hidden] { display: none; }

@media (max-width: 760px) {
    .walk.with-app .walk-body { grid-template-columns: 1fr; }
    .walk-app { position: static; display: flex; justify-content: center; }
}

/* An address on the visitor's own website ({{site:…}}), or an example when it isn't known. */
.site-link {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .92em;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--secondary);
    color: var(--on-secondary);
    word-break: break-all;
}
a.site-link { color: var(--readable); text-decoration: underline; text-underline-offset: 2px; }
.site-link.example { font-style: italic; }
