/*
 * Hà Tiên Theme v0.5.0 — Mobile / landing / article stability
 * Nguồn: Homepage Concept 23/07/2026 + Bộ tiêu chuẩn Website 2026.
 */

:root {
    --ht-mobile-gutter: 20px;
    --ht-header-height: 76px;
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    min-width: 320px;
    background: var(--ht-white);
    color: var(--ht-ink);
    font-family: var(--ht-font);
    font-size: 18px;
    font-weight: 400;
}

img,
video,
iframe,
svg,
canvas {
    max-width: 100%;
    height: auto;
}

.wp-site-blocks,
.ht-main,
.ht-page-shell,
.ht-entry-content {
    min-width: 0;
}

/* Header chính: logo, menu, CTA trên một hàng. */
.ht-site-header {
    position: sticky;
    top: 0;
    z-index: 999;
    min-height: var(--ht-header-height);
    background: rgba(7, 17, 22, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px);
}

.ht-header-inner {
    width: min(calc(100% - 40px), 1200px) !important;
    min-height: var(--ht-header-height) !important;
    gap: 20px !important;
}

.ht-brand {
    min-width: 0 !important;
    flex: 0 1 auto;
}

.ht-brand-logo,
.ht-brand-logo a,
.ht-brand-logo img {
    display: block;
}

.ht-brand-logo img {
    width: auto !important;
    max-width: 150px !important;
    max-height: 48px !important;
    object-fit: contain;
}

.ht-header-actions {
    min-width: 0;
    margin-left: auto;
    gap: 14px !important;
}

.ht-header-cta {
    flex: 0 0 auto;
}

.ht-header-cta .wp-block-button__link {
    min-height: 44px;
    padding: 10px 18px;
    white-space: nowrap;
}

.ht-primary-nav .wp-block-navigation__responsive-container-open,
.ht-primary-nav .wp-block-navigation__responsive-container-close {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--ht-gold);
}

.ht-primary-nav .wp-block-navigation__responsive-container-open svg,
.ht-primary-nav .wp-block-navigation__responsive-container-close svg {
    width: 28px;
    height: 28px;
}

/* Landing page: hình ảnh làm nền, nội dung nằm dưới và không phóng đại quá mức. */
.ht-home-hero {
    position: relative;
    min-height: min(760px, calc(100svh - var(--ht-header-height)));
    display: grid;
    align-items: end;
    overflow: hidden;
    isolation: isolate;
    background: var(--ht-dark);
}

.ht-home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(7, 17, 22, 0.12) 0%, rgba(7, 17, 22, 0.38) 48%, rgba(7, 17, 22, 0.96) 100%);
    pointer-events: none;
}

.ht-home-hero__media,
.ht-home-hero__media a,
.ht-home-hero__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

.ht-home-hero__media img {
    object-fit: cover;
    object-position: center;
}

.ht-home-hero__content {
    position: relative;
    z-index: 2;
    width: min(calc(100% - 64px), 1200px) !important;
    padding-block: 96px 72px;
    color: #fff;
}

.ht-home-hero h1,
.ht-home-hero p,
.ht-home-hero .ht-eyebrow {
    color: #fff;
}

.ht-home-hero h1 {
    max-width: 900px;
    margin-bottom: 24px;
    font-size: clamp(44px, 5.4vw, 68px);
    line-height: 1.08;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.ht-home-hero .ht-hero-lead {
    max-width: 780px;
    margin-bottom: 30px;
    font-size: clamp(19px, 1.8vw, 22px);
}

.ht-home-actions {
    gap: 12px;
}

.ht-home-route-grid {
    margin-top: 0;
}

.ht-home-route-card {
    height: 100%;
    padding: 28px;
    border: 1px solid var(--ht-border-standard);
    border-radius: 10px;
    background: #fff;
}

.ht-home-route-card h3 {
    margin-bottom: 12px;
}

.ht-home-route-card p:last-child {
    margin-bottom: 0;
}

.ht-home-route-card a {
    font-weight: 600;
}

.ht-section-actions {
    margin-top: 28px;
}

.ht-home-cta {
    background: var(--ht-dark);
}

.ht-home-cta .ht-cta-band,
.ht-home-cta .ht-cta-band h2,
.ht-home-cta .ht-cta-band p,
.ht-home-cta .ht-eyebrow {
    color: #fff;
}

/* Overlay card: phần chữ tối đa khoảng 20% đáy ảnh. */
.ht-overlay-card {
    min-height: 280px;
}

.ht-overlay-card__content {
    inset: auto 0 0 !important;
    min-height: 20%;
    max-height: 42%;
    padding: 18px 20px !important;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.88) 42%);
}

