/* ============================================================
   TAX.hk 2026 redesign layer
   Loaded after site.css + effects.css. Owns: glass navbar, cinematic
   video hero + live estimator, video-backed dark sections, expertise
   band, refined type scale. Everything motion-related is gated behind
   prefers-reduced-motion; video is poster-only on narrow/data-saver.
   ============================================================ */

:root {
    --ink: #0a1628;
    --ink-2: #13233d;
    --gold: #d4af37;
    --gold-soft: rgba(212, 175, 55, 0.18);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.16);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-display: 'Inter', 'Noto Sans HK', -apple-system, sans-serif;
}

/* ===== Type scale: authority without shouting ===== */
.section-title {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.12;
}
.section-title::after { width: 56px; height: 3px; }
.section-label {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    font-weight: 600;
}
.section-subtitle { color: var(--gray-600); }

/* ===== Navbar: transparent over hero, frosted once scrolled ===== */
.navbar-transparent.scrolled,
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    box-shadow: 0 1px 0 rgba(10, 22, 40, 0.06), 0 8px 30px rgba(10, 22, 40, 0.06);
}
.navbar-transparent:not(.scrolled) {
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.55) 0%, rgba(10, 22, 40, 0) 100%);
}
.navbar-transparent:not(.scrolled) .nav-cta {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.nav-link::after {
    content: '';
    position: absolute;
    left: 1rem; right: 1rem; bottom: 0.15rem;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease-out);
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ===== Cinematic hero ===== */
.hero-cinematic {
    position: relative;
    min-height: 100svh;
    display: grid;
    align-items: center;
    padding: calc(var(--nav-height) + 4.5rem) 0 5rem;
    background: var(--ink);
    color: #fff;
    overflow: hidden;
    isolation: isolate;
}
.hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}
.hero-media video,
.hero-media picture,
.hero-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 60% center;
}
.hero-media video {
    opacity: 0;
    transition: opacity 1.4s ease;
    transform: scale(1.04);
}
.hero-media video.is-playing { opacity: 1; }
/* Readability scrim: dense on the copy side, thin on the skyline side. */
.hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(10, 22, 40, 0.94) 0%, rgba(10, 22, 40, 0.78) 38%, rgba(10, 22, 40, 0.32) 70%, rgba(10, 22, 40, 0.55) 100%),
        linear-gradient(180deg, rgba(10, 22, 40, 0.35) 0%, rgba(10, 22, 40, 0) 30%, rgba(10, 22, 40, 0.75) 100%);
}
/* Fine gold grain keeps flat gradients from banding on wide screens. */
.hero-media::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
    background-image: radial-gradient(rgba(212, 175, 55, 0.12) 0.5px, transparent 0.6px);
    background-size: 3px 3px;
    mix-blend-mode: screen;
}
.hero-inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 4rem;
    align-items: center;
}
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 1.75rem;
}
.hero-eyebrow::before {
    content: '';
    width: 28px; height: 1px;
    background: var(--gold);
}
.hero-cinematic h1 {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 5.2vw, 4.6rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    text-wrap: balance;
}
.hero-cinematic h1 em {
    font-style: normal;
    color: transparent;
    background: linear-gradient(90deg, #f3d670 0%, var(--gold) 45%, #e9c85a 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
.hero-lead {
    font-size: 1.1rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.78);
    max-width: 540px;
    margin-bottom: 2.25rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 3rem; }
.hero-actions .btn { padding: 0.95rem 2rem; font-size: 0.9rem; font-weight: 600; letter-spacing: 0.01em; }
.hero-actions .btn-gold {
    background: var(--gold);
    color: var(--ink);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.28);
}
.hero-actions .btn-gold:hover { background: #e6c84a; transform: translateY(-2px); box-shadow: 0 14px 36px rgba(212, 175, 55, 0.38); }
.hero-actions .btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.5); }
.hero-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 0 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.hero-proof-item { padding: 0.25rem 0; }
.hero-proof-num {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.hero-proof-num small { font-size: 1.1rem; color: var(--gold); margin-left: 2px; }
.hero-proof-label { font-size: 0.78rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.4rem; letter-spacing: 0.02em; }

/* Live estimator card */
.estimator {
    position: relative;
    background: rgba(13, 26, 48, 0.62);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.75rem 1.75rem 1.5rem;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.estimator::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 21px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.55), rgba(255, 255, 255, 0.05) 40%, rgba(13, 137, 191, 0.4));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.estimator-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.estimator-head h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.2rem; color: #fff; }
