/* ==========================================================================
   Moratti Scooter Trikes - User Manual
   Design system: Swiss-influenced minimalism. Single red accent on a
   near-black / white neutral base. 8px spacing rhythm.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand */
    --red: #e2231a;
    --red-dark: #b8180f;
    --red-50: #fdecea;
    --red-100: #fbd5d1;

    /* Neutrals */
    --ink: #14141a;
    --ink-800: #24242c;
    --ink-600: #55555f;
    --ink-400: #86868f;
    --line: #e6e6eb;
    --line-strong: #d3d3da;
    --surface: #ffffff;
    --surface-alt: #f7f7f9;
    --surface-sunken: #efeff2;

    /* Legacy aliases kept so nothing else has to change */
    --black: var(--ink);
    --gray-900: var(--ink-800);
    --gray-600: var(--ink-600);
    --gray-300: var(--line-strong);
    --gray-100: var(--surface-alt);
    --white: var(--surface);

    /* Scale */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --max-width: 900px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(20, 20, 26, 0.06), 0 1px 1px rgba(20, 20, 26, 0.04);
    --shadow-md: 0 10px 24px -8px rgba(20, 20, 26, 0.16), 0 2px 6px rgba(20, 20, 26, 0.06);
    --shadow-lg: 0 20px 45px -12px rgba(20, 20, 26, 0.28);
    --shadow: var(--shadow-md);

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --fast: 160ms;
    --base: 220ms;

    /* z-index scale: topbar 50 < dropdown 55 < fab 60 */
    font-size: 16px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC',
        'Microsoft YaHei', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink-800);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
svg { display: block; }

::selection { background: var(--red); color: var(--white); }

a, button {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2.5px solid var(--red);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Anchor targets should not hide under the sticky topbar + toc bar */
.section, #contact { scroll-margin-top: 104px; }
@media (min-width: 960px) { .section, #contact { scroll-margin-top: 80px; } }

/* ---------- Topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-logo { display: flex; align-items: center; }
.topbar-logo img { height: 35px; width: auto; }

.topbar-unit {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--ink-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}
.topbar-unit strong { color: var(--ink); font-weight: 700; }

.lang-switch {
    position: relative;
    margin-left: auto;
}
.topbar-unit + .lang-switch { margin-left: 12px; }

.lang-switch-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.84rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink-800);
    transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.lang-switch-btn:hover { background: var(--surface-sunken); border-color: var(--line-strong); }
.lang-switch-btn svg { transition: transform var(--fast) var(--ease); color: var(--ink-400); }
.lang-switch-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.lang-switch-code { letter-spacing: 0.02em; }

.flag-icon {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(20, 20, 26, 0.12);
}
.lang-switch-menu a .flag-icon { width: 22px; height: 15px; }

.lang-switch-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    list-style: none;
    margin: 0;
    padding: 6px;
    min-width: 200px;
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 55;
}
.lang-switch-menu.is-open {
    display: block;
    animation: menu-in var(--fast) var(--ease);
}
@keyframes menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-switch-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-800);
    transition: background var(--fast) var(--ease);
}
.lang-switch-menu a:hover { background: var(--surface-alt); }
.lang-switch-menu a.is-active { background: var(--red); color: var(--white); font-weight: 600; }

/* ---------- Cover page ---------- */

.cover-hero {
    background:
        radial-gradient(ellipse 80% 60% at 70% 0%, rgba(226, 35, 26, 0.18), transparent 60%),
        linear-gradient(150deg, var(--ink) 0%, #26262e 100%);
    display: flex;
    justify-content: center;
    padding: 32px 16px 0;
}
.cover-hero-img {
    max-width: 420px;
    width: 100%;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.35));
}

.cover-content {
    max-width: 580px;
    margin: 0 auto;
    padding: 36px 20px 64px;
    text-align: center;
}

.cover-brand {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-600);
    margin: 0 0 10px;
}

.cover-title {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    color: var(--ink);
    font-weight: 800;
}
.cover-title::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    background: var(--red);
    border-radius: 999px;
    margin: 18px auto 0;
}

.cover-subtitle {
    color: var(--ink-600);
    margin: 0 0 28px;
    font-size: 1.02rem;
    line-height: 1.6;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
    border-radius: 999px;
    padding: 15px 34px;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn-primary {
    background: var(--red);
    color: var(--white);
    box-shadow: 0 10px 24px -6px rgba(226, 35, 26, 0.45);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-2px); box-shadow: 0 14px 28px -6px rgba(226, 35, 26, 0.5); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 6px 14px -4px rgba(226, 35, 26, 0.4); }

.cover-cta { margin-bottom: 32px; }

.cover-languages-note {
    font-size: 0.8rem;
    color: var(--ink-400);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin: 0 0 16px;
}

.cover-lang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 480px) {
    .cover-lang-grid { grid-template-columns: repeat(3, 1fr); }
}

