/* =========================================================
   HOME.CSS FINAL - dibelajar.com
   Prinsip layout:
   - Section mengikuti lebar halaman secara normal.
   - Container di dalam section yang mengatur max-width.
   - Tidak memakai 100vw dan negative margin.
========================================================= */

/* =========================================================
   BASE / RESET
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
}

/* =========================================================
   GENERATEPRESS HOMEPAGE RESET
   Agar konten homepage tidak dikurung container bawaan theme
========================================================= */

body.home .site-content,
body.home .content-area,
body.home .site-main,
body.home .inside-article {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

body.home .site-content {
    display: block;
}

body.home .content-area {
    float: none;
}

body.home .site-main {
    margin: 0;
}

body.home .inside-article {
    padding-top: 0;
    padding-bottom: 0;
}

/* =========================================================
   HOMEPAGE SECTION BASE
   Section auto, container berbeda ukuran
========================================================= */

.hero-section,
.search-section,
.latest-posts-section,
.subscribe-section,
.category-section,
.prefooter-section {
    width: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

/* Container utama selalu center */
.hero-container,
.search-container,
.latest-posts-container,
.subscribe-wrapper,
.category-wrapper,
.prefooter-container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Ukuran container per section */
.hero-container {
    max-width: 1800px;
}

.search-container {
    max-width: 1200px;
}

.latest-posts-container,
.subscribe-wrapper,
.category-wrapper,
.prefooter-container {
    max-width: 1400px;
}

/* =========================================================
   HERO SECTION
========================================================= */

.hero-section {
    padding: 10px;
    background: var(--bg-hero);
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 300px 1fr;
    gap: 15px;
    align-items: stretch;
}

.hero-box {
    border-radius: 15px;
    overflow: hidden;
}

/* =========================================================
   HERO CONTENT
========================================================= */

.hero-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--surface);
    min-height: 600px;
}

.hero-content h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: clamp(42px, 5vw, 64px);
    line-height: 1.05;
    font-weight: 800;
    background: linear-gradient(90deg, var(--color-primary), #00bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-intro {
    margin-bottom: 30px;
    font-size: 18px;
    line-height: 1.7;
    color: var(--color-muted);
}

/* =========================================================
   HERO FEATURE GRID
========================================================= */

.hero-features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.feature-card {
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--surface);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.feature-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.feature-icon {
    font-size: 22px;
    line-height: 1;
    color: var(--color-primary);
}

.feature-heading h2,
.feature-heading h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-ink);
}

.feature-card p {
    margin: 0;
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-muted);
}

/* =========================================================
   HERO BUTTON
========================================================= */

.hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin-top: auto;
    padding: 14px 40px;
    border-radius: 999px;
    background: var(--color-primary);
    color: var(--white);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(0, 112, 243, 0.2);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.hero-button:hover {
    transform: translateY(-3px);
    color: var(--white);
    box-shadow: 0 14px 30px rgba(0, 112, 243, 0.25);
}

/* =========================================================
   HERO ADS
========================================================= */

.hero-ads {
    width: 300px;
    max-width: 300px;
}

.ads-placeholder {
    width: 100%;
    height: 650px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    background: #dfe6f3;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-muted);
}

/* =========================================================
   HERO IMAGE
========================================================= */

.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hero);
}

.hero-image img {
    width: 100%;
    max-height: 650px;
    object-fit: contain;
    display: block;
}

/* =========================================================
   SEARCH SECTION
========================================================= */

.search-section {
    padding: 20px 10px 30px;
    background: linear-gradient(90deg, var(--bg-0), var(--surface-hi));
}

.search-container {
    display: grid;
    grid-template-columns: 600px 1fr;
    gap: 30px;
    align-items: center;
}

.search-heading h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 35px;
    font-weight: 800;
    color: var(--color-ink);
}

.search-heading p {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 800;
    color: var(--color-muted);
}

/* =========================================================
   SEARCH FORM
========================================================= */

.search-form {
    display: flex;
    align-items: center;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.search-field {
    flex: 1;
    min-width: 0;
    height: 60px;
    border: none;
    outline: none;
    padding: 0 28px;
    font-size: 18px;
    background: transparent;
}

.search-submit {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    height: 60px;
    padding: 0 36px;
    background: var(--color-primary);
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-submit:hover {
    background: var(--color-primary-hover);
}

/* =========================================================
   LATEST POSTS SECTION
========================================================= */

.latest-posts-section {
    padding: 40px 20px;
    background: var(--color-bg);
}

.section-heading {
    text-align: center;
    margin-bottom: 32px;
}

.section-heading h2 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: clamp(38px, 5vw, 52px);
    font-weight: 800;
    color: var(--color-ink);
}

.section-heading p {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 17px;
    color: var(--color-muted);
}

.latest-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.post-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: var(--surface);
    transition:
        transform 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease;
}

