/*
Theme Name: KahuStack Editorial
Theme URI: https://kahustack.com/
Author: Parker Meredith
Author URI: https://parkr.dev/
Description: A pattern-first, accessible block child theme for Twenty Twenty-Five. Pages use a zero-spacing blank canvas by default; reusable KahuStack patterns own all page spacing, while dedicated editorial templates frame blog content.
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 7.2
Version: 1.3.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Template: twentytwentyfive
Text Domain: kahustack-editorial
Tags: block-patterns, block-styles, blog, custom-colors, custom-logo, editor-style, featured-images, full-site-editing, news, portfolio, rtl-language-support, style-variations, threaded-comments, wide-blocks, accessibility-ready
*/

:root {
  color-scheme: light;
  --kahu-color-canvas: var(--wp--custom--kahu--light--canvas, #F7F7F5);
  --kahu-color-text: var(--wp--custom--kahu--light--text, #1D1F20);
  --kahu-color-surface: var(--wp--custom--kahu--light--surface, #FFFFFF);
  --kahu-color-surface-muted: var(--wp--custom--kahu--light--surface-muted, #ECEDEA);
  --kahu-color-text-muted: var(--wp--custom--kahu--light--text-muted, #686D70);
  --kahu-color-border: var(--wp--custom--kahu--light--border, #D7D9D5);
  --kahu-color-accent: var(--wp--custom--kahu--light--accent, #4666F5);
  --kahu-color-accent-soft: var(--wp--custom--kahu--light--accent-soft, #E8ECFF);
  --kahu-color-focus: var(--wp--custom--kahu--light--focus, #315EF6);
  --kahu-color-success: var(--wp--custom--kahu--light--success, #198754);
  --kahu-color-warning: var(--wp--custom--kahu--light--warning, #A86500);
  --kahu-color-danger: var(--wp--custom--kahu--light--danger, #B42318);
  --kahu-color-info: var(--wp--custom--kahu--light--info, #2453D4);
  --kahu-content-size: var(--wp--style--global--content-size, 720px);
  --kahu-wide-size: var(--wp--style--global--wide-size, 1280px);
  --kahu-gutter: clamp(1rem, 2.5vw, 2rem);
  --kahu-section-space: clamp(3rem, 6vw, 6rem);
  --kahu-section-space-compact: clamp(2rem, 4vw, 3.5rem);
  --kahu-flow-space: 1.5rem;
  --kahu-header-height: 4.25rem;
  --kahu-reading-measure: 72ch;
  --kahu-easing: cubic-bezier(.2,.75,.2,1);
  --kahu-shadow-soft: 0 1px 2px rgb(20 24 28 / .04), 0 12px 30px rgb(20 24 28 / .05);
}

:root[data-kahu-theme="dark"] {
  color-scheme: dark;
  --kahu-color-canvas: var(--wp--custom--kahu--dark--canvas, #101214);
  --kahu-color-text: var(--wp--custom--kahu--dark--text, #F2F4F5);
  --kahu-color-surface: var(--wp--custom--kahu--dark--surface, #15181B);
  --kahu-color-surface-muted: var(--wp--custom--kahu--dark--surface-muted, #1D2125);
  --kahu-color-text-muted: var(--wp--custom--kahu--dark--text-muted, #AAB0B6);
  --kahu-color-border: var(--wp--custom--kahu--dark--border, #30363C);
  --kahu-color-accent: var(--wp--custom--kahu--dark--accent, #9AAEFF);
  --kahu-color-accent-soft: var(--wp--custom--kahu--dark--accent-soft, #202944);
  --kahu-color-focus: var(--wp--custom--kahu--dark--focus, #AFC0FF);
  --kahu-color-success: var(--wp--custom--kahu--dark--success, #69D49B);
  --kahu-color-warning: var(--wp--custom--kahu--dark--warning, #E8AF55);
  --kahu-color-danger: var(--wp--custom--kahu--dark--danger, #FF8B82);
  --kahu-color-info: var(--wp--custom--kahu--dark--info, #91AEFF);
}

:root[data-kahu-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-kahu-theme]),
  :root[data-kahu-theme="system"] {
    color-scheme: dark;
    --kahu-color-canvas: var(--wp--custom--kahu--dark--canvas, #101214);
    --kahu-color-text: var(--wp--custom--kahu--dark--text, #F2F4F5);
    --kahu-color-surface: var(--wp--custom--kahu--dark--surface, #15181B);
    --kahu-color-surface-muted: var(--wp--custom--kahu--dark--surface-muted, #1D2125);
    --kahu-color-text-muted: var(--wp--custom--kahu--dark--text-muted, #AAB0B6);
    --kahu-color-border: var(--wp--custom--kahu--dark--border, #30363C);
    --kahu-color-accent: var(--wp--custom--kahu--dark--accent, #9AAEFF);
    --kahu-color-accent-soft: var(--wp--custom--kahu--dark--accent-soft, #202944);
    --kahu-color-focus: var(--wp--custom--kahu--dark--focus, #AFC0FF);
    --kahu-color-success: var(--wp--custom--kahu--dark--success, #69D49B);
    --kahu-color-warning: var(--wp--custom--kahu--dark--warning, #E8AF55);
    --kahu-color-danger: var(--wp--custom--kahu--dark--danger, #FF8B82);
    --kahu-color-info: var(--wp--custom--kahu--dark--info, #91AEFF);
  }
}

/* Resolve style-variation custom properties at the element where WordPress emits them. */
body,
.editor-styles-wrapper {
  --kahu-color-canvas: var(--wp--custom--kahu--light--canvas, #F7F7F5);
  --kahu-color-text: var(--wp--custom--kahu--light--text, #1D1F20);
  --kahu-color-surface: var(--wp--custom--kahu--light--surface, #FFFFFF);
  --kahu-color-surface-muted: var(--wp--custom--kahu--light--surface-muted, #ECEDEA);
  --kahu-color-text-muted: var(--wp--custom--kahu--light--text-muted, #686D70);
  --kahu-color-border: var(--wp--custom--kahu--light--border, #D7D9D5);
  --kahu-color-accent: var(--wp--custom--kahu--light--accent, #4666F5);
  --kahu-color-accent-soft: var(--wp--custom--kahu--light--accent-soft, #E8ECFF);
  --kahu-color-focus: var(--wp--custom--kahu--light--focus, #315EF6);
  --kahu-color-success: var(--wp--custom--kahu--light--success, #198754);
  --kahu-color-warning: var(--wp--custom--kahu--light--warning, #A86500);
  --kahu-color-danger: var(--wp--custom--kahu--light--danger, #B42318);
  --kahu-color-info: var(--wp--custom--kahu--light--info, #2453D4);
}

:root[data-kahu-theme="dark"] body,
:root[data-kahu-theme="dark"] .editor-styles-wrapper {
  --kahu-color-canvas: var(--wp--custom--kahu--dark--canvas, #101214);
  --kahu-color-text: var(--wp--custom--kahu--dark--text, #F2F4F5);
  --kahu-color-surface: var(--wp--custom--kahu--dark--surface, #15181B);
  --kahu-color-surface-muted: var(--wp--custom--kahu--dark--surface-muted, #1D2125);
  --kahu-color-text-muted: var(--wp--custom--kahu--dark--text-muted, #AAB0B6);
  --kahu-color-border: var(--wp--custom--kahu--dark--border, #30363C);
  --kahu-color-accent: var(--wp--custom--kahu--dark--accent, #9AAEFF);
  --kahu-color-accent-soft: var(--wp--custom--kahu--dark--accent-soft, #202944);
  --kahu-color-focus: var(--wp--custom--kahu--dark--focus, #AFC0FF);
  --kahu-color-success: var(--wp--custom--kahu--dark--success, #69D49B);
  --kahu-color-warning: var(--wp--custom--kahu--dark--warning, #E8AF55);
  --kahu-color-danger: var(--wp--custom--kahu--dark--danger, #FF8B82);
  --kahu-color-info: var(--wp--custom--kahu--dark--info, #91AEFF);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-kahu-theme]) body,
  :root[data-kahu-theme="system"] body,
  :root:not([data-kahu-theme]) .editor-styles-wrapper,
  :root[data-kahu-theme="system"] .editor-styles-wrapper {
    --kahu-color-canvas: var(--wp--custom--kahu--dark--canvas, #101214);
    --kahu-color-text: var(--wp--custom--kahu--dark--text, #F2F4F5);
    --kahu-color-surface: var(--wp--custom--kahu--dark--surface, #15181B);
    --kahu-color-surface-muted: var(--wp--custom--kahu--dark--surface-muted, #1D2125);
    --kahu-color-text-muted: var(--wp--custom--kahu--dark--text-muted, #AAB0B6);
    --kahu-color-border: var(--wp--custom--kahu--dark--border, #30363C);
    --kahu-color-accent: var(--wp--custom--kahu--dark--accent, #9AAEFF);
    --kahu-color-accent-soft: var(--wp--custom--kahu--dark--accent-soft, #202944);
    --kahu-color-focus: var(--wp--custom--kahu--dark--focus, #AFC0FF);
    --kahu-color-success: var(--wp--custom--kahu--dark--success, #69D49B);
    --kahu-color-warning: var(--wp--custom--kahu--dark--warning, #E8AF55);
    --kahu-color-danger: var(--wp--custom--kahu--dark--danger, #FF8B82);
    --kahu-color-info: var(--wp--custom--kahu--dark--info, #91AEFF);
  }
}

html { margin: 0; padding: 0; scroll-behavior: smooth; }
body { margin: 0; padding: 0; text-rendering: optimizeLegibility; }
.wp-site-blocks { margin: 0; padding: 0 !important; }
.wp-site-blocks > * { margin-block-start: 0; }
.kahu-blank-canvas,
.kahu-blank-canvas > .wp-block-post-content { width: 100%; max-width: none; margin: 0; padding: 0; }
::selection { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--base); }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--kahu-color-focus);
  outline-offset: 3px;
}

/* Pattern-owned layout primitives. */
.kahu-section {
  container-type: inline-size;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding-block: var(--kahu-section-space);
  padding-inline: var(--kahu-gutter);
}
.kahu-section--compact { padding-block: var(--kahu-section-space-compact); }
.kahu-section--flush { padding: 0; }
.kahu-section--no-block { padding-block: 0; }
.kahu-container { box-sizing: border-box; width: min(100%, var(--kahu-content-size)); margin-inline: auto; }
.kahu-container--wide { width: min(100%, var(--kahu-wide-size)); }
.kahu-container--full { width: 100%; max-width: none; }
.kahu-flow > * { margin-block: 0; }
.kahu-flow > * + * { margin-block-start: var(--kahu-flow-space); }
.kahu-flow--tight { --kahu-flow-space: .75rem; }
.kahu-flow--loose { --kahu-flow-space: 2.25rem; }
.kahu-grid { gap: var(--wp--preset--spacing--50) !important; }

/* Header, brand, and theme mode. */
.kahu-site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  margin: 0;
  padding: 0;
  backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in srgb, var(--wp--preset--color--base) 88%, transparent);
  border-bottom: 1px solid var(--wp--preset--color--border);
}
.kahu-header-inner {
  box-sizing: border-box;
  width: min(100%, var(--kahu-wide-size));
  min-height: var(--kahu-header-height);
  margin-inline: auto;
  padding: .75rem var(--kahu-gutter);
}
.admin-bar .kahu-site-header { inset-block-start: 32px; }
.kahu-brand-link { display: inline-flex; align-items: center; color: var(--wp--preset--color--contrast); text-decoration: none; }
.kahu-logo-svg { display: block; width: clamp(8.5rem, 17vw, 11.5rem); height: auto; color: currentColor; }
.kahu-footer-logo { width: min(14rem, 100%); }


.kahu-eyebrow,
.is-style-section-label {
  font-family: var(--wp--preset--font-family--interface);
  font-size: var(--wp--preset--font-size--x-small) !important;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.25;
  text-transform: uppercase;
}
.is-style-display { max-width: 17ch; text-wrap: balance; }
.is-style-lead { font-size: var(--wp--preset--font-size--x-large); line-height: 1.5; color: var(--wp--preset--color--subtle); }
.is-style-metadata { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--subtle); }
.is-style-annotation { padding-inline-start: 1rem; border-inline-start: 2px solid var(--wp--preset--color--border); color: var(--wp--preset--color--subtle); }

.is-style-panel,
.is-style-muted-panel,
.is-style-inset-note,
.is-style-bordered-section { border-radius: .5rem; }
.is-style-panel { background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--border); box-shadow: var(--kahu-shadow-soft); }
.is-style-muted-panel { background: var(--wp--preset--color--muted); }
.is-style-bordered-section { border-block: 1px solid var(--wp--preset--color--border); }
.is-style-inset-note { background: var(--wp--preset--color--accent-soft); border-inline-start: 3px solid var(--wp--preset--color--accent); }

.is-style-editorial-quote { margin-inline: 0; padding: clamp(1.5rem, 4vw, 3rem); border: 0; border-block: 1px solid var(--wp--preset--color--border); font-family: var(--wp--preset--font-family--reading); font-size: var(--wp--preset--font-size--xx-large); line-height: 1.25; }
.is-style-technical-principle { padding: 1.25rem 1.5rem; background: var(--wp--preset--color--muted); border-inline-start: 3px solid var(--wp--preset--color--accent); }
.is-style-compact-list { padding-inline-start: 1.15rem; }
.is-style-compact-list li + li { margin-block-start: .3rem; }
.is-style-specification-list { list-style: none; padding: 0; border-top: 1px solid var(--wp--preset--color--border); }
.is-style-specification-list li { display: grid; grid-template-columns: minmax(8rem, .35fr) 1fr; gap: 1rem; padding-block: .85rem; border-bottom: 1px solid var(--wp--preset--color--border); }

.is-style-framed-screenshot img { border: 1px solid var(--wp--preset--color--border); border-radius: .45rem; box-shadow: var(--kahu-shadow-soft); }
.is-style-bleed-media { width: min(calc(100vw - (2 * var(--kahu-gutter))), var(--kahu-wide-size)); max-width: none; margin-inline: 50%; transform: translateX(-50%); }
.is-style-technical-data table,
.is-style-comparison table { border-collapse: collapse; }
.is-style-technical-data th,
.is-style-technical-data td,
.is-style-comparison th,
.is-style-comparison td { padding: .8rem 1rem; border-color: var(--wp--preset--color--border); }
.is-style-technical-data thead,
.is-style-comparison thead { background: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); text-align: start; }

.is-style-terminal,
.is-style-source-code {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: .45rem;
  background: #0D0F12 !important;
  color: #E7EAED !important;
  font-family: var(--wp--preset--font-family--mono) !important;
  font-size: .875rem !important;
  line-height: 1.65 !important;
  tab-size: 2;
}
.is-style-terminal::before { content: "Terminal"; display: block; margin: -1.25rem -1.25rem 1rem; padding: .55rem 1.25rem; border-bottom: 1px solid #292E34; color: #9EA6AE; font: 600 .7rem/1 var(--wp--preset--font-family--interface); letter-spacing: .08em; text-transform: uppercase; }
.is-style-research-notes,
.is-style-implementation-notes { padding: 1rem 1.15rem; border: 1px solid var(--wp--preset--color--border); border-radius: .4rem; background: var(--wp--preset--color--surface); }
.is-style-research-notes summary,
.is-style-implementation-notes summary { cursor: pointer; font-weight: 700; }
.is-style-short-marker { width: 3rem !important; margin-inline: 0 !important; border-top-width: 3px !important; color: var(--wp--preset--color--accent); }
.is-style-featured-audio { padding: 1rem; border: 1px solid var(--wp--preset--color--border); border-radius: .45rem; background: var(--wp--preset--color--surface); }
.is-style-featured-audio audio { width: 100%; }

/* Blog-only automatic framing and readable prose rhythm. */
.kahu-blog-shell,
.kahu-article-shell { container-type: inline-size; box-sizing: border-box; width: 100%; margin: 0; padding: var(--kahu-section-space-compact) var(--kahu-gutter) var(--kahu-section-space); }
.kahu-blog-container { width: min(100%, var(--kahu-wide-size)); margin-inline: auto; }
.kahu-article-container { width: min(100%, var(--kahu-content-size)); margin-inline: auto; }
.kahu-article-container--wide { width: min(100%, 960px); }
.kahu-article-header { padding-block: clamp(2.5rem, 6vw, 5.5rem); border-bottom: 1px solid var(--wp--preset--color--border); }
.kahu-article-meta { color: var(--wp--preset--color--subtle); font-size: var(--wp--preset--font-size--small); }
.kahu-article-meta > * + *::before { content: ""; display: inline-block; inline-size: .22rem; block-size: .22rem; margin-inline-end: .75rem; border-radius: 50%; background: currentColor; vertical-align: middle; opacity: .65; }
.kahu-prose { margin-block-start: var(--wp--preset--spacing--60); hanging-punctuation: first last; font-family: var(--wp--preset--font-family--reading); font-size: var(--wp--preset--font-size--large); line-height: 1.72; }
.kahu-prose > * { margin-block: 0; }
.kahu-prose > * + * { margin-block-start: 1.5rem; }
.kahu-prose > :where(h2,h3,h4) { scroll-margin-top: calc(var(--kahu-header-height) + 2rem); font-family: var(--wp--preset--font-family--interface); }
.kahu-prose > h2 { margin-block-start: clamp(3rem, 7vw, 5rem); }
.kahu-prose > h3 { margin-block-start: clamp(2.25rem, 5vw, 3.5rem); }
.kahu-prose :where(p,li) { text-wrap: pretty; }
.kahu-prose :where(code:not(pre code)) { padding: .1em .35em; border: 1px solid var(--wp--preset--color--border); border-radius: .25rem; background: var(--wp--preset--color--muted); font-family: var(--wp--preset--font-family--mono); font-size: .86em; }
.kahu-prose pre { overscroll-behavior-inline: contain; }
.kahu-article-footer { margin-block-start: clamp(4rem, 9vw, 7rem); padding-block-start: 2rem; border-top: 1px solid var(--wp--preset--color--border); }

.kahu-post-card { height: 100%; }
.kahu-post-card .wp-block-post-featured-image img { aspect-ratio: 16/10; object-fit: cover; border-radius: .4rem; }
.kahu-post-card .wp-block-post-title a { text-decoration: none; }
.kahu-post-card .wp-block-post-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; }
.wp-block-query-pagination { border-top: 1px solid var(--wp--preset--color--border); padding-top: 1.5rem; }
.wp-block-query-pagination a,
.wp-block-post-navigation-link a { text-decoration: none; }
.wp-block-post-navigation-link a:hover { text-decoration: underline; }

.wp-block-search__inside-wrapper,
:where(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
  border-color: var(--wp--preset--color--border) !important;
  border-radius: .35rem !important;
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--contrast);
}
:where(input, textarea, select) { min-height: 2.75rem; }
textarea { min-height: 10rem; }
.kahu-site-footer { margin: 0; border-top: 1px solid var(--wp--preset--color--border); }

@media (max-width: 782px) {
  .admin-bar .kahu-site-header { inset-block-start: 46px; }
  .kahu-header-inner { align-items: center !important; }
  .is-style-specification-list li { grid-template-columns: 1fr; gap: .3rem; }
  .wp-block-navigation__responsive-container.is-menu-open { padding: 1.25rem; background: var(--wp--preset--color--base) !important; color: var(--wp--preset--color--contrast) !important; }
  .kahu-grid.wp-block-columns { grid-template-columns: 1fr !important; }
}

@container (max-width: 52rem) {
  .kahu-grid.wp-block-columns,
  .wp-block-post-template.kahu-grid,
  .kahu-evidence-grid { grid-template-columns: 1fr 1fr !important; flex-wrap: wrap !important; }
  .kahu-grid.wp-block-columns > .wp-block-column { flex-basis: calc(50% - .75rem) !important; }
  .kahu-featured-feed .wp-block-post-template > li:first-child .kahu-post-card,
  .kahu-editorial-list-item { grid-template-columns: 1fr; }
}

@container (max-width: 36rem) {
  .kahu-grid.wp-block-columns,
  .wp-block-post-template.kahu-grid,
  .kahu-evidence-grid,
  .kahu-status-row,
  .kahu-timeline-item { grid-template-columns: 1fr !important; }
  .kahu-grid.wp-block-columns > .wp-block-column { flex-basis: 100% !important; }
  .is-style-specification-list li { grid-template-columns: 1fr; gap: .3rem; }
}

@media print {
  .kahu-site-header, .kahu-site-footer, .wp-block-post-navigation-link, .wp-block-comments, .wp-block-kahustack-appearance-control { display: none !important; }
  body { color: #000 !important; background: #fff !important; font-size: 11pt; }
  a { color: inherit !important; text-decoration: underline; }
  .wp-site-blocks, .kahu-blog-shell, .kahu-article-shell { padding: 0 !important; }
  .kahu-prose { max-width: none !important; }
}

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


/* Semantic spacing utilities used by reusable patterns. */
.kahu-pad-card { padding: var(--wp--preset--spacing--50); }
.kahu-pad-panel { padding: var(--wp--preset--spacing--60); }
.kahu-pad-section { padding: var(--kahu-section-space) var(--kahu-gutter); }
.kahu-stack-compact { --kahu-flow-space: .75rem; }
.kahu-stack-normal { --kahu-flow-space: 1.5rem; }
.kahu-stack-loose { --kahu-flow-space: 2.25rem; }
.kahu-surface { background: var(--kahu-color-surface); }
.kahu-surface-muted { background: var(--kahu-color-surface-muted); }

/* Skip link and responsive SVG brand. */
.kahu-skip-link {
  position: fixed;
  inset-block-start: .75rem;
  inset-inline-start: .75rem;
  z-index: 100000;
  padding: .65rem .9rem;
  border-radius: .35rem;
  background: var(--kahu-color-text);
  color: var(--kahu-color-canvas);
  font: 700 .875rem/1.2 var(--wp--preset--font-family--interface);
  text-decoration: none;
  transform: translateY(-180%);
}
.kahu-skip-link:focus { transform: translateY(0); }
.kahu-brand-symbol { display: none; }
.kahu-symbol-svg { display: block; width: 1.75rem; height: 1.875rem; color: currentColor; }
.kahu-appearance-preview-grid { align-items: center; gap: 1rem; }

/* Distinct editorial template behavior. */
.kahu-template-essay .kahu-prose { font-family: var(--wp--preset--font-family--reading); }
.kahu-template-technical .kahu-article-container { width: min(100%, 1040px); }
.kahu-template-technical .kahu-prose { font-family: var(--wp--preset--font-family--interface); font-size: 1.0625rem; line-height: 1.7; }
.kahu-template-technical .kahu-prose > :where(p, ul, ol, blockquote) { max-width: 76ch; }
.kahu-template-note .kahu-article-header { padding-block: clamp(2rem, 5vw, 3.5rem); }
.kahu-template-note .kahu-prose { margin-block-start: 2rem; font-size: 1.0625rem; }
.kahu-template-update .kahu-article-header { background: var(--kahu-color-surface-muted); border: 1px solid var(--kahu-color-border); border-radius: .5rem; padding: clamp(1.5rem, 4vw, 3rem); }
.kahu-template-case-study .kahu-article-container { width: min(100%, 1120px); }
.kahu-template-case-study .kahu-prose { max-width: none; }
.kahu-template-case-study .kahu-prose > :where(p, h2, h3, h4, ul, ol, blockquote) { max-width: var(--kahu-content-size); margin-inline: auto; }
.kahu-template-audio .kahu-article-header { border-bottom: 0; }

/* Editorial evidence, references, and resilient overflow. */
.wp-block-footnotes.is-style-references,
.kahu-prose .wp-block-footnotes { margin-block-start: 4rem; padding-block-start: 1.5rem; border-top: 1px solid var(--kahu-color-border); font-family: var(--wp--preset--font-family--interface); font-size: .875rem; color: var(--kahu-color-text-muted); }
.kahu-prose figcaption,
.kahu-prose .wp-element-caption { color: var(--kahu-color-text-muted); font: 500 .8125rem/1.5 var(--wp--preset--font-family--interface); }
.kahu-prose .wp-block-table { overflow-x: auto; overscroll-behavior-inline: contain; }
.kahu-prose .wp-block-table table { min-width: 38rem; }
.kahu-citation-list { padding-inline-start: 1.25rem; font-size: .925rem; }
.kahu-citation-list li + li { margin-block-start: .65rem; }
.kahu-evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--wp--preset--spacing--40); }
.kahu-status-row { display: grid; grid-template-columns: minmax(8rem, .3fr) 1fr; gap: 1rem; padding-block: .9rem; border-bottom: 1px solid var(--kahu-color-border); }

/* Preview pattern support. */
.kahu-token-swatch { min-height: 5rem; border: 1px solid var(--kahu-color-border); border-radius: .4rem; }
.kahu-preview-label { color: var(--kahu-color-text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 600px) {
  .kahu-brand-full { display: none; }
  .kahu-brand-symbol { display: inline-flex; }
  .kahu-evidence-grid { grid-template-columns: 1fr; }
  .kahu-status-row { grid-template-columns: 1fr; gap: .3rem; }
}

/* Archive presentation variants. */
.kahu-featured-feed .wp-block-post-template > li:first-child { grid-column: 1 / -1; }
.kahu-featured-feed .wp-block-post-template > li:first-child .kahu-post-card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, .8fr); column-gap: clamp(1.5rem, 4vw, 4rem); align-items: center; padding-bottom: var(--wp--preset--spacing--60); border-bottom: 1px solid var(--kahu-color-border); }
.kahu-featured-feed .wp-block-post-template > li:first-child .wp-block-post-featured-image { grid-row: 1 / span 5; }
.kahu-featured-feed .wp-block-post-template > li:first-child .wp-block-post-title { font-size: var(--wp--preset--font-size--xxx-large) !important; }
.kahu-timeline-item { display: grid; grid-template-columns: minmax(8rem, .22fr) 1fr; gap: 1.5rem; padding-block: 1.5rem; border-top: 1px solid var(--kahu-color-border); }
.kahu-editorial-list-item { display: grid; grid-template-columns: minmax(12rem, .35fr) 1fr; gap: clamp(1.25rem, 4vw, 3rem); align-items: center; padding-block: 1.5rem; border-top: 1px solid var(--kahu-color-border); }
.kahu-editorial-list-item .wp-block-post-featured-image img { border-radius: .4rem; object-fit: cover; }
.kahu-compact-feed-item { min-height: 3.5rem; padding-block: .85rem; border-top: 1px solid var(--kahu-color-border); }
.kahu-compact-feed-item .wp-block-post-title { margin: 0; }
.kahu-post-navigation { gap: 1rem; }
.kahu-post-navigation > * { flex: 1 1 16rem; padding: 1rem; border: 1px solid var(--kahu-color-border); border-radius: .4rem; background: var(--kahu-color-surface); }

@media (max-width: 782px) {
  .kahu-featured-feed .wp-block-post-template > li:first-child .kahu-post-card,
  .kahu-editorial-list-item,
  .kahu-timeline-item { grid-template-columns: 1fr; }
  .kahu-featured-feed .wp-block-post-template > li:first-child .wp-block-post-featured-image { grid-row: auto; }
}

/* Query patterns and form-quality preview. */
.kahu-query-shell { container-type: inline-size; }
.kahu-technical-index__item {
  display: grid;
  grid-template-columns: minmax(7rem, .22fr) minmax(0, 1fr) minmax(8rem, .25fr);
  gap: 1rem;
  align-items: baseline;
  padding-block: 1rem;
  border-top: 1px solid var(--kahu-color-border);
}
.kahu-technical-index__item .wp-block-post-title { margin: 0; }
.kahu-form-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.kahu-field,
.kahu-choice-group { display: grid; gap: .45rem; min-width: 0; }
.kahu-field label,
.kahu-choice-group legend { font-size: .875rem; font-weight: 650; }
.kahu-choice-group { padding: 1rem; border: 1px solid var(--kahu-color-border); border-radius: .4rem; }
.kahu-choice-group label { display: flex; align-items: center; gap: .5rem; min-height: 2rem; }
.kahu-choice-group input { min-height: 0; }
.kahu-field [aria-invalid="true"] { border-color: var(--kahu-color-danger) !important; }
.kahu-field-error { margin: 0; color: var(--kahu-color-danger); font-size: .8125rem; }
.kahu-status { margin: 0; padding: .8rem 1rem; border-radius: .4rem; grid-column: 1 / -1; }
.kahu-status--success { background: color-mix(in srgb, var(--kahu-color-success) 14%, transparent); color: var(--kahu-color-success); border: 1px solid color-mix(in srgb, var(--kahu-color-success) 42%, transparent); }

@container (max-width: 42rem) {
  .kahu-technical-index__item,
  .kahu-form-preview { grid-template-columns: 1fr; }
  .kahu-status { grid-column: auto; }
}

/* Optional shell variants. */
.kahu-site-header--compact { --kahu-header-height: 3.75rem; }
.kahu-site-header--reading { --kahu-header-height: 3.75rem; box-shadow: none; }
.kahu-site-header--reading .kahu-wordmark-svg { display: block; width: clamp(6.5rem, 12vw, 8.5rem); height: auto; color: currentColor; }
.kahu-site-header--reading .kahu-header-inner { max-width: 960px; }