.estimator-head p { font-size: 0.78rem; color: rgba(255, 255, 255, 0.55); margin: 0; }
.estimator-year {
    flex-shrink: 0;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--gold);
    background: var(--gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 0.3rem 0.6rem;
    border-radius: 60px;
}
.estimator label { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); margin-bottom: 0.45rem; }
.estimator-field { position: relative; margin-bottom: 1rem; }
.estimator-field .prefix {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    font-size: 0.85rem; color: rgba(255, 255, 255, 0.5); pointer-events: none;
}
.estimator-field input[type="text"],
.estimator-field input[type="number"] {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 3.1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: #fff;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.estimator-field input:focus {
    border-color: var(--gold);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}
.estimator-field input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 400; }
.estimator-seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 1.25rem;
}
.estimator-seg input { position: absolute; opacity: 0; pointer-events: none; }
.estimator-seg span {
    display: block;
    text-align: center;
    padding: 0.55rem 0.5rem;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.estimator-seg input:checked + span { background: rgba(255, 255, 255, 0.14); color: #fff; }
.estimator-seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.estimator-result {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 1rem;
    padding: 1.1rem 1.15rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(13, 137, 191, 0.12));
    border: 1px solid rgba(212, 175, 55, 0.25);
    margin-bottom: 1rem;
}
.estimator-result-label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); }
.estimator-result-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
    font-variant-numeric: tabular-nums;
    transition: transform 0.25s var(--ease-out);
}
.estimator-result-value.bump { transform: scale(1.04); }
.estimator-result-side { text-align: right; font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); line-height: 1.4; }
.estimator-result-side strong { display: block; color: var(--gold); font-size: 1rem; font-weight: 600; }
.estimator-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: -0.25rem 0 1rem; }
.estimator-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 0.6s var(--ease-out); }
.estimator-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.estimator-foot small { font-size: 0.68rem; color: rgba(255, 255, 255, 0.4); line-height: 1.4; max-width: 60%; }
.estimator-foot a {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; font-weight: 600; color: var(--gold); text-decoration: none; white-space: nowrap;
}
.estimator-foot a i { transition: transform 0.2s; font-size: 0.7rem; }
.estimator-foot a:hover i { transform: translateX(3px); }

.hero-scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 2;
    width: 26px; height: 42px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
}
.hero-scroll-cue::after {
    content: '';
    position: absolute;
    left: 50%; top: 8px;
    width: 3px; height: 8px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--gold);
    animation: cueDrop 1.8s ease-in-out infinite;
}
@keyframes cueDrop {
    0% { transform: translateY(0); opacity: 1; }
    70% { transform: translateY(14px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

/* Hero entrance choreography */
.hero-cinematic [data-rise] {
    opacity: 0;
    transform: translateY(22px);
    animation: heroRise 0.9s var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 110ms + 120ms);
}
@keyframes heroRise { to { opacity: 1; transform: none; } }

/* ===== Expertise band (marquee of credentials) ===== */
.expertise-band {
    background: #fff;
    border-bottom: 1px solid rgba(10, 22, 40, 0.06);
    padding: 1.4rem 0;
    overflow: hidden;
    position: relative;
}
.expertise-band::before,
.expertise-band::after {
    content: '';
    position: absolute; top: 0; bottom: 0; width: 120px; z-index: 2; pointer-events: none;
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));
}
.expertise-band::before { left: 0; }
.expertise-band::after { right: 0; transform: scaleX(-1); }
.expertise-track {
    display: flex;
    gap: 3.5rem;
    width: max-content;
    animation: bandScroll 42s linear infinite;
}
.expertise-band:hover .expertise-track { animation-play-state: paused; }
.expertise-item {
    display: inline-flex; align-items: center; gap: 0.7rem;
    font-size: 0.82rem; font-weight: 500; color: var(--gray-700); white-space: nowrap;
}
.expertise-item i { color: var(--gold); font-size: 0.95rem; }
.expertise-item .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--gray-300); margin-left: 2.8rem; }
@keyframes bandScroll { to { transform: translateX(-50%); } }

