/* =========================================================
   TRANG CHỦ — PHONG CÁCH MODERN CIVIC EDITORIAL V2.1 (ROUND 2)
   Ban Quản lý Dự án Đầu tư Xây dựng phường Bến Cát
   Nền chuyển sắc ngà - xanh xám dịu mắt, card cơ quan tinh gọn
   ========================================================= */

:root {
    --civic-navy-950: #071527;
    --civic-navy-900: #0c2340;
    --civic-navy-800: #14355a;
    --civic-navy-700: #1f4a7a;

    --civic-crimson-900: #680d19;
    --civic-crimson-800: #851221;
    --civic-crimson-700: #a3192b;

    --civic-gold-600: #b5831f;
    --civic-gold-500: #c89628;

    /* Nền trắng ngà & xanh xám nhạt dịu mắt (Soft Ivory & Warm Slate) */
    --civic-bg-canvas: #fbfcfd;
    --civic-bg-subtle: #f4f7fa;
    --civic-bg-surface: #eef3f8;

    --civic-border-subtle: rgba(12, 35, 64, 0.08);
    --civic-border-medium: #cbd5e1;
    --civic-border-focus: #14355a;

    --civic-text-heading: #0c2340;
    --civic-text-body: #1e293b;
    --civic-text-muted: #475569;
}

/* =========================================================
   1. HERO SECTION & INTERACTIVE ARCHITECTURAL LINES (B)
   ========================================================= */

.home-hero {
    position: relative;
    padding: 56px 0 64px;
    background: linear-gradient(175deg, #fcfdfd 0%, #f4f7fa 55%, #eef3f8 100%);
    border-bottom: 1px solid var(--civic-border-subtle);
    overflow: hidden;
}

/* Three.js Architectural Lines stage (nằm chìm dưới văn bản) */
.home-hero .hero-interactive-lines-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

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

.home-hero .home-hero__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.95fr);
    align-items: start;
    gap: 48px;
}

.home-hero__copy {
    min-width: 0;
}

.home-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    color: var(--civic-crimson-800);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-hero__eyebrow-mark {
    display: inline-block;
    width: 20px;
    height: 2px;
    background-color: var(--civic-crimson-800);
}

