/* ==========================================================================
   Layout — Container, grid system, flex utilities
   ========================================================================== */

.nc-container {
    width: 100%;
    max-width: var(--nc-container-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--nc-container-padding, 1.5rem);
    padding-right: var(--nc-container-padding, 1.5rem);
}

.nc-container--wide {
    max-width: var(--nc-container-wide);
}

.nc-container--narrow {
    max-width: var(--nc-container-narrow);
}

.nc-container--fluid {
    max-width: none;
}

/* ---- Grid ---- */
.nc-grid {
    display: grid;
    gap: var(--nc-space-6);
}

.nc-grid--posts {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.nc-grid--footer {
    grid-template-columns: repeat(3, 1fr);
}

.nc-grid--2 { grid-template-columns: repeat(2, 1fr); }
.nc-grid--3 { grid-template-columns: repeat(3, 1fr); }
.nc-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Section ---- */
.nc-section {
    padding: var(--nc-space-20) 0;
}

.nc-section--sm {
    padding: var(--nc-space-12) 0;
}

.nc-section--lg {
    padding: var(--nc-space-24) 0;
}

.nc-section--dark {
    background: var(--nc-color-surface-dark);
    color: var(--nc-color-text-inverse);
}

.nc-section--alt {
    background: var(--nc-color-surface-alt);
}

.nc-section__title {
    text-align: center;
    margin-bottom: var(--nc-space-4);
}

.nc-section__subtitle {
    text-align: center;
    color: var(--nc-color-text-muted);
    max-width: 600px;
    margin: 0 auto var(--nc-space-12);
    font-size: var(--nc-text-lg);
}

/* ---- Skip link (accessibility — must not be in base.css, agents overwrite it) ---- */
.nc-skip-link {
    position: absolute;
    left: -9999px;
    top: 0.5rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--nc-color-primary, #2563eb);
    color: #fff;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.nc-skip-link:focus {
    left: 0.5rem;
    outline: 2px solid var(--nc-color-primary, #2563eb);
    outline-offset: 2px;
}

/* ---- Main layout ---- */
.nc-main {
    min-height: 60vh;
}

/* ---- Hero (structural — agents overwrite navigation.css, hero lives here) ---- */
.nc-hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--nc-color-secondary, #1a1a1a);
    color: #fff;
}

.nc-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.nc-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 4rem 0;
}

.nc-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.15;
    color: inherit;
}

.nc-hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.85;
    max-width: 600px;
}

