/* INCA:s framsida och presentation (public/home.html, public/js/home.js).
   Ljust INCA-tema som adminsidan: blått för rubriker och ramar, orange för
   handling, svart text på vitt. Varje modul är en "bild" (.slide) som fyller
   skärmen; body.presenting = helskärm med bläddring och INCA-hjälmen. */

:root {
    --blue: #015e9f;
    --blue-deep: #01487a;
    --orange: #f0833d;
    --orange-dark: #d9722e;
    --ink: #000000;
    --text: #1a1a1a;
    --muted: #555a61;
    --dim: #8a9099;
    --bg: #f0f2f5;
    --card: #ffffff;
    --border: #d8dbe0;
    --shadow: 0 18px 50px rgba(1, 40, 70, 0.18), 0 2px 8px rgba(1, 40, 70, 0.08);
    --top-h: 64px;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-snap-type: y proximity; scroll-padding-top: 0; -webkit-text-size-adjust: 100%; }
body.presenting { overflow: hidden auto; }
html:has(body.presenting) { scroll-snap-type: y mandatory; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.ic { display: inline-flex; width: 1.2em; height: 1.2em; flex-shrink: 0; }
.ic svg { width: 100%; height: 100%; }

/* ── Topprad ─────────────────────────────────────────────────────────── */
.topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--top-h);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 max(20px, 4vw);
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid rgba(1, 94, 159, 0.12);
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { font-weight: 900; font-size: 24px; letter-spacing: 0.08em; color: var(--blue); }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
    border-radius: 8px; border: 1.5px solid var(--border); background: #fff; color: var(--ink);
    font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.top-btn:hover { border-color: var(--blue); color: var(--blue); }
