/*
Theme Name: NodeUP Theme Child
Template: nodeup-theme
Description: Child theme for NodeUP Theme
Version: 2.0
*/

/* ===== CSS Variables ===== */
:root {
    --nu-dark: #0f172a;
    --nu-text: #1e293b;
    --nu-muted: #64748b;
    --nu-border: #e2e8f0;
    --nu-bg: #f8fafc;
    --nu-accent: #2d9e8f;
    --nu-accent-light: #e0f5f1;
    --nu-radius: 20px;
    --nu-radius-sm: 12px;
    --nu-radius-pill: 999px;
}

/* ===== Extra4koma Card (single post) ===== */
.extra4koma-card-wrap { width: 100%; overflow: hidden; margin-bottom: 1.5em; }
.extra4koma-card { width: 100%; border-radius: var(--nu-radius-sm); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.extra4koma-card img.extra4koma-img { width: 100%; height: auto; display: block; }

/* ===== Archive #nu-manga horizontal scroll (non-home) ===== */
body:not(.home) #nu-manga { display: flex; flex-direction: row; overflow-x: auto; gap: 16px; padding: 12px 8px 20px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
body:not(.home) #nu-manga > a { flex: 0 0 260px; scroll-snap-align: start; }
body:not(.home) #nu-manga::-webkit-scrollbar { height: 6px; }
body:not(.home) #nu-manga::-webkit-scrollbar-track { background: #f0f0f0; }
body:not(.home) #nu-manga::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ===== Header / Navigation ===== */
.nu-skip { position: absolute; top: -100%; left: 16px; z-index: 9999; padding: 8px 16px; background: var(--nu-accent); color: #fff; border-radius: 0 0 8px 8px; font-weight: 700; text-decoration: none; transition: top 0.2s; }
.nu-skip:focus { top: 0; }

.nu-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nu-border);
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}
.nu-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 24px;
}
.nu-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nu-logo__image { height: 40px; width: auto; display: block; }
.nu-logo__text { font-size: 1rem; font-weight: 700; color: var(--nu-text); }

.nu-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
}
.nu-nav-toggle__line { display: block; width: 24px; height: 2px; background: var(--nu-text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.nu-nav-toggle[aria-expanded="true"] .nu-nav-toggle__line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nu-nav-toggle[aria-expanded="true"] .nu-nav-toggle__line:nth-child(2) { opacity: 0; }
.nu-nav-toggle[aria-expanded="true"] .nu-nav-toggle__line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nu-nav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 6px; }
.nu-nav a {
    display: block;
    padding: 8px 18px;
    color: var(--nu-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0;
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
    transition: all 0.2s;
}
.nu-nav a:hover, .nu-nav a:focus-visible {
    background: var(--nu-accent-light);
    border-color: #2b8a8a;
    color: #2b8a8a;
}

/* ===== Hero Section ===== */
.nu-hero {
    background: linear-gradient(135deg, #e6fafa 0%, #dff5f5 30%, #e8f4f8 60%, #f0faf8 100%);
    padding: 80px 24px 40px;
    position: relative;
    overflow: hidden;
}
.nu-hero__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}
.nu-hero__label {
    display: inline-block;
    padding: 4px 0;
    background: none;
    border: none;
    border-bottom: 2px solid rgba(94,200,200,0.4);
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2b8a8a;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}
.nu-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.2;
    color: var(--nu-text);
    margin: 0 0 16px;
}
.nu-hero__company {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--nu-text);
    margin: 0 0 16px;
}
.nu-hero__desc {
    font-size: 0.95rem;
    color: var(--nu-muted);
    line-height: 1.7;
    margin: 0 0 28px;
}
.nu-hero__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.nu-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s;
    cursor: pointer;
    border: none;
}
.nu-btn--primary {
    background: var(--nu-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(45,158,143,0.3);
}
.nu-btn--primary:hover { background: #258a7c; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(45,158,143,0.4); }
.nu-btn--ghost {
    background: transparent;
    color: var(--nu-text);
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
}
.nu-btn--ghost:hover { border-color: #2b8a8a; color: var(--nu-accent); }
.nu-btn--outline {
    background: transparent;
    color: var(--nu-text);
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
    padding: 8px 20px;
    font-size: 0.85rem;
}
.nu-btn--outline:hover { border-color: #2b8a8a; color: var(--nu-accent); }

/* Hero Featured Card */
.nu-hero__featured {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nu-hero__featured-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--nu-text);
    padding: 0 4px;
}
.nu-hero__featured-label span:last-child {
    color: var(--nu-muted);
    font-weight: 400;
    font-size: 0.8rem;
}
.nu-featured-card {
    display: block;
    position: relative;
    border-radius: var(--nu-radius);
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    transition: transform 0.3s, box-shadow 0.3s;
    aspect-ratio: 4/3;
}
.nu-featured-card:hover { transform: translateY(-4px); box-shadow: 0 16px 48px rgba(0,0,0,0.16); }
.nu-featured-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nu-featured-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
}
.nu-featured-card__title {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Hero Scroll Indicator */
.nu-hero__scroll {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 48px;
}
.nu-scroll-text {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--nu-muted);
    font-weight: 500;
}
.nu-scroll-line {
    width: 1px;
    height: 40px;
    background: var(--nu-border);
    animation: scrollPulse 2s infinite;
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}


/* ===== Section Layout ===== */
.nu-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px;
}
.nu-section--card {
    background: var(--nu-bg);
    border-radius: var(--nu-radius);
    margin: 32px auto;
    padding: 48px 40px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.nu-section__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}
.nu-section__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #2b8a8a;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.nu-section__title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--nu-text);
    margin: 0;
}

