/* ==========================================================================
   SC88 — Chuyển đổi link
   Layout dựng theo file Figma (PC 1920x1080, Mobile 430x1080).
   Mọi khoảng cách viết theo đơn vị rem = 10px của bản thiết kế,
   nên 1 con số trong CSS = 1/10 giá trị px trong Figma.
   ========================================================================== */

:root {
    --orange: #F27121;
    --orange-strong: #FA6A1B;
    --orange-soft: #FF973F;
    --amber: #F99A00;
    --gauge-green: #39D353;
    --gauge-green-bright: #5CFF3A;
    --heading-muted: #676565;
    --label: #353535;
    --card-surface: rgba(255, 255, 255, 0.3);
    --btn-gradient: linear-gradient(90deg, #FA6A1B 0%, #FF8000 42.7%, #FB7C2A 100%);
    --title-gradient: linear-gradient(180deg, #FC9046 0%, #F95909 100%);
}
/* Transition mau khi bo hover */
@property --card-bg {
    syntax: '<color>';
    inherits: false;
    initial-value: rgba(255, 255, 255, 0.3);
}

@property --gauge-accent {
    syntax: '<color>';
    inherits: true;
    initial-value: #F2711F;
}

@property --gauge-arc {
    syntax: '<color>';
    inherits: true;
    initial-value: #F99A00;
}

@property --dot-from {
    syntax: '<color>';
    inherits: true;
    initial-value: #FF9D00;
}

@property --dot-to {
    syntax: '<color>';
    inherits: true;
    initial-value: #997A00;
}

@property --dot-glow {
    syntax: '<color>';
    inherits: true;
    initial-value: rgba(255, 157, 0, 0.9);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--label);
    background-color: #FFF3EB;
    background-image: url(../assets/images/bg-pc.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    overflow-x: hidden;
}

img,
svg {
    display: block;
    max-width: 100%;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ------------------------------ Hero ------------------------------ */

.hero__visual img {
    width: 100%;
    height: auto;
    cursor: pointer;
    filter: drop-shadow(0 2rem 4rem rgba(200, 120, 60, 0.18));
}

.hero__title {
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.174;
}

.hero__title-line {
    display: block;
    white-space: nowrap;
}

.hero__title-line--muted {
    color: var(--heading-muted);
}

.hero__title-line--accent {
    background: var(--title-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.features {
    display: flex;
    align-items: center;
    color: var(--orange);
}

.features__item {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.features__icon {
    width: auto;
    flex-shrink: 0;
}

.features__divider {
    width: 0.2rem;
    background: var(--orange);
    flex-shrink: 0;
}

/* --------------------------- Link cards --------------------------- */

.links {
    display: flex;
}

/* --u = 1px cua card (card goc 309px) */
.link-card {
    --u: calc(var(--card-w) / 309);
    --card-bg: var(--card-surface);
    --gauge-accent: #F2711F;
    --gauge-arc: #F99A00;
    --dot-from: #FF9D00;
    --dot-to: #997A00;
    --dot-glow: rgba(255, 157, 0, 0.9);
    position: relative;
    width: var(--card-w);
    aspect-ratio: 309 / 272;
    flex-shrink: 0;
    border: calc(2 * var(--u)) solid var(--orange-soft);
    border-radius: calc(44 * var(--u));
    background: var(--card-bg);
    backdrop-filter: blur(calc(20 * var(--u)));
    -webkit-backdrop-filter: blur(calc(20 * var(--u)));
    box-shadow:
        inset 0 calc(-17 * var(--u)) calc(10.3 * var(--u)) #FFFFFF,
        inset 0 calc(11 * var(--u)) calc(10.3 * var(--u)) #FFFFFF;
    transition:
        transform 0.5s ease,
        box-shadow 0.5s ease,
        border-color 0.5s ease,
        --card-bg 0.5s ease,
        --gauge-accent 0.5s ease,
        --gauge-arc 0.5s ease,
        --dot-from 0.5s ease,
        --dot-to 0.5s ease,
        --dot-glow 0.5s ease;
}

/* Hover vao 0.5s */
.link-card.is-hover {
    --gauge-accent: #39D353;
    --gauge-arc: #5CFF3A;
    --dot-from: #5CFF3A;
    --dot-to: #1F9A2E;
    --dot-glow: rgba(92, 255, 58, 0.95);
    transform: translateY(calc(-4 * var(--u)));
    border-color: var(--orange);
    box-shadow:
        inset 0 calc(-17 * var(--u)) calc(10.3 * var(--u)) #FFFFFF,
        inset 0 calc(11 * var(--u)) calc(10.3 * var(--u)) #FFFFFF,
        0 calc(8 * var(--u)) calc(24 * var(--u)) rgba(242, 113, 33, 0.22);
    animation: cardHoverBg 0.5s ease forwards;
}

/* Trang thai ket thuc hover (dung cho intro load) — khong animation */
.link-card.is-hover-end {
    --gauge-accent: #39D353;
    --gauge-arc: #5CFF3A;
    --dot-from: #5CFF3A;
    --dot-to: #1F9A2E;
    --dot-glow: rgba(92, 255, 58, 0.95);
    --card-bg: #fdfae8;
    background: #fdfae8;
    transform: translateY(calc(-4 * var(--u)));
    border-color: var(--orange);
    box-shadow:
        inset 0 calc(-17 * var(--u)) calc(10.3 * var(--u)) #FFFFFF,
        inset 0 calc(11 * var(--u)) calc(10.3 * var(--u)) #FFFFFF,
        0 calc(8 * var(--u)) calc(24 * var(--u)) rgba(242, 113, 33, 0.22);
    transition: none;
}

.link-card.is-hover-end .gauge__dial {
    filter: hue-rotate(88deg) saturate(3.4) brightness(1.18);
    transition: none;
}

.link-card.is-hover-end .gauge__value {
    text-shadow: 0 0 calc(10 * var(--u)) rgba(92, 255, 58, 0.55);
    transition: none;
}

.link-card.is-hover-end .btn-play::before {
    opacity: 1;
    transition: none;
}

/* Bo hover 0.5s: tu ket thuc ve mac dinh */
.link-card.is-leaving {
    animation: cardLeaveBg 0.5s ease forwards;
}

.link-card.is-leaving .gauge__dial {
    animation: gaugeDialSpinReverse 0.5s linear 1;
}

.link-card.is-leaving .gauge__arc {
    animation: gaugeArcSpinReverse 0.5s linear 1;
}

/* Intro load trang: leave 1s */
.link-card.is-leaving.is-intro-leave {
    animation-duration: 1s;
    transition-duration: 1s;
}

.link-card.is-leaving.is-intro-leave .gauge__dial,
.link-card.is-leaving.is-intro-leave .gauge__arc {
    animation-duration: 1s;
}

.link-card.is-leaving.is-intro-leave .gauge__dial,
.link-card.is-leaving.is-intro-leave .gauge__value,
.link-card.is-leaving.is-intro-leave .link-card__dot,
.link-card.is-leaving.is-intro-leave .btn-play::before {
    transition-duration: 1s;
}

.gauge {
    position: absolute;
    top: calc(11 * var(--u));
    left: 50%;
    transform: translateX(-50%);
    width: calc(158 * var(--u));
    height: calc(158 * var(--u));
}

.gauge__dial,
.gauge__arc {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.gauge__dial {
    filter: none;
    transition: filter 0.5s ease;
}

.link-card.is-hover .gauge__dial {
    /* ticks be → neon green; tâm trắng gần như giữ nguyên */
    filter: hue-rotate(88deg) saturate(3.4) brightness(1.18);
    animation: gaugeDialSpin 0.5s linear 1;
}

.gauge__arc-fill {
    fill: none;
    stroke: var(--gauge-arc);
    stroke-width: 6;
    stroke-linecap: round;
    /* pathLength=100 — JS set dasharray cố định [cung][khe][cung][khe] */
    stroke-dasharray: 22 28 22 28;
    stroke-dashoffset: 0;
    transform-box: view-box;
    transform-origin: 79px 79px;
    /* Mẫu: cung trên-trái (~10→12:30) & dưới-phải (~4→6:30) */
    transform: rotate(-150deg);
    transition: stroke 0.5s ease;
}

.link-card.is-hover .gauge__arc {
    /* forwards: kết thúc xoay dừng ở 9h & 3h */
    animation: gaugeArcSpin 0.5s linear 1 forwards;
}

.gauge__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(25 * var(--u));
    font-weight: 700;
    color: var(--gauge-accent);
    text-shadow: none;
    font-variant-numeric: tabular-nums;
    transition: color 0.5s ease, text-shadow 0.5s ease;
}

.link-card.is-hover .gauge__value {
    text-shadow: 0 0 calc(10 * var(--u)) rgba(92, 255, 58, 0.55);
}

.link-card__label {
    position: absolute;
    top: calc(173 * var(--u));
    left: 0;
    right: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(8 * var(--u));
    font-size: calc(16 * var(--u));
    font-weight: 700;
    color: var(--label);
    white-space: nowrap;
}

.link-card__dot {
    width: calc(16 * var(--u));
    height: calc(16 * var(--u));
    border-radius: 50%;
    background: linear-gradient(180deg, var(--dot-from) 0%, var(--dot-to) 100%);
    box-shadow: 0 0 calc(9 * var(--u)) var(--dot-glow);
    flex-shrink: 0;
    transition: background 0.5s ease, box-shadow 0.5s ease, transform 0.5s ease;
}

.link-card.is-hover .link-card__dot {
    animation: gaugeDotPulse 0.5s ease-in-out 1;
}

.btn-play {
    position: absolute;
    top: calc(207 * var(--u));
    left: 50%;
    transform: translateX(-50%);
    width: calc(227 * var(--u));
    height: calc(51 * var(--u));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(14 * var(--u));
    border: 1px solid var(--orange);
    border-radius: calc(25.5 * var(--u));
    background: var(--btn-gradient);
    box-shadow: inset 0 calc(-3 * var(--u)) calc(4 * var(--u)) rgba(159, 0, 0, 0.25);
    color: #FFFFFF;
    font-size: calc(20.8 * var(--u));
    font-weight: 700;
    text-decoration: none;
    isolation: isolate;
    overflow: hidden;
    transition: transform 0.5s ease;
}

.btn-play::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #fdbd0d;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s ease;
}

.btn-play:hover {
    transform: translateX(-50%) translateY(calc(-3 * var(--u)));
}

.btn-play:hover::before,
.link-card.is-hover .btn-play::before {
    opacity: 1;
}

.link-card.is-hover .btn-play__arrow {
    animation: btnArrowNudge 0.5s ease-in-out 1;
}

.btn-play__arrow {
    width: calc(26 * var(--u));
    height: auto;
    fill: none;
    stroke: #FFFFFF;
    stroke-width: 2.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
}

@keyframes gaugeDialSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes gaugeDialSpinReverse {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }
}

@keyframes cardHoverBg {
    /* Cả 0.5s đều #fdfae8 (0.3s đầu giống 0.2s cuối) */
    0%,
    100% {
        --card-bg: #fdfae8;
        background: #fdfae8;
    }
}

@keyframes cardLeaveBg {
    /* 0.5s: #fdfae8 → mặc định */
    0% {
        --card-bg: #fdfae8;
        background: #fdfae8;
    }

    100% {
        --card-bg: rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.3);
    }
}

@keyframes gaugeArcSpin {
    from {
        transform: rotate(0deg);
    }

    /* 360° + 110.4°: base fill -150° → hiệu ứng dừng tại 9h & 3h */
    to {
        transform: rotate(470.4deg);
    }
}

@keyframes gaugeArcSpinReverse {
    from {
        transform: rotate(470.4deg);
    }

    to {
        transform: rotate(0deg);
    }
}

@keyframes gaugeDotPulse {

    0%,
    100% {
        box-shadow: 0 0 calc(9 * var(--u)) var(--dot-glow);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 calc(16 * var(--u)) var(--dot-glow);
        transform: scale(1.12);
    }
}

@keyframes btnArrowNudge {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(calc(3 * var(--u)));
    }
}

/* --------------------------- Speed test --------------------------- */

.speedtest {
    display: flex;
    align-items: center;
}

.speedtest__line {
    position: relative;
    height: 0.15rem;
    flex-shrink: 0;
    /* Trái: mờ → đậm, đầu gần nút có kim cương */
    background: linear-gradient(90deg, transparent 0%, var(--orange) 100%);
}

.speedtest__line::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 1rem;
    height: 1rem;
    background: var(--orange);
    transform: translate(35%, -50%) rotate(45deg);
    pointer-events: none;
}

.speedtest__line--right {
    /* Phải: đậm → mờ, kim cương ở đầu gần nút (bên trái) */
    background: linear-gradient(90deg, var(--orange) 0%, transparent 100%);
}

.speedtest__line--right::after {
    right: auto;
    left: 0;
    transform: translate(-35%, -50%) rotate(45deg);
}

.speedtest__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    border: 0.23rem solid var(--orange-strong);
    border-radius: 999rem;
    color: var(--orange);
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow:
        inset -0.46rem -0.92rem 1.68rem rgba(238, 213, 191, 0.25),
        inset 0.31rem 0.61rem 1.22rem rgba(255, 255, 255, 0.32),
        0 0 0 0.46rem rgba(222, 162, 109, 0.25);
    transition:
        transform 0.5s ease,
        background 0.5s ease,
        border-color 0.5s ease,
        box-shadow 0.5s ease,
        color 0.5s ease;
}

