/*
 * KN Phone case study — page styles.
 *
 * Loaded only by resources/views/web/projects/case-studies/kn-phone.blade.php.
 * Every class is prefixed `kp-` and every colour, radius, font and easing comes
 * from the site's own tokens (--c-*, --radius, --font-*, --ease-out), so the
 * page follows the dashboard theme, light/dark mode and RTL without a Tailwind
 * rebuild. Logical properties throughout: the Arabic page mirrors itself.
 *
 * One colour is the store's rather than ours: --kp-store, KN Phone's cyan,
 * used sparingly on the device frames and the client mark so the store's
 * identity sits inside MagnAct's page without competing with it.
 */

:root { --kp-store: #22b8e6; }

/* ---------------------------------------------------------------- basics */
.kp-ico    { width: 1.35rem; height: 1.35rem; }
.kp-ico-sm { width: 1rem; height: 1rem; flex: none; }
.kp-ico-xs { width: .8rem; height: .8rem; flex: none; color: var(--c-primary); margin-top: .35em; }

/* The shared hero sizes its h1 for a project name; this one is a sentence
   sharing the row with a screenshot, so it is set a step smaller. */
.page-open h1 { font-size: clamp(2.1rem, 4.6vw, 3.7rem); line-height: 1.06; max-width: 20ch; }
html[dir='rtl'] .page-open h1 { line-height: 1.3; }

.kp-lede { margin-top: 1.75rem; max-width: 46ch; }
.kp-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem; }
.kp-hint {
    font-family: var(--font-mono);
    font-size: .65rem;
    letter-spacing: .12em;
    color: var(--c-text-muted);
    margin-inline-start: .15rem;
}
html[dir='rtl'] .kp-hint { letter-spacing: 0; font-size: .75rem; }

.kp-section { position: relative; }
.kp-band {
    background:
        radial-gradient(60rem 30rem at 85% 0%, color-mix(in srgb, var(--c-primary) 7%, transparent), transparent 70%),
        var(--c-surface);
    border-block: 1px solid var(--c-border);
}
html[dir='rtl'] .kp-band {
    background:
        radial-gradient(60rem 30rem at 15% 0%, color-mix(in srgb, var(--c-primary) 7%, transparent), transparent 70%),
        var(--c-surface);
}

.kp-head { max-width: 46rem; margin-bottom: clamp(2.25rem, 5vw, 3.5rem); }
.kp-head--split { max-width: none; display: grid; gap: 1.25rem; align-items: end; }
@media (min-width: 1024px) {
    .kp-head--split { grid-template-columns: 1.15fr .85fr; gap: 4rem; }
}
.kp-h2 {
    margin-top: 1rem;
    font-size: clamp(1.9rem, 4.4vw, 3.2rem);
    line-height: 1.08;
    max-width: 21ch;
}
html[dir='rtl'] .kp-h2 { line-height: 1.3; }
.kp-lead { color: var(--c-text-muted); font-size: 1.075rem; line-height: 1.7; max-width: 52ch; }

/* ------------------------------------------------------- framed screens */
.kp-frame {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) * .75);
    border: 1px solid var(--c-border);
    background: var(--c-surface-raised);
    box-shadow:
        0 1px 0 color-mix(in srgb, #fff 6%, transparent) inset,
        0 30px 60px -28px rgba(3, 8, 20, .55),
        0 12px 24px -16px rgba(3, 8, 20, .35);
}
.kp-frame > img { display: block; width: 100%; height: auto; background: #f4f7fa; }
.kp-frame-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    height: 2rem;
    padding-inline: .85rem;
    border-bottom: 1px solid var(--c-border);
    background: color-mix(in srgb, var(--c-surface) 85%, var(--c-text) 4%);
}
.kp-frame-bar i {
    flex: none;
    width: .55rem; height: .55rem; border-radius: 50%;
    background: color-mix(in srgb, var(--c-text) 22%, transparent);
}
.kp-frame-bar span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    margin-inline: auto;
    font-family: var(--font-mono);
    font-size: .66rem;
    letter-spacing: .08em;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-inline-end: 2.2rem;
}
html[dir='rtl'] .kp-frame-bar span { font-family: inherit; letter-spacing: 0; font-size: .75rem; }
.kp-frame-bar span img { width: .9rem; height: .9rem; border-radius: .2rem; flex: none; }