/* ===== Latest Posts Grid ===== */
.home .nu-card-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px;
}
.home .nu-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--nu-radius-sm);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
}
.home .nu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border-color: #2b8a8a;
}
.home .nu-card .nu-card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.home .nu-card .nu-card__body {
    padding: 20px;
}
.home .nu-card .nu-card__date {
    display: inline-block;
    padding: 4px 12px;
    background: var(--nu-accent-light);
    color: #2b8a8a;
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.home .nu-card .nu-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--nu-text);
    margin: 0 0 8px;
    line-height: 1.4;
}
.home .nu-card .nu-card__excerpt {
    font-size: 0.85rem;
    color: var(--nu-muted);
    margin: 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Manga Grid ===== */
.home .nu-manga-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 24px;
}
.home .nu-manga-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--nu-radius-sm);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
}
.home .nu-manga-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border-color: #2b8a8a;
}
.home .nu-manga-card__img {
    width: 100%;
    height: auto;
    display: block;
}
.home .nu-manga-card__body {
    padding: 16px 20px;
}
.home .nu-manga-card__body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--nu-text);
    margin: 0 0 6px;
}
.home .nu-manga-card__date {
    font-size: 0.8rem;
    color: var(--nu-muted);
}

/* ===== Company / Accordion ===== */
.nu-accordion-details {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    border-radius: var(--nu-radius-sm);
    overflow: hidden;
}
.nu-accordion-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    background: #fff;
    border-radius: var(--nu-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--nu-text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    list-style: none;
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
    transition: all 0.2s;
}
.nu-accordion-toggle:hover {
    border-color: #2b8a8a;
}
.nu-accordion-toggle::-webkit-details-marker { display: none; }
.nu-accordion-icon { transition: transform 0.3s ease; font-size: 0.8rem; }
details[open] .nu-accordion-icon { transform: rotate(180deg); }
details[open] .nu-accordion-toggle {
    border-radius: var(--nu-radius-sm) var(--nu-radius-sm) 0 0;
}
.nu-accordion-body {
    padding: 24px 28px;
    background: #fff;
    border-radius: 0 0 var(--nu-radius-sm) var(--nu-radius-sm);
    border: none; border-bottom: 2px solid rgba(94,200,200,0.4);
    border-top: none;
}
.nu-accordion-body table { width: 100%; border-collapse: collapse; }
.nu-accordion-body th, .nu-accordion-body td { padding: 14px 16px; border-bottom: 1px solid var(--nu-border); text-align: left; }
.nu-accordion-body th { font-weight: 600; color: var(--nu-muted); width: 120px; white-space: nowrap; font-size: 0.9rem; }
.nu-accordion-body td { color: var(--nu-text); font-size: 0.95rem; }
.nu-accordion-body tr:last-child th, .nu-accordion-body tr:last-child td { border-bottom: none; }


