/* ==========================================================================
   RAP IST — Modern Editorial Theme Override
   Designed for the supplied Ghost 0.7 / Bootstrap markup
   ========================================================================== */

:root {
    --ink: #111114;
    --ink-soft: #36363d;
    --paper: #f7f5f1;
    --surface: #ffffff;
    --line: #e4e0d8;
    --red: #ed1c24;
    --red-deep: #bc1119;
    --lime: #d8ff55;
    --shadow: 0 18px 45px rgba(17, 17, 20, 0.10);
    --shadow-hover: 0 24px 54px rgba(17, 17, 20, 0.17);
    --radius: 18px;
    --font-display: "Arial Black", Impact, "Open Sans", sans-serif;
    --font-body: "Open Sans", Arial, sans-serif;
}

/* Reset and foundation */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--paper);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background:
        radial-gradient(circle at 0% 0%, rgba(237, 28, 36, 0.08), transparent 28rem),
        linear-gradient(180deg, #fff 0, var(--paper) 30rem);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

a:focus-visible,
input:focus-visible,
button:focus-visible {
    outline: 3px solid var(--lime);
    outline-offset: 3px;
}

.main-wrap {
    overflow: hidden;
}

/* Layout */
.container {
    width: min(1240px, calc(100% - 48px));
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -16px;
    margin-left: -16px;
}

.col-md-8,
.col-md-4 {
    position: relative;
    width: 100%;
    min-height: 1px;
    padding-right: 16px;
    padding-left: 16px;
}

.col-md-8 {
    width: 68%;
}

.col-md-4 {
    width: 32%;
}

/* Header / navigation */
.navbar.navbar-custom {
    position: sticky;
    z-index: 100;
    top: 0;
    margin: 0 0 44px;
    border: 0;
    border-bottom: 1px solid rgba(17, 17, 20, 0.12);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 26px rgba(17, 17, 20, 0.05);
    backdrop-filter: blur(16px);
}

.navbar.navbar-custom > .container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: 82px;
}

.navbar-header {
    display: flex;
    align-items: center;
}

.navbar-brand.logo-img {
    display: inline-flex;
    align-items: center;
    width: 134px;
    height: 54px;
    padding: 0;
}

.navbar-brand.logo-img img {
    width: 100%;
    max-height: 50px;
    object-fit: contain;
    object-position: left center;
}

.ads-leaderboard {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.ads-leaderboard > div {
    max-width: 100%;
}

.social-top {
    padding-left: 14px;
}

.social.top {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.social.top a {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink);
}

.social.top a:hover {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
    transform: translateY(-2px);
}

.navbar-toggle {
    display: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
}

.main-nav {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 3px;
    width: 100%;
    margin: 8px 0 0;
    padding: 12px 0 14px;
    border-top: 1px solid var(--line);
    list-style: none;
}

.main-nav > li > a {
    display: block;
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.main-nav > li.active > a,
.main-nav > li > a:hover {
    background: var(--ink);
    color: #fff;
}

.main-nav .navbar-advice {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 0;
}

.main-nav .navbar-advice:hover {
    background: transparent;
}

.navbar-advice img {
    width: auto;
    max-width: 90px;
    max-height: 25px;
    opacity: 0.74;
}

/* Advertising placeholders retain their existing IDs */
#advice-gutter-left,
#advice-gutter-right {
    position: fixed;
    top: 110px;
    z-index: 2;
}

#advice-gutter-left {
    right: calc(50% + 630px);
}

#advice-gutter-right {
    left: calc(50% + 630px);
}

#advice-hpa,
#advice-mpu {
    display: flex;
    justify-content: center;
    margin: 0 0 25px;
}

/* Posts */
.post-list {
    display: grid;
    gap: 26px;
}