.home-hero h1 {
    margin: 0 0 20px;
    color: var(--civic-navy-900);
    font-family: "Merriweather", Georgia, "Times New Roman", serif;
    font-size: clamp(2.1rem, 3.4vw, 2.7rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.home-hero h1 span {
    display: block;
}

.home-hero h1 span:last-child {
    color: var(--civic-crimson-800);
}

.home-hero__description {
    max-width: 620px;
    margin: 0 0 32px;
    color: var(--civic-text-body);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Cụm nút CTA điều hướng trực diện */
.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.home-hero-button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.home-hero-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.home-hero-button--primary {
    color: #ffffff;
    background-color: var(--civic-crimson-800);
    border: 1px solid var(--civic-crimson-900);
}

.home-hero-button--primary:hover,
.home-hero-button--primary:focus-visible {
    color: #ffffff;
    background-color: var(--civic-crimson-900);
    transform: translateY(-1px);
}

.home-hero-button--secondary {
    color: var(--civic-navy-900);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--civic-border-medium);
}

.home-hero-button--secondary:hover,
.home-hero-button--secondary:focus-visible {
    color: var(--civic-navy-900);
    background-color: #ffffff;
    border-color: var(--civic-navy-800);
    transform: translateY(-1px);
}

/* =========================================================
   Agency Facts Card (Khối thông tin nhận diện cơ quan — Chuẩn R1 tinh chỉnh thẩm mỹ)
   Nền chuyển sắc ngà - xanh xám nhạt, chiều sâu thị giác, điểm nhấn Navy & Burgundy
   ========================================================= */
.home-agency-card {
    position: relative;
    background: linear-gradient(168deg, rgba(255, 255, 255, 0.97) 0%, rgba(251, 253, 254, 0.95) 45%, rgba(244, 247, 251, 0.92) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(12, 35, 64, 0.12);
    border-top: 3px solid var(--civic-navy-900);
    border-radius: 6px;
    padding: 26px 24px 22px;
    box-shadow:
        0 10px 28px -6px rgba(12, 35, 64, 0.07),
        0 4px 12px -2px rgba(12, 35, 64, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.home-agency-card__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    padding-right: 78px;
    border-bottom: 1px solid rgba(12, 35, 64, 0.09);
    position: relative;
}

/* =========================================================
   Dải cờ đuôi nheo Việt Nam R3.3 — Vietnamese Swallowtail Ribbon
   Approved Concept by Owner: Gắn trực tiếp vào nẹp trên bên phải card.
   Thanh mảnh, đuôi V ngược, không cột cờ, không thanh treo, không khung bao.
   Kích thước cờ: 60px x 110px. Vùng render an toàn: 136px x 174px (chống clipping 4 góc)
   ========================================================= */
.home-agency-card__ribbon-flag {
    position: absolute;
    top: -16px;
    right: -12px;
    width: 136px;
    height: 174px;
    z-index: 10;
    pointer-events: auto;
    touch-action: pan-y;
    overflow: visible;
    display: block;
}

.home-agency-ribbon-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    background: transparent !important;
}

.home-agency-ribbon-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    background: transparent !important;
}

/* Progressive enhancement: SVG tĩnh hiển thị mặc định; JS chỉ ẩn sau khi WebGL render thành công */
.home-agency-ribbon-fallback {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.home-agency-ribbon-fallback svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 3px 8px rgba(12, 35, 64, 0.16));
}

/* Chặn stroke kế thừa từ `.public-shell svg` (public-refresh.css) gây viền tối quanh sao/mép trên */
.home-agency-card__ribbon-flag .home-agency-ribbon-fallback svg {
    stroke: none;
}

/* Lớp tương thích ngược R2 */
.home-agency-card__crest {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

.home-agency-card__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    padding: 3px;
    background: #ffffff;
    border: 1px solid rgba(12, 35, 64, 0.08);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(12, 35, 64, 0.04);
}

.home-agency-card__logo img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

/* =========================================================
   Quốc kỳ Việt Nam 3D — Architectural Civic Integration R2
   HOÀN TOÀN KHÔNG DÙNG HỘP VIỀN, KHÔNG STICKER, KHÔNG WIDGET
   Cờ hòa nhập trực tiếp vào không gian card như một thực thể 3D
   ========================================================= */
.home-agency-card__national-flag {
    flex: 0 0 auto;
    width: 148px;
    height: 98px;
    position: relative;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible;
    margin-top: -6px;
    margin-right: -4px;
    display: block;
}

.home-agency-flag-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    background: transparent !important;
    pointer-events: none;
}

.home-agency-flag-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    background: transparent !important;
}

