/* HomeTwin3D project page (?exp=4). Grey stage, back link and light uppercase
   title follow the carousel subpages; the panels reuse the look of the
   editorial cards in the home page's "3D, Gen AI & More" section. */
body.hometwin-page {
    --ht-accent: #c7ad69;
    --ht-accent-rgb: 199, 173, 105;
    --ht-text: rgba(248, 247, 241, 0.94);
    --ht-muted: rgba(238, 238, 232, 0.74);
    --ht-faint: rgba(238, 238, 232, 0.5);
    --ht-live: #7fc8a9;

    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 30%, #2a2a2a 60%, #1a1a1a 100%) fixed;
    background-color: #2a2a2a;
    color: var(--ht-text);
    font-family: var(--font-main);
    overflow-x: hidden;
}

.hometwin-page *,
.hometwin-page *::before,
.hometwin-page *::after {
    box-sizing: border-box;
}

.hometwin-page :focus-visible {
    outline: 3px solid #e2c264;
    outline-offset: 3px;
}

.hometwin-page .pos-abs-top-right {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
}

.ht-page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 72px 20px 96px;
}

/* ---------- Header (carousel title + home section underline) ---------- */
.ht-head {
    margin-bottom: 26px;
    text-align: center;
}

.ht-title {
    margin: 0;
    color: #fff;
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: clamp(2px, 0.4vw, 5px);
    text-transform: uppercase;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    gap: clamp(10px, 1.4vw, 16px);
}

.ht-title-icon {
    flex: 0 0 auto;
    width: clamp(34px, 4.6vw, 48px);
    height: auto;
    border-radius: 22%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.ht-underline {
    width: 78px;
    height: 1px;
    margin: 14px auto;
    background: linear-gradient(to right, rgba(255, 236, 143, 0.6), rgba(186, 143, 26, 0.9), rgba(255, 236, 143, 0.6));
}

.ht-subtitle {
    margin: 0;
    color: #e0e0e0;
    font-size: clamp(14px, 1.6vw, 17px);
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* ---------- Shared card look ---------- */
.ht-card,
.ht-video-card {
    position: relative;
    margin: 0 0 18px;
    border: 1px solid rgba(var(--ht-accent-rgb), 0.24);
    border-radius: 20px;
    background: linear-gradient(150deg, rgba(45, 46, 41, 0.97), rgba(31, 34, 31, 0.98));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.ht-card {
    padding: 22px 24px 22px;
}

.ht-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 92% 5%, rgba(var(--ht-accent-rgb), 0.12), transparent 38%);
    pointer-events: none;
}

.ht-card > * {
    position: relative;
    z-index: 1;
}

.ht-card-title {
    margin: 0 0 14px;
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(var(--ht-accent-rgb), 0.2);
    color: rgba(237, 236, 229, 0.86);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ht-card > p {
    margin: 0 0 10px;
    color: var(--ht-muted);
    font-size: 14.5px;
    font-weight: 350;
    line-height: 1.55;
}

.ht-card-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    color: var(--ht-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    text-decoration: none;
}

.ht-card-link:hover {
    color: #e2c787;
    text-decoration: none;
}

/* Bullet list with the accent dot of the home page cards. */
.ht-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ht-list li {
    position: relative;
    padding-left: 17px;
    color: var(--ht-muted);
    font-size: 14px;
    font-weight: 350;
    line-height: 1.46;
}

.ht-list li::before {
    content: "";
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ht-accent);
    box-shadow: 0 0 0 3px rgba(var(--ht-accent-rgb), 0.12);
}

.ht-list strong {
    color: var(--ht-text);
    font-weight: 600;
}

.ht-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
}

.ht-features li strong {
    display: block;
}

/* ---------- Video ---------- */
.ht-video-card {
    overflow: hidden;
}

.ht-video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #0d0f0e;
}

.ht-video-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(var(--ht-accent-rgb), 0.2);
}

.ht-video-note {
    color: var(--ht-faint);
    font-size: 12px;
    letter-spacing: 0.02em;
}

.ht-chapters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ht-chapter {
    min-height: 30px;
    padding: 4px 10px;
    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: 11.5px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ht-chapter span {
    color: var(--ht-accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ht-chapter:hover,
.ht-chapter.is-active {
    border-color: rgba(var(--ht-accent-rgb), 0.7);
    background: rgba(var(--ht-accent-rgb), 0.14);
    color: #fff;
}

/* ---------- Two-column cards ---------- */
.ht-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.ht-grid > .ht-card {
    margin-bottom: 18px;
}

/* ---------- Architecture ---------- */
.ht-arch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr) 76px minmax(0, 1fr);
    grid-template-rows: auto 52px auto;
    grid-template-areas:
        "model c-model app c-ws ha"
        ".     .       c-addon . c-devices"
        ".     .       addon   . devices";
}

.ht-node {
    padding: 13px 15px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(7, 11, 10, 0.35);
}

.ht-node--app {
    border-color: rgba(var(--ht-accent-rgb), 0.6);
    background: rgba(var(--ht-accent-rgb), 0.1);
}

.ht-node--ha {
    border-color: rgba(127, 200, 169, 0.45);
}

.ht-node-head {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 8px;
}

.ht-node-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
}

.ht-node-icon img {
    display: block;
    width: 100%;
    height: 100%;
}

.ht-node--app .ht-node-icon {
    border-color: rgba(var(--ht-accent-rgb), 0.5);
    background: none;
}

