/* Compact proportions for the active Trakan theme.
 * Body scoping wins over view-local styles. !important is limited to properties
 * also set by Bootstrap utilities, inline declarations, or existing overrides.
 * Keep the root font size intact so the accessibility font controls still work.
 */
body.modern-small {
    --compact-title: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
    --compact-section: clamp(1.2rem, 1rem + .65vw, 1.5rem);
    --compact-panel: clamp(1rem, 2vw, 1.5rem);
    font-size: .9375rem;
    line-height: 1.65;
}

/* One navigation header, followed directly by the page content. */
body.modern-small .section-main-content > .main-content {
    padding-left: clamp(12px, 1.5vw, 24px) !important;
    padding-right: clamp(12px, 1.5vw, 24px) !important;
}
body.modern-small .main-content > .row {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1rem;
}
body.modern-small .gov-page-article > .gov-page-content-header { padding: 1rem 1.25rem !important; }
body.modern-small .gov-page-article > .gov-page-body { padding: 1.25rem !important; }

/* Shared page hierarchy, including the home page and Smart Report portal. */
body.modern-small :is(.gov-post-title, .gov-content-title, .gov-personnel-title,
    .gov-egp-title, .gov-login-title, .gov-auth-title, .bless-title,
    .eform-title, .gov-portal-title, .gov-search-hero h1) {
    font-size: var(--compact-title) !important;
    line-height: 1.4;
    margin-bottom: .75rem !important;
}
body.modern-small :is(.section-title, .ci-section-title, .gov-section-title-centered,
    .gov-news-title, .gov-activity-title, .gov-tour-title, .gov-service-title,
    .gov-banner-title, .gov-procurement-title, .gov-job-title, .gov-dla-title,
    .gov-links-title, .gov-search-title, .gov-search-title-sub,
    .ci-smart-report-heading h2, .eservice-heading, .ebook-heading) {
    font-size: var(--compact-section) !important;
    line-height: 1.4;
}
body.modern-small :is(.section-title, .ci-section-title) {
    margin-bottom: 1.25rem !important;
}
body.modern-small :is(.ci-section-title-icon, .eform-header .eform-icon) {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-bottom: .5rem;
}

/* Reduce large section gutters without changing grid columns or hero images. */
body.modern-small :is(.gov-post-index, .gov-page-detail-section, .gov-egp-page,
    .gov-personnel-index, .eservice-section, .section-service,
    .section-procurement, .section-job, .section-news, .section-activity,
    .section-place, .section-product, .section-banner, .section-file) {
    padding-top: 1.75rem !important;
    padding-bottom: 1.75rem !important;
}
body.modern-small :is(.gov-post-hero, .gov-egp-hero, .gov-search-hero,
    .bless-hero, .report-portal-header) {
    padding: var(--compact-panel) !important;
    margin-bottom: 1.5rem !important;
}
body.modern-small :is(.gov-post-hero-content, .gov-post-content-panel,
    .gov-egp-panel, .gov-page-content-header, .gov-page-body,
    .gov-page-footer, .eservice-content-card, .service-content-card,
    .contact-card .card-body, .gov-search-card, .gov-main-service-card,
    .gov-qr-card, .gov-procurement-panel, .quick-action-card) {
    padding: var(--compact-panel) !important;
}
body.modern-small :is(.gov-post-panel-title, .contact-card h4,
    .gov-main-service-title, .service-content-card h5, .forum-title) {
    font-size: 1.0625rem;
    line-height: 1.5;
}
body.modern-small :is(.gov-news-content, .gov-product-content,
    .gov-tour-body, .gov-post-card-body) {
    padding: 1rem !important;
}
body.modern-small :is(.gov-news-title-link, .gov-post-card-title,
    .gov-post-list-title, .gov-search-title-link, .gov-personnel-name) {
    font-size: 1rem !important;
    line-height: 1.5 !important;
}
body.modern-small :is(.gov-post-card-grid, .contact-card .row) {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}
body.modern-small :is(.news-list-item-modern, .eservice-file-item,
    .service-item-row, .gov-post-list-body) {
    padding: .75rem 1rem !important;
}
body.modern-small .section-procurement .news-list-item-modern {
    min-height: 0;
    height: auto;
}
body.modern-small :is(.gov-dla-table th, .gov-dla-table td) {
    padding: .75rem 1rem !important;
}

/* All eleven citizen service forms share these classes. */
body.modern-small .eform-wrap { margin-bottom: 2rem; }
body.modern-small .eform-card { border-radius: 16px; }
body.modern-small .eform-header { padding: 1.5rem var(--compact-panel); }
body.modern-small .eform-body { padding: var(--compact-panel); }
body.modern-small :is(.eform-alert, .eform-channels-box) {
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: 12px;
}
body.modern-small .eform-section-title {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
}
body.modern-small .eform-channels li { margin-bottom: .5rem; }
body.modern-small .eform-divider { margin-bottom: 1.25rem; }
body.modern-small :is(.eform-form, .contact-card, .site-signup) :is(.form-control, .form-select) {
    font-size: 1rem;
    padding: .5rem .75rem;
    min-height: 42px;
}
body.modern-small :is(.eform-form, .contact-card, .site-signup) textarea.form-control {
    min-height: 120px;
}