.post {
    display: grid;
    grid-template-columns: minmax(220px, 42%) 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 0 rgba(17, 17, 20, 0.02);
    transition: box-shadow 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.post:hover {
    border-color: rgba(237, 28, 36, 0.4);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.post-media {
    position: relative;
    min-height: 100%;
    overflow: hidden;
    background: var(--ink);
}

.post-media p {
    height: 100%;
    margin: 0;
}

.post-media a,
.post-media img {
    display: block;
    width: 100%;
    height: 100%;
}

.post-media img {
    min-height: 248px;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.03);
    transition: transform 450ms cubic-bezier(.2, .8, .2, 1), filter 300ms ease;
}

.post:hover .post-media img {
    transform: scale(1.055);
    filter: saturate(1.12) contrast(1.06);
}

.post-desc {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 29px 30px 23px;
}

.post-title {
    margin: 0 0 13px;
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 29px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.045em;
    text-transform: uppercase;
}

.post-title a:hover {
    color: var(--red);
}

.post-excerpt {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #65656c;
    font-size: 13px;
    line-height: 1.72;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
    padding-top: 21px;
    color: #818188;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.post-meta .pull-left,
.post-meta .pull-right {
    float: none !important;
}

.post-meta .fa-calendar {
    margin-right: 4px;
    color: var(--red);
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--red);
}

.read-more:hover {
    color: var(--red-deep);
}

.read-more .fa {
    transition: transform 180ms ease;
}

.read-more:hover .fa {
    transform: translateX(3px);
}

/* Sidebar */
.widget,
.fb-page {
    overflow: hidden;
    margin: 0 0 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(17, 17, 20, 0.035);
}

.widget-title {
    margin: 0;
    padding: 17px 20px 15px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.widget-title::before {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 9px 1px 0;
    border-radius: 50%;
    background: var(--red);
    content: "";
}

.widget-content {
    padding: 19px;
}

/* Search */
.search-widget .form-group {
    position: relative;
    margin: 0;
}

.search-keyword-widget {
    width: 100%;
    height: 47px;
    padding: 0 45px 0 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    background: #fbfaf8;
    color: var(--ink);
    font: inherit;
}

.search-keyword-widget::placeholder {
    color: #9b9ba1;
}

.search-keyword-widget:focus {
    border-color: var(--red);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(237, 28, 36, 0.1);
}

.sf-widget-search-icon {
    position: absolute;
    top: 0;
    right: 0;
    display: grid;
    width: 47px;
    height: 47px;
    place-items: center;
    color: var(--red);
    pointer-events: none;
}

.search-result-widget {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

/* Recent posts generated by existing JavaScript */
.recent-posts {
    display: grid;
    gap: 13px;
}

.recent-posts a {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.recent-posts a:hover {
    color: var(--red);
}

/* Tags generated by existing JavaScript */
.sf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.sf-tags a {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.sf-tags a:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 34px 0 56px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.page-number {
    color: #77777e;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.older-posts {
    padding: 10px 15px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.older-posts:hover {
    background: var(--red);
    color: #fff;
    transform: translateY(-2px);
}

/* Loader */
.sf-loading {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 14px;
}

.sf-loading > div {
    width: 6px;
    height: 21px;
    border-radius: 4px;
    background: var(--red);
    animation: rapPulse 0.75s infinite ease-in-out;
}

.sf-loading .rect2 { animation-delay: 0.08s; }
.sf-loading .rect3 { animation-delay: 0.16s; }
.sf-loading .rect4 { animation-delay: 0.24s; }
.sf-loading .rect5 { animation-delay: 0.32s; }

@keyframes rapPulse {
    0%, 100% { transform: scaleY(0.4); opacity: 0.55; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 1199px) {
    #advice-gutter-left,
    #advice-gutter-right {
        display: none;
    }

    .main-nav {
        gap: 0;
    }

    .main-nav > li > a {
        padding-right: 9px;
        padding-left: 9px;
        font-size: 10px;
    }
}

@media (max-width: 991px) {
    .col-md-8,
    .col-md-4 {
        width: 100%;
    }

    .col-md-4 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        margin-top: 28px;
    }

    .col-md-4 > * {
        margin-bottom: 0;
    }

    #advice-hpa,
    #advice-mpu,
    .fb-page {
        grid-column: span 1;
    }

    .navbar.navbar-custom > .container {
        grid-template-columns: auto 1fr auto;
    }

    .ads-leaderboard {
        display: none;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    .container {
        width: min(100% - 28px, 620px);
    }

    .navbar.navbar-custom {
        margin-bottom: 25px;
    }

    .navbar.navbar-custom > .container {
        min-height: 64px;
    }

    .navbar-brand.logo-img {
        width: 108px;
        height: 42px;
    }

    .social-top {
        padding-left: 0;
    }

    .social.top {
        gap: 4px;
    }

    .social.top a {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .navbar-toggle {
        display: block;
        margin-left: auto;
        padding: 7px 0;
        font-size: 0;
    }

    .navbar-toggle i {
        font-size: 22px;
    }

    .main-nav {
        display: none;
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: stretch;
        margin-top: 4px;
        padding: 8px 0 12px;
    }

    .main-nav.collapse.in,
    .main-nav.in {
        display: flex;
    }

    .main-nav > li > a {
        padding: 10px 3px;
        border-radius: 0;
    }

    .main-nav .navbar-advice {
        margin: 8px 0 0;
    }

    .post {
        grid-template-columns: 1fr;
    }

    .post-media img {
        min-height: 205px;
        max-height: 280px;
    }

    .post-desc {
        padding: 22px 20px 18px;
    }

    .post-title {
        font-size: 24px;
    }

    .post-excerpt {
        -webkit-line-clamp: 3;
    }

    .col-md-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pagination {
        margin-bottom: 35px;
    }
}

@media (max-width: 420px) {
    .container {
        width: min(100% - 20px, 620px);
    }

    .social-top {
        display: none;
    }

    .post-list {
        gap: 17px;
    }

    .post-title {
        font-size: 21px;
    }

    .post-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* Accessibility and printing */
@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;
    }
}

@media print {
    .navbar,
    .social-top,
    .ads-leaderboard,
    #advice-gutter-left,
    #advice-gutter-right,
    #advice-hpa,
    #advice-mpu,
    .widget,
    .fb-page,
    .pagination {
        display: none !important;
    }

    body,
    html {
        background: #fff;
    }

    .post {
        break-inside: avoid;
        box-shadow: none;
    }

    .col-md-8 {
        width: 100%;
    }
}