.home-agency-flag-fallback {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.home-agency-flag-fallback svg {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 3px;
    filter: drop-shadow(0 2px 6px rgba(12, 35, 64, 0.12));
}

.home-agency-card__heading {
    width: 100%;
}

.home-agency-card__meta {
    margin: 0 0 4px;
    color: var(--civic-crimson-800);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.home-agency-card h2 {
    margin: 0;
    color: var(--civic-navy-900);
    font-family: "Merriweather", Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
}

.home-agency-card__details {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
}

.home-agency-detail {
    display: grid;
    gap: 2px;
}

.home-agency-detail dt {
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.home-agency-detail dd {
    margin: 0;
    color: var(--civic-navy-900);
    font-size: 0.88rem;
    line-height: 1.5;
}

.home-agency-detail dd strong {
    font-weight: 600;
    color: var(--civic-navy-900);
}

.home-agency-detail dd a {
    color: var(--civic-navy-900);
    text-decoration: underline;
    text-decoration-color: rgba(12, 35, 64, 0.35);
    text-underline-offset: 3px;
    transition: color 140ms ease, text-decoration-color 140ms ease;
}

.home-agency-detail dd a:hover,
.home-agency-detail dd a:focus-visible {
    color: var(--civic-crimson-800);
    text-decoration-color: var(--civic-crimson-800);
}

.home-agency-detail__working-hours {
    display: grid;
    gap: 2px;
    color: #334155;
    font-size: 0.86rem;
    line-height: 1.45;
}

.home-agency-card__footer {
    padding-top: 15px;
    border-top: 1px solid rgba(12, 35, 64, 0.09);
}

.home-agency-card__footer-title {
    margin: 0 0 9px;
    color: var(--civic-navy-800);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-agency-card__footer-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--civic-crimson-800);
}

.home-agency-card__footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.home-agency-card__footer li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 9px 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
    border: 1px solid rgba(12, 35, 64, 0.08);
    border-top: 2.5px solid var(--civic-navy-800);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(12, 35, 64, 0.03);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.home-agency-card__footer li:nth-child(1) {
    border-top-color: var(--civic-navy-800);
}

.home-agency-card__footer li:nth-child(2) {
    border-top-color: #244b7a;
}

.home-agency-card__footer li:nth-child(3) {
    border-top-color: var(--civic-crimson-800);
}

.home-agency-card__footer li:hover {
    transform: translateY(-1px);
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(12, 35, 64, 0.06);
}

.home-agency-card__footer li span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.home-agency-card__footer li:nth-child(1) span {
    color: var(--civic-navy-800);
}

.home-agency-card__footer li:nth-child(2) span {
    color: #244b7a;
}

.home-agency-card__footer li:nth-child(3) span {
    color: var(--civic-crimson-800);
}

.home-agency-card__footer li strong {
    color: var(--civic-navy-900);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}

/* =========================================================
   2. HỆ THỐNG ĐIỀU HƯỚNG CHUYÊN BIỆT (CIVIC GATEWAYS)
   ========================================================= */

.home-civic-gateway {
    padding: 72px 0 80px;
    background-color: var(--civic-bg-subtle);
    border-bottom: 1px solid var(--civic-border-subtle);
}

.home-gateway-header {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: end;
    gap: 48px;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--civic-border-subtle);
}

.home-gateway-eyebrow {
    margin: 0 0 8px;
    color: var(--civic-crimson-800);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-gateway-header h2 {
    margin: 0;
    color: var(--civic-navy-900);
    font-family: "Merriweather", Georgia, serif;
    font-size: clamp(1.6rem, 2.4vw, 1.95rem);
    font-weight: 700;
    line-height: 1.3;
}

.home-gateway-desc {
    margin: 0;
    color: var(--civic-text-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

/* Ma trận Architectural Ledger (2x2 trên Desktop, 1 cột trên Mobile) */
.home-gateway-directory {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}

.home-gateway-item {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 34px 34px 30px;
    background-color: #ffffff;
    border: 1px solid var(--civic-border-subtle);
    border-left: 3px solid var(--civic-navy-800);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(12, 35, 64, 0.02);
    transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.home-gateway-item:hover,
.home-gateway-item:focus-within {
    background-color: #fbfcfd;
    border-color: var(--civic-border-medium);
    border-left-color: var(--civic-crimson-800);
    box-shadow: 0 6px 20px rgba(12, 35, 64, 0.06);
    transform: translateY(-2px);
}

.home-gateway-item__meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.home-gateway-item__numeral {
    font-family: "Merriweather", Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--civic-crimson-800);
    line-height: 1;
}

.home-gateway-item__category {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--civic-navy-700);
    text-transform: uppercase;
}

.home-gateway-item__body {
    flex-grow: 1;
    margin-bottom: 22px;
}

.home-gateway-item__title {
    margin: 0 0 10px;
    font-family: "Merriweather", Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.home-gateway-item__title-link {
    color: var(--civic-navy-900);
    text-decoration: none;
    transition: color 140ms ease;
}

.home-gateway-item__title-link:hover,
.home-gateway-item__title-link:focus-visible {
    color: var(--civic-crimson-800);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.home-gateway-item__synopsis {
    margin: 0;
    color: var(--civic-text-muted);
    font-size: 0.94rem;
    line-height: 1.65;
}

.home-gateway-item__action {
    display: flex;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--civic-border-subtle);
}

.home-gateway-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--civic-crimson-800);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 140ms ease;
}

.home-gateway-link__icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    transition: transform 160ms ease;
}

.home-gateway-item:hover .home-gateway-link__icon,
.home-gateway-link:focus-visible .home-gateway-link__icon {
    transform: translateX(4px);
}

.home-gateway-link:hover,
.home-gateway-link:focus-visible {
    color: var(--civic-crimson-900);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* =========================================================
   3. KHỐI THÔNG BÁO NGUYÊN TẮC THỂ CHẾ (STATUTORY NOTICE)
   ========================================================= */

.home-statutory-notice {
    padding: 32px 0;
    background-color: var(--civic-bg-canvas);
    border-bottom: 1px solid var(--civic-border-subtle);
}

.home-statutory-notice__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.home-statutory-notice__icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--civic-bg-subtle);
    border: 1px solid var(--civic-border-subtle);
    border-radius: 50%;
    color: var(--civic-navy-900);
}