/* Keep article text comfortable for long Thai documents. */
body.modern-small .gov-content-body {
    font-size: 1rem !important;
    line-height: 1.8 !important;
}
body.modern-small .gov-content-body p { margin-bottom: 1rem; }
body.modern-small .gov-content-body h2 { font-size: 1.4rem; }
body.modern-small .gov-content-body h3 { font-size: 1.2rem; }
body.modern-small .gov-content-body h4 { font-size: 1.0625rem; }
body.modern-small .gov-content-body :is(th, td) { padding: .75rem; }
body.modern-small .gov-meta-row { gap: .75rem; }

/* Side navigation, downloads, auth and personnel cards. */
body.modern-small .gov-sidebar-header { padding: 1rem; font-size: 1rem; }
body.modern-small .gov-sidebar-group-title {
    padding: .625rem 1rem;
    margin-bottom: .25rem;
    font-size: .9375rem;
}
body.modern-small .gov-sidebar-item { padding: 0; margin: 0; }
body.modern-small .gov-sidebar-link {
    width: calc(100% - 16px);
    margin: 2px 8px;
    padding: 8px 12px;
    min-height: 44px;
    gap: 10px;
    line-height: 1.45;
}
body.modern-small .gov-sidebar-link:hover,
body.modern-small .gov-sidebar-link:focus { padding-left: 12px; }
body.modern-small .gov-sidebar-icon { width: 28px; height: 28px; }
body.modern-small .gov-sidebar-sub-list {
    margin: 2px 12px 6px 28px;
    padding: 2px 0;
}
body.modern-small .gov-sidebar-sub-link {
    padding: 6px 10px 6px 12px;
    line-height: 1.45;
}
body.modern-small :is(.eservice-tabs-nav, .service-tabs-nav) { padding: .625rem; }
body.modern-small :is(.eservice-tabs-nav, .service-tabs-nav) .nav-link {
    padding: .625rem .875rem;
    font-size: .9375rem;
}
body.modern-small .gov-personnel-card { padding: 1rem; }
body.modern-small :is(.site-login, .site-signup) .card-body {
    padding: var(--compact-panel) !important;
}
body.modern-small .auth-clients a { padding: .75rem 1rem; font-size: 1rem; }
body.modern-small .gov-auth-badge { width: 52px; height: 52px; font-size: 1.35rem; }
body.modern-small .gov-search-input-premium {
    padding: .75rem 1rem !important;
    font-size: 1rem !important;
}
body.modern-small .gov-search-btn-premium { padding: 0 1.25rem !important; font-size: 1rem !important; }
body.modern-small .btn-gov-report-primary { padding: .75rem 1.25rem !important; }
body.modern-small .btn-gov-report-primary .btn-text { font-size: 1.0625rem; }
body.modern-small .btn-gov-view-all { padding: .625rem 1.25rem !important; }

/* Light blue footer with readable burgundy text. */
body.modern-small footer.footer {
    --footer-text: #7f1d2d;
    background: linear-gradient(150deg, #effaff 0%, #d9efff 50%, #bddfff 100%) !important;
    color: var(--footer-text) !important;
}
body.modern-small footer.footer .gov-footer-card {
    background: rgba(255, 255, 255, .5);
    border-color: rgba(83, 145, 190, .22);
}
body.modern-small footer.footer .gov-footer-card:hover {
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 10px 24px rgba(57, 113, 157, .12);
}
body.modern-small footer.footer :is(a, span, p, small, li, .footer-title,
    .footer-contact-item, .footer-brand-subtitle, .stat-label, .stat-value) {
    color: var(--footer-text) !important;
    text-shadow: none !important;
}
body.modern-small footer.footer .footer-brand-title {
    background: none;
    color: var(--footer-text) !important;
    -webkit-text-fill-color: var(--footer-text);
    text-shadow: none !important;
}
body.modern-small footer.footer a:hover { color: #581321 !important; }
body.modern-small footer.footer .stat-item {
    background: rgba(255, 255, 255, .35);
    border-color: rgba(83, 145, 190, .2);
}
body.modern-small footer.footer .footer-bottom {
    background: rgba(176, 216, 248, .65) !important;
    border-top-color: rgba(83, 145, 190, .2);
}
body.modern-small footer.footer .fb-page-wrapper { height: 420px; }

/* The user's accessibility selection takes priority over the compact hierarchy. */
body.modern-small.font-size-small { --compact-accessible-size: 13px; }
body.modern-small.font-size-normal { --compact-accessible-size: 16px; }
body.modern-small.font-size-large { --compact-accessible-size: 19px; }
body.modern-small.font-size-xlarge { --compact-accessible-size: 22px; }
body.modern-small.font-size-xxlarge { --compact-accessible-size: 25px; }
body.modern-small:is(.font-size-small, .font-size-normal, .font-size-large,
    .font-size-xlarge, .font-size-xxlarge)
    *:not(.accessibility-float):not(.accessibility-float *) {
    font-size: var(--compact-accessible-size) !important;
}

@media (max-width: 767.98px) {
    body.modern-small { --compact-panel: 1rem; }
    body.modern-small :is(.gov-post-index, .gov-page-detail-section,
        .gov-egp-page, .gov-personnel-index, .eservice-section) {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
    body.modern-small .eform-header { padding: 1.25rem 1rem; }
    body.modern-small :is(.eform-alert, .eform-channels-box) { padding: 1rem; }
    body.modern-small .gov-post-hero-content { padding: 0 !important; }
    body.modern-small .gov-content-body { overflow-wrap: anywhere; }
}
