:root {
    --hf-bg: #f5f7fb;
    --hf-card: #ffffff;
    --hf-text: #172033;
    --hf-muted: #667085;
    --hf-border: #e5e7eb;
    --hf-primary: #2563eb;
    --hf-primary-dark: #1d4ed8;
    --hf-radius: 18px;
}

body {
    margin: 0;
    font-family: Arial, "Helvetica Neue", sans-serif;
    background: var(--hf-bg);
    color: var(--hf-text);
}

.hf-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 22px;
}

.hf-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.hf-brand {
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
    color: var(--hf-text);
}

.hf-nav-links a {
    color: var(--hf-muted);
    text-decoration: none;
    margin-left: 14px;
}

.hf-card {
    background: var(--hf-card);
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.hf-title {
    font-size: 30px;
    margin: 0 0 8px;
}

.hf-muted {
    color: var(--hf-muted);
}

.hf-list {
    display: grid;
    gap: 14px;
}

.hf-item {
    background: var(--hf-card);
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    padding: 18px;
}

.hf-item a {
    color: var(--hf-primary);
    font-weight: 700;
    text-decoration: none;
}

.hf-button {
    display: inline-block;
    background: var(--hf-primary);
    color: #fff !important;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
}

.hf-button:hover {
    background: var(--hf-primary-dark);
}

textarea,
input[type="text"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--hf-border);
    border-radius: 12px;
    padding: 12px;
    font-size: 16px;
}

@media (max-width: 700px) {
    .hf-wrap {
        padding: 14px;
    }

    .hf-nav {
        display: block;
    }

    .hf-nav-links {
        margin-top: 10px;
    }

    .hf-nav-links a {
        margin-left: 0;
        margin-right: 12px;
    }

    .hf-title {
        font-size: 24px;
    }
}

.hf-card + hr,
.hf-wrap > hr {
    display: none;
}

.hf-wrap ul {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: grid;
    gap: 14px;
}

.hf-wrap li {
    background: var(--hf-card);
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    padding: 18px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.hf-wrap li a {
    color: var(--hf-primary);
    font-weight: 800;
    text-decoration: none;
    font-size: 17px;
}

.hf-wrap li small {
    color: var(--hf-muted);
    margin-left: 8px;
}


.hf-wrap article,
.hf-wrap .post,
.hf-wrap blockquote {
    background: var(--hf-card);
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    padding: 18px;
    margin: 16px 0;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.hf-wrap form {
    background: var(--hf-card);
    border: 1px solid var(--hf-border);
    border-radius: var(--hf-radius);
    padding: 18px;
    margin-top: 18px;
}

.hf-wrap button,
.hf-wrap input[type="submit"] {
    background: var(--hf-primary);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 800;
    cursor: pointer;
}

.hf-wrap button:hover,
.hf-wrap input[type="submit"]:hover {
    background: var(--hf-primary-dark);
}

.hf-wrap p a {
    color: var(--hf-primary);
    font-weight: 700;
    text-decoration: none;
}

/* Phase 15 - Advertising Banner System */
.hf-banner-section {
    margin: 12px 0 16px;
}

.hf-banner-note {
    margin: 0 0 6px;
    font-size: 12px;
    color: #666;
}

.hf-banner-grid {
    display: grid;
    grid-template-columns: repeat(3, 250px);
    gap: 4px 6px;
    align-items: start;
}

.hf-banner {
    display: block;
    width: 250px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #ddd;
}

.hf-banner img {
    display: block;
    width: 250px;
    object-fit: cover;
    border: 0;
}

.hf-banner-regular,
.hf-banner-regular img {
    height: 60px;
}

.hf-banner-large,
.hf-banner-large img {
    height: 120px;
}

@media (max-width: 820px) {
    .hf-banner-grid {
        grid-template-columns: 1fr;
    }

    .hf-banner,
    .hf-banner img {
        width: 100%;
        max-width: 250px;
    }
}

/* Phase 15 Fix - Keep banner grid 3 columns on mobile */
@media (max-width: 820px) {
    .hf-banner-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        width: 100%;
    }

    .hf-banner {
        width: 100%;
        max-width: none;
    }

    .hf-banner img {
        width: 100%;
        max-width: none;
    }

    .hf-banner-regular,
    .hf-banner-regular img {
        height: auto;
        aspect-ratio: 250 / 60;
    }

    .hf-banner-large,
    .hf-banner-large img {
        height: auto;
        aspect-ratio: 250 / 120;
    }
}

/* Phase 15 Step 22 - Desktop banner grid fills the content width */
.hf-banner-section {
    width: 100%;
    margin: 16px 0 24px;
}

.hf-banner-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 6px;
    width: 100%;
}

