/*
 * k28k Base — structure.css
 * Layout skeleton only. No colour, typography or brand values.
 * All design tokens live in the child theme.
 */

/* ── Minimal reset ── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, h4, h5, h6 { margin-top: 0; }
img, svg, video { display: block; max-width: 100%; }
ul, ol { padding-left: 1.25em; }

/* ── Skip link (accessibility) ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: #000;
    color: #fff;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Site wrapper ── */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-main {
    flex: 1;
}

/* ── Container ── */
.container {
    width: 100%;
    max-width: var(--layout-max-width, 1400px);
    margin-inline: auto;
    padding-inline: clamp(1rem, 3vw, 3rem);
}
.container--narrow {
    max-width: var(--layout-max-width-narrow, 880px);
}
.container--wide {
    max-width: 100%;
    padding-inline: var(--space-struct-x, clamp(1rem, 5vw, 15vw));
}

/* ── Header ── */
.site-header {
    position: relative;
    z-index: var(--z-sticky, 100);
    transition:
        box-shadow var(--transition-duration, 0.25s) ease,
        background var(--transition-duration, 0.25s) ease;
}
.site-header.is-scrolled {
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-block: 1rem;
}

/* ── Logo ── */
.site-logo { display: flex; align-items: center; }
.site-logo a { display: block; text-decoration: none; }
.site-logo img { height: 48px; width: auto; }

/* ── Primary navigation ── */
/* flex: 1 pushes nav to fill the space between logo and .nav-cta,
   justify-content: center visually centres the links within that space */
.primary-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}
.primary-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.primary-nav__list a {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
}

/* ── Header action group (secondary link + CTA button) ── */
/* Hidden on mobile — show only what fits next to the toggle */
.nav-cta {
    display: flex;
    align-items: center;
    gap: var(--space-global-xs, 0.5rem);
    flex-shrink: 0;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .nav-toggle { display: flex; align-items: center; }
    .nav-cta    { display: none; }
    .primary-nav {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 500;
        padding: 1rem;
    }
    .primary-nav__list { flex-direction: column; align-items: stretch; }
}

/* ── Footer ── */
.site-footer { margin-top: auto; }
.site-footer__widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-global-lg, 2rem);
    padding-block: var(--space-struct-y-base, clamp(4rem, 5vw + 2rem, 6rem));
}
.site-footer__bottom {
    border-top: 1px solid var(--border-subtle, #e4e4e7);
}
/* Inner container carries the flex layout so space-between works
   even when copyright + credit are wrapped in .container */
.site-footer__bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-global-sm, 1rem);
    padding-block: 1rem;
}

