/**
 * Village History — brownish home-aligned UI + top timeline navigator
 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --hy-primary: #8b5e3c;
    --hy-primary-light: #a6784f;
    --hy-primary-dark: #5c3d28;
    --hy-accent: #c9a227;
    --hy-bg: #faf6f1;
    --hy-card: #ffffff;
    --hy-text: #2a1f16;
    --hy-text-secondary: #5c4a3a;
    --hy-muted: #8a7460;
    --hy-border: #e8ddd0;
    --hy-shadow: 0 10px 30px -8px rgba(92, 61, 40, 0.16);
    --hy-font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
    --hy-font-body: 'Inter', system-ui, sans-serif;
}

.history-page {
    font-family: var(--hy-font-body);
    background: var(--hy-bg);
    color: var(--hy-text);
}

.hy-hero {
    background: linear-gradient(135deg, var(--hy-primary-dark) 0%, var(--hy-primary) 55%, var(--hy-primary-light) 100%);
    padding: 48px 0 56px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hy-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(201, 162, 39, 0.18), transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.06), transparent 35%);
    pointer-events: none;
}

.hy-hero .container { position: relative; z-index: 1; }

.hy-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    font-size: 0.85rem;
}

.hy-breadcrumb a { color: rgba(255, 255, 255, 0.75); text-decoration: none; }
.hy-breadcrumb a:hover { color: #fff; }
.hy-breadcrumb span { color: rgba(255, 255, 255, 0.4); }
.hy-breadcrumb .current { color: rgba(255, 255, 255, 0.95); }

.hy-hero-title {
    font-family: var(--hy-font-display);
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 10px;
}

.hy-hero-sub {
    margin: 0;
    max-width: 560px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.55;
}

.hy-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hy-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.hy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 12px;
    font-family: var(--hy-font-display);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hy-btn:hover { transform: translateY(-2px); text-decoration: none; }

.hy-btn-primary {
    background: linear-gradient(135deg, var(--hy-primary) 0%, var(--hy-primary-light) 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(139, 94, 60, 0.35);
}
.hy-btn-primary:hover { color: #fff; }

.hy-btn-light {
    background: #fff;
    color: var(--hy-primary-dark);
}
.hy-btn-light:hover { color: var(--hy-primary); }

.hy-btn-outline {
    background: transparent;
    color: var(--hy-primary);
    border: 1.5px solid var(--hy-border);
}
.hy-btn-outline:hover {
    border-color: var(--hy-primary);
    background: rgba(139, 94, 60, 0.05);
    color: var(--hy-primary-dark);
}

.hy-btn-ghost {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}
.hy-btn-ghost:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Top timeline navigator — horizontal */
.hy-nav-section {
    padding: 28px 0 8px;
    position: relative;
    z-index: 40;
}

.hy-nav-card {
    background: var(--hy-card);
    border: 1px solid var(--hy-border);
    border-radius: 20px;
    box-shadow: 0 4px 18px rgba(92, 61, 40, 0.06);
    padding: 22px 18px 28px;
    overflow: visible;
}

.hy-nav-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.hy-nav-head h2 {
    font-family: var(--hy-font-display);
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}

.hy-nav-head p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--hy-muted);
}

.hy-timeline {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    max-width: none;
    margin: 0;
    padding: 56px 24px 28px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.hy-timeline::-webkit-scrollbar { height: 6px; }
.hy-timeline::-webkit-scrollbar-thumb {
    background: rgba(139, 94, 60, 0.35);
    border-radius: 999px;
}

.hy-timeline::before {
    content: '';
    position: absolute;
    left: 24px;
    right: 24px;
    top: 76px;
    bottom: auto;
    width: auto;
    height: 3px;
    background: linear-gradient(90deg, rgba(139, 94, 60, 0.15), rgba(139, 94, 60, 0.5), rgba(139, 94, 60, 0.15));
    transform: none;
    border-radius: 999px;
}

.hy-timeline-track {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: max-content;
    z-index: 1;
}

.hy-year-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.hy-year-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0 6px 0 10px;
    padding-top: 4px;
}

.hy-year-mark span {
    font-family: var(--hy-font-display);
    font-weight: 800;
    font-size: 0.78rem;
    background: var(--hy-primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(139, 94, 60, 0.3);
    white-space: nowrap;
}

.hy-nodes {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 18px;
    padding: 0;
}

.hy-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 88px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    text-align: center;
    min-height: 0;
    z-index: 2;
}

.hy-node:hover,
.hy-node.is-active,
.hy-node:focus-visible {
    z-index: 80;
}

.hy-node-mid {
    position: relative;
    width: 100%;
    height: 28px;
    margin-top: 10px;
}

.hy-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--hy-primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.2);
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hy-node:hover .hy-dot,
.hy-node.is-active .hy-dot {
    transform: translate(-50%, -50%) scale(1.35);
    background: var(--hy-accent);
    box-shadow: 0 0 0 6px rgba(201, 162, 39, 0.25);
}

.hy-node-date {
    order: 3;
    margin-top: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--hy-muted);
    line-height: 1.2;
    white-space: nowrap;
}