/* A phone, drawn in CSS around a 390 × 844 capture. */
.kp-phone {
    position: relative;
    aspect-ratio: 390 / 844;
    padding: .45rem;
    border-radius: 2.1rem;
    background: linear-gradient(160deg, #1c2638, #070b14 60%);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--kp-store) 28%, rgba(255, 255, 255, .08)),
        0 28px 50px -22px rgba(3, 8, 20, .65),
        0 10px 20px -12px rgba(3, 8, 20, .45);
}
.kp-phone::before {
    content: '';
    position: absolute;
    z-index: 2;
    top: calc(.45rem + 8px);
    left: 50%;
    width: 28%;
    height: .8rem;
    border-radius: 99px;
    background: #05080f;
    transform: translateX(-50%);
}
.kp-phone > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 1.7rem;
    /* A status-bar strip, as on a real phone, so the camera sits above the page. */
    padding-top: 12%;
    background: #f5f8fb;
}

/* --------------------------------------------------------------- hero art */
.kp-hero-visual { position: relative; margin: 0; padding-bottom: 2.5rem; }
.kp-frame--hero { transform: perspective(1800px) rotateY(-4deg) rotateX(2deg); transform-origin: 70% 50%; }
html[dir='rtl'] .kp-frame--hero { transform: perspective(1800px) rotateY(4deg) rotateX(2deg); transform-origin: 30% 50%; }
.kp-phone--float {
    position: absolute;
    z-index: 2;
    width: 27%;
    inset-inline-start: -5%;
    bottom: 0;
    animation: kp-float 7s ease-in-out infinite;
}
@keyframes kp-float { 50% { transform: translateY(-8px); } }
.kp-note {
    position: absolute;
    inset-inline-end: 0;
    bottom: 0;
    max-width: 62%;
    font-size: .75rem;
    line-height: 1.5;
    text-align: end;
    color: var(--c-text-muted);
}
@media (max-width: 1023px) {
    .kp-frame--hero, html[dir='rtl'] .kp-frame--hero { transform: none; }
    .kp-phone--float { inset-inline-start: auto; inset-inline-end: 3%; width: 24%; bottom: 2.6rem; }
    .kp-note { position: static; display: block; max-width: none; margin-top: .75rem; text-align: start; }
    .kp-hero-visual { padding-bottom: 0; }
}
@media (max-width: 479px) { .kp-phone--float { display: none; } }

/* ------------------------------------------------------------ facts/stats */
.kp-facts-wrap { padding-block: 0 clamp(3.5rem, 7vw, 5.5rem); }
/* Five facts here, not the shared four: keep them on one row on wide screens. */
@media (min-width: 1024px) {
    .kp-facts-wrap .facts { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 1.75rem; }
}
.kp-client { display: inline-flex; align-items: center; gap: .5rem; }
.kp-client img { width: 1.4rem; height: 1.4rem; border-radius: .35rem; flex: none; }
.kp-credits { margin-top: 1.75rem; }
.kp-stats {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--c-surface);
}
.kp-stat {
    padding: clamp(1.25rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    border-inline-end: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
}
.kp-stat:nth-child(2n) { border-inline-end: 0; }
.kp-stat:nth-last-child(-n+2) { border-bottom: 0; }
@media (min-width: 900px) {
    .kp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .kp-stat { border-bottom: 0; border-inline-end: 1px solid var(--c-border); }
    .kp-stat:nth-child(2n) { border-inline-end: 1px solid var(--c-border); }
    .kp-stat:last-child { border-inline-end: 0; }
}
.kp-stat-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.1rem, 4.6vw, 3.25rem);
    line-height: 1;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
}
.kp-stat-label { color: var(--c-text-muted); font-size: .92rem; line-height: 1.45; }

/* ------------------------------------------------------------------ story */
.kp-story {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1px;
    background: var(--c-border);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}