/* ── Post layout ── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--space-global-lg, 2rem);
}
.post-entry { display: flex; flex-direction: column; }
.post-entry__thumbnail { aspect-ratio: 16 / 9; overflow: hidden; }
.post-entry__thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.post-entry__body { flex: 1; display: flex; flex-direction: column; }

/* ── Single post ── */
.entry-header { margin-bottom: var(--space-global-lg, 2rem); }
.entry-content { width: 100%; }
.entry-content > * + * { margin-top: 1.25em; }
.entry-footer { margin-top: var(--space-global-xl, 3rem); padding-top: var(--space-global-md, 1.5rem); border-top: 1px solid var(--border-subtle, #e4e4e7); }

/* ── Pagination ── */
.pagination, .posts-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-block: var(--space-global-xl, 3rem);
}

/* ── Comments ── */
.comments-area { margin-top: var(--space-global-2xl, 5rem); }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-body { padding: var(--space-global-md, 1.5rem) 0; border-bottom: 1px solid var(--border-subtle, #e4e4e7); }

/* ── Search form ── */
.search-form { display: flex; gap: 0.5rem; }
.search-form input[type="search"] { flex: 1; }

/* ── Alignments (block editor) ── */
.alignleft  { float: left; margin-right: 1.5rem; margin-bottom: 1rem; }
.alignright { float: right; margin-left: 1.5rem; margin-bottom: 1rem; }
.aligncenter { display: block; margin-inline: auto; }
.alignwide  { margin-inline: calc(-1 * var(--space-struct-x, clamp(1rem, 5vw, 15vw))); }
.alignfull  {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}


/* ── Clearfix ── */
.clearfix::after { content: ""; display: table; clear: both; }

/* ── Screen reader text ── */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ── WooCommerce layout helpers ── */
.site-main--woo {
    padding-block: var(--space-struct-y-base, clamp(4rem, 5vw + 2rem, 6rem));
}
.woocommerce-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: var(--space-global-lg, 2rem);
}

/* ── Block editor content width fix ──
   Ensures block editor pages respect the container width
   and don't run edge-to-edge. */
.entry-content .wp-block-group,
.entry-content .wp-block-cover,
.entry-content .wp-block-columns {
    max-width: var(--layout-max-width, 1400px);
}

/* content children inherit width from entry-content */

/* ── Fix: ensure .container has padding when content is sparse ── */
.site-main > .container {
    padding-block: clamp(3rem, 5vw, 6rem);
    min-height: 30vh;
}

/* ── Fix: page content typography baseline ── */
.entry-content p,
.entry-content li {
    font-size: var(--text-prose-size-body, clamp(1rem, 0.9rem + 0.3vw, 1.125rem));
    line-height: 1.75;
    color: var(--text-body, #18181b);
}

.entry-content h1, .entry-content h2,
.entry-content h3, .entry-content h4 {
    color: var(--text-heading, #18181b);
    line-height: 1.2;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.entry-content img {
    border-radius: var(--radius-md, 8px);
}

/* ── Nav link active colour ── */
.primary-nav__list .current-menu-item > a,
.primary-nav__list .current_page_item > a {
    color: var(--brand-accent, #2463eb);
    font-weight: 700;
}

/* ── Full width page template ── */
.site-main--full-width {
    width: 100%;
}
.site-main--full-width .entry-content--full > * {
    max-width: 100%;
}
.site-main--full-width .entry-content--full > .alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}
.site-main--full-width .entry-content--full > .wp-block-group:not(.alignfull),
.site-main--full-width .entry-content--full > p,
.site-main--full-width .entry-content--full > h1,
.site-main--full-width .entry-content--full > h2,
.site-main--full-width .entry-content--full > h3,
.site-main--full-width .entry-content--full > ul,
.site-main--full-width .entry-content--full > ol {
    max-width: var(--layout-max-width-narrow, 880px);
    margin-inline: auto;
    padding-inline: var(--space-struct-x, clamp(1rem, 5vw, 15vw));
}

/* ============================================================
   SPACING UTILITIES
   Use these on any Custom HTML block wrapper to control
   vertical and horizontal padding without editing CSS.
   ============================================================ */

/* ── Section padding — vertical breathing room ── */
.section-pad       { padding-block: var(--space-struct-y-base, clamp(3rem,5vw,6rem)); }
.section-pad--sm   { padding-block: var(--space-global-xl, 3rem); }
.section-pad--lg   { padding-block: var(--space-struct-y-hero, clamp(5rem,8vw,9rem)); }
.section-pad--none { padding-block: 0; }
/* When used standalone (no .container child), add horizontal breathing room too.
   Prevents component-library HTML from sitting flush against the viewport edge. */
.section-pad:not(:has(> .container)),
.section-pad--sm:not(:has(> .container)),
.section-pad--lg:not(:has(> .container)) {
    padding-inline: var(--space-struct-x, clamp(1rem, 3vw, 3rem));
}

/* ── Inner padding — for content that should not be full width ── */
.inner             { max-width: var(--layout-max-width, 1400px); margin-inline: auto; padding-inline: clamp(1rem,3vw,3rem); }
.inner--narrow     { max-width: var(--layout-max-width-narrow, 880px); margin-inline: auto; padding-inline: clamp(1rem,3vw,3rem); }
.inner--wide       { max-width: 1600px; margin-inline: auto; padding-inline: clamp(1rem,3vw,3rem); }

/* ── Gap utilities ── */
.gap-sm  { gap: var(--space-global-sm,  1rem); }
.gap-md  { gap: var(--space-global-md,  1.5rem); }
.gap-lg  { gap: var(--space-global-lg,  2rem); }
.gap-xl  { gap: var(--space-global-xl,  3rem); }

/* ── Margin helpers ── */
.mt-sm  { margin-top: var(--space-global-sm,  1rem); }
.mt-md  { margin-top: var(--space-global-md,  1.5rem); }
.mt-lg  { margin-top: var(--space-global-lg,  2rem); }
.mt-xl  { margin-top: var(--space-global-xl,  3rem); }
.mb-sm  { margin-bottom: var(--space-global-sm,  1rem); }
.mb-md  { margin-bottom: var(--space-global-md,  1.5rem); }
.mb-lg  { margin-bottom: var(--space-global-lg,  2rem); }
.mb-xl  { margin-bottom: var(--space-global-xl,  3rem); }

/* ── Text alignment ── */
.text-centre { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* ── Display helpers ── */
.d-flex        { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-global-md,1.5rem); }
.d-flex--start { align-items: flex-start; }
.d-grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-global-lg,2rem); }
.d-grid-3      { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--space-global-lg,2rem); }
.d-grid-4      { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--space-global-lg,2rem); }
.d-grid-auto   { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: var(--space-global-lg,2rem); }

/* Stack on mobile */
@media (max-width: 640px) {
  .d-grid-2, .d-grid-3, .d-grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .d-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── Width constraints for non-full-width content ── */
/* Wrap any component in .constrain to limit its width and centre it */
.constrain        { max-width: var(--layout-max-width, 1400px); margin-inline: auto; }
.constrain--narrow{ max-width: var(--layout-max-width-narrow, 880px); margin-inline: auto; }
.constrain--sm    { max-width: 640px; margin-inline: auto; }
.constrain--md    { max-width: 800px; margin-inline: auto; }

/* ── Bleed: let a component break out of the prose column ── */
.bleed {
  width: 100%;
  max-width: 100%;
}

/* ── Transparent header support ── */
body.header-transparent .site-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: transparent;
  border-bottom: none;
  z-index: 200;
}
body.header-transparent .site-header .primary-nav__list a,
body.header-transparent .site-header .site-logo a {
  color: #fff;
}
body.header-transparent.scrolled .site-header {
  position: fixed;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}


/* ============================================================
   ACCESSIBILITY — FOCUS & MOTION
   ============================================================ */

/* ── Focus visible — keyboard users get a clear ring ── */
:focus-visible {
    outline: 2px solid var(--brand-accent, #2463eb);
    outline-offset: 3px;
    border-radius: var(--radius-sm, 4px);
}
/* Remove outline for mouse/touch users */
:focus:not(:focus-visible) { outline: none; }

/* ── Respect prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration:       0.01ms !important;
        animation-iteration-count: 1     !important;
        transition-duration:      0.01ms !important;
        scroll-behavior:          auto   !important;
    }
}


/* ============================================================
   CONTENT + SIDEBAR LAYOUT
   Used by template-sidebar.php
   ============================================================ */
.content-sidebar-wrap {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-global-xl, 3rem);
    align-items: start;
}
@media (max-width: 900px) {
    .content-sidebar-wrap { grid-template-columns: 1fr; }
}
.site-main--sidebar { padding-block: var(--space-struct-y-base, clamp(4rem, 5vw + 2rem, 6rem)); }


/* ============================================================
   POST TEMPLATE LAYOUTS
   ============================================================ */

/* ── Editorial: full-bleed hero ── */
.entry--editorial .entry-hero {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    aspect-ratio: 21 / 8;
    overflow: hidden;
    position: relative;
}
.entry--editorial .entry-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.entry--editorial .entry-header {
    max-width: var(--layout-max-width-narrow, 880px);
    margin-inline: auto;
    padding-block: var(--space-global-xl, 3rem);
    text-align: center;
}

/* ── Conversion: sidebar layout ── */
.entry--conversion {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-global-xl, 3rem);
    align-items: start;
    max-width: var(--layout-max-width, 1400px);
    margin-inline: auto;
    padding: var(--space-struct-y-base, clamp(4rem, 5vw + 2rem, 6rem)) clamp(1rem, 3vw, 3rem);
}
.entry--conversion .entry-main { min-width: 0; }
.entry--conversion .entry-sidebar {
    position: sticky;
    top: 6rem;
}
@media (max-width: 900px) {
    .entry--conversion {
        grid-template-columns: 1fr;
        padding-inline: clamp(1rem, 3vw, 2rem);
    }
    .entry--conversion .entry-sidebar { position: static; }
}