.home-statutory-notice__icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
}

.home-statutory-notice__content {
    flex-grow: 1;
}

.home-statutory-notice__motto {
    margin: 0 0 4px;
    color: var(--civic-navy-900);
    font-size: 0.95rem;
    line-height: 1.5;
}

.home-statutory-notice__agency {
    margin: 0;
    color: var(--civic-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.home-statutory-notice__action {
    flex: 0 0 auto;
}

.home-statutory-notice__link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--civic-navy-900);
    border: 1px solid var(--civic-border-medium);
    border-radius: 4px;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.home-statutory-notice__link:hover,
.home-statutory-notice__link:focus-visible {
    background-color: var(--civic-bg-subtle);
    border-color: var(--civic-navy-800);
}

/* =========================================================
   4. THIẾT KẾ ĐÁP ỨNG (RESPONSIVE VIEWPORTS)
   ========================================================= */

@media (max-width: 1024px) {
    .home-hero .home-hero__layout {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .home-gateway-header {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .home-hero {
        padding: 36px 0 44px;
    }

    .home-hero__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .home-hero-button {
        width: 100%;
    }

    .home-agency-card {
        padding: 20px 18px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .home-agency-card__header {
        gap: 14px;
        padding-bottom: 14px;
        margin-bottom: 14px;
        padding-right: 72px;
    }

    .home-agency-card__logo {
        width: 54px;
        height: 54px;
    }

    .home-agency-card__logo img {
        width: 46px;
        height: 46px;
    }

    .home-agency-card h2 {
        font-size: 1.08rem;
    }

    .home-agency-card__national-flag {
        width: 132px;
        height: 88px;
    }

    .home-agency-card__details {
        gap: 11px;
        margin-bottom: 15px;
    }

    .home-agency-detail dd {
        font-size: 0.85rem;
        word-break: break-word;
    }

    .home-agency-card__footer {
        padding-top: 14px;
    }

    .home-agency-card__footer ul {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .home-agency-card__footer li {
        padding: 7px 6px;
    }

    .home-agency-card__footer li strong {
        font-size: 0.74rem;
        white-space: normal;
        word-break: break-word;
    }

    .home-civic-gateway {
        padding: 48px 0 56px;
    }

    .home-gateway-directory {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .home-gateway-item {
        padding: 24px 20px 20px;
    }

    .home-statutory-notice__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .home-statutory-notice__action {
        width: 100%;
    }

    .home-statutory-notice__link {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .home-agency-card__header {
        gap: 12px;
        padding-bottom: 14px;
        margin-bottom: 14px;
        padding-right: 72px;
    }

    .home-agency-card__crest {
        gap: 10px;
    }

    .home-agency-card__logo {
        width: 48px;
        height: 48px;
    }

    .home-agency-card__logo img {
        width: 40px;
        height: 40px;
    }

    .home-agency-card h2 {
        font-size: 1.02rem;
    }

    .home-agency-card__national-flag {
        width: 114px;
        height: 76px;
    }
}

@media (max-width: 360px) {
    .home-agency-card__header {
        padding-right: 72px;
    }

    .home-agency-card__national-flag {
        width: 96px;
        height: 64px;
    }

    .home-agency-card__footer ul {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .home-agency-card__footer li {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-agency-card__ribbon-flag,
    .home-agency-card__national-flag,
    .home-gateway-item,
    .home-hero-button,
    .home-gateway-link__icon {
        transition: none !important;
        transform: none !important;
    }
}
