/* Automotive portfolio page (?portf=0). Builds on smarthome-project.css
   (body.hometwin-page: stage, header, cards, lists, chips) and adds the
   gallery, key figures, career journey, case studies and code gate. */
body.automotive-page {
    --au-lotus: #d8e021;
    --au-lotus-rgb: 216, 224, 33;
}

/* ---------- Gallery ---------- */
.au-gallery {
    overflow: hidden;
}

.au-stage {
    position: relative;
    aspect-ratio: 2 / 1;
    background: #0d0f0e;
}

.au-stage img,
.au-stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

/* Two stacked layers crossfade; the visible one drifts in slowly (Ken Burns). */
.au-layer {
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1.4s ease, transform 1.4s ease;
}

.au-layer.is-visible {
    opacity: 1;
    transform: scale(1);
}

.au-layer.is-visible.is-zooming {
    animation: auKenBurns 9s ease-out forwards;
}

@keyframes auKenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.07) translateX(-1%); }
}

.au-stage.is-video .au-layer {
    opacity: 0.25;
}

.au-stage-caption {
    position: absolute;
    left: 14px;
    bottom: 12px;
    z-index: 1;
    max-width: calc(100% - 28px);
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(8, 10, 9, 0.62);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.au-stage.is-video .au-stage-caption {
    display: none;
}

.au-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(var(--ht-accent-rgb), 0.2);
    overflow-x: auto;
    scrollbar-width: none;
}

.au-thumbs::-webkit-scrollbar {
    display: none;
}

.au-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 118px;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: #0d0f0e;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.62;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

/* Progress bar of the auto cycle. */
.au-thumb::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 1;
    width: 100%;
    height: 3px;
    background: var(--ht-accent);
    transform: scaleX(0);
    transform-origin: left;
}

.au-thumb.is-running::before {
    animation: auProgress var(--au-cycle, 6000ms) linear forwards;
}

@keyframes auProgress {
    to { transform: scaleX(1); }
}

.au-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.au-thumb:hover,
.au-thumb.is-active {
    border-color: rgba(var(--ht-accent-rgb), 0.85);
    opacity: 1;
}

.au-thumb--video::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.35);
}

.au-thumb-label {
    position: absolute;
    left: 6px;
    bottom: 5px;
    z-index: 1;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Click-to-load notice for YouTube (no request to Google before consent). */
.au-consent {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: rgba(8, 10, 9, 0.78);
    text-align: center;
}

.au-consent p {
    max-width: 46ch;
    margin: 0;
    color: var(--ht-muted);
    font-size: 13px;
    line-height: 1.5;
}

.au-button {
    min-height: 36px;
    padding: 7px 16px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.7);
    border-radius: 999px;
    background: rgba(var(--ht-accent-rgb), 0.16);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
}

.au-button:hover {
    background: rgba(var(--ht-accent-rgb), 0.3);
}

/* ---------- Career journey ---------- */
.au-journey-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
}

.au-years {
    color: var(--ht-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: none;
}

.au-years strong {
    color: var(--ht-accent);
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.au-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.6);
    border-radius: 999px;
    background: rgba(var(--ht-accent-rgb), 0.14);
    color: #fff;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.au-journey {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

/* Road line through the station dots. */
.au-journey::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 8px;
    right: 8px;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--ht-accent-rgb), 0.25), rgba(var(--ht-accent-rgb), 0.9));
}

.au-stop {
    position: relative;
    padding-top: 26px;
}

.au-stop::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    border: 2px solid var(--ht-accent);
    border-radius: 50%;
    background: #2b2d29;
}

.au-stop.is-side::before {
    border-color: rgba(255, 255, 255, 0.35);
}

.au-stop.is-now::before {
    background: var(--ht-accent);
    box-shadow: 0 0 0 5px rgba(var(--ht-accent-rgb), 0.2);
}

