/* ==========================================================================
   Homepage — navy flat theme, matches navbar / chat / block-detail
   ========================================================================== */

:root {
    --hp-ink: #16181c;
    --hp-ink-muted: #6b7280;
    --hp-ink-faint: #9aa1ab;
    --hp-border: #e2e5e9;
    --hp-surface: #e9ebee;
    --hp-surface-raised: #dfe2e6;
    --hp-navy: #1c2333;
    --hp-accent: #3fa9c9;
    --hp-green: #4fb84a;
    --hp-red: #e0453f;
}

.home-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

/* Hero ------------------------------------------------------------------ */

.home-hero {
    position: relative;
    background: var(--hp-navy) url('/siteimages/banner2.png') top center / 100% auto no-repeat;
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 0 40px 20px;
    text-align: center;
    margin-bottom: 24px;
    overflow: hidden;
}

.home-hero::before {
    content: "";
    display: block;
    width: 100%;
    height: clamp(140px, 22vw, 220px);
}

.home-hero-tagline {
    position: relative;
    z-index: 1;
    display: inline-block;
    background: rgba(16, 21, 31, 0.78);
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 14px 24px;
    max-width: 56ch;
}

.home-hero-tagline p {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: #ffffff;
    margin: 0;
    line-height: 1.5;
}

/* Columns ------------------------------------------------------------------ */

.home-columns {
    display: flex;
    flex-direction: column;
}

.home-columns .home-section {
    display: flex;
    flex-direction: column;
}

.home-section {
    background: var(--hp-surface);
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 22px 24px;
}

.home-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.home-section h2 {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--hp-ink);
    margin: 0 0 16px;
}

.home-section-head h2 {
    margin: 0;
}

/* News ------------------------------------------------------------------ */

.home-news-add-btn {
    background: var(--hp-accent);
    color: #ffffff;
    border: 1px solid var(--hp-accent);
    border-radius: 6px;
    padding: 6px 14px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.12s ease;
}

.home-news-add-btn:hover {
    background: #379bb8;
}

.home-news-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--hp-surface-raised);
    border: 1px solid var(--hp-border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 16px;
}

.home-news-form input,
.home-news-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--hp-border);
    border-radius: 5px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--hp-ink);
    background: #ffffff;
    box-sizing: border-box;
    resize: vertical;
}

.home-news-form input:focus,
.home-news-form textarea:focus {
    outline: none;
    border-color: var(--hp-accent);
}

.home-news-form-actions {
    display: flex;
    gap: 8px;
}

.home-news-form-save {
    background: var(--hp-accent);
    color: #ffffff;
    border: 1px solid var(--hp-accent);
    border-radius: 5px;
    padding: 7px 16px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}

.home-news-form-cancel {
    background: transparent;
    color: var(--hp-ink-muted);
    border: 1px solid var(--hp-border);
    border-radius: 5px;
    padding: 7px 16px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
}

.home-news-form-error {
    background: rgba(224, 69, 63, 0.1);
    color: #a23c1f;
    border: 1px solid rgba(224, 69, 63, 0.35);
    border-radius: 5px;
    padding: 8px 12px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
}

.home-news-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.home-news-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 120px;
    gap: 12px;
}

.home-news-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: var(--hp-surface-raised);
    border: 1px solid var(--hp-border);
    border-radius: 8px;
    padding: 16px 18px;
    cursor: pointer;
    overflow: hidden;
}

.home-news-card.has-image {
    overflow: hidden;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    gap: 0;
    background: var(--hp-navy);
    border-color: var(--hp-navy);
}

.home-news-card.has-image .home-news-card-date {
    display: none;
}

.home-news-card.has-image .home-news-card-main {
    flex: 1;
    min-width: 0;
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.home-news-card.has-image h3 {
    color: #ffffff;
}

.home-news-card.has-image .home-news-card-excerpt {
    color: #cbd2de;
}

.home-news-card-image-wrap {
    flex-shrink: 0;
    width: 46%;
    min-width: 90px;
    background: var(--hp-navy);
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.home-news-card-image-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(138, 111, 212, 0.35), transparent 65%);
}

.home-news-card.size-big .home-news-card-image-wrap {
    width: 46%;
}

.home-news-card-image {
    position: relative;
    width: 100%;
    height: 96%;
    object-fit: contain;
    object-position: bottom;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.home-news-address-inline-image {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    margin-top: 12px;
    border-radius: 4px;
}

.home-news-card:hover {
    border-color: var(--hp-accent);
}

.home-news-card:focus-visible {
    outline: 2px solid var(--hp-accent);
    outline-offset: 2px;
}

/* Bento sizing: big spans 2 cols x 2 rows, medium spans 2 cols x 1 row, small is 1x1 */
.home-news-card.size-big {
    grid-column: span 2;
    grid-row: span 2;
    background: var(--hp-navy);
    border-color: var(--hp-navy);
    justify-content: center;
}

.home-news-card.size-medium {
    grid-column: span 2;
    grid-row: span 1;
}

.home-news-card.size-small {
    grid-column: span 1;
    grid-row: span 1;
}

.home-news-card-date {
    flex-shrink: 0;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 600;
    font-size: 0.76rem;
    color: var(--hp-ink-faint);
}

.home-news-card.size-big .home-news-card-date {
    color: #9aa1ab;
}

.home-news-card-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.home-news-card h3 {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--hp-ink);
    margin: 0 0 4px;
    line-height: 1.3;
}