@media (min-width: 720px)  { .kp-story { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kp-story { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 720px) and (max-width: 1199px) { .kp-story-step:last-child { grid-column: 1 / -1; } }
.kp-story-step { background: var(--c-bg); padding: clamp(1.5rem, 3vw, 2rem); }
.kp-story-step:last-child { background: color-mix(in srgb, var(--c-primary) 8%, var(--c-bg)); }
.kp-step-num {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--c-primary);
    letter-spacing: .12em;
}
.kp-story-step h3 { margin-top: .9rem; font-size: 1.2rem; }
.kp-story-step p, .kp-module p, .kp-quality p, .kp-flow-step p {
    margin-top: .7rem;
    color: var(--c-text-muted);
    line-height: 1.7;
    font-size: .965rem;
}

/* ---------------------------------------------------------------- journey */
.kp-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
@media (min-width: 720px)  { .kp-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px)  { .kp-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kp-flow { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; } }
.kp-flow-step { position: relative; padding-top: 3.4rem; }
.kp-flow-step::before {
    content: '';
    position: absolute;
    top: 1.15rem;
    inset-inline-start: 2.6rem;
    inset-inline-end: -1rem;
    height: 1px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--c-primary) 55%, transparent), var(--c-border));
}
html[dir='rtl'] .kp-flow-step::before { background: linear-gradient(-90deg, color-mix(in srgb, var(--c-primary) 55%, transparent), var(--c-border)); }
.kp-flow-step:last-child::before { display: none; }
@media (max-width: 1199px) { .kp-flow-step::before { display: none; } }
.kp-flow-dot {
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: .85rem;
    font-weight: 700;
    color: var(--c-button-text, #fff);
    background: linear-gradient(140deg, var(--c-primary), var(--c-primary-deep));
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--c-primary) 14%, transparent);
}
.kp-flow-step h3 { font-size: 1.1rem; }
.kp-flow-step p { font-size: .925rem; }