/* ===== Video-backed dark sections ===== */
.video-section { position: relative; isolation: isolate; }
.video-section > .video-bg {
    position: absolute; inset: 0; z-index: -1; overflow: hidden; background: var(--ink);
}
.video-section > .video-bg video,
.video-section > .video-bg img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity 1.2s ease;
}
.video-section > .video-bg img { opacity: 0.28; }
.video-section > .video-bg video.is-playing { opacity: 0.32; }
.video-section > .video-bg::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.85), rgba(10, 22, 40, 0.6) 50%, rgba(10, 22, 40, 0.9));
}
.how-section.video-section, .cta-section.video-section { background: transparent; }
.how-section .how-step .how-number {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold) !important;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 0 8px rgba(212, 175, 55, 0.06);
}
.how-connector { color: rgba(212, 175, 55, 0.5); }
.cta-section .cta-title { font-weight: 600; }
.cta-form button { background: var(--gold); }
.cta-form button:hover { background: #e6c84a; }

/* ===== Card polish: hairline gold reveal on hover ===== */
.tool-card, .article-card, .why-card, .category-card, .consultant-card, .chart-card {
    position: relative;
}
.tool-card::before { background: linear-gradient(90deg, var(--primary), var(--gold)); height: 3px; }
.why-card:hover, .category-card:hover, .article-card:hover, .consultant-card:hover, .chart-card:hover {
    border-color: rgba(212, 175, 55, 0.55);
}
.why-title, .article-title, .category-name { letter-spacing: -0.01em; }
.tool-cta { border-radius: 10px; }

/* ===== Rates: gold accent for hard numbers ===== */
.rate-card { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.rates-year-badge { border: 1px solid rgba(212, 175, 55, 0.35); color: var(--gold); background: var(--gold-soft); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .hero-inner { grid-template-columns: 1fr; gap: 3rem; }
    .estimator { max-width: 560px; }
}
@media (max-width: 768px) {
    .hero-cinematic { min-height: auto; padding: calc(var(--nav-height) + 3rem) 0 4rem; }
    .hero-media::after {
        background:
            linear-gradient(180deg, rgba(10, 22, 40, 0.86) 0%, rgba(10, 22, 40, 0.8) 60%, rgba(10, 22, 40, 0.92) 100%);
    }
    .hero-lead { font-size: 1rem; }
    .hero-proof { gap: 1.25rem 1.75rem; }
    .hero-proof-num { font-size: 1.6rem; }
    .hero-scroll-cue { display: none; }
    .estimator { padding: 1.4rem 1.25rem 1.25rem; }
    .estimator-result-value { font-size: 1.65rem; }
    .estimator-foot { flex-direction: column; align-items: flex-start; }
    .estimator-foot small { max-width: none; }
    /* The deadline bar overlays the hero on desktop; on a phone it wraps to
       three lines and lands on the headline, so flow it above the hero and
       drop the hero's nav offset when it is present. */
    main > .deadline-bar { position: relative; top: auto; padding-top: var(--nav-height); font-size: 0.82rem; }
    main > .deadline-bar .container { padding: 0.5rem 1rem !important; }
    main > .deadline-bar ~ .hero-cinematic { padding-top: 3rem; }
}

/* ===== Motion & data guards ===== */
@media (prefers-reduced-motion: reduce) {
    .hero-cinematic [data-rise] { animation: none; opacity: 1; transform: none; }
    .hero-scroll-cue::after, .expertise-track { animation: none; }
    .hero-media video, .video-bg video { display: none; }
    .hero-media video.is-playing, .video-bg video.is-playing { opacity: 0; }
    .nav-link::after { transition: none; }
}