.au-stop-year {
    margin: 0 0 4px;
    color: var(--ht-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.au-stop.is-side .au-stop-year {
    color: var(--ht-faint);
}

.au-stop-role {
    margin: 0;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.au-stop-org {
    margin: 2px 0 6px;
    color: var(--ht-faint);
    font-size: 11.5px;
    line-height: 1.35;
}

.au-stop-text {
    margin: 0;
    color: var(--ht-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* ---------- Highlights inside cards ---------- */
.ht-card > .au-kicker {
    margin: -6px 0 12px;
    line-height: 1.4;
    color: var(--ht-faint);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ht-card .ht-chips {
    margin-top: 14px;
}

/* ---------- Competences ---------- */
.au-skills {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.au-skills li {
    padding: 13px 15px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(7, 11, 10, 0.35);
}

.au-skills strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
}

.au-skills span {
    color: var(--ht-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .au-skills {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    /* Vertical journey: line on the left, stations stacked. */
    .au-journey {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding-left: 28px;
    }

    .au-journey::before {
        top: 8px;
        bottom: 8px;
        left: 7px;
        right: auto;
        width: 2px;
        height: auto;
        background: linear-gradient(180deg, rgba(var(--ht-accent-rgb), 0.25), rgba(var(--ht-accent-rgb), 0.9));
    }

    .au-stop {
        padding-top: 0;
    }

    .au-stop::before {
        top: 1px;
        left: -28px;
    }
}

@media (max-width: 575.98px) {
    .au-stage {
        aspect-ratio: 16 / 10;
    }

    .au-thumb {
        width: 96px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .au-layer,
    .au-thumb {
        transition: none;
    }

    .au-layer.is-visible.is-zooming,
    .au-thumb.is-running::before {
        animation: none;
    }
}

/* ---------- Role cards (2 × 2) ---------- */
.au-roles {
    row-gap: 0;
}

/* Equal-height cards: the chip row sits at the bottom of each card. */
.au-roles > .ht-card {
    display: flex;
    flex-direction: column;
}

.au-roles .ht-chips {
    margin-top: auto;
}

.au-roles .ht-list {
    margin-bottom: 14px;
}

/* ---------- Case studies ---------- */
.au-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
}

.au-tab {
    min-height: 34px;
    padding: 5px 13px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.28);
    border-radius: 999px;
    background: rgba(7, 11, 10, 0.4);
    color: var(--ht-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.au-tab span {
    color: var(--ht-accent);
    font-weight: 600;
}

.au-tab:hover,
.au-tab[aria-selected="true"] {
    border-color: rgba(var(--ht-accent-rgb), 0.7);
    background: rgba(var(--ht-accent-rgb), 0.14);
    color: #fff;
}

.au-case {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.au-case[hidden] {
    display: none;
}

.au-case-media {
    margin: 0;
}

.au-fade {
    position: relative;
    aspect-ratio: 16 / 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: #0b0c0b;
    overflow: hidden;
}

/* Screens and charts are shown whole, never cropped. */
.au-fade img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.au-fade img.is-visible {
    opacity: 1;
}

.au-case-caption {
    margin: 8px 2px 0;
    color: var(--ht-faint);
    font-size: 12px;
}

.au-levels {
    display: grid;
    gap: 5px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.au-levels li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ht-muted);
    font-size: 12.5px;
}

/* Each level is indented a bit further: zooming into detail. */
.au-levels li:nth-child(2) { padding-left: 10px; }
.au-levels li:nth-child(3) { padding-left: 20px; }
.au-levels li:nth-child(4) { padding-left: 30px; }
.au-levels li:nth-child(5) { padding-left: 40px; }

.au-levels span {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.6);
    border-radius: 50%;
    color: var(--ht-accent);
    font-size: 11px;
    font-weight: 600;
}

.ht-card .au-case-kicker {
    margin: 0 0 4px;
    color: var(--ht-accent);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.au-case-title {
    margin: 0 0 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
}

.au-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px 14px;
    margin: 0;
}

.au-facts dt {
    color: var(--ht-text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.55;
    text-transform: uppercase;
}

.au-facts dd {
    margin: 0;
    color: var(--ht-muted);
    font-size: 13.5px;
    line-height: 1.5;
}

/* Result chart rebuilt from the study data. */
.au-bars {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--ht-accent-rgb), 0.2);
}

.au-bars figcaption {
    margin-bottom: 10px;
    color: var(--ht-faint);
    font-size: 11.5px;
}

.au-bar {
    display: grid;
    grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 4.8em;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.au-bar-label {
    color: var(--ht-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.au-bar-track {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.07);
}

.au-bar-track i {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: rgba(var(--ht-accent-rgb), 0.55);
}

.au-bar.is-marked .au-bar-track i {
    background: var(--au-lotus);
}

.au-bar-track b,
.au-bars-legend b {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 0;
    border-left: 2px dashed var(--ht-live);
}

.au-bar-value {
    white-space: nowrap;
    color: var(--ht-text);
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.au-bars-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    color: var(--ht-faint);
    font-size: 11.5px;
}

.au-bars-legend b {
    position: static;
    height: 12px;
}

@media (max-width: 900px) {
    .au-case {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 575.98px) {
    .au-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .au-facts dd {
        margin-bottom: 8px;
    }

    .au-bar {
        grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) 4.6em;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .au-fade img,
    .au-tab {
        transition: none;
    }
}

/* ---------- Code gate ---------- */
.au-gate-page {
    max-width: 560px;
    padding-top: clamp(72px, 16vh, 160px);
}

.au-gate {
    padding: 26px 26px 22px;
}

.au-gate-label {
    display: block;
    margin-bottom: 10px;
    color: rgba(237, 236, 229, 0.86);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.au-gate-row {
    display: flex;
    gap: 10px;
}

.au-gate-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.4);
    border-radius: 12px;
    background: rgba(7, 11, 10, 0.5);
    color: #fff;
    font: inherit;
    font-size: 16px;
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
}

.au-gate-input::placeholder {
    color: rgba(255, 255, 255, 0.28);
}

.au-gate-input:focus {
    border-color: var(--ht-accent);
    outline: none;
}

.au-gate-input[aria-invalid="true"] {
    border-color: #e0806b;
}

.au-gate .au-button {
    min-height: 44px;
    padding: 8px 20px;
}

.au-gate .au-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ht-card > .au-gate-error {
    margin: 10px 0 0;
    color: #f0a08e;
    font-size: 13px;
}

.ht-card > .au-gate-note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--ht-accent-rgb), 0.2);
    color: var(--ht-faint);
    font-size: 13px;
}

.au-gate-note a,
.au-confidential a {
    color: var(--ht-accent);
}

.ht-credits.au-confidential {
    margin-top: 8px;
}