/* ---- Footer (structural — covers both starter __col and agent __column conventions) ---- */
.nc-footer {
    background: var(--nc-color-secondary, #1a1a1a);
    color: var(--nc-color-surface, #fff);
}

.nc-footer a {
    color: inherit;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.nc-footer a:hover {
    opacity: 1;
}

.nc-footer__main {
    padding: 3rem 0;
}

/* Grid for footer columns — both __grid (starter) and __main > __column (agent) */
.nc-footer__grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(auto-fit, minmax(160px, 1fr));
    gap: 2rem;
}

/* When agent puts columns directly in __main (no __grid wrapper) */
.nc-footer__main:not(:has(.nc-footer__grid)) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
}

/* Column headings — supports both __heading (starter) and __title (agent) */
.nc-footer__heading,
.nc-footer__title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 1rem;
    color: var(--nc-color-surface, #fff);
}

/* Link lists */
.nc-footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nc-footer__links li {
    margin-bottom: 0.5rem;
}

.nc-footer__links a {
    font-size: 0.875rem;
}

.nc-footer__links li svg {
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Brand column (starter template) */
.nc-footer__col--brand .nc-footer__logo,
.nc-footer__col--brand .custom-logo-link {
    display: inline-block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    opacity: 1;
}

.nc-footer__tagline {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Social icons */
.nc-footer__social {
    display: flex;
    gap: 0.75rem;
}

.nc-footer__social a {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer bottom / copyright */
.nc-footer__bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: 1.5rem 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    opacity: 0.7;
}

.nc-footer__copy,
.nc-footer__copyright {
    margin: 0;
}

/* ---- Newsletter section (structural) ---- */
.nc-newsletter {
    background: var(--nc-color-surface-alt, #f5f5f5);
    padding: 2.5rem 0;
}

.nc-newsletter__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
}

.nc-newsletter__title {
    font-size: 1.25rem;
    font-weight: 700;
}

.nc-newsletter__form {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    width: 100%;
}

.nc-newsletter__form input[type="email"] {
    flex: 1;
    min-width: 0;
}

/* ---- CTA section (structural) ---- */
.nc-cta {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.nc-cta__title {
    margin-bottom: 0.75rem;
}

.nc-cta__text {
    color: var(--nc-color-text-muted, #64748b);
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

/* ---- Page template (clean page rendering, no post-like metadata) ---- */
.nc-page {
    padding: 2rem 0 3rem;
}

.nc-page__header {
    margin-bottom: 2rem;
}

.nc-page__content {
    max-width: 75ch;
}

/* WC archive layout — left sidebar + products */
.nc-wc-archive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

@media (min-width: 1024px) {
    .nc-wc-archive {
        grid-template-columns: 260px 1fr;
    }
}

/* Sidebar category list */
.nc-widget__cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nc-widget__cat-list li {
    border-bottom: 1px solid var(--nc-color-border, #e2e8f0);
}

.nc-widget__cat-list li:last-child {
    border-bottom: none;
}

.nc-widget__cat-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--nc-color-text, #0f172a);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nc-widget__cat-list a:hover {
    color: var(--nc-color-primary, #2563eb);
}

.nc-widget__cat-list .count {
    font-size: 0.75rem;
    color: var(--nc-color-text-muted, #64748b);
}

/* Nested subcategories */
.nc-widget__cat-list .children {
    list-style: none;
    padding: 0 0 0 1rem;
    margin: 0;
}

.nc-widget__cat-list .children a {
    font-size: 0.8125rem;
}

/* ---- Mobile Drawer (structural — agents overwrite navigation.css, so drawer lives here) ---- */
.nc-drawer {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    visibility: hidden;
}

.nc-drawer[aria-hidden="false"] {
    pointer-events: auto;
    visibility: visible;
}

.nc-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.nc-drawer[aria-hidden="false"] .nc-drawer__overlay {
    opacity: 1;
}

.nc-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: var(--nc-color-surface, #fff);
    transform: translateX(100%);
    transition: transform 0.35s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nc-drawer[aria-hidden="false"] .nc-drawer__panel {
    transform: translateX(0);
}

.nc-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--nc-color-border, #e2e8f0);
    flex-shrink: 0;
}

.nc-drawer__title {
    font-family: var(--nc-font-heading, system-ui);
    font-weight: 700;
    font-size: 1.125rem;
}

.nc-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--nc-color-primary, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}

.nc-drawer__close:hover {
    background: var(--nc-color-primary-hover, #1d4ed8);
}

.nc-drawer__nav {
    padding: 1rem;
    flex: 1;
}

.nc-drawer__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nc-drawer__list li {
    border-bottom: 1px solid var(--nc-color-border, #e2e8f0);
}

.nc-drawer__list a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--nc-color-text, #0f172a);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease;
}

.nc-drawer__list a:hover {
    background: var(--nc-color-surface-alt, #f8fafc);
    color: var(--nc-color-primary, #2563eb);
}

.nc-drawer__list .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nc-drawer__list .sub-menu a {
    padding-left: 2rem;
    font-size: 0.875rem;
    font-weight: 400;
}

/* WC toolbar: result count + ordering + view toggle in one row */
.nc-wc-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nc-wc-toolbar .woocommerce-result-count {
    margin: 0;
    font-size: 0.875rem;
    color: var(--nc-color-text-muted, #64748b);
}

.nc-wc-toolbar .woocommerce-ordering {
    margin: 0;
}

.nc-wc-toolbar .nc-wc-view-toggle {
    margin-left: auto;
}

/* WC grid/list view toggle (structural — agents overwrite woocommerce.css) */
.nc-wc-view-toggle {
    display: flex;
    gap: 0.5rem;
}

/* !important overrides agent components.css broad `button` selector */
.nc-wc-view-toggle__btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--nc-color-surface, #fff) !important;
    border: 1px solid var(--nc-color-border, #e2e8f0) !important;
    border-radius: 0.25rem;
    cursor: pointer;
    color: var(--nc-color-text-muted, #64748b) !important;
    padding: 0 !important;
    transition: all 0.15s ease;
}

.nc-wc-view-toggle__btn:hover,
.nc-wc-view-toggle__btn.active {
    background: var(--nc-color-primary, #2563eb) !important;
    border-color: var(--nc-color-primary, #2563eb) !important;
    color: var(--nc-color-surface, #fff) !important;
}

/* Grid view (default) */


@media (max-width: 480px) {
    
}

/* ---- Flex utilities ---- */
.nc-flex { display: flex; }
.nc-flex--center { align-items: center; justify-content: center; }
.nc-flex--between { justify-content: space-between; }
.nc-flex--wrap { flex-wrap: wrap; }
.nc-flex--col { flex-direction: column; }
.nc-gap-2 { gap: var(--nc-space-2); }
.nc-gap-4 { gap: var(--nc-space-4); }
.nc-gap-6 { gap: var(--nc-space-6); }
.nc-gap-8 { gap: var(--nc-space-8); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    :root {
        --nc-container-padding: var(--nc-space-4, 1rem);
    }

    .nc-grid--footer {
        grid-template-columns: 1fr;
    }

    .nc-grid--3,
    .nc-grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }

    h1 { font-size: var(--nc-text-3xl); }
    h2 { font-size: var(--nc-text-2xl); }

    .nc-section {
        padding: var(--nc-space-12) 0;
    }

    .nc-hero {
        min-height: 40vh;
    }

    .nc-hero__inner {
        padding: 2.5rem 0;
    }

    .nc-footer__grid,
    .nc-footer__main:not(:has(.nc-footer__grid)) {
        grid-template-columns: repeat(2, 1fr);
    }

    .nc-newsletter__inner {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .nc-grid--2,
    .nc-grid--3,
    .nc-grid--4 {
        grid-template-columns: 1fr;
    }

    .nc-footer__grid,
    .nc-footer__main:not(:has(.nc-footer__grid)) {
        grid-template-columns: 1fr;
    }
}

/* Mobile: reduce container padding from 24px to 10px */
@media (max-width: 640px) {
  .nc-container { padding-left: 10px !important; padding-right: 10px !important; }
}

/* Mobile: collapse footer table-based widget to stacked rows */
@media (max-width: 640px) {
  .nc-footer__col table,
  .nc-footer__col tbody,
  .nc-footer__col tr { display: block !important; width: 100% !important; }
  .nc-footer__col td {
    display: block !important;
    width: 100% !important;
    padding: 0 0 var(--nc-space-6) 0 !important;
    vertical-align: top !important;
  }
}