/* ===== Mobile Navigation ===== */
@media (max-width: 768px) {
    .nu-nav-toggle { display: flex; }
    .nu-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(255,255,255,0.98);
        padding: 80px 24px 24px;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -4px 0 24px rgba(0,0,0,0.08);
    }
    .nu-nav[aria-hidden="false"] { right: 0; }
    .nu-nav ul { flex-direction: column; gap: 8px; }
    .nu-nav a { font-size: 1.05rem; padding: 12px 20px; }
}

/* ===== Admin Bar offset ===== */
.admin-bar .nu-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .nu-header { top: 46px; } }

/* ===== Homepage Mobile Responsive ===== */
@media (max-width: 768px) {
    .nu-hero { padding: 48px 20px 32px; }
    .nu-hero__inner {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }
    .nu-hero__content { order: 1; }
    .nu-hero__featured { order: 2; }
    .nu-hero__label { margin-bottom: 16px; }
    .nu-hero__title { font-size: 2rem; }
    .nu-hero__company { font-size: 1.4rem; }
    .nu-hero__actions { justify-content: center; }
    .nu-hero__scroll { padding-top: 24px; }

    .nu-section--card {
        margin: 16px;
        padding: 28px 20px;
        border-radius: 16px;
    }
    .nu-section__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .home .nu-card-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .home .nu-manga-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .nu-section {
        padding: 40px 20px;
    }
    .nu-section__title {
        font-size: 1.4rem;
    }
    .nu-featured-card {
        aspect-ratio: 16/10;
    }
}

/* ===== Gradient border for posts (home) ===== */
.home #nu-posts .nu-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(45,158,143,0.25) 0%, rgba(76,104,138,0.15) 50%, rgba(187,197,209,0.25) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 2;
}
.home #nu-posts .nu-card { position: relative; }
.home #nu-posts .nu-card:hover::before {
    background: linear-gradient(135deg, rgba(45,158,143,0.45) 0%, rgba(64,95,140,0.25) 50%, rgba(197,205,214,0.35) 100%);
}

/* ===== Manga scroll non-home mobile ===== */
@media (max-width: 768px) {
    #nu-manga, .nu-manga-section, section.nu-manga-section {
        width: 100%; max-width: 100%; margin-left: auto; margin-right: auto;
        padding-left: 16px; padding-right: 16px; box-sizing: border-box; overflow: hidden;
    }
    #nu-manga .nu-manga-grid, .nu-manga-section .nu-manga-grid {
        display: grid; grid-template-columns: 1fr; gap: 20px;
        width: 100%; max-width: 100%; min-width: 0;
        margin-left: auto; margin-right: auto; box-sizing: border-box;
    }
    #nu-manga .nu-manga-card, .nu-manga-section .nu-manga-card {
        width: 100%; max-width: 100%; min-width: 0;
        margin-left: auto; margin-right: auto; box-sizing: border-box;
    }
    #nu-manga img, .nu-manga-section img {
        display: block; width: 100%; max-width: 100%; height: auto;
    }
}