.hy-node-title {
    order: 4;
    margin-top: 4px;
    font-family: var(--hy-font-display);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--hy-text);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 88px;
}

.hy-node:hover .hy-node-title {
    color: var(--hy-primary);
}

/* Hover image preview — floats above the dot */
/* Hover image preview — fixed on top of all layers (position set by JS) */
.hy-preview {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    top: auto;
    right: auto;
    z-index: 5;
    width: 132px;
    background: #fff;
    border: 1px solid var(--hy-border);
    border-radius: 12px;
    box-shadow: var(--hy-shadow);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.hy-preview.is-floating {
    position: fixed;
    bottom: auto;
    right: auto;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, calc(-100% - 10px));
}

.hy-node:hover .hy-preview:not(.is-floating),
.hy-node:focus-visible .hy-preview:not(.is-floating),
.hy-node.is-active .hy-preview:not(.is-floating) {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.hy-preview img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #f0e6da;
}

.hy-preview-cap {
    margin: 5px 2px 0;
    font-size: 0.68rem;
    color: var(--hy-muted);
    font-weight: 600;
    text-align: center;
}

/* Toolbar */
.hy-toolbar {
    padding: 12px 0 8px;
}

.hy-toolbar-card {
    background: var(--hy-card);
    border: 1px solid var(--hy-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(92, 61, 40, 0.04);
}

.hy-toolbar-card .form-control {
    border-radius: 10px;
    border: 1.5px solid var(--hy-border);
    background: var(--hy-bg);
    padding: 10px 12px;
}

.hy-toolbar-card .form-control:focus {
    border-color: var(--hy-primary);
    box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.12);
    background: #fff;
}

.hy-decade-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hy-decade-pills a {
    text-decoration: none;
    border: 1px solid var(--hy-border);
    background: #fff;
    color: var(--hy-text-secondary);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
}

.hy-decade-pills a:hover,
.hy-decade-pills a.active {
    background: var(--hy-primary);
    border-color: var(--hy-primary);
    color: #fff;
}

/* Gallery */
.hy-gallery {
    padding: 20px 0 64px;
}

.hy-year-section {
    margin-bottom: 36px;
    scroll-margin-top: 90px;
}

.hy-year-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.hy-year-heading h3 {
    font-family: var(--hy-font-display);
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
    color: var(--hy-primary-dark);
}

.hy-year-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--hy-border), transparent);
}

.hy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.hy-card {
    background: var(--hy-card);
    border: 1px solid var(--hy-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(92, 61, 40, 0.04);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    scroll-margin-top: 100px;
}

.hy-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--hy-shadow);
}

.hy-card.is-flash {
    animation: hy-flash 1.2s ease;
}

@keyframes hy-flash {
    0%, 100% { box-shadow: 0 2px 10px rgba(92, 61, 40, 0.04); }
    30% { box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.45), var(--hy-shadow); }
}

.hy-card-media {
    position: relative;
    height: 200px;
    background: #efe4d6;
    cursor: pointer;
    border: none;
    padding: 0;
    width: 100%;
    display: block;
}

.hy-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hy-card-year {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(92, 61, 40, 0.85);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.hy-card-body { padding: 16px; }

.hy-card-title {
    font-family: var(--hy-font-display);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.hy-card-desc {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--hy-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hy-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--hy-muted);
}

.hy-empty {
    text-align: center;
    padding: 56px 20px;
    background: #fff;
    border: 1px solid var(--hy-border);
    border-radius: 18px;
}

.hy-empty i {
    font-size: 2.4rem;
    color: var(--hy-muted);
    margin-bottom: 12px;
}

.hy-upload-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #f3e8da, #fff8f0);
    border: 1px solid var(--hy-border);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 24px;
}

.hy-upload-bar h3 {
    font-family: var(--hy-font-display);
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 2px;
}

.hy-upload-bar p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--hy-muted);
}

.hy-alert {
    border-radius: 12px;
    margin-bottom: 16px;
}

/* Modals */
.hy-modal .modal-content {
    border: none;
    border-radius: 18px;
    overflow: hidden;
}

.hy-modal .modal-header {
    background: linear-gradient(135deg, var(--hy-primary-dark), var(--hy-primary));
    color: #fff;
    border: none;
}

.hy-modal .modal-header .btn-close { filter: invert(1); }

.hy-modal .modal-body img {
    max-height: 65vh;
    width: auto;
    max-width: 100%;
    border-radius: 12px;
}

@media (max-width: 991px) {
    .hy-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
    .hy-timeline {
        padding: 48px 16px 24px;
    }

    .hy-timeline::before {
        left: 16px;
        right: 16px;
        top: 68px;
    }

    .hy-node {
        width: 76px;
    }

    .hy-node-title {
        max-width: 76px;
        font-size: 0.68rem;
    }

    .hy-preview {
        width: 118px;
    }

    .hy-preview img {
        height: 76px;
    }

    .hy-grid { grid-template-columns: 1fr; }
    .hy-card-media { height: 180px; }
}