.top-btn .ic { width: 16px; height: 16px; }
.top-login { background: var(--blue); border-color: var(--blue); color: #fff; }
.top-login:hover { background: var(--blue-deep); color: #fff; }
.top-present { border-color: var(--orange); color: var(--ink); }
.top-exit { display: none; }
body.presenting .top-exit { display: inline-flex; }
body.presenting .top-present, body.presenting .top-login, body.presenting .top-btn:first-child { display: none; }

.progress { position: fixed; top: var(--top-h); left: 0; right: 0; height: 3px; z-index: 31; pointer-events: none; }
.progress-bar { height: 100%; background: var(--orange); transform-origin: left center; transform: scaleX(0); transition: transform 0.35s ease; }

/* ── Prickar och bläddring ───────────────────────────────────────────── */
.dots {
    position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 25;
    display: flex; flex-direction: column; gap: 10px;
}
.dot {
    width: 12px; height: 12px; padding: 0; border-radius: 6px; border: 2px solid var(--blue);
    background: #fff; cursor: pointer; transition: height 0.25s ease, background 0.25s ease;
}
.dot[aria-current="true"] { height: 30px; background: var(--orange); border-color: var(--orange); }
.pager {
    position: fixed; right: 16px; bottom: 16px; z-index: 25; display: flex; align-items: center; gap: 6px;
    background: rgba(255, 255, 255, 0.94); border: 1px solid var(--border); border-radius: 12px; padding: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.pager-btn {
    width: 40px; height: 40px; border: none; border-radius: 9px; background: transparent; color: var(--blue);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.pager-btn:hover { background: var(--bg); }
.pager-btn .ic { width: 22px; height: 22px; }
.pager-count { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 74px; text-align: center; }

/* ── Bilderna ────────────────────────────────────────────────────────── */
.slide {
    position: relative; min-height: 100vh; min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--top-h) + 40px) max(24px, 7vw) 64px max(24px, 6vw);
    scroll-snap-align: start;
    background: var(--card);
}
.slide.alt { background: var(--bg); }
.slide-inner { width: 100%; max-width: 1240px; margin: 0 auto; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
    font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue);
}
.eyebrow-ic {
    width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--orange); color: #fff;
}
.eyebrow-light { color: rgba(255, 255, 255, 0.85); }
.slide-title {
    margin: 0 0 16px; font-size: clamp(30px, 3.9vw, 52px); line-height: 1.08; font-weight: 850; color: var(--ink);
    letter-spacing: -0.01em; text-wrap: balance;
}
.slide-lead { margin: 0 0 22px; font-size: clamp(17px, 1.45vw, 20px); color: #333; max-width: 40em; text-wrap: pretty; }
.points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.points li { position: relative; padding-left: 32px; color: var(--text); }
.points li::before {
    content: ''; position: absolute; left: 0; top: 0.2em; width: 20px; height: 20px; border-radius: 50%;
    background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.note {
    display: inline-block; margin: -6px 0 22px; padding: 8px 14px; border: 2px dashed var(--orange); border-radius: 10px;
    font-size: 15px; color: var(--muted); background: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions-center { justify-content: center; }
.btn {
    display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 10px;
    font: inherit; font-size: 17px; font-weight: 800; text-decoration: none; cursor: pointer; border: 2px solid transparent;
    transition: transform 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn .ic { width: 18px; height: 18px; }
.btn-cta { background: var(--orange); color: #fff; }
.btn-cta:hover { background: var(--orange-dark); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-ghost-dark { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-ghost-dark:hover { border-color: var(--blue); color: var(--blue); }
.ic-ext { width: 15px; height: 15px; margin-left: 2px; }

/* Två kolumner: text och bild; varannan bild speglad. */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.slide.alt .split-text { order: 2; }
.slide.alt .split-media { order: 1; }
.split-media { position: relative; }
.split-media.has-overlay { padding-bottom: 12%; }

.shot {
    margin: 0; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid rgba(1, 94, 159, 0.16);
    box-shadow: var(--shadow);
}
.shot-bar { height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 14px; background: #eef1f5; border-bottom: 1px solid var(--border); }
.shot-bar i { width: 10px; height: 10px; border-radius: 50%; background: #c9ced6; }
.shot img { display: block; width: 100%; height: auto; }
.shot-overlay { position: absolute; width: 54%; right: -4%; bottom: -4%; border: 3px solid #fff; }

/* ── Startbilden ─────────────────────────────────────────────────────── */
.slide-hero {
    color: #fff;
    background-color: var(--blue);
    background-image:
        radial-gradient(ellipse at 85% 10%, rgba(240, 131, 61, 0.28), transparent 55%),
        radial-gradient(ellipse at 0% 100%, rgba(0, 0, 0, 0.28), transparent 60%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='360' viewBox='0 0 560 360' fill='none' stroke='white' stroke-opacity='0.09' stroke-width='1.5'%3E%3Cpath d='M-20 300 C 110 250 210 330 340 270 S 500 210 580 250'/%3E%3Cpath d='M-20 250 C 100 200 230 270 330 215 S 490 160 580 195'/%3E%3Cpath d='M-20 200 C 90 150 240 205 340 160 S 480 110 580 140'/%3E%3Cpath d='M-20 150 C 110 100 240 150 350 105 S 490 60 580 85'/%3E%3Cpath d='M-20 100 C 120 55 250 100 360 55 S 500 15 580 35'/%3E%3Cpath d='M-20 50 C 130 10 260 50 370 10 S 510 -25 580 -10'/%3E%3C/svg%3E");
    background-size: auto, auto, 560px 360px;
    gap: 40px;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; }
.hero-title { margin: 0 0 18px; font-size: clamp(36px, 5.2vw, 68px); line-height: 1.04; font-weight: 900; letter-spacing: -0.015em; text-wrap: balance; max-width: 15em; }
.hero-lead { margin: 0 0 28px; font-size: clamp(17px, 1.6vw, 21px); color: rgba(255, 255, 255, 0.9); max-width: 36em; text-wrap: pretty; }
.hero-face { display: flex; justify-content: center; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.35)); animation: hero-float 6s ease-in-out infinite; }
@keyframes hero-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }

.tiles { width: 100%; max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tile {
    display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 14px; text-decoration: none;
    background: #fff; color: var(--text); border: 2px solid transparent;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); transition: transform 0.18s ease, border-color 0.18s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--orange); }
.tile:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.tile-head { display: flex; align-items: center; gap: 10px; }
.tile-ic { width: 36px; height: 36px; padding: 7px; border-radius: 10px; background: var(--orange); color: #fff; }
.tile-name { font-weight: 850; font-size: 18px; color: var(--ink); }
.tile-ext {
    margin-left: auto; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--blue); border: 1.5px solid var(--blue); border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.eyebrow .tile-ext { margin-left: 4px; letter-spacing: 0.04em; }
.tile-text { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.45; }
.tile-sensors { border-style: dashed; border-color: var(--orange); }

/* ── Kedjan ──────────────────────────────────────────────────────────── */
.chain { width: 100%; height: auto; max-width: 640px; display: block; margin: 0 auto; overflow: visible; }
.chain-node rect { fill: #fff; stroke: var(--blue); stroke-width: 2.5; }
.chain-node text { font-size: 18px; font-weight: 800; fill: var(--ink); font-family: inherit; }
.chain-live rect { fill: var(--blue); }
.chain-live text { fill: #fff; }
.chain-small rect { fill: var(--bg); stroke: var(--dim); stroke-width: 1.5; }
.chain-small text { font-size: 15px; font-weight: 700; fill: var(--text); }
.chain-arrow { fill: none; stroke: var(--orange); stroke-width: 3.5; stroke-linecap: round; }
.chain-arrow.dashed { stroke-dasharray: 8 7; }
.chain-label { font-size: 14px; font-style: italic; fill: var(--muted); font-family: inherit; }
.chain-centre { fill: var(--orange); }
.chain-centre-t { font-size: 16px; font-weight: 800; fill: #fff; font-family: inherit; }
.chain-feed { fill: none; stroke: var(--dim); stroke-width: 2; stroke-dasharray: 4 5; }

/* ── INCA Sensors (tecknad karta i kartans mörka tema) ───────────────── */
.sensors-art { width: 100%; height: auto; display: block; border-radius: 18px; box-shadow: var(--shadow); }
.sa-bg { fill: #0d1217; }
.sa-contour { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 1.5; }
.sa-sector { fill: rgba(240, 131, 61, 0.16); stroke: var(--orange); stroke-width: 1.5; stroke-dasharray: 6 5; }
.sa-bearing { stroke: var(--orange); stroke-width: 3; stroke-linecap: round; }
.sa-fire { fill: #ff3333; }
.sa-cam circle { fill: #fff; stroke: var(--orange); stroke-width: 3; }
.sa-cam path { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.sa-node { fill: #fff; stroke: var(--blue); stroke-width: 3; }
.sa-warn { fill: var(--orange); stroke: #fff; }
.sa-pulse { fill: none; stroke: #ff3333; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: sa-pulse 2.2s ease-out infinite; }
.sa-pulse-warn { stroke: var(--orange); animation-delay: 0.9s; }
@keyframes sa-pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }

/* ── Avslut ──────────────────────────────────────────────────────────── */
.slide-close { text-align: center; background: var(--bg); }
.close-inner { max-width: 920px; }
.close-inner .slide-lead { margin-left: auto; margin-right: auto; }
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 8px 0 28px; text-align: left; }
.path-card {
    display: block; padding: 26px; border-radius: 16px; background: #fff; text-decoration: none; color: var(--text);
    border: 2px solid var(--border); box-shadow: 0 8px 24px rgba(1, 40, 70, 0.08); transition: transform 0.18s ease, border-color 0.18s ease;
}
.path-card:hover { transform: translateY(-3px); border-color: var(--orange); }
.path-card h3 { margin: 14px 0 6px; font-size: 22px; color: var(--ink); }
.path-card p { margin: 0; color: var(--muted); }
.path-ic { width: 46px; height: 46px; padding: 10px; border-radius: 12px; background: var(--blue); color: #fff; }
.foot { margin-top: 40px; font-size: 14px; color: var(--dim); text-align: center; }

/* ── Inträde: texten glider upp när bilden syns ──────────────────────── */
.split-text > *, .close-inner > *, .hero-text > *, .tiles > * {
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.slide:not(.in-view) .split-text > *, .slide:not(.in-view) .close-inner > *,
.slide:not(.in-view) .hero-text > *, .slide:not(.in-view) .tiles > * { opacity: 0; transform: translateY(18px); }
.slide .split-text > :nth-child(2), .slide .tiles > :nth-child(2) { transition-delay: 0.06s; }
.slide .split-text > :nth-child(3), .slide .tiles > :nth-child(3) { transition-delay: 0.12s; }
.slide .split-text > :nth-child(4), .slide .tiles > :nth-child(4) { transition-delay: 0.18s; }
.slide .split-text > :nth-child(5), .slide .tiles > :nth-child(5) { transition-delay: 0.24s; }
.slide .tiles > :nth-child(6) { transition-delay: 0.3s; }
.split-media { transition: opacity 0.7s ease 0.1s, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s; }
.slide:not(.in-view) .split-media { opacity: 0; transform: translateY(24px) scale(0.985); }

/* ── Presentationen: en bild i taget, större text ────────────────────── */
body.presenting .slide { height: 100vh; height: 100svh; min-height: 0; overflow: hidden; scroll-snap-stop: always; }
body.presenting .slide-title { font-size: clamp(34px, 4.4vw, 60px); }
/* Hjälmen berättar nere på skärmdumpens sida (till höger, eller till vänster på bilder
   där texten står till höger: body.inca-left) — bläddringen står på andra sidan. */
body.presenting .pager { right: auto; left: 16px; }
body.presenting.inca-left .pager { left: auto; right: 16px; }

/* ── Smal skärm ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    html { scroll-snap-type: none; }
    .slide { min-height: 0; padding: calc(var(--top-h) + 28px) 20px 48px; }
    .slide-hero { padding-top: calc(var(--top-h) + 24px); }
    .split { grid-template-columns: 1fr; gap: 28px; }
    .slide.alt .split-text, .slide.alt .split-media { order: 0; }
    .hero-grid { grid-template-columns: 1fr; gap: 10px; }
    .hero-face { order: -1; justify-content: flex-start; }
    .hero-face canvas { width: 120px !important; height: auto !important; }
    .dots, .pager { display: none; }
    .shot-overlay { position: relative; width: 78%; right: auto; bottom: auto; margin: -18% 0 0 auto; }
    .split-media.has-overlay { padding-bottom: 0; }
    .paths { grid-template-columns: 1fr; }
    body.presenting .slide { height: auto; min-height: 100svh; overflow: visible; }
}
@media (max-width: 560px) {
    .tiles { grid-template-columns: 1fr; }
    .top-btn { padding: 0 10px; }
    .top-present span:not(.ic), .top-exit span:not(.ic) { display: none; }
    .top-login { font-size: 14px; }
    .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-face, .sa-pulse { animation: none; }
    .split-text > *, .close-inner > *, .hero-text > *, .tiles > *, .split-media, .progress-bar, .tile, .path-card { transition: none; }
    .slide:not(.in-view) .split-text > *, .slide:not(.in-view) .close-inner > *,
    .slide:not(.in-view) .hero-text > *, .slide:not(.in-view) .tiles > *, .slide:not(.in-view) .split-media { opacity: 1; transform: none; }
}
@media print {
    .topbar, .progress, .dots, .pager { display: none; }
    .slide { min-height: 0; page-break-after: always; padding: 32px; }
    .slide:not(.in-view) * { opacity: 1 !important; transform: none !important; }
}