.hf-banner {
    width: 100%;
    max-width: none;
    border: 1px solid #ddd;
    background: #f5f5f5;
    overflow: hidden;
}

.hf-banner img {
    display: block;
    width: 100%;
    max-width: none;
    border: 0;
    object-fit: cover;
}

.hf-banner-regular,
.hf-banner-regular img {
    height: auto;
    aspect-ratio: 250 / 60;
}

.hf-banner-large,
.hf-banner-large img {
    height: auto;
    aspect-ratio: 250 / 120;
}

/* Phase 15 Step 33 - Fixed banner ratio, no cropping */
.hf-banner img {
    object-fit: fill;
}

.hf-banner-regular,
.hf-banner-regular img {
    aspect-ratio: 250 / 60;
    height: auto;
}

.hf-banner-large,
.hf-banner-large img {
    aspect-ratio: 250 / 120;
    height: auto;
}

/* Phase 15 Step 42 - Banner cursor behaviour */
a.hf-banner {
    cursor: pointer;
}

div.hf-banner {
    cursor: default;
}

/* UI polish - board grid + banner spacing */
.hf-banner-grid {
    gap: 12px 12px !important;
    padding: 8px 0 14px;
}

.hf-banner {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.hf-banner img {
    border-radius: 9px;
}

/* Forum board cards */
.hf-wrap ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hf-wrap li {
    min-height: 92px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.hf-wrap li:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.30);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.09);
}

/* If only one board item appears in a section, let it breathe full width */
.hf-wrap ul > li:only-child {
    grid-column: 1 / -1;
}

/* Tablet still 3 columns */
@media (max-width: 900px) {
    .hf-wrap ul {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Mobile 2 columns */
@media (max-width: 620px) {
    .hf-wrap ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .hf-wrap li {
        padding: 13px;
        min-height: 86px;
    }

    .hf-wrap li a {
        font-size: 15px;
    }

    .hf-wrap li small {
        display: block;
        margin-left: 0;
        margin-top: 3px;
        font-size: 12px;
    }
}

/* Forum board cards */
.hf-wrap section {
    margin-bottom: 34px !important;
}

.hf-wrap section > h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.hf-wrap section > p {
    color: var(--hf-muted);
    margin-bottom: 18px;
}

/* desktop/tablet = 3 columns */
.hf-wrap section {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

/* category title full width */
.hf-wrap section > h2,
.hf-wrap section > p {
    grid-column: 1 / -1;
}

/* board card */
.hf-wrap section > div[style*="padding:12px"] {
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 18px !important;
    padding: 18px !important;
    margin-bottom: 0 !important;
    box-shadow: 0 10px 24px rgba(15,23,42,0.06);
    transition: all 0.18s ease;
}

.hf-wrap section > div[style*="padding:12px"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15,23,42,0.10);
}

.hf-wrap section > div[style*="padding:12px"] a {
    font-size: 20px;
    font-weight: 800;
    color: var(--hf-primary);
    text-decoration: none;
}

.hf-wrap section > div[style*="padding:12px"] small {
    display: block;
    margin-top: 10px;
    color: var(--hf-muted);
}

/* mobile = 2 columns */
@media (max-width: 700px) {
    .hf-wrap section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* very small phones = 1 column */
@media (max-width: 480px) {
    .hf-wrap section {
        grid-template-columns: 1fr;
    }
}

/* FINAL banner alignment: fixed size, rounded, always 3 per row */
.hf-banner-section {
    margin: 18px 0 22px !important;
    display: block !important;
}

.hf-banner-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 250px) !important;
    gap: 10px 12px !important;
    justify-content: start !important;
    align-items: start !important;
    padding: 8px 0 14px !important;
}

.hf-banner {
    width: 250px !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 163, 184, 0.38) !important;
    background: #fff !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08) !important;
}