/* 2 cung vàng trên/dưới — hiện khi hover */
.speedtest__btn::before {
    content: '';
    position: absolute;
    inset: 0.12rem;
    border-radius: inherit;
    border: 0.22rem solid transparent;
    border-top-color: #FFD23A;
    border-bottom-color: #FFD23A;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.speedtest__btn:hover {
    background: #fdfae8;
    border-color: #E8B07A;
    color: var(--orange);
    transform: translateY(-0.3rem);
    box-shadow:
        inset 0 -0.2rem 0.6rem rgba(255, 255, 255, 0.7),
        inset 0 0.15rem 0.5rem rgba(255, 255, 255, 0.5),
        0 0 0 0.46rem rgba(232, 176, 122, 0.4);
}

.speedtest__btn:hover::before {
    opacity: 1;
}

.speedtest__btn:disabled {
    cursor: progress;
    opacity: 0.75;
}

.speedtest__btn:disabled .speedtest__icon {
    animation: speedtestPulse 0.9s ease-in-out infinite;
}

.speedtest__icon,
.speedtest__label {
    position: relative;
    z-index: 1;
}

@keyframes speedtestPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.14);
    }
}

/* ============================= PC ============================= */
/* 1rem = 10px của thiết kế 1920x1080 → trang luôn vừa đúng 1 màn hình */