/* Trang con: hệ thống bài viết chất lượng, không biến thành landing page thứ hai. */
.ht-page-shell {
    width: 100%;
    padding-block: clamp(56px, 7vw, 96px);
    background: #fff;
}

.ht-entry-hero,
.ht-archive-heading {
    width: min(calc(100% - 64px), 1200px) !important;
    margin-bottom: 36px;
}

.ht-entry-hero > *,
.ht-archive-heading > * {
    max-width: 820px;
}

.ht-entry-hero .wp-block-post-title,
.ht-archive-heading .wp-block-query-title {
    margin-bottom: 18px;
    color: var(--ht-ink);
    font-size: clamp(38px, 4vw, 52px);
    line-height: 1.16;
    overflow-wrap: normal;
    word-break: normal;
}

.ht-entry-hero .wp-block-post-excerpt,
.ht-archive-heading .wp-block-term-description {
    color: var(--ht-muted);
    font-size: 20px;
}

.ht-entry-meta {
    color: var(--ht-muted);
    font-size: 15px;
}

.ht-entry-featured {
    width: min(calc(100% - 64px), 1200px) !important;
    margin-bottom: 48px !important;
    overflow: hidden;
    border-radius: 10px;
}

.ht-entry-featured img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.ht-entry-content {
    width: min(calc(100% - 64px), 1200px) !important;
}

.ht-entry-content > :where(p, ul, ol, blockquote, h2, h3, h4, .wp-block-buttons, .wp-block-separator):not(.alignwide):not(.alignfull) {
    max-width: 800px;
    margin-left: 0;
    margin-right: auto;
}

.ht-entry-content > h2 {
    margin-top: 72px;
}

.ht-entry-content > h3 {
    margin-top: 40px;
}

.ht-entry-content .wp-block-image,
.ht-entry-content .wp-block-gallery,
.ht-entry-content .wp-block-cover,
.ht-entry-content .wp-block-columns,
.ht-entry-content .wp-block-table,
.ht-entry-content .wp-block-embed {
    margin-block: 36px;
}

.ht-entry-content table {
    width: 100%;
    border-collapse: collapse;
}

.ht-entry-content th,
.ht-entry-content td {
    padding: 14px 16px;
    border: 1px solid var(--ht-border-standard);
    text-align: left;
    vertical-align: top;
}

.ht-entry-content th {
    background: var(--ht-surface);
}

.ht-entry-footer {
    width: min(calc(100% - 64px), 1200px) !important;
    margin-top: 64px;
}

/* Archive / hub. */
.ht-archive-query {
    width: min(calc(100% - 64px), 1200px) !important;
}

.ht-archive-card {
    overflow: hidden;
    border: 1px solid var(--ht-border-standard);
    border-radius: 10px;
    background: #fff;
}

.ht-archive-card .wp-block-post-featured-image,
.ht-archive-card .wp-block-post-featured-image a,
.ht-archive-card .wp-block-post-featured-image img {
    width: 100%;
    margin: 0;
}

.ht-archive-card .wp-block-post-featured-image img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.ht-archive-card__body {
    padding: 24px;
}

.ht-archive-card__body h2 {
    margin-bottom: 12px;
    font-size: 24px;
}

.ht-archive-card__body .wp-block-post-excerpt {
    color: var(--ht-muted);
    font-size: 16px;
}