.cover-lang-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 10px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-800);
    background: var(--surface);
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cover-lang-pill:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.cover-lang-pill.is-active { border-color: var(--red); background: var(--red-50); color: var(--red-dark); }
.cover-lang-flag { display: flex; align-items: center; }

/* ---------- Table of contents ---------- */

.toc {
    position: sticky;
    top: 51px;
    z-index: 40;
    background: var(--ink);
    overflow-x: auto;
    scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }

.toc-inner {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    max-width: var(--max-width);
    margin: 0 auto;
    white-space: nowrap;
}
.toc a {
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.toc a:hover { background: rgba(255, 255, 255, 0.14); color: var(--white); }
.toc a.is-current { background: var(--red); color: var(--white); }

/* ---------- Manual layout ---------- */

.manual { max-width: var(--max-width); margin: 0 auto; padding-bottom: 48px; }

/* On wide screens the table of contents becomes a fixed left sidebar,
   like a typical documentation site, instead of the mobile horizontal bar. */
@media (min-width: 960px) {
    .manual-shell {
        display: flex;
        align-items: flex-start;
        max-width: 1220px;
        margin: 0 auto;
    }

    .toc {
        position: sticky;
        top: 61px;
        width: 256px;
        flex-shrink: 0;
        max-height: calc(100vh - 61px);
        overflow-y: auto;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }
    .toc-inner {
        flex-direction: column;
        align-items: stretch;
        white-space: normal;
        max-width: none;
        margin: 0;
        padding: 28px 16px;
        gap: 2px;
    }
    .toc a {
        text-align: left;
        border-radius: 8px;
        padding: 10px 14px;
        position: relative;
    }
    .toc a.is-current { background: rgba(226, 35, 26, 0.16); color: var(--white); }
    .toc a.is-current::before {
        content: '';
        position: absolute;
        left: -16px;
        top: 8px;
        bottom: 8px;
        width: 3px;
        background: var(--red);
        border-radius: 0 3px 3px 0;
    }

    .manual { flex: 1; min-width: 0; max-width: none; margin: 0; padding: 0 48px; }
}

.manual-hero {
    text-align: center;
    padding: 40px 20px 16px;
}
.manual-hero-brand {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--ink-400);
    margin: 0 0 6px;
}
.manual-hero-title {
    font-size: clamp(1.35rem, 3vw, 1.7rem);
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink);
    font-weight: 700;
}
.manual-hero-unit {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: var(--red-dark);
    font-weight: 600;
}

.section { padding: 44px 20px; border-top: 1px solid var(--line); }
.section-alt { background: var(--surface-alt); }
.section-dark {
    background: var(--ink);
    color: var(--white);
    border-top-color: var(--ink);
}
.section-dark .section-intro { color: rgba(255, 255, 255, 0.82); }

.section-title {
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 1.36rem;
    letter-spacing: -0.01em;
    font-weight: 700;
    margin: 0 0 18px;
}
.section-title-badge {
    background: var(--red);
    color: var(--white);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 5px 10px;
    border-radius: 7px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.subsection-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 26px 0 12px;
    color: var(--red-dark);
}

.section-photo {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.section-intro { line-height: 1.65; color: var(--ink-800); margin: 0 0 18px; }
.section-intro.highlight { font-weight: 700; color: var(--red-dark); }

.numbered-list {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.numbered-list li { line-height: 1.65; }
.numbered-list li::marker { color: var(--red); font-weight: 700; }

/* ---------- Card base ---------- */

.accessory-card,
.control-item,
.knob-item,
.note-card,
.step-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--base) var(--ease), transform var(--base) var(--ease), border-color var(--base) var(--ease);
}
@media (hover: hover) {
    .accessory-card:hover,
    .control-item:hover,
    .knob-item:hover,
    .note-card:hover,
    .step-item:hover {
        box-shadow: var(--shadow-md);
        border-color: var(--line-strong);
        transform: translateY(-2px);
    }
}

/* ---------- Accessories ---------- */

.accessory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.accessory-card { text-align: center; padding: 14px; }
.accessory-card img {
    border-radius: var(--radius-sm);
    margin: 0 auto 12px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}
.accessory-card p { font-size: 0.82rem; font-weight: 600; margin: 0; line-height: 1.4; }

/* ---------- Controls ---------- */