.post-card:hover {
    transform: translateY(-6px);
    border-color: var(--color-primary);
    box-shadow: 0 18px 35px rgba(0, 112, 243, 0.12);
}

.post-thumbnail {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: transform;
    transition: transform 0.5s ease;
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.06);
}

.post-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 24px;
}

/* Scoped agar tidak konflik dengan editor picks */
.latest-posts-section .post-category {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
}

.post-title {
    margin: 0 0 14px;
    font-size: 22px;
    line-height: 1.4;
    font-weight: 800;
}

.post-title a {
    color: var(--color-ink);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-title a:hover {
    color: var(--color-primary);
}

.post-excerpt {
    margin-bottom: 22px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--color-muted);
}

.read-more {
    margin-top: auto;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

.read-more:hover {
    opacity: 0.8;
    transform: translateX(3px);
}

.latest-posts-footer {
    display: flex;
    justify-content: center;
    margin-top: 36px;
}

.latest-posts-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 34px;
    border-radius: 999px;
    background: var(--color-primary);
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(0, 112, 243, 0.18);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.latest-posts-button:hover {
    transform: translateY(-3px);
    color: var(--white);
    box-shadow: 0 16px 35px rgba(0, 112, 243, 0.25);
}

/* =========================================================
   CATEGORY SECTION
========================================================= */

.category-section {
    padding: 15px 20px;
    background: var(--surface);
}

.category-section .section-heading {
    margin-bottom: 30px;
    text-align: center;
}

.category-section .section-heading h2 {
    margin-bottom: 10px;
    font-size: 42px;
    font-weight: 800;
    color: var(--color-ink);
}

.category-section .section-heading p {
    font-size: 17px;
    color: var(--color-muted);
}

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

.category-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: var(--surface);
    text-decoration: none;
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary);
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(0, 112, 243, 0.08);
}

.category-card i {
    font-size: 20px;
    color: var(--color-primary);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.category-card span {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-ink);
    line-height: 1.3;
}

/* =========================================================
   SUBSCRIBE SECTION
========================================================= */

.subscribe-section {
    background: var(--surface);
    padding: 40px 20px;
    color: var(--color-ink);
}

.subscribe-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 30px;
    align-items: start;
}

.subscribe-card,
.editor-card {
    background: var(--surface);
    border: 1px solid var(--line-300);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.editor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.editor-heading h2 {
    color: var(--color-ink);
    font-size: 24px;
    margin: 0;
    line-height: 1.3;
}

.editor-heading a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.editor-heading a:hover,
.editor-heading a:focus {
    color: var(--color-primary-hover);
}

.editor-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.editor-item {
    display: flex;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    transition: background 0.25s ease;
    padding: 10px;
}

.editor-item:hover {
    background: var(--color-bg);
}

.editor-thumb {
    flex-shrink: 0;
    width: 110px;
}

.editor-thumb img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.editor-content {
    flex: 1;
}

/* Scoped agar tidak konflik dengan latest posts */
.editor-card .post-category {
    display: inline-block;
    background: var(--color-primary);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.4px;
    line-height: 1.4;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.editor-content h3 {
    color: var(--color-ink);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    transition: color 0.25s ease;
}

.editor-item:hover .editor-content h3 {
    color: var(--color-primary);
}

/* =========================================================
   MAILPOET
========================================================= */

.mailpoet_form {
    color: var(--color-ink);
}

.mailpoet_form p,
.mailpoet_form span,
.mailpoet_form label,
.mailpoet_form div {
    color: var(--color-ink);
    line-height: 1.7;
}

.mailpoet_form a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mailpoet_form a:hover,
.mailpoet_form a:focus {
    color: var(--color-primary-hover);
}

.mailpoet_form input[type="email"] {
    width: 100%;
    background: var(--surface);
    color: var(--color-ink);
    border: 1px solid var(--muted-400);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
}

.mailpoet_form input[type="email"]::placeholder {
    color: var(--color-muted);
}

.mailpoet_form input[type="submit"],
.mailpoet_form button {
    background: var(--color-primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s ease;
}

.mailpoet_form input[type="submit"]:hover,
.mailpoet_form button:hover {
    background: var(--color-primary-hover);
}

/* =========================================================
   PREFOOTER SECTION
========================================================= */

.prefooter-section {
    background: var(--ink-800);
    padding: 50px 24px 30px;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.prefooter-container {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 0.9fr 0.9fr;
    gap: 20px;
}

.prefooter-column h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-ink);
    margin-top: 0;
    margin-bottom: 24px;
}

.prefooter-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prefooter-column ul li {
    margin-bottom: 16px;
    color: var(--color-muted);
    font-size: 15px;
}

.prefooter-column ul li a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.prefooter-column ul li a:hover {
    color: var(--color-primary-hover);
}

.prefooter-about p {
    color: var(--color-muted);
    line-height: 1.8;
    margin-top: 24px;
}

.prefooter-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.prefooter-logo img {
    width: 48px;
    height: auto;
}

.prefooter-logo h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-ink);
    margin: 0;
}