.kp-phones {
    margin-top: clamp(3rem, 6vw, 4.5rem);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.25rem, 3vw, 2.5rem);
    max-width: 68rem;
    margin-inline: auto;
}
@media (min-width: 900px) { .kp-phones { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) {
    .kp-phone-fig:nth-child(even) { transform: translateY(2.5rem); }
    .kp-phones { padding-bottom: 2.5rem; }
}
.kp-phone-fig { margin: 0; }
.kp-phone-fig figcaption {
    margin-top: 1rem;
    text-align: center;
    font-size: .9rem;
    color: var(--c-text-muted);
}

/* -------------------------------------------------------------- features */
.kp-group + .kp-group { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.kp-group-title {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    font-family: var(--font-mono);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--c-text-muted);
}
html[dir='rtl'] .kp-group-title { font-family: var(--font-display); letter-spacing: 0; font-size: .95rem; }
.kp-group-title::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }
.kp-group-mark { width: .55rem; height: .55rem; transform: rotate(45deg); background: var(--c-primary); flex: none; }
.kp-modules { display: grid; gap: 1.25rem; }
@media (min-width: 720px)  { .kp-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kp-modules { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kp-module { padding: clamp(1.4rem, 2.6vw, 1.75rem); background: var(--c-bg); }
.kp-module:hover { border-color: color-mix(in srgb, var(--c-primary) 45%, transparent); }
.kp-module-icon {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .85rem;
    color: var(--c-primary);
    background: color-mix(in srgb, var(--c-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c-primary) 25%, transparent);
}
.kp-module h4, .kp-quality h3 { margin-top: 1.1rem; font-size: 1.15rem; }
.kp-module ul { list-style: none; margin: 1.1rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--c-border); display: grid; gap: .5rem; }
.kp-module li { display: flex; gap: .6rem; font-size: .9rem; line-height: 1.5; }

/* -------------------------------------------------------------------- tour */
.kp-tour-tabs {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .35rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    background: var(--c-bg);
    scrollbar-width: none;
}
.kp-tour-tabs::-webkit-scrollbar { display: none; }
.kp-tour-tabs[hidden] { display: none; }
.kp-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-radius: 999px;
    font-size: .875rem;
    color: var(--c-text-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.kp-tab:hover { color: var(--c-text); }
.kp-tab[aria-selected='true'] { color: var(--c-button-text, #fff); background: var(--c-primary); }
.kp-tab:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.kp-tab-num { font-family: var(--font-mono); font-size: .68rem; opacity: .7; }

.kp-tour-panels { display: grid; gap: 3rem; }
.kp-tour.is-tabbed .kp-tour-panels { display: block; }
.kp-panel { margin: 0; }
.kp-panel[hidden] { display: none; }
.kp-tour.is-tabbed .kp-panel:not([hidden]) { animation: kp-in .45s var(--ease-out) both; }
@keyframes kp-in { from { opacity: 0; transform: translateY(10px); } }
.kp-panel figcaption {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    align-items: baseline;
    margin-top: 1.1rem;
    color: var(--c-text-muted);
    line-height: 1.6;
}
.kp-panel figcaption strong { color: var(--c-text); font-family: var(--font-display); font-size: 1.05rem; }

/* ------------------------------------------------------------------ roles */
.kp-roles {
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    padding: clamp(1.4rem, 3vw, 2rem);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
}
.kp-roles-title { display: flex; align-items: center; gap: .6rem; font-size: 1.15rem; }
.kp-roles-title svg { color: var(--c-primary); }
.kp-roles dl { margin: 1.25rem 0 0; display: grid; gap: 1rem; }
@media (min-width: 900px) { .kp-roles dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; } }
.kp-role {
    padding-inline-start: 1rem;
    border-inline-start: 3px solid var(--c-primary);
}
.kp-role + .kp-role { border-inline-start-color: color-mix(in srgb, var(--c-primary) 40%, var(--c-border)); }
.kp-role dt { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.kp-role dd { margin: .35rem 0 0; color: var(--c-text-muted); line-height: 1.65; font-size: .95rem; }

/* -------------------------------------------------------------- deep dives */
.kp-deep { display: grid; gap: clamp(3.5rem, 8vw, 6rem); }
.kp-deep-item { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 1024px) {
    .kp-deep-item { grid-template-columns: .9fr 1.1fr; gap: 4rem; }
    .kp-deep-item--flip .kp-deep-copy { order: 2; }
}
.kp-deep-copy h3 { font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1.2; }
html[dir='rtl'] .kp-deep-copy h3 { line-height: 1.45; }
.kp-deep-copy dl { margin: 1.5rem 0 0; display: grid; gap: 1.15rem; }
.kp-deep-copy dt {
    font-family: var(--font-mono);
    font-size: .7rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--c-primary);
}
html[dir='rtl'] .kp-deep-copy dt { letter-spacing: 0; font-size: .85rem; font-family: var(--font-display); font-weight: 700; }
.kp-deep-copy dd { margin: .35rem 0 0; color: var(--c-text-muted); line-height: 1.7; }
.kp-deep-value {
    padding: 1rem 1.15rem;
    border-radius: calc(var(--radius) * .6);
    border-inline-start: 3px solid var(--c-primary);
    background: color-mix(in srgb, var(--c-primary) 8%, transparent);
}
.kp-deep-value dd { color: var(--c-text); }

/* -------------------------------------------------------------- qualities */
.kp-qualities { display: grid; gap: 2.25rem 2rem; }
@media (min-width: 720px)  { .kp-qualities { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kp-qualities { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* -------------------------------------------------------------------- tech */
.kp-tech { display: grid; gap: 2.5rem; }
@media (min-width: 1024px) { .kp-tech { grid-template-columns: .9fr 1.1fr; gap: 4rem; align-items: start; } }
.kp-tech .kp-head { margin-bottom: 0; }
.kp-tech .kp-lead { margin-top: 1rem; }
.kp-brochures { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 2rem; }
.kp-alt-link { font-size: .9rem; color: var(--c-text-muted); text-decoration: underline; text-underline-offset: 4px; }
.kp-alt-link:hover { color: var(--c-text); }
.kp-tech-list { margin: 0; border-top: 1px solid var(--c-border); }
.kp-tech-list > div {
    display: grid;
    gap: .25rem 2rem;
    padding-block: 1.1rem;
    border-bottom: 1px solid var(--c-border);
}
@media (min-width: 640px) { .kp-tech-list > div { grid-template-columns: 11rem 1fr; } }
.kp-tech-list dt { color: var(--c-text-muted); font-size: .9rem; }
.kp-tech-list dd { margin: 0; font-weight: 600; text-align: start; }

/* ------------------------------------------------------- sample results */
/* Series colours: the first three slots of the validated categorical
   palette (blue, orange, aqua), stepped separately for each theme and
   checked against these surfaces for colour-blind separation. Dark is the
   site's base theme, so it is the default here as well. */
:root { --kpc-s1: #3987e5; --kpc-s2: #d95926; --kpc-s3: #199e70; }
:root[data-theme='light'] { --kpc-s1: #2a78d6; --kpc-s2: #eb6834; --kpc-s3: #1baf7a; }
@media (prefers-color-scheme: light) {
    :root[data-theme='system'] { --kpc-s1: #2a78d6; --kpc-s2: #eb6834; --kpc-s3: #1baf7a; }
}
.s1 { --kpc-c: var(--kpc-s1); }
.s2 { --kpc-c: var(--kpc-s2); }
.s3 { --kpc-c: var(--kpc-s3); }

.kp-sample {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem .85rem;
    max-width: 62rem;
    margin: 0 0 clamp(2rem, 4vw, 3rem);
    padding: 1rem 1.15rem;
    border: 1px solid color-mix(in srgb, var(--c-primary) 35%, var(--c-border));
    border-radius: calc(var(--radius) * .6);
    background: color-mix(in srgb, var(--c-primary) 8%, transparent);
    color: var(--c-text-muted);
    font-size: .95rem;
    line-height: 1.65;
}
.kp-sample span:last-child { flex: 1 1 22rem; }
.kp-sample-tag {
    flex: none;
    padding: .2rem .65rem;
    border-radius: 99px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-mono);
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
}
html[dir='rtl'] .kp-sample-tag { font-family: inherit; letter-spacing: 0; font-size: .8rem; font-weight: 700; }

.kp-results { display: grid; gap: clamp(2.75rem, 5vw, 4rem); }
.kp-result-title { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; font-size: 1.3rem; }
.kp-result-title svg { color: var(--c-primary); }
.kp-charts { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
@media (min-width: 960px) { .kp-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kp-result-note { margin-top: .9rem; color: var(--c-text-muted); font-size: .9rem; line-height: 1.6; }

/* headline figures */
.kpc-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-border);
}
@media (min-width: 900px) { .kpc-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpc-tile { padding: 1.05rem 1.25rem; background: var(--c-bg); }
.kpc-tile dt { color: var(--c-text-muted); font-size: .85rem; line-height: 1.4; }
.kpc-tile dd { margin: .4rem 0 0; }
.kpc-tile-value { display: block; color: var(--c-text); font-family: var(--font-display); font-weight: 700; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.1; }
html[dir='rtl'] .kpc-tile-value { text-align: right; }
.kpc-tile-note { display: block; margin-top: .25rem; color: var(--c-text-muted); font-size: .8rem; }

/* chart card */
.kpc {
    --grid: color-mix(in srgb, var(--c-text) 10%, transparent);
    --axis: color-mix(in srgb, var(--c-text) 24%, transparent);
    min-width: 0;
    margin: 0;
    padding: 1.25rem 1.25rem 1.05rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-bg);
}
.kpc-head { display: flex; flex-direction: column; gap: .2rem; }
.kpc-title { color: var(--c-text); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.kpc-sub { color: var(--c-text-muted); font-size: .82rem; line-height: 1.45; }
.kpc-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .8rem 0 0; padding: 0; list-style: none; color: var(--c-text-muted); font-size: .82rem; }
.kpc-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.kpc-key { width: .7rem; height: .7rem; border-radius: 3px; background: var(--kpc-c); }

/* columns: the plot reads left to right in both languages, like the dashboard's own charts */
.kpc-plot { position: relative; height: 13rem; margin-top: 1.35rem; }
.kpc-grid, .kpc-cols { position: absolute; inset: 0 0 0 2.75rem; }
.kpc-grid span { position: absolute; left: 0; right: 0; bottom: var(--y); border-top: 1px solid var(--grid); }
.kpc-grid span:first-child { border-top-color: var(--axis); }
.kpc-grid b {
    position: absolute;
    right: calc(100% + .55rem);
    bottom: -.45em;
    color: var(--c-text-muted);
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.kpc-cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.kpc-col { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; border-radius: 8px; outline: none; }
.kpc-col::before { content: ''; position: absolute; inset: -.35rem .1rem 0; border-radius: 8px; background: transparent; transition: background-color .15s ease; }
.kpc-col:hover::before, .kpc-col:focus-visible::before { background: color-mix(in srgb, var(--c-text) 6%, transparent); }
.kpc-col:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }
.kpc-stack { position: relative; display: flex; flex-direction: column-reverse; gap: 2px; width: min(24px, 58%); height: var(--h); }
.kpc-seg { flex: var(--w) 1 0px; min-height: 2px; background: var(--kpc-c); }
.kpc-stack .kpc-seg:last-child { border-radius: 4px 4px 0 0; }
.kpc-group { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.kpc-bar { position: relative; width: 24px; height: var(--h); border-radius: 4px 4px 0 0; background: var(--kpc-c); }
.kpc--grouped .kpc-bar { width: 15px; }
.kpc-val, .kpc-cap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--c-text);
    font-size: .74rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.kpc-val { bottom: calc(var(--h) + .4rem); }
.kpc-cap { bottom: calc(100% + .4rem); }
.kpc-col--last .kpc-val, .kpc-col--last .kpc-cap { left: auto; right: 0; transform: none; }
.kpc-x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: .5rem 0 0 2.75rem; color: var(--c-text-muted); font-size: .72rem; text-align: center; }
.kpc-x span { white-space: nowrap; }
@media (max-width: 480px) {
    .kpc { padding-inline: 1rem; }
    .kpc-x { font-size: .62rem; letter-spacing: -.01em; }
}

/* readout on hover and keyboard focus; the same numbers are in the table */
.kpc-tip {
    position: absolute;
    z-index: 5;
    bottom: calc(100% + .6rem);
    left: 50%;
    min-width: 8.5rem;
    padding: .55rem .7rem;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-surface-raised);
    box-shadow: 0 14px 30px -14px rgba(3, 8, 20, .55);
    color: var(--c-text-muted);
    font-size: .76rem;
    line-height: 1.45;
    text-align: start;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity .15s ease;
}
html[dir='rtl'] .kpc-tip { direction: rtl; text-align: right; }
.kpc-col--first .kpc-tip { left: 0; transform: none; }
.kpc-col--last .kpc-tip { left: auto; right: 0; transform: none; }
.kpc-col:hover .kpc-tip, .kpc-col:focus-visible .kpc-tip { opacity: 1; }
.kpc-tip strong { display: block; color: var(--c-text); font-size: .95rem; }
.kpc-tip em { display: block; font-style: normal; }
.kpc-tip-row { display: flex; align-items: center; gap: .45rem; margin-top: .2rem; color: var(--c-text); }
.kpc-tip-row small { color: var(--c-text-muted); font-size: .72rem; }
.kpc-line { width: .8rem; height: 2px; border-radius: 2px; background: var(--kpc-c); }

/* horizontal bars (faults): bars grow from the reading edge */
.kpc-rows { display: grid; gap: .5rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.kpc-rows li { display: grid; grid-template-columns: minmax(6.5rem, 34%) 1fr; align-items: center; gap: .75rem; padding: .15rem .3rem; border-radius: 6px; outline: none; font-size: .86rem; }
.kpc-rows li:hover, .kpc-rows li:focus-visible { background: color-mix(in srgb, var(--c-text) 6%, transparent); }
.kpc-rows li:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.kpc-row-label { overflow: hidden; color: var(--c-text); text-overflow: ellipsis; white-space: nowrap; }
.kpc-track { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.kpc-hbar { flex: none; width: calc(var(--w) * .82); min-width: 2px; height: 14px; border-radius: 0 4px 4px 0; background: var(--kpc-c); }
html[dir='rtl'] .kpc-hbar { border-radius: 4px 0 0 4px; }
.kpc-track b { color: var(--c-text); font-size: .8rem; font-weight: 700; }

/* the numbers behind each chart */
.kpc-data { margin-top: .95rem; font-size: .85rem; }
.kpc-data summary { display: inline-flex; align-items: center; gap: .4rem; color: var(--c-text-muted); cursor: pointer; border-radius: 6px; }
.kpc-data summary:hover { color: var(--c-text); }
.kpc-data summary:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 3px; }
.kpc-scroll { margin-top: .6rem; overflow-x: auto; }
.kpc-data table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kpc-data th, .kpc-data td { padding: .4rem .55rem; border-bottom: 1px solid var(--c-border); text-align: end; white-space: nowrap; }
.kpc-data thead th { color: var(--c-text-muted); font-size: .78rem; font-weight: 600; }
.kpc-data th[scope='row'], .kpc-data thead th:first-child { text-align: start; font-weight: 600; }

/* ----------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
    .kp-phone--float, .kp-tour.is-tabbed .kp-panel:not([hidden]) { animation: none; }
    .kpc-tip, .kpc-col::before { transition: none; }
}