.home-news-card.size-big h3 {
    font-size: 1.35rem;
    color: #ffffff;
}

.home-news-card.size-medium h3 {
    font-size: 1.05rem;
}

.home-news-card-excerpt {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.86rem;
    color: var(--hp-ink-muted);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-news-card.size-big .home-news-card-excerpt {
    font-size: 1rem;
    color: #cbd2de;
    -webkit-line-clamp: 3;
}

.home-news-card.size-small .home-news-card-excerpt {
    -webkit-line-clamp: 1;
}

.home-news-item-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    gap: 8px;
    background: rgba(20, 25, 38, 0.75);
    border-radius: 5px;
    padding: 3px 6px;
}

/* Server toggle button (disabled placeholder) ------------------------------- */

.home-news-server-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin-top: 8px;
    background: rgba(63, 169, 201, 0.12);
    border: 1px solid rgba(63, 169, 201, 0.4);
    border-radius: 5px;
    padding: 5px 12px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--hp-accent);
    cursor: not-allowed;
}

.home-news-server-toggle-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    border-radius: 50%;
    background: var(--hp-red);
}

.home-news-server-toggle[data-state="running"] .home-news-server-toggle-dot {
    background: var(--hp-green);
}

.home-news-server-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #0a0d14;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.68rem;
    white-space: nowrap;
    padding: 4px 9px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 20;
}

.home-news-server-toggle:hover::after {
    opacity: 1;
    visibility: visible;
}

.home-news-edit-btn,
.home-news-delete-btn {
    background: transparent;
    border: none;
    color: var(--hp-ink-muted);
    font-family: 'Baloo 2', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0;
}

.home-news-edit-btn:hover {
    color: var(--hp-accent);
}

.home-news-delete-btn:hover {
    color: var(--hp-red);
}

/* News modal ------------------------------------------------------------------ */

.home-news-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 13, 20, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.home-news-modal-overlay.active {
    display: flex;
}

.home-news-modal {
    position: relative;
    background: var(--hp-navy);
    border: 2px solid #000000;
    border-radius: 10px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.home-news-modal-scroll {
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    box-sizing: border-box;
}

.home-news-modal-inner {
    width: 100%;
    background: #ffffff;
    padding: 32px;
    box-sizing: border-box;
}

.home-news-modal-image-wrap {
    position: relative;
    display: flex;
    width: 100%;
    height: 220px;
    background-color: var(--hp-navy);
    background-image: radial-gradient(circle at 50% 40%, rgba(138, 111, 212, 0.35), transparent 65%);
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
}

.home-news-modal-image {
    position: relative;
    width: auto;
    height: 96%;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}

.home-news-modal-image-wrap.is-address {
    height: 140px;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
    background-image: none;
}

.home-news-modal-image-wrap.is-address .home-news-modal-image {
    width: 100%;
    height: auto;
    max-height: 100%;
    filter: none;
}

.home-news-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hp-surface-raised);
    border: 1px solid var(--hp-border);
    border-radius: 6px;
    color: var(--hp-ink-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.home-news-modal-close:hover {
    color: var(--hp-ink);
}

.home-news-modal-date {
    display: block;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--hp-accent);
    margin-bottom: 8px;
}

.home-news-modal h2 {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--hp-ink);
    margin: 0 0 16px;
    padding-right: 30px;
}

.home-news-modal-body {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.94rem;
    color: #33363d;
    line-height: 1.65;
    margin: 0 0 20px;
    white-space: pre-line;
}

.home-news-modal-author {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--hp-ink-faint);
    margin: 0;
}

@media (max-width: 560px) {
    .home-news-grid {
        grid-template-columns: 1fr;
    }
}

.home-news-delete-btn:hover {
    color: var(--hp-red);
}

.home-news-empty {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--hp-ink-muted);
    margin: 0;
}

/* Free servers promo ------------------------------------------------------------------ */

.home-servers-promo {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--hp-navy);
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 22px 24px;
    margin-bottom: 20px;
}

.home-servers-promo-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 8px;
    background: rgba(63, 169, 201, 0.15);
    border: 1px solid rgba(63, 169, 201, 0.35);
    color: var(--hp-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-servers-promo-content {
    flex: 1;
    min-width: 0;
}

.home-servers-promo-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #f6d488;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 9px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.home-servers-promo h2 {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0 0 8px;
}

.home-servers-promo p {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    color: #cbd2de;
    margin: 0;
    line-height: 1.5;
    max-width: 62ch;
}

/* Responsive ---------------------------------------------------------------- */

@media (max-width: 820px) {
    .home-page {
        padding: 28px 20px 40px;
    }

    .home-hero {
        padding: 36px 24px;
    }

    .home-hero h1 {
        font-size: 1.6rem;
    }
}