.prefooter-social {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}

.prefooter-social a {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--surface-hi);
    color: var(--white);
    text-decoration: none;
    transition:
        transform 0.3s ease,
        background 0.3s ease;
}

.prefooter-social a:hover {
    transform: translateY(-3px);
    background: var(--color-primary-hover);
    color: var(--white);
}

.prefooter-social i {
    font-size: 16px;
}

/* =========================================================
   TABLET RESPONSIVE
========================================================= */

@media (max-width: 1200px) {

    .hero-container {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .hero-content {
        min-height: auto;
    }

    .hero-ads {
        width: 100%;
        max-width: 100%;
    }

    .ads-placeholder {
        height: 250px;
    }

    .hero-image img {
        max-height: 500px;
    }

    .latest-posts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .prefooter-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   TABLET / SMALL DESKTOP
========================================================= */

@media (max-width: 1100px) {

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {

    .search-container,
    .subscribe-wrapper {
        grid-template-columns: 1fr;
    }

    .search-heading {
        text-align: center;
    }

    .editor-thumb {
        width: 90px;
    }

    .editor-thumb img {
        height: 70px;
    }

    .editor-content h3 {
        font-size: 15px;
    }
}

/* =========================================================
   MOBILE RESPONSIVE
========================================================= */

@media (max-width: 768px) {

    .hero-section {
        padding: 16px;
    }

    .hero-container {
        grid-template-columns: 1fr;
    }

    .hero-content {
        min-height: auto;
        padding: 28px 22px;
    }

    .hero-content h1 {
        font-size: 42px;
        line-height: 1.1;
    }

    .hero-intro {
        font-size: 16px;
        line-height: 1.7;
    }

    .hero-features {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .feature-card {
        padding: 22px;
    }

    .feature-heading h2,
    .feature-heading h3 {
        font-size: 20px;
    }

    .feature-card p {
        font-size: 15px;
    }

    .hero-button {
        width: 100%;
        margin-top: 12px;
    }

    .hero-ads,
    .hero-image {
        display: none;
    }

    .search-section {
        padding: 20px 16px 30px;
    }

    .search-heading h2 {
        font-size: 32px;
    }

    .search-heading p {
        font-size: 18px;
    }

    .search-form {
        flex-direction: column;
        border-radius: 24px;
    }

    .search-field {
        width: 100%;
    }

    .search-submit {
        width: 100%;
        justify-content: center;
    }

    .latest-posts-section {
        padding: 50px 16px;
    }

    .section-heading {
        margin-bottom: 24px;
    }

    .section-heading h2 {
        font-size: 36px;
    }

    .latest-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .post-card {
        animation: mobileFadeUp 0.7s ease both;
    }

    .post-card:nth-child(1) {
        animation-delay: 0.1s;
    }

    .post-card:nth-child(2) {
        animation-delay: 0.2s;
    }

    .post-card:nth-child(3) {
        animation-delay: 0.3s;
    }

    .post-card:nth-child(4) {
        animation-delay: 0.4s;
    }

    .post-content {
        padding: 20px;
    }

    .post-title {
        font-size: 20px;
    }

    .post-excerpt {
        font-size: 14px;
        line-height: 1.7;
    }

    .latest-posts-button {
        width: 100%;
    }

    .category-section {
        padding: 60px 20px;
    }

    .category-section .section-heading h2 {
        font-size: 34px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .subscribe-section {
        padding: 40px 16px;
    }

    .prefooter-section {
        padding: 70px 20px 50px;
    }

    .prefooter-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .prefooter-logo h3 {
        font-size: 24px;
    }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 520px) {

    .category-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   ANIMATION
========================================================= */

@keyframes mobileFadeUp {

    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}