/*
 * AIRundown Design System v1.0.1
 * Sweet. Smart. Elegant. Technical. Responsive.
 * Scope: public frontend only via body.airundown-design-system.
 */

.airundown-design-system {
  /* Typography */
  --air-font-heading: "Manrope", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --air-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --air-font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Preserve Kadence/site brand palette when present; otherwise use calm technical defaults. */
  --air-ink: var(--global-palette3, #111827);
  --air-text: var(--global-palette4, #334155);
  --air-muted: var(--global-palette5, #64748b);
  --air-border: var(--global-palette7, #e5e7eb);
  --air-surface: var(--global-palette8, #f8fafc);
  --air-surface-strong: var(--global-palette9, #ffffff);
  --air-accent: var(--global-palette1, #2563eb);
  --air-accent-hover: var(--global-palette2, #1d4ed8);

  /* Fluid type scale */
  --air-text-xs: clamp(0.74rem, 0.72rem + 0.05vw, 0.78rem);
  --air-text-sm: clamp(0.82rem, 0.80rem + 0.06vw, 0.88rem);
  --air-text-base: clamp(0.97rem, 0.95rem + 0.05vw, 1rem);
  --air-text-reading: clamp(1rem, 0.98rem + 0.08vw, 1.06rem);
  --air-h6: clamp(1rem, 0.98rem + 0.05vw, 1.08rem);
  --air-h5: clamp(1.06rem, 1.02rem + 0.10vw, 1.18rem);
  --air-h4: clamp(1.16rem, 1.08rem + 0.20vw, 1.34rem);
  --air-h3: clamp(1.30rem, 1.20rem + 0.32vw, 1.65rem);
  --air-h2: clamp(1.62rem, 1.42rem + 0.70vw, 2.15rem);
  --air-h1: clamp(2.05rem, 1.72rem + 1.30vw, 3.25rem);
  --air-hero: clamp(2.45rem, 1.95rem + 1.95vw, 4.15rem);

  /* Layout */
  --air-container: 1240px;
  --air-wide: 1080px;
  --air-reading: 780px;
  --air-narrow: 680px;
  --air-gutter: clamp(1.15rem, 3vw, 3rem);
  --air-section: clamp(3rem, 5vw, 5.5rem);
  --air-block-gap: clamp(1.15rem, 1.7vw, 1.75rem);

  /* Shape / effects */
  --air-radius-sm: 8px;
  --air-radius: 14px;
  --air-radius-lg: 20px;
  --air-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.04);
  --air-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.09);

  color: var(--air-text);
  font-family: var(--air-font-body);
  font-size: var(--air-text-base);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Foundation ---------- */
.airundown-design-system :where(p, li, dd, dt, input, textarea, select, button) {
  font-family: var(--air-font-body);
}

.airundown-design-system :where(h1, h2, h3, h4, h5, h6, .entry-title, .site-title) {
  color: var(--air-ink);
  font-family: var(--air-font-heading);
  font-style: normal;
  text-wrap: balance;
}

.airundown-design-system h1,
.airundown-design-system .entry-title {
  font-size: var(--air-h1);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.airundown-design-system h2 {
  font-size: var(--air-h2);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.airundown-design-system h3 {
  font-size: var(--air-h3);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.026em;
}

.airundown-design-system h4 {
  font-size: var(--air-h4);
  font-weight: 700;
  line-height: 1.30;
  letter-spacing: -0.018em;
}

.airundown-design-system h5 {
  font-size: var(--air-h5);
  font-weight: 700;
  line-height: 1.36;
}

.airundown-design-system h6 {
  font-size: var(--air-h6);
  font-weight: 700;
  line-height: 1.4;
}

.airundown-design-system :where(h1, h2, h3, h4, h5, h6)[id] {
  scroll-margin-top: 7rem;
}

.airundown-design-system p {
  margin-block: 0 1.2em;
}

.airundown-design-system :where(ul, ol) {
  padding-inline-start: 1.45em;
}

.airundown-design-system li + li {
  margin-top: 0.42em;
}

.airundown-design-system strong,
.airundown-design-system b {
  color: color-mix(in srgb, var(--air-ink) 94%, transparent);
  font-weight: 700;
}

.airundown-design-system small,
.airundown-design-system .entry-meta,
.airundown-design-system .post-date,
.airundown-design-system .posted-on,
.airundown-design-system .byline,
.airundown-design-system .cat-links,
.airundown-design-system .tags-links {
  color: var(--air-muted);
  font-size: var(--air-text-sm);
  line-height: 1.5;
}

/* ---------- Links ---------- */
.airundown-design-system a {
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

.airundown-design-system :where(.entry-content, .site-main) p a,
.airundown-design-system :where(.entry-content, .site-main) li a {
  color: var(--air-accent);
  font-weight: 550;
  text-decoration-color: color-mix(in srgb, var(--air-accent) 32%, transparent);
}

.airundown-design-system :where(.entry-content, .site-main) p a:hover,
.airundown-design-system :where(.entry-content, .site-main) li a:hover {
  color: var(--air-accent-hover);
  text-decoration-color: currentColor;
}

/* ---------- Header / navigation ---------- */
.airundown-design-system :where(.site-header, #masthead) {
  font-family: var(--air-font-body);
}

.airundown-design-system :where(.site-title, .site-branding .site-title) {
  font-weight: 800;
  letter-spacing: -0.035em;
}

.airundown-design-system :where(.primary-menu-container a, .main-navigation a, .header-navigation a, .mobile-navigation a) {
  font-size: var(--air-text-sm);
  font-weight: 650;
  letter-spacing: -0.008em;
}

.airundown-design-system :where(.primary-menu-container a, .main-navigation a, .header-navigation a) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ---------- Global content rhythm ---------- */
.airundown-design-system :where(.entry-content, .wp-site-blocks main) > :where(h2, h3, h4, h5, h6) {
  margin-top: clamp(2.2rem, 4vw, 3.6rem);
  margin-bottom: 0.7em;
}

.airundown-design-system :where(.entry-content, .wp-site-blocks main) > h2 + :where(p, ul, ol),
.airundown-design-system :where(.entry-content, .wp-site-blocks main) > h3 + :where(p, ul, ol) {
  margin-top: 0;
}

.airundown-design-system :where(.entry-content, .wp-site-blocks main) > :where(figure, blockquote, pre, table, .wp-block-table, .wp-block-image, .wp-block-code) {
  margin-block: clamp(1.6rem, 3vw, 2.5rem);
}

/* ---------- Reading surfaces ---------- */
.airundown-design-system.air-single-content :where(article .entry-header, article .entry-content, article .entry-footer) {
  margin-inline: auto;
}

.airundown-design-system.air-single-content article .entry-header {
  max-width: min(var(--air-wide), calc(100vw - (2 * var(--air-gutter))));
}

.airundown-design-system.air-single-content article .entry-content {
  max-width: min(var(--air-reading), calc(100vw - (2 * var(--air-gutter))));
  font-size: var(--air-text-reading);
  line-height: 1.72;
}

.airundown-design-system.air-single-content article .entry-content :where(h2, h3, h4, h5, h6) {
  line-height: 1.18;
}

.airundown-design-system.air-single-content article .entry-content > p:first-of-type {
  color: color-mix(in srgb, var(--air-text) 90%, var(--air-ink));
}

.airundown-design-system.air-single-content :where(.entry-meta, .entry-taxonomies) {
  font-variant-numeric: tabular-nums;
}

/* ---------- Homepage / landing pages ---------- */
.airundown-design-system.air-page-home :where(.entry-content > h1, .entry-content > .wp-block-group:first-child h1) {
  font-size: var(--air-hero);
  line-height: 1.01;
  letter-spacing: -0.058em;
  max-width: 12ch;
}

.airundown-design-system.air-page-home :where(.entry-content > p, .entry-content > .wp-block-group:first-child p) {
  max-width: 68ch;
}

.airundown-design-system.air-page-home :where(.entry-content > .wp-block-group, .entry-content > section),
.airundown-design-system.air-page-start-here :where(.entry-content > .wp-block-group, .entry-content > section) {
  margin-block: var(--air-section);
}

/* ---------- Cards / grouped surfaces ---------- */
.airundown-design-system :where(.wp-block-group.has-background, .wp-block-column.has-background, .kt-inside-inner-col, .kb-section-dir-horizontal > .kt-inside-inner-col) {
  border-radius: var(--air-radius-lg);
}

.airundown-design-system :where(.wp-block-group.has-background, .wp-block-column.has-background) {
  border: 1px solid color-mix(in srgb, var(--air-border) 86%, transparent);
  box-shadow: var(--air-shadow-sm);
}

/* ---------- Buttons ---------- */
.airundown-design-system :where(.wp-element-button, .wp-block-button__link, button, input[type="submit"], input[type="button"], .button) {
  border-radius: var(--air-radius-sm);
  font-family: var(--air-font-body);
  font-size: var(--air-text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  min-height: 44px;
  padding: 0.78rem 1.08rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.airundown-design-system :where(.wp-element-button, .wp-block-button__link, button, input[type="submit"], input[type="button"], .button):hover {
  transform: translateY(-1px);
}

/* ---------- Form controls / glossary search ---------- */
.airundown-design-system :where(input[type="text"], input[type="search"], input[type="email"], input[type="url"], textarea, select) {
  background: var(--air-surface-strong);
  border: 1px solid var(--air-border);
  border-radius: var(--air-radius-sm);
  color: var(--air-ink);
  font-size: 1rem;
  min-height: 46px;
  padding: 0.72rem 0.9rem;
}

.airundown-design-system :where(input, textarea, select, button, a):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--air-accent) 34%, transparent);
  outline-offset: 3px;
}

.airundown-design-system.air-page-glossary input[type="search"] {
  width: min(100%, 620px);
  min-height: 50px;
  font-size: 1rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

/* Compact glossary alphabet controls without making them visually loud. */
.airundown-design-system.air-page-glossary :where(.entry-content button, .entry-content .button) {
  min-width: 40px;
  min-height: 40px;
  padding: 0.55rem 0.72rem;
}

/* ---------- Blockquotes / callouts ---------- */
.airundown-design-system :where(blockquote, .wp-block-quote) {
  margin-inline: 0;
  padding: 1.1rem 1.25rem;
  border: 0;
  border-left: 3px solid var(--air-accent);
  border-radius: 0 var(--air-radius) var(--air-radius) 0;
  background: color-mix(in srgb, var(--air-surface) 92%, var(--air-accent) 8%);
  color: var(--air-text);
}

.airundown-design-system :where(blockquote, .wp-block-quote) p:last-child {
  margin-bottom: 0;
}

/* ---------- Code ---------- */
.airundown-design-system :where(code, kbd, samp, pre) {
  font-family: var(--air-font-mono);
  font-variant-ligatures: none;
}

.airundown-design-system :not(pre) > code {
  border: 1px solid var(--air-border);
  border-radius: 6px;
  background: var(--air-surface);
  color: color-mix(in srgb, var(--air-ink) 92%, var(--air-accent));
  font-size: 0.88em;
  padding: 0.12em 0.36em;
}

.airundown-design-system :where(pre, .wp-block-code) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid color-mix(in srgb, var(--air-border) 86%, transparent);
  border-radius: var(--air-radius);
  background: #0f172a;
  color: #e5edf8;
  box-shadow: var(--air-shadow-sm);
  font-size: clamp(0.80rem, 0.76rem + 0.12vw, 0.90rem);
  line-height: 1.65;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  tab-size: 2;
}

.airundown-design-system pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

/* ---------- Tables ---------- */
.airundown-design-system :where(table, .wp-block-table table) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--air-border);
  border-radius: var(--air-radius);
  overflow: hidden;
  background: var(--air-surface-strong);
  font-size: var(--air-text-sm);
  line-height: 1.55;
}

.airundown-design-system :where(th, td) {
  padding: clamp(0.72rem, 1.6vw, 1rem);
  border-right: 0;
  border-bottom: 1px solid var(--air-border);
  text-align: left;
  vertical-align: top;
}

.airundown-design-system th {
  background: var(--air-surface);
  color: var(--air-ink);
  font-family: var(--air-font-heading);
  font-weight: 700;
}

.airundown-design-system tr:last-child > :where(th, td) {
  border-bottom: 0;
}

.airundown-design-system .wp-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Images / figures ---------- */
.airundown-design-system :where(.entry-content img, .post-thumbnail img, figure img) {
  height: auto;
  max-width: 100%;
}

.airundown-design-system :where(.entry-content figure img, .entry-content > img, .post-thumbnail img) {
  border-radius: var(--air-radius);
}

.airundown-design-system figcaption,
.airundown-design-system .wp-element-caption {
  color: var(--air-muted);
  font-size: var(--air-text-xs);
  line-height: 1.5;
  margin-top: 0.65rem;
}

/* ---------- Separators ---------- */
.airundown-design-system hr,
.airundown-design-system .wp-block-separator {
  border: 0;
  border-top: 1px solid var(--air-border);
  margin-block: clamp(2rem, 4vw, 3.5rem);
}

/* ---------- Archives ---------- */
.airundown-design-system.air-archive-content :where(.entry-title, .archive-title, .page-title) {
  letter-spacing: -0.04em;
}

.airundown-design-system.air-archive-content :where(article, .loop-entry) {
  border-bottom-color: var(--air-border);
}

/* ---------- Selection ---------- */
.airundown-design-system ::selection {
  background: color-mix(in srgb, var(--air-accent) 20%, white);
  color: var(--air-ink);
}

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1023px) {
  .airundown-design-system {
    --air-container: 960px;
    --air-wide: 880px;
    --air-reading: 740px;
    --air-section: clamp(2.8rem, 6vw, 4.5rem);
  }

  .airundown-design-system.air-single-content article .entry-content {
    line-height: 1.72;
  }

  .airundown-design-system :where(.wp-block-columns) {
    gap: clamp(1rem, 2.6vw, 1.6rem);
  }
}

/* ---------- Responsive: mobile ---------- */
@media (max-width: 767px) {
  .airundown-design-system {
    --air-gutter: clamp(1rem, 5vw, 1.35rem);
    --air-section: clamp(2.3rem, 9vw, 3.6rem);
    --air-block-gap: 1.2rem;
    line-height: 1.64;
  }

  .airundown-design-system h1,
  .airundown-design-system .entry-title {
    letter-spacing: -0.038em;
  }

  .airundown-design-system h2 {
    letter-spacing: -0.028em;
  }

  .airundown-design-system.air-page-home :where(.entry-content > h1, .entry-content > .wp-block-group:first-child h1) {
    max-width: 14ch;
    line-height: 1.01;
    letter-spacing: -0.045em;
  }

  .airundown-design-system.air-single-content article .entry-content {
    max-width: calc(100vw - (2 * var(--air-gutter)));
    line-height: 1.70;
  }

  .airundown-design-system :where(.wp-block-buttons) {
    gap: 0.7rem;
  }

  .airundown-design-system :where(.wp-block-button, .wp-block-button__link) {
    max-width: 100%;
  }

  .airundown-design-system :where(.wp-element-button, .wp-block-button__link, button, input[type="submit"], input[type="button"], .button) {
    min-height: 46px;
  }

  /* Let comparison/data tables scroll rather than crush columns. */
  .airundown-design-system .wp-block-table {
    margin-inline: calc(-1 * var(--air-gutter));
    padding-inline: var(--air-gutter);
    width: calc(100% + (2 * var(--air-gutter)));
  }

  .airundown-design-system :where(pre, .wp-block-code) {
    border-radius: 10px;
  }

  .airundown-design-system :where(.entry-content figure.alignwide, .entry-content figure.alignfull) {
    max-width: 100vw;
  }
}

/* ---------- Very small phones ---------- */
@media (max-width: 390px) {
  .airundown-design-system {
    --air-gutter: 1rem;
  }

  .airundown-design-system :where(.entry-content, .site-main) {
    overflow-wrap: anywhere;
  }
}

/* ---------- Large screens ---------- */
@media (min-width: 1440px) {
  .airundown-design-system {
    --air-container: 1320px;
    --air-wide: 1120px;
    --air-reading: 800px;
  }
}

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

/* ---------- Print ---------- */
@media print {
  .airundown-design-system {
    color: #111;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
  }

  .airundown-design-system :where(.site-header, .site-footer, nav, .sidebar, .widget-area, .wp-block-buttons) {
    display: none !important;
  }

  .airundown-design-system.air-single-content article .entry-content {
    max-width: none;
  }

  .airundown-design-system a {
    color: inherit;
    text-decoration: underline;
  }
}
