/* 北京天文钟 — Beijing Astronomical Clock */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=EB+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --bg: #12100d;
    --parchment: #ebdcb2;
    --ink: #3b2c24;
    --ink-faint: rgba(59, 44, 36, 0.25);
    --gold: #b8860b;
    --gold-glow: rgba(184, 134, 11, 0.15);
    --muted: #5e4c3b;
    --hl-color: #ffd700;
    --hl-glow: rgba(255, 215, 0, 0.55);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--parchment);
    background-image: radial-gradient(circle at center, transparent 0%, rgba(50, 30, 10, 0.25) 150%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    font-family: 'EB Garamond', serif;
    color: var(--ink);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ===== ENTRANCE ===== */
.entrance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: entranceFade 1.5s 4s forwards;
}

@keyframes entranceFade {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.entrance-gears {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 40px;
}

.gear {
    position: absolute;
    border: 3px solid rgba(184, 134, 11, 0.5);
    border-radius: 50%;
}

.gear::after {
    content: '⚙';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(184, 134, 11, 0.3);
}

.gear-1 {
    width: 120px;
    height: 120px;
    top: 10px;
    left: 10px;
    animation: spin 3s linear infinite;
}

.gear-1::after {
    font-size: 100px;
    animation: spin 3s linear infinite;
}

.gear-2 {
    width: 80px;
    height: 80px;
    top: 0;
    right: 15px;
    animation: spin 2s linear infinite reverse;
}

.gear-2::after {
    font-size: 70px;
    animation: spin 2s linear infinite reverse;
}

.gear-3 {
    width: 60px;
    height: 60px;
    bottom: 10px;
    left: 50px;
    animation: spin 1.5s linear infinite;
}

.gear-3::after {
    font-size: 50px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.entrance-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold);
    letter-spacing: 6px;
    text-align: center;
    line-height: 1.4;
    opacity: 0;
    animation: fadeIn 2s 0.5s forwards;
}

.entrance-sub {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 1.2rem;
    color: rgba(184, 134, 11, 0.5);
    margin-top: 15px;
    letter-spacing: 3px;
    opacity: 0;
    animation: fadeIn 1.5s 1.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* ===== MAIN ===== */
.main-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    opacity: 0;
    animation: fadeIn 1.5s 4.5s forwards;
}

.back-link {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--ink);
    padding: 6px 14px;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.back-link:hover {
    background: var(--ink);
    color: var(--parchment);
}

.clock-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* ===== LABEL COLUMNS ===== */
.label-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 210px;
    flex-shrink: 0;
    padding: 15px 8px;
    opacity: 0;
    animation: fadeIn 1s 11s forwards;
}

.label-column-left {
    align-items: flex-end;
}

.label-column-right {
    align-items: flex-start;
}

.feature-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--ink-faint);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: 'EB Garamond', serif;
    font-size: 0.78rem;
    color: var(--ink);
    cursor: pointer;
    width: 100%;
    flex-wrap: wrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    letter-spacing: 0.3px;
    position: relative;
}

.feature-btn:hover,
.feature-btn.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 2px 12px rgba(184, 134, 11, 0.15);
}

.label-column-left .feature-btn:hover {
    transform: translateX(3px);
}

.label-column-right .feature-btn:hover {
    transform: translateX(-3px);
}

.btn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.feature-btn:hover .btn-dot,
.feature-btn.active .btn-dot {
    opacity: 1;
}

.btn-arrow {
    position: absolute;
    font-size: 0.7rem;
    color: var(--gold);
    opacity: 0;
    transition: opacity 0.3s;
}

.label-column-left .btn-arrow {
    right: -14px;
}

.label-column-right .btn-arrow {
    left: -14px;
}

.feature-btn:hover .btn-arrow {
    opacity: 1;
}

.btn-status {
    width: 100%;
    font-size: 0.66rem;
    color: var(--gold);
    font-style: italic;
    margin-top: 1px;
    padding-left: 14px;
    line-height: 1.3;
    opacity: 0.85;
    letter-spacing: 0;
}

/* ===== CLOCK CENTER ===== */
.clock-center {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.clock-wrapper {
    position: relative;
    width: 56vmin;
    height: 56vmin;
    max-width: 560px;
    max-height: 560px;
}

#orloj-svg {
    width: 100%;
    height: 100%;
}

/* ===== SVG TEXT ===== */
.zone-label {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    fill: var(--ink-faint);
    letter-spacing: 3px;
}

.zone-label-small {
    font-family: 'EB Garamond', serif;
    font-size: 10px;
    fill: var(--ink-faint);
    font-style: italic;
}

.davinci-mirror {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    fill: var(--ink-faint);
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeIn 1s 5s forwards;
}

