/* ==========================================================
   TAPPITRACK — SOLUTION PAGE TEMPLATE
   Used by every solution and industry page
   (scripts/site/layout.py builds the markup).
   Script: assets/js/solution-page.js (features accordion)
   Builds on components/page.css. Class prefix: sp-
   Sections: spheres of application, numbered benefits, features
   accordion with framed screenshots, scenario cards, useful links
   panel, platform band, articles.
   Built-in platform mock-ups are used until real screenshots are
   uploaded (see docs/PHOTOS.md).
   ========================================================== */

.sp-center {
    justify-content: center;
    margin-top: 40px;
}

/* ---------- Framed screenshots (features accordion) ---------- */

.sp-feature-visual {
    position: relative;
    isolation: isolate;
}

.sp-deco {
    position: absolute;
    z-index: -1;
    border-radius: 22px;
}

.sp-deco--c {
    top: -24px;
    left: -24px;
    width: 45%;
    height: 70%;
    background: var(--tt-blue);
}

.sp-deco--d {
    right: -24px;
    bottom: -24px;
    width: 55%;
    height: 55%;
    background: var(--tt-blue-soft);
}

.sp-shot {
    margin: 0;
    overflow: hidden;
    background: var(--tt-white);
    border: 8px solid var(--tt-white);
    border-radius: 22px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18);
}

.sp-shot[hidden] {
    display: none;
}

.sp-shot img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 14px;
}

/* Hero mock-ups sit in the shared hero panel. */
.pg-hero-visual .sp-shot {
    max-width: 560px;
    margin-left: auto;
    animation: pg-float 6s ease-in-out infinite alternate;
}

/* ---------- App frame mock-ups ---------- */

.sp-app {
    overflow: hidden;
    color: var(--tt-text);
    background: var(--tt-white);
    border-radius: 14px;
}

.sp-app-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: var(--tt-white);
    background: var(--tt-dark);
}

.sp-app-bar > span {
    width: 9px;
    height: 9px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
}

.sp-app-bar strong {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 600;
}

.sp-app-bar em {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 2px 9px;
    color: #7EE2A8;
    background: rgba(22, 129, 81, 0.25);
    border-radius: 999px;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sp-app-body {
    min-height: 260px;
}

.sp-chart {
    display: block;
    width: 100%;
    height: auto;
    padding: 14px 14px 0;
}

.sp-area { fill: rgba(0, 103, 238, 0.1); }

.sp-line {
    fill: none;
    stroke: var(--tt-blue);
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-dasharray: 420;
    animation: sp-draw 6s ease-in-out infinite;
}

.sp-dot {
    stroke: var(--tt-white);
    stroke-width: 3;
    animation: sp-pulse 2s ease-in-out infinite;
}

.sp-dot--fill { fill: var(--tt-blue); }
.sp-dot--drain { fill: var(--tt-red); animation-delay: 1s; }

.sp-events {
    display: grid;
    margin: 0;
    padding: 4px 0 8px;
    list-style: none;
}

.sp-event {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--tt-muted);
    font-size: 13px;
}

.sp-event + .sp-event {
    border-top: 1px solid var(--tt-border);
}

.sp-event svg {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 7px;
    border-radius: 8px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.sp-event--fill svg { color: var(--tt-blue); background: var(--tt-blue-soft); }
.sp-event--drain svg { color: var(--tt-red); background: #FFF0F1; }

.sp-event strong {
    display: block;
    color: var(--tt-dark);
    font-size: 14px;
}

.sp-gauges,
.sp-settings {
    display: grid;
    margin: 0;
    padding: 12px 18px;
    list-style: none;
}

.sp-gauges li {
    display: grid;
    grid-template-columns: 96px 1fr 80px;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    color: var(--tt-dark);
    font-size: 14px;
    font-weight: 600;
}

.sp-gauges li + li,
.sp-settings li + li {
    border-top: 1px solid var(--tt-border);
}

.sp-gauges i {
    position: relative;
    height: 10px;
    overflow: hidden;
    background: var(--tt-light);
    border-radius: 999px;
}

.sp-gauges i::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--lvl);
    background: var(--tt-blue);
    border-radius: inherit;
    animation: sp-fill 1.6s var(--tt-ease) both;
}

.sp-gauges b {
    color: var(--tt-muted);
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.sp-gauges b.sp-warn {
    color: var(--tt-red);
}

.sp-tank {
    display: block;
    width: 100%;
    height: auto;
    padding: 20px;
}

.sp-tank-fuel {
    animation: sp-slosh 4s ease-in-out infinite alternate;
}

.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sp-table th,
.sp-table td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--tt-border);
}

.sp-table th {
    color: var(--tt-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.sp-table td {
    color: var(--tt-dark);
}

.sp-table td.sp-flag {
    color: var(--tt-red);
    font-weight: 700;
}

.sp-settings li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    color: var(--tt-muted);
    font-size: 13px;
}

.sp-settings strong {
    display: block;
    color: var(--tt-dark);
    font-size: 14px;
}

.sp-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    height: 22px;
    background: #C9D5E3;
    border-radius: 999px;
}

.sp-toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--tt-white);
    border-radius: 50%;
}

.sp-toggle.is-on {
    background: var(--tt-blue);
}

.sp-toggle.is-on::after {
    left: 21px;
}

/* ---------- 2. Spheres of application ---------- */

.sp-spheres {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sp-sphere {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 18px;
    transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.sp-sphere:hover {
    border-color: var(--tt-blue);
    box-shadow: var(--tt-shadow-sm);
    transform: translateY(-3px);
}

.sp-sphere img {
    flex: 0 0 auto;
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 12px;
}

.sp-sphere strong {
    color: var(--tt-dark);
    font-family: var(--tt-font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
}

/* ---------- 3. Numbered cards ---------- */

.sp-nums {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: benefit;
}

.sp-num {
    padding: 36px 36px 40px;
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 24px;
    counter-increment: benefit;
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.sp-num:hover {
    box-shadow: var(--tt-shadow);
    transform: translateY(-3px);
}

.sp-num::before {
    content: counter(benefit);
    display: block;
    margin-bottom: 20px;
    color: var(--tt-blue);
    font-family: var(--tt-font-heading);
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.sp-num h3 {
    margin: 0 0 14px;
    font-size: 22px;
}

.sp-num p {
    margin: 0;
    color: var(--tt-muted);
    font-size: 16px;
    line-height: 1.7;
}

/* ---------- 4. Features accordion ---------- */

.sp-features {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 96px);
}

.sp-acc {
    border-bottom: 1px solid var(--tt-border);
}

.sp-acc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0;
    color: var(--tt-dark);
    font-family: var(--tt-font-heading);
    font-size: clamp(20px, 2vw, 26px);
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    transition: color 160ms ease;
}

.sp-acc summary::-webkit-details-marker {
    display: none;
}

.sp-acc summary svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: var(--tt-muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transform: rotate(90deg);
    transition: transform 200ms ease, color 160ms ease;
}

.sp-acc[open] summary,
.sp-acc summary:hover {
    color: var(--tt-blue);
}

.sp-acc[open] summary svg {
    color: var(--tt-blue);
    transform: rotate(-90deg);
}

.sp-acc p {
    margin: 0 0 26px;
    color: var(--tt-muted);
    font-size: 17px;
    line-height: 1.75;
}

.sp-feature-visual .sp-shot {
    animation: sp-in 400ms var(--tt-ease);
    box-shadow: var(--tt-shadow);
}

/* ---------- 5. Where fleets lose fuel ---------- */

.sp-cases {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sp-case {
    overflow: hidden;
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 18px;
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.sp-case:hover {
    box-shadow: var(--tt-shadow-sm);
    transform: translateY(-3px);
}

.sp-case img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.sp-case > div {
    padding: 22px 22px 24px;
}

.sp-case h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.sp-case p {
    margin: 0;
    color: var(--tt-muted);
    font-size: 15px;
    line-height: 1.6;
}

/* ---------- 6. Useful links panel ---------- */

.sp-links-panel {
    position: relative;
    overflow: hidden;
    padding: clamp(40px, 6vw, 72px) clamp(24px, 4vw, 48px);
    text-align: center;
    background: linear-gradient(100deg, var(--tt-blue-soft) 0%, #F4F8FF 60%, var(--tt-white) 100%);
    border: 1px solid #DCE7F8;
    border-radius: 28px;
}

.sp-lines {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 320px;
    height: 100%;
    fill: none;
    stroke: rgba(0, 103, 238, 0.28);
    stroke-width: 1.2;
    pointer-events: none;
}

.sp-links-panel h2 {
    position: relative;
    margin: 0 0 12px;
    font-size: clamp(28px, 3vw, 40px);
}

.sp-links-panel p {
    position: relative;
    margin: 0 0 32px;
    color: var(--tt-text);
    font-size: 18px;
}

.sp-pills {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.sp-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 30px;
    color: var(--tt-white);
    background: var(--tt-blue);
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms ease, transform 160ms ease;
}

.sp-pill:hover {
    background: var(--tt-blue-dark);
    transform: translateY(-2px);
}

.sp-pill svg,
.sp-article em svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* ---------- 8. Platform band ---------- */

.sp-platform {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: clamp(28px, 5vw, 64px);
    padding: clamp(28px, 5vw, 56px);
    background: var(--tt-light);
    border: 1px solid var(--tt-border);
    border-radius: 28px;
}

.sp-platform h2 {
    margin: 0 0 14px;
    color: var(--tt-dark);
    font-size: clamp(26px, 3vw, 38px);
}

.sp-platform p {
    margin: 0 0 24px;
    color: var(--tt-muted);
    font-size: 17px;
    line-height: 1.7;
}

.sp-platform-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sp-platform-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: var(--tt-dark);
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 12px;
    font-weight: 600;
}

.sp-platform-list svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--tt-blue);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* ---------- 11. Articles ---------- */

.sp-articles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sp-article {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    padding: 26px;
    color: inherit;
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 18px;
    text-decoration: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.sp-article:hover {
    border-color: var(--tt-blue);
    box-shadow: var(--tt-shadow-sm);
}

.sp-article > span {
    color: var(--tt-blue);
    font-size: 13px;
    font-weight: 700;
}

.sp-article strong {
    color: var(--tt-dark);
    font-family: var(--tt-font-heading);
    font-size: 19px;
    line-height: 1.35;
}

.sp-article em {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    color: var(--tt-blue);
    font-style: normal;
    font-weight: 700;
}


.sp-app-bar em i {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: sp-blink 1.4s steps(2, jump-none) infinite;
}

/* ---------- Map and video mock-ups ---------- */

.sp-map {
    display: block;
    width: 100%;
    height: auto;
}

.sp-route {
    fill: none;
    stroke: var(--tt-blue);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 10 8;
    animation: sp-dash 1.4s linear infinite;
}

.sp-video {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.sp-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 12%;
}

.sp-rec,
.sp-video-label {
    position: absolute;
    top: 12px;
    padding: 3px 10px;
    color: var(--tt-white);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.sp-rec {
    left: 12px;
    color: var(--tt-white);
    background: var(--tt-red);
    animation: sp-blink 1.4s steps(2, jump-none) infinite;
}

.sp-video-label {
    right: 12px;
}

.sp-timeline {
    position: relative;
    height: 4px;
    margin: 18px;
    background: var(--tt-border);
    border-radius: 2px;
}

.sp-timeline i {
    position: absolute;
    top: -4px;
    left: var(--at);
    width: 12px;
    height: 12px;
    background: var(--tt-red);
    border: 2px solid var(--tt-white);
    border-radius: 50%;
}

.sp-timeline b {
    position: absolute;
    top: -6px;
    left: 0;
    width: 2px;
    height: 16px;
    background: var(--tt-dark);
    animation: sp-play 8s linear infinite;
}

/* White card for a transparent-background product video. */
.sp-video-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--tt-white);
    border-radius: 14px;
}

/* The demo video is portrait with a black strip along its top edge;
   cover + bottom alignment crops that strip off. */
.sp-video-card video {
    display: block;
    width: auto;
    max-width: 100%;
    height: 360px;
    aspect-ratio: 17 / 18;
    object-fit: cover;
    object-position: 50% 100%;
    border-radius: 10px;
}

/* Feature titles are real headings (h3) for search engines. */
.sp-acc summary h3 {
    margin: 0;
    color: inherit;
    font: inherit;
}

@keyframes sp-dash { to { stroke-dashoffset: -36; } }
@keyframes sp-blink { 50% { opacity: 0.4; } }
@keyframes sp-play { to { left: 100%; } }

/* ---------- Animation ---------- */

@keyframes sp-draw { 0% { stroke-dashoffset: 420; } 55%, 100% { stroke-dashoffset: 0; } }
@keyframes sp-pulse { 50% { r: 8; } }
@keyframes sp-fill { from { width: 0; } }
@keyframes sp-slosh { to { transform: translateY(8px); } }
@keyframes sp-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .sp-spheres,
    .sp-nums {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sp-cases {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .sp-features,
    .sp-platform {
        grid-template-columns: minmax(0, 1fr);
    }

    .sp-feature-visual {
        order: -1;
        max-width: 620px;
    }

    .sp-articles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .sp-spheres,
    .sp-nums,
    .sp-cases,
    .sp-articles,
    .sp-platform-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .sp-sphere {
        gap: 16px;
        padding: 16px;
    }

    .sp-sphere img {
        width: 64px;
        height: 64px;
    }

    .sp-sphere strong {
        font-size: 18px;
    }

    .sp-num {
        padding: 28px;
    }

    .sp-pill {
        width: 100%;
        justify-content: center;
    }

    .sp-gauges li {
        grid-template-columns: 80px 1fr 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pg-hero-visual .sp-shot,
    .sp-route,
    .sp-rec,
    .sp-timeline b,
    .sp-line,
    .sp-dot,
    .sp-gauges i::after,
    .sp-tank-fuel,
    .sp-feature-visual .sp-shot {
        animation: none;
    }

    .sp-line {
        stroke-dasharray: none;
    }
}