.control-list { display: flex; flex-direction: column; gap: 12px; }
.control-item { display: flex; gap: 15px; align-items: flex-start; padding: 16px; }
.control-no {
    background: var(--red);
    color: var(--white);
    font-weight: 800;
    font-size: 0.85rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.control-label { font-weight: 700; margin: 0 0 4px; }
.control-desc { margin: 0; color: var(--ink-600); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Transmission ---------- */

.transmission-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.transmission-grid img {
    border-radius: var(--radius);
    aspect-ratio: 3/4;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}
.transmission-labels {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}
.transmission-labels p {
    margin: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-alt);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
}
.transmission-labels .arrow {
    color: var(--red);
    font-size: 1.2rem;
    font-weight: 900;
}

/* ---------- Dashboard icons ---------- */

.icon-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px 20px;
}
@media (min-width: 620px) {
    .icon-grid { grid-template-columns: 1fr 1fr; }
}
.icon-item { display: flex; gap: 13px; align-items: flex-start; }
.icon-glyph {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    color: var(--ink-800);
}
.icon-glyph svg { width: 22px; height: 22px; }
.icon-text { font-weight: 800; font-size: 0.86rem; letter-spacing: 0.01em; }
.icon-display { font-weight: 700; font-size: 0.66rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.icon-green { background: #e5f7ea; color: #16833f; }
.icon-amber { background: #fff2d9; color: #a86300; }
.icon-blue { background: #e4edfd; color: #1c4fd1; }
.icon-red { background: #fde5e3; color: var(--red-dark); }
.icon-plain { background: var(--surface-alt); color: var(--ink-800); }

.icon-title { font-weight: 700; margin: 0 0 3px; font-size: 0.93rem; }
.icon-desc { margin: 0; color: var(--ink-600); font-size: 0.85rem; line-height: 1.5; }

/* ---------- Knob ---------- */

.knob-photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.knob-photos img { border-radius: var(--radius); aspect-ratio: 1; object-fit: cover; box-shadow: var(--shadow-sm); }

.knob-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 560px) {
    .knob-grid { grid-template-columns: 1fr 1fr; }
}
.knob-item { padding: 16px; }
.knob-label {
    margin: 0 0 7px;
    font-weight: 800;
    color: var(--red-dark);
    font-size: 0.83rem;
    letter-spacing: 0.04em;
}
.knob-desc { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink-800); }

/* ---------- Engine start steps ---------- */

.step-list { display: flex; flex-direction: column; gap: 22px; }
.step-item { overflow: hidden; }
.step-item img { width: 100%; max-height: 220px; object-fit: cover; }
.step-body { padding: 18px 18px 20px; position: relative; }
.step-no {
    position: absolute;
    top: -22px;
    right: 18px;
    background: var(--red);
    color: var(--white);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border: 4px solid var(--surface);
    box-shadow: var(--shadow-sm);
    font-variant-numeric: tabular-nums;
}
.step-title { font-weight: 800; margin: 0 0 6px; color: var(--red-dark); }
.step-desc { margin: 0; line-height: 1.55; }

/* ---------- Safety tips ---------- */

.tips-grid { display: flex; flex-direction: column; gap: 20px; }
.tips-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tips-photos img { border-radius: var(--radius); aspect-ratio: 3/4; object-fit: cover; box-shadow: var(--shadow-sm); }

/* ---------- Notes ---------- */

.notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 560px) {
    .notes-grid { grid-template-columns: 1fr 1fr; }
}
.note-card { padding: 18px; }
.note-card h3 { margin: 0 0 9px; font-size: 1rem; font-weight: 700; color: var(--red-dark); }
.note-card p { margin: 0 0 5px; font-size: 0.9rem; line-height: 1.55; }
.note-card ul { margin: 0; padding-left: 18px; font-size: 0.9rem; line-height: 1.6; }
.note-card ul li::marker { color: var(--red); }
.note-card-emergency { background: var(--ink); color: var(--white); border-color: var(--ink); }
.note-card-emergency h3 { color: #ff9d97; }
.note-card-emergency a { color: var(--white); font-weight: 700; text-decoration-color: rgba(255, 255, 255, 0.4); }
.note-quote { font-style: italic; opacity: 0.85; margin-top: 10px !important; }

/* ---------- Back to top ---------- */

.back-to-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    color: var(--ink-600);
    padding: 10px 18px;
    margin: 32px auto 8px;
    font-size: 0.88rem;
    border-radius: 999px;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.manual > .back-to-top { display: flex; width: fit-content; }
.back-to-top:hover { background: var(--surface-alt); color: var(--ink); }

/* ---------- Footer ---------- */

.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, 0.72);
    padding: 40px 20px 96px;
    text-align: center;
}
.site-footer-inner { max-width: var(--max-width); margin: 0 auto; }
.site-footer-logo-chip {
    display: inline-block;
    background: var(--white);
    border-radius: 8px;
    padding: 6px 12px;
    margin: 0 auto 16px;
}
.site-footer-logo { height: 22px; margin: 0; }
.site-footer-tagline { margin: 0 0 8px; font-size: 0.92rem; }
.site-footer-rights, .site-footer-url { margin: 3px 0; font-size: 0.78rem; opacity: 0.65; }

/* ---------- Emergency floating button ---------- */

.emergency-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    background: var(--red);
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.emergency-fab:hover { background: var(--red-dark); transform: translateY(-2px); }
.emergency-fab:active { transform: translateY(0); }

/* ---------- Utility ---------- */

@media (min-width: 720px) {
    .section { padding: 56px 36px; }
}