.hf-banner img {
    display: block !important;
    width: 250px !important;
    border-radius: 9px !important;
    object-fit: fill !important;
}

.hf-banner-regular,
.hf-banner-regular img {
    height: 60px !important;
}

.hf-banner-large,
.hf-banner-large img {
    height: 120px !important;
}

/* FINAL FIX: mobile-safe header + banners aligned with page container */
.hf-wrap,
.hf-container,
.hf-main,
main {
    max-width: 980px !important;
    width: calc(100% - 32px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.hf-hero,
.hf-page-hero,
.hf-card {
    width: 100% !important;
    box-sizing: border-box !important;
}

.hf-banner-section {
    width: 100% !important;
    max-width: 786px !important;
    margin: 18px 0 22px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.hf-banner-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: clamp(5px, 1.4vw, 12px) !important;
    width: 100% !important;
    max-width: 786px !important;
    justify-content: start !important;
    align-items: start !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.hf-banner {
    width: 100% !important;
    max-width: 250px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 163, 184, 0.38) !important;
    background: #fff !important;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08) !important;
    box-sizing: border-box !important;
}

.hf-banner img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: fill !important;
    border-radius: 9px !important;
}

.hf-banner-regular {
    aspect-ratio: 250 / 60 !important;
    height: auto !important;
}

.hf-banner-large {
    aspect-ratio: 250 / 120 !important;
    height: auto !important;
}

.hf-banner-regular img,
.hf-banner-large img {
    height: 100% !important;
}

@media (max-width: 640px) {
    .hf-wrap,
    .hf-container,
    .hf-main,
    main {
        width: calc(100% - 24px) !important;
        max-width: none !important;
    }

    .hf-banner-section,
    .hf-banner-grid {
        max-width: 100% !important;
    }

    .hf-banner {
        max-width: none !important;
    }
}

/* =========================================================
   Banner responsive alignment fix
   Goal:
   - Same visual width as main header/card area
   - Always 3 banners per row
   - Scale banner images proportionally on desktop
   - Keep rounded corners
   ========================================================= */

.hf-banner-section,
.hf-banners,
.hf-ad-banners,
.ad-banner-section,
.banner-section {
    width: 100%;
    max-width: 980px;
    margin-left: 0;
    margin-right: auto;
}

.hf-banner-grid,
.hf-banners-grid,
.hf-ad-banner-grid,
.ad-banner-grid,
.banner-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
    align-items: start;
}

.hf-banner-grid a,
.hf-banners-grid a,
.hf-ad-banner-grid a,
.ad-banner-grid a,
.banner-grid a {
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.hf-banner-grid img,
.hf-banners-grid img,
.hf-ad-banner-grid img,
.ad-banner-grid img,
.banner-grid img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 250 / 60;
    object-fit: cover;
    border-radius: 8px;
}

/* Large banner keeps 250x120 ratio, but still scales with column width */
.hf-banner-grid .large img,
.hf-banners-grid .large img,
.hf-ad-banner-grid .large img,
.ad-banner-grid .large img,
.banner-grid .large img,
.hf-banner-grid img.large,
.hf-banners-grid img.large,
.hf-ad-banner-grid img.large,
.ad-banner-grid img.large,
.banner-grid img.large {
    aspect-ratio: 250 / 120;
}