/* Footer gọn, không tạo một trang thứ hai ở cuối màn hình. */
.ht-site-footer {
    padding-block: 56px 20px;
    background: var(--ht-dark);
    color: #fff;
}

.ht-footer-grid {
    width: min(calc(100% - 64px), 1200px) !important;
    display: grid !important;
    grid-template-columns: 1.35fr 0.8fr 0.9fr 1fr;
    gap: 36px !important;
    margin-bottom: 40px;
}

.ht-footer-grid h3,
.ht-footer-grid p,
.ht-footer-grid li,
.ht-footer-grid a {
    color: #fff;
}

.ht-footer-grid h3 {
    margin-bottom: 14px;
    font-size: 18px;
}

.ht-footer-grid p,
.ht-footer-grid li,
.ht-footer-grid a {
    font-size: 15px;
}

.ht-footer-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ht-footer-links li + li {
    margin-top: 8px;
}

.ht-footer-links a {
    color: var(--ht-gold);
}

.ht-footer-logo img {
    max-width: 160px;
    max-height: 52px;
    object-fit: contain;
}

.ht-footer-bottom {
    width: min(calc(100% - 64px), 1200px) !important;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.ht-footer-bottom p,
.ht-footer-bottom a {
    color: #d5dde1;
    font-size: 13px;
}

/* Core navigation mobile: đóng thật khi chưa mở; mở thành panel toàn màn hình. */
@media (max-width: 1023px) {
    .ht-brand-copy {
        display: none;
    }

    .ht-primary-nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: none !important;
    }

    .ht-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: block !important;
        padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
        overflow-y: auto;
        background: var(--ht-dark);
        color: #fff;
    }

    .ht-primary-nav .wp-block-navigation__responsive-container-content {
        width: min(100%, 520px);
        margin: 56px auto 0;
        padding: 0;
    }

    .ht-primary-nav .wp-block-navigation__container {
        width: 100%;
        display: grid !important;
        gap: 0 !important;
    }

    .ht-primary-nav .wp-block-navigation-item,
    .ht-primary-nav .wp-block-navigation-submenu {
        width: 100%;
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .ht-primary-nav .wp-block-navigation-item__content,
    .ht-primary-nav .wp-block-navigation-submenu__toggle {
        width: 100%;
        min-height: 54px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 14px 0 !important;
        color: #fff !important;
        font-size: 18px !important;
        font-weight: 600;
        text-align: left;
        white-space: normal !important;
    }

    .ht-primary-nav .wp-block-navigation__submenu-container {
        position: static !important;
        width: 100% !important;
        min-width: 0 !important;
        display: grid !important;
        padding: 0 0 12px 16px !important;
        border: 0 !important;
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .ht-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item {
        border: 0;
    }

    .ht-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
        min-height: 44px;
        padding: 8px 0 !important;
        color: #d5dde1 !important;
        font-size: 16px !important;
        font-weight: 500;
    }

    .ht-primary-nav .wp-block-navigation__responsive-container-close {
        position: fixed;
        top: max(16px, env(safe-area-inset-top));
        right: 18px;
        z-index: 1002;
        color: var(--ht-gold) !important;
    }

    body.ht-mobile-menu-open {
        overflow: hidden;
    }

    .ht-layout-grid--3,
    .ht-footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .ht-footer-brand-block,
    .ht-footer-action {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    :root {
        --ht-header-height: 72px;
    }

    body {
        font-size: 17px !important;
        line-height: 1.65;
    }

    .admin-bar .ht-site-header {
        top: 0 !important;
    }

    .ht-header-inner {
        width: calc(100% - 28px) !important;
        min-height: var(--ht-header-height) !important;
        gap: 8px !important;
    }

    .ht-brand-logo img {
        max-width: 128px !important;
        max-height: 42px !important;
    }

    .ht-header-actions {
        gap: 6px !important;
    }

    .ht-header-cta {
        display: block !important;
    }

    .ht-header-cta .wp-block-button__link {
        min-height: 46px;
        padding: 10px 14px;
        font-size: 15px;
    }

    .ht-primary-nav .wp-block-navigation__responsive-container-open {
        width: 46px;
        height: 46px;
    }

    .ht-home-hero {
        min-height: calc(100svh - var(--ht-header-height));
    }

    .ht-home-hero__content {
        width: calc(100% - 40px) !important;
        padding-block: 56px 40px;
    }

    .ht-home-hero h1 {
        max-width: 100%;
        margin-bottom: 20px;
        font-size: clamp(34px, 10.2vw, 42px) !important;
        line-height: 1.14 !important;
        letter-spacing: -0.025em;
    }

    .ht-home-hero .ht-eyebrow {
        margin-bottom: 14px;
        font-size: 13px;
        line-height: 1.45;
    }

    .ht-home-hero .ht-hero-lead {
        margin-bottom: 24px;
        font-size: 18px;
        line-height: 1.65;
    }

    .ht-home-actions,
    .ht-home-actions .wp-block-button,
    .ht-home-actions .wp-block-button__link {
        width: 100%;
    }

    .ht-home-actions {
        display: grid !important;
        gap: 12px;
    }

    .ht-section {
        padding-block: 56px !important;
    }

    .ht-section-heading {
        margin-bottom: 28px;
    }

    .ht-section-heading h2,
    .ht-home-cta h2 {
        font-size: 30px !important;
        line-height: 1.24 !important;
    }

    .ht-layout-grid--2,
    .ht-layout-grid--3,
    .ht-footer-grid {
        grid-template-columns: 1fr !important;
    }

    .ht-home-route-card {
        padding: 22px;
    }

    .ht-overlay-card {
        min-height: 0;
        aspect-ratio: 4 / 3;
    }

    .ht-overlay-card__content {
        max-height: 46%;
        padding: 16px !important;
    }

    .ht-page-shell {
        padding-block: 44px 56px;
    }

    .ht-entry-hero,
    .ht-entry-featured,
    .ht-entry-content,
    .ht-entry-footer,
    .ht-archive-heading,
    .ht-archive-query {
        width: calc(100% - 40px) !important;
    }

    .ht-entry-hero {
        margin-bottom: 26px;
    }

    .ht-entry-hero .wp-block-post-title,
    .ht-archive-heading .wp-block-query-title {
        font-size: 34px !important;
        line-height: 1.22 !important;
    }

    .ht-entry-hero .wp-block-post-excerpt,
    .ht-archive-heading .wp-block-term-description {
        font-size: 18px;
    }

    .ht-entry-featured {
        margin-bottom: 32px !important;
        border-radius: 8px;
    }

    .ht-entry-content > h2 {
        margin-top: 48px;
        font-size: 28px !important;
    }

    .ht-entry-content > h3 {
        margin-top: 32px;
        font-size: 23px !important;
    }

    .ht-entry-content .wp-block-columns {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .ht-entry-content .wp-block-table,
    .ht-entry-content .ht-table-wrap {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ht-archive-card__body {
        padding: 20px;
    }

    .ht-site-footer {
        padding-block: 44px 18px;
    }

    .ht-footer-grid,
    .ht-footer-bottom {
        width: calc(100% - 40px) !important;
    }

    .ht-footer-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 28px 18px !important;
        margin-bottom: 30px;
    }

    .ht-footer-brand-block,
    .ht-footer-action {
        grid-column: 1 / -1;
    }

    .ht-footer-grid h3 {
        font-size: 17px;
    }

    .ht-footer-grid p,
    .ht-footer-grid li,
    .ht-footer-grid a {
        font-size: 15px;
        line-height: 1.55;
    }

    .ht-footer-action .wp-block-button,
    .ht-footer-action .wp-block-button__link {
        width: 100%;
    }

    .ht-footer-bottom {
        display: grid !important;
        gap: 10px;
    }
}

@media (max-width: 390px) {
    .ht-brand-logo img {
        max-width: 112px !important;
    }

    .ht-header-cta .wp-block-button__link {
        padding-inline: 11px;
        font-size: 14px;
    }

    .ht-home-hero h1 {
        font-size: 34px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