.ht-node-kicker {
    margin: 0 0 2px;
    color: var(--ht-faint);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ht-node--app .ht-node-kicker {
    color: var(--ht-accent);
}

.ht-node--ha .ht-node-kicker {
    color: var(--ht-live);
}

.ht-node-title {
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.ht-node ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ht-node li {
    color: var(--ht-muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.ht-connector {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
}

.ht-connector > span {
    position: relative;
    z-index: 1;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: #2b2d29;
    color: var(--ht-muted);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.ht-line {
    position: absolute;
}

.ht-connector--h .ht-line {
    top: 50%;
    left: 4px;
    right: 4px;
    height: 2px;
    margin-top: -1px;
    background: repeating-linear-gradient(90deg, var(--ht-accent) 0 6px, transparent 6px 11px);
    background-size: 22px 2px;
    animation: htFlowH 1.4s linear infinite;
}

.ht-connector--v .ht-line {
    top: 4px;
    bottom: 4px;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: repeating-linear-gradient(180deg, var(--ht-accent) 0 6px, transparent 6px 11px);
    background-size: 2px 22px;
    animation: htFlowV 1.4s linear infinite reverse;
}

.ht-connector--h.ht-connector--both .ht-line {
    background-image: repeating-linear-gradient(90deg, var(--ht-live) 0 6px, transparent 6px 11px);
}

.ht-connector--v.ht-connector--both .ht-line {
    background-image: repeating-linear-gradient(180deg, var(--ht-live) 0 6px, transparent 6px 11px);
}

@keyframes htFlowH {
    to { background-position: 22px 0; }
}

@keyframes htFlowV {
    to { background-position: 0 22px; }
}

/* Arrow heads: ::after marks the target end, ::before the start of two-way links. */
.ht-line::before,
.ht-line::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
}

.ht-connector--h .ht-line::after {
    top: 50%;
    right: -2px;
    transform: translateY(-50%);
    border-left: 8px solid var(--ht-accent);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.ht-connector--h.ht-connector--both .ht-line::before {
    top: 50%;
    left: -2px;
    transform: translateY(-50%);
    border-right: 8px solid var(--ht-live);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.ht-connector--h.ht-connector--both .ht-line::after {
    border-left-color: var(--ht-live);
}

.ht-connector--up .ht-line::before,
.ht-connector--v.ht-connector--both .ht-line::before {
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom: 8px solid var(--ht-accent);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.ht-connector--v.ht-connector--both .ht-line::before {
    border-bottom-color: var(--ht-live);
}

.ht-connector--v.ht-connector--both .ht-line::after {
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 8px solid var(--ht-live);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

/* ---------- Tech ---------- */
.ht-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 28px;
}

.ht-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid rgba(var(--ht-accent-rgb), 0.2);
    list-style: none;
}

.ht-chips li {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(7, 11, 10, 0.35);
    color: var(--ht-muted);
    font-size: 11.5px;
    font-weight: 500;
}

.ht-credits {
    margin: 22px auto 0;
    max-width: 70ch;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    text-align: center;
}

.ht-credits a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ht-credits a:hover {
    color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .ht-grid,
    .ht-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .ht-grid {
        gap: 0;
    }

}

@media (max-width: 760px) {
    /* Single column flow: model → app ⇄ HA ⇄ devices, add-on as a branch below. */
    .ht-arch {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-template-areas:
            "model"
            "c-model"
            "app"
            "c-ws"
            "ha"
            "c-devices"
            "devices"
            "c-addon"
            "addon";
    }

    .ht-connector {
        min-height: 44px;
    }

    .ht-connector--h .ht-line {
        top: 4px;
        bottom: 4px;
        left: 50%;
        right: auto;
        width: 2px;
        height: auto;
        margin: 0 0 0 -1px;
        background: repeating-linear-gradient(180deg, var(--ht-accent) 0 6px, transparent 6px 11px);
        background-size: 2px 22px;
        animation-name: htFlowV;
    }

    .ht-connector--h.ht-connector--both .ht-line {
        background-image: repeating-linear-gradient(180deg, var(--ht-live) 0 6px, transparent 6px 11px);
    }

    .ht-connector--h .ht-line::after {
        top: auto;
        bottom: -2px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 8px solid var(--ht-accent);
        border-bottom: 0;
    }

    .ht-connector--h.ht-connector--both .ht-line::after {
        border-top-color: var(--ht-live);
    }

    .ht-connector--h.ht-connector--both .ht-line::before {
        top: -2px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 8px solid var(--ht-live);
        border-top: 0;
    }

    /* The add-on link points back at the web app, which is no longer adjacent. */
    .ht-connector--up .ht-line {
        background: none;
        border-left: 2px dashed rgba(255, 255, 255, 0.18);
        animation: none;
    }

    .ht-connector--up .ht-line::before {
        display: none;
    }

    .ht-connector--up > span::before {
        content: "↑ Webapp · ";
        color: var(--ht-accent);
    }
}

@media (max-width: 575.98px) {
    .ht-page {
        padding: 68px 12px 84px;
    }

    .ht-card {
        padding: 18px 18px;
    }

    .ht-features {
        grid-template-columns: minmax(0, 1fr);
    }

    .ht-video-bar {
        padding: 10px 12px 12px;
    }

    .ht-chapters {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .ht-chapters::-webkit-scrollbar {
        display: none;
    }

    .ht-chapter {
        flex: 0 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ht-line {
        animation: none !important;
    }

    .ht-chapter {
        transition: none;
    }
}