/* Desktop: stretch banner area to match the main card/header visual width */
@media (min-width: 900px) {
    .hf-banner-section,
    .hf-banners,
    .hf-ad-banners,
    .ad-banner-section,
    .banner-section {
        max-width: 980px;
    }

    .hf-banner-grid,
    .hf-banners-grid,
    .hf-ad-banner-grid,
    .ad-banner-grid,
    .banner-grid {
        gap: 12px 18px;
    }
}

/* Tablet and phone: keep 3 per row, but shrink proportionally */
@media (max-width: 899px) {
    .hf-banner-section,
    .hf-banners,
    .hf-ad-banners,
    .ad-banner-section,
    .banner-section {
        max-width: 100%;
    }

    .hf-banner-grid,
    .hf-banners-grid,
    .hf-ad-banner-grid,
    .ad-banner-grid,
    .banner-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px 10px;
    }
}

@media (max-width: 480px) {
    .hf-banner-grid,
    .hf-banners-grid,
    .hf-ad-banner-grid,
    .ad-banner-grid,
    .banner-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px 8px;
    }

    .hf-banner-grid a,
    .hf-banners-grid a,
    .hf-ad-banner-grid a,
    .ad-banner-grid a,
    .banner-grid a,
    .hf-banner-grid img,
    .hf-banners-grid img,
    .hf-ad-banner-grid img,
    .ad-banner-grid img,
    .banner-grid img {
        border-radius: 6px;
    }
}


/* =========================================================
   Desktop banner full-content-width fix
   Make banner area align with top hero/header card
   ========================================================= */

@media (min-width: 900px) {
    .hf-banner-section,
    .hf-banners,
    .hf-ad-banners,
    .ad-banner-section,
    .banner-section {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .hf-banner-grid,
    .hf-banners-grid,
    .hf-ad-banner-grid,
    .ad-banner-grid,
    .banner-grid {
        width: 100% !important;
        max-width: none !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        column-gap: 24px !important;
        row-gap: 12px !important;
    }

    .hf-banner-grid a,
    .hf-banners-grid a,
    .hf-ad-banner-grid a,
    .ad-banner-grid a,
    .banner-grid a {
        width: 100% !important;
        max-width: none !important;
        display: block !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    .hf-banner-grid img,
    .hf-banners-grid img,
    .hf-ad-banner-grid img,
    .ad-banner-grid img,
    .banner-grid img {
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        aspect-ratio: 250 / 60 !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        display: block !important;
    }
}


/* =========================================================
   FINAL Banner Display Rule
   - Regular banners display as 250:60 ratio
   - Large banners display as 250:120 ratio
   - No crop, no cover
   - Image may stretch/distort
   - Always 3 columns
   ========================================================= */

.hf-banner-section {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.hf-banner-grid {
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px 24px !important;
    align-items: start !important;
}

/* Every banner cell, even if class name is typo */
.hf-banner-grid > * {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    aspect-ratio: 250 / 60 !important;
    height: auto !important;
    overflow: hidden !important;
    border-radius: 8px !important;
    background: transparent !important;
}

/* Large banner cell */
.hf-banner-grid > .hf-banner-large,
.hf-banner-grid > .hf-banne-large,
.hf-banner-grid > .hfbanner-large {
    aspect-ratio: 250 / 120 !important;
}

/* Image fills the whole banner box WITHOUT cropping */
.hf-banner-grid > * img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: fill !important;
    border-radius: 8px !important;
}

/* Tablet / phone: still 3 per row, just smaller */
@media (max-width: 899px) {
    .hf-banner-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px 10px !important;
    }

    .hf-banner-grid > *,
    .hf-banner-grid > * img {
        border-radius: 7px !important;
    }
}

@media (max-width: 480px) {
    .hf-banner-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px 8px !important;
    }

    .hf-banner-grid > *,
    .hf-banner-grid > * img {
        border-radius: 6px !important;
    }
}

/* Final responsive override: PC 3 columns, mobile 2 columns */
.hf-banner-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 640px) {
    .hf-banner-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px 10px !important;
    }
}