@media (min-width: 1025px) {

    html {
        font-size: min(0.5208vw, 0.9259vh);
    }

    body {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        overflow: hidden;
    }

    .page {
        position: relative;
        width: 192rem;
        height: 108rem;
        flex-shrink: 0;
    }

    .hero__visual {
        position: absolute;
        top: 4rem;
        left: 22.7rem;
        width: 65.1rem;
    }

    .hero__content {
        position: absolute;
        top: 24.3rem;
        left: 86.6rem;
        width: 78.2rem;
        display: flex;
        flex-direction: column;
        gap: 1.8rem;
        filter: drop-shadow(0 0 6rem #FFFFFF);
    }

    .hero__title {
        font-size: 8.522rem;
    }

    .features {
        gap: 3.5rem;
        font-size: 2.0924rem;
    }

    .features__item {
        gap: 1.3rem;
    }

    .features__icon--security {
        height: 3.157rem;
    }

    .features__icon--speed {
        height: 3.018rem;
    }

    .features__icon--easy {
        height: 2.952rem;
    }

    .features__divider {
        height: 2.2rem;
    }

    .links {
        position: absolute;
        top: 63.9rem;
        left: 26.4rem;
        width: 137.1rem;
        gap: 4.5rem;
    }

    .link-card {
        --card-w: 30.9rem;
    }

    .speedtest {
        position: absolute;
        top: 93.8rem;
        left: 55.6rem;
        width: 84.9rem;
        gap: 2.5rem;
    }

    .speedtest__line {
        width: 21.9rem;
    }

    .speedtest__btn {
        width: 36.1rem;
        height: 6.11rem;
        gap: 1.53rem;
        font-size: 3.056rem;
    }

    .speedtest__icon {
        width: 3.667rem;
        height: 3.667rem;
    }
}

/* ============================ Mobile ============================ */
/* 1rem = 10px của thiết kế 430px */

@media (max-width: 1024px) {

    html {
        font-size: min(2.3256vw, 11px);
    }

    body {
        background-image: url(../assets/images/bg-mobile.jpg);
        background-attachment: scroll;
        background-size: 100% 100%;
        min-height: 100vh;
    }

    .page {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        min-height: 100vh;
        padding: 1rem 1.2rem 3rem;
    }

    .hero {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .hero__visual {
        width: 45.3rem;
        max-width: 108%;
        margin-bottom: -6.1rem;
    }

    .hero__content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.87rem;
        width: 100%;
        text-align: center;
        filter: drop-shadow(0 0 3.2rem #FFFFFF);
    }

    .hero__title {
        font-size: 4.126rem;
    }

    .features {
        gap: 1.69rem;
        font-size: 1.153rem;
    }

    .features__item {
        gap: 0.63rem;
    }

    .features__icon--security {
        height: 1.528rem;
    }

    .features__icon--speed {
        height: 1.461rem;
    }

    .features__icon--easy {
        height: 1.429rem;
    }

    .features__divider {
        height: 1.07rem;
        width: 0.1rem;
    }

    .links {
        display: grid;
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        gap: 0.53rem 0.7rem;
        margin-top: 2.6rem;
    }

    .link-card {
        --card-w: 19.922rem;
    }

    .speedtest {
        width: 100%;
        justify-content: center;
        gap: 1.6rem;
        margin-top: 2.5rem;
    }

    .speedtest__line {
        width: 6.8rem;
        height: 0.12rem;
    }

    .speedtest__line::after {
        width: 0.72rem;
        height: 0.72rem;
    }

    .speedtest__btn {
        width: 23.63rem;
        height: 4rem;
        gap: 1rem;
        font-size: 2rem;
        border-width: 0.15rem;
        box-shadow:
            inset -0.3rem -0.6rem 1.1rem rgba(238, 213, 191, 0.25),
            inset 0.2rem 0.4rem 0.8rem rgba(255, 255, 255, 0.32),
            0 0 0 0.3rem rgba(222, 162, 109, 0.25);
    }

    .speedtest__btn:hover {
        box-shadow:
            inset 0 -0.15rem 0.4rem rgba(255, 255, 255, 0.7),
            inset 0 0.1rem 0.35rem rgba(255, 255, 255, 0.5),
            0 0 0 0.3rem rgba(232, 176, 122, 0.4);
    }

    .speedtest__btn::before {
        inset: 0.08rem;
        border-width: 0.15rem;
    }

    .speedtest__icon {
        width: 2.4rem;
        height: 2.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    .btn-play,
    .speedtest__btn,
    .link-card,
    .gauge__dial,
    .gauge__arc-fill,
    .gauge__value,
    .link-card__dot,
    .btn-play__arrow {
        transition: none;
    }

    .speedtest__btn:disabled .speedtest__icon,
    .link-card.is-hover,
    .link-card.is-leaving,
    .link-card.is-hover .gauge__dial,
    .link-card.is-hover .gauge__arc,
    .link-card.is-leaving .gauge__dial,
    .link-card.is-leaving .gauge__arc,
    .link-card.is-hover .link-card__dot,
    .link-card.is-hover .btn-play__arrow {
        animation: none;
    }

    .link-card.is-hover {
        transform: none;
        --card-bg: #fdfae8;
        background: #fdfae8;
    }
}