/* ===== Parent Theme Overrides ===== */
.nu-hero {
    background: linear-gradient(135deg, #f0fdf8 0%, #ecfdf5 30%, #f0f9ff 70%, #faf5ff 100%) !important;
}
.nu-hero__title {
    color: var(--nu-text) !important;
}
.nu-hero__company {
    color: var(--nu-text) !important;
}
.nu-hero__desc {
    color: var(--nu-muted) !important;
}
.nu-hero__label {
    color: var(--nu-accent) !important;
}
.nu-section__title {
    color: var(--nu-text) !important;
}
.nu-section__label {
    color: var(--nu-accent) !important;
}
.nu-hero__featured-label {
    color: var(--nu-text) !important;
}
.nu-scroll-text {
    color: var(--nu-muted) !important;
}
.home .nu-card .nu-card__title {
    color: var(--nu-text) !important;
}
.home .nu-card .nu-card__date {
    color: var(--nu-accent) !important;
}
.home .nu-card .nu-card__excerpt {
    color: var(--nu-muted) !important;
}
.nu-btn--primary {
    background: var(--nu-accent) !important;
    color: #fff !important;
}
.nu-btn--ghost {
    color: var(--nu-text) !important;
    background: rgba(255,255,255,0.6) !important;
}

/* Fix parent theme center alignment and grid override */
.nu-hero__content {
    text-align: left !important;
    grid-template-columns: none !important;
    display: block !important;
    width: auto !important;
    overflow: visible !important;
}
.nu-hero__title {
    text-align: left !important;
}
.nu-hero__company {
    text-align: left !important;
}
.nu-hero__desc {
    text-align: left !important;
    max-width: 100% !important;
}
.nu-hero__actions {
    justify-content: flex-start !important;
}
.nu-hero__inner {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
}


/* ===== Past Posts Horizontal Scroll ===== */
.nu-past-posts-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 16px;
    padding: 12px 8px 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.nu-past-posts-scroll::-webkit-scrollbar { height: 6px; }
.nu-past-posts-scroll::-webkit-scrollbar-track { background: #f0f0f0; }
.nu-past-posts-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.nu-past-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--nu-radius-sm);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nu-past-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.nu-past-card__img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.nu-past-card__img--placeholder {
    background: var(--nu-accent-light, #e0f5f1);
}
.nu-past-card__body {
    padding: 12px;
}
.nu-past-card__date {
    font-size: 0.75rem;
    color: #2b8a8a;
    display: block;
    margin-bottom: 4px;
}
.nu-past-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    color: var(--nu-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Past posts section title */
#nu-past-posts .nu-section__title {
    font-size: 1.3rem;
}

@media (max-width: 768px) {
    .nu-past-card {
        flex: 0 0 180px;
    }
    .nu-past-card__img {
        height: 110px;
    }
}
/* ===== Merge Latest & Past Posts visually ===== */
#nu-posts {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 24px !important;
}
#nu-past-posts {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    margin-top: 0 !important;
    padding-top: 16px !important;
    box-shadow: none !important;
    border-top: 1px solid var(--nu-border, #e2e8f0);
}

/* Past posts header - button only, left aligned */
.nu-past-posts__header {
    padding: 0 0 8px;
}

/* ===== Past Posts Expand Animation ===== */
#nu-past-posts .nu-past-posts-scroll {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#nu-past-posts .nu-past-card {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Expanded state */
#nu-past-posts.expanded {
    margin-top: -60px !important;
    padding-top: 24px !important;
    position: relative;
    z-index: 5;
    transition: margin-top 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#nu-past-posts.expanded .nu-past-posts-scroll {
    padding: 16px 8px 24px;
}
#nu-past-posts.expanded .nu-past-card {
    flex: 0 0 300px;
}
#nu-past-posts.expanded .nu-past-card__img {
    height: 200px;
}
#nu-past-posts.expanded .nu-past-card__body {
    padding: 16px;
}
#nu-past-posts.expanded .nu-past-card__title {
    font-size: 1.05rem;
}
@media (max-width: 768px) {
    #nu-past-posts.expanded .nu-past-card {
        flex: 0 0 240px;
    }
    #nu-past-posts.expanded .nu-past-card__img {
        height: 160px;
    }
    #nu-past-posts.expanded {
        margin-top: -40px !important;
    }
}