/* ============================================================
   BREAKPOINT REFERENCE (comments only — cannot use vars in @media)
   --bp-sm:  640px   stack most grids
   --bp-md:  768px   mobile nav threshold
   --bp-lg:  1024px  comfortable desktop
   --bp-xl:  1280px  wide content
   ============================================================ */


/* ============================================================
   SURFACE BLOCKS
   Background + padding + radius for component library output.
   The component library generates HTML using these classes —
   they must exist here so pasted blocks render correctly.
   ============================================================ */
:root {
    --surface-padding: var(--space-global-xl, 3rem);
    --surface-radius:  var(--radius-lg, 16px);
}
.surface {
    padding:       var(--surface-padding);
    border-radius: var(--surface-radius);
}
.surface--light    { background: var(--bg-surface, #f9fafb); }
.surface--alt      { background: var(--bg-surface-alt, #f3f4f6); }
.surface--dark {
    background: var(--neutral-900, #18181b);
    color: var(--text-on-dark, #f9fafb);
}
.surface--dark h1, .surface--dark h2, .surface--dark h3,
.surface--dark h4, .surface--dark h5, .surface--dark h6 {
    color: var(--text-heading-on-dark, #ffffff);
}
.surface--brand {
    background: var(--brand-accent, #2463eb);
    color: var(--text-on-dark, #f9fafb);
}
.surface--brand h1, .surface--brand h2, .surface--brand h3,
.surface--brand h4, .surface--brand h5, .surface--brand h6 {
    color: var(--text-heading-on-dark, #ffffff);
}
.surface--bordered { border: 1px solid var(--border-subtle, #e4e4e7); }
.surface--dark.surface--bordered  { border-color: rgba(255,255,255,.15); }
.surface--brand.surface--bordered { border-color: rgba(255,255,255,.25); }