/* ===== PHASED DRAWING ===== */
.orloj-draw circle,
.orloj-draw line,
.orloj-draw path {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
}

.phase-1 circle,
.phase-1 line {
    animation: drawS 3s 4.5s cubic-bezier(.4, 0, .2, 1) forwards;
}

.phase-2 circle,
.phase-2 line,
.phase-2 rect {
    animation: drawS 2.5s 5.5s cubic-bezier(.4, 0, .2, 1) forwards;
}

.phase-3 circle,
.phase-3 line {
    animation: drawS 2.5s 6.5s cubic-bezier(.4, 0, .2, 1) forwards;
}

.phase-4 circle,
.phase-4 line {
    animation: drawS 2s 7.5s cubic-bezier(.4, 0, .2, 1) forwards;
}

.phase-5 {
    opacity: 0;
    animation: handsIn 1.5s 9s forwards;
}

@keyframes drawS {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes handsIn {
    0% {
        opacity: 0;
        transform: scale(.5);
    }

    70% {
        opacity: 1;
        transform: scale(1.03);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.clock-hand-anim {
    transform-origin: 0 0;
    transition: transform 0.15s linear;
}

.orloj-text-roman {
    font-family: 'Cinzel', serif;
    fill: var(--ink);
    font-size: 19px;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeIn 1s 6s forwards;
}

.orloj-text-chinese {
    font-family: 'EB Garamond', serif;
    fill: var(--ink);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    animation: fadeIn 1s 5s forwards;
}

.orloj-text-zodiac {
    font-family: 'EB Garamond', serif;
    fill: var(--ink);
    font-size: 13px;
    font-style: italic;
    opacity: 0;
    animation: fadeIn 1s 8s forwards;
}

/* ============================================= */
/* ★★★ HOVER HIGHLIGHT — THE KEY FEATURE ★★★ */
/* ============================================= */
.highlightable {
    transition: filter 0.4s, opacity 0.4s;
}

.highlightable.highlighted {
    filter: url(#highlight-glow) !important;
    opacity: 1 !important;
}

/* Bright gold strokes */
.highlightable.highlighted circle,
.highlightable.highlighted line,
.highlightable.highlighted path {
    stroke: var(--hl-color) !important;
    stroke-width: 3.5 !important;
    transition: stroke 0.3s, stroke-width 0.3s;
}

.highlightable.highlighted text {
    fill: var(--hl-color) !important;
    font-weight: bold !important;
}

.highlightable.highlighted rect {
    fill: var(--hl-glow) !important;
    transition: fill 0.3s;
}

/* Dim everything else when something is highlighted */
#orloj-svg.has-highlight>g:not(.skip-dim) {
    transition: opacity 0.4s;
}

#orloj-svg.has-highlight>g:not(.skip-dim):not(:has(.highlighted)) {
    opacity: 0.25;
}

/* Fallback: dim via class */
.dimmed {
    opacity: 0.2 !important;
    transition: opacity 0.4s;
}

/* ===== FEATURE PANEL ===== */
.feature-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(235, 220, 178, 0.97);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    overflow-y: auto;
    padding: 40px 0;
}

.feature-panel.open {
    opacity: 1;
    pointer-events: auto;
}

.close-panel-btn {
    position: fixed;
    top: 20px;
    right: 25px;
    z-index: 201;
    background: transparent;
    border: 1.5px solid var(--ink);
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
    color: var(--ink);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.close-panel-btn:hover {
    background: var(--ink);
    color: var(--parchment);
}

.feature-panel-inner {
    max-width: 700px;
    width: 90%;
    padding: 40px 30px;
}

.fp-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--ink);
    letter-spacing: 2px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ink-faint);
}

.fp-desc {
    font-family: 'EB Garamond', serif;
    font-size: 1.12rem;
    line-height: 1.8;
    color: var(--ink);
    text-align: justify;
    margin-bottom: 25px;
}

.fp-demo-section {
    background: rgba(59, 44, 36, 0.04);
    border: 1px solid var(--ink-faint);
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 22px;
}

.fp-demo-title {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--gold);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.fp-demo {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

.fp-demo svg {
    width: 100%;
    max-width: 480px;
    height: auto;
}

.fp-demo-note {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.88rem;
    color: var(--muted);
    margin-top: 10px;
    text-align: center;
    line-height: 1.6;
    white-space: pre-line;
}

.fp-details {
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.7;
}

.fp-details h3 {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    margin: 18px 0 6px;
    color: var(--ink);
    letter-spacing: 1px;
}

.fp-details ul {
    padding-left: 18px;
    margin-bottom: 8px;
}

.fp-details li {
    margin-bottom: 4px;
}

.fp-details strong {
    color: var(--ink);
}