/* KeynotesPodcast.com — mobile hardening. The original theme is unchanged. */
/* Flat equivalents of the template's responsive grid utilities keep its
   layouts available in Safari versions without nested CSS rule support. */
@media (min-width: 640px) { .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) { .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
:root {
  --site-header-height: 86px;
  --phone-gutter: 32px;
}
html { scroll-padding-top: calc(var(--site-header-height) + 16px); }
html.menu-open { overflow: hidden; overscroll-behavior: none; scroll-behavior: auto; }

/* Explicit visibility also keeps closed native details out of layout checks. */
.mobile-nav:not([open]) > .mobile-panel { display: none; }
.mobile-nav[open] > .mobile-panel { display: block; }
.menu-icon { width: 18px; height: 18px; flex: 0 0 18px; display: block; }
.menu-icon svg { display: block; width: 100%; height: 100%; }
.mobile-nav { flex: 0 0 auto; }
.mobile-nav summary, .mobile-toggle, .menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 78px;
  min-height: 46px;
  padding: 9px 10px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  border-radius: 0;
  font: 800 14px/1.2 'Work Sans', Arial, sans-serif;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}
.mobile-nav summary::marker { content: ''; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav summary:hover, .mobile-toggle:hover, .menu-close:hover { background: #ffda47; }
.mobile-nav[open] .menu-icon { transform: rotate(90deg); }

/* A native modal lives in the browser's top layer, outside sticky-header stacks.
   The disclosure above remains the usable, no-JavaScript fallback. */
.mobile-dialog {
  position: fixed;
  inset: 0 0 auto;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: auto;
  max-height: 100vh;
  max-height: var(--menu-viewport-height, 100dvh);
  border: 0;
  border-bottom: 4px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 8px 0 rgb(15 23 42 / 15%);
  overflow: hidden;
  overscroll-behavior: contain;
}
.mobile-dialog:not([open]) { display: none; }
.mobile-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: menu-appear 140ms ease-out;
}
.mobile-dialog::backdrop { background: rgb(15 23 42 / 55%); }
.mobile-dialog-header {
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 16px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 4px solid var(--ink);
}
.mobile-dialog .mobile-panel {
  position: static;
  inset: auto;
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-height: none;
  margin: 0;
  padding: 10px var(--phone-gutter) 20px;
  padding-left: max(var(--phone-gutter), calc(env(safe-area-inset-left, 0px) + 12px));
  padding-right: max(var(--phone-gutter), calc(env(safe-area-inset-right, 0px) + 12px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  border: 0;
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: auto;
  scroll-padding-block: 10px;
}
.mobile-panel a {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 12px 10px;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}
.mobile-panel a:hover, .mobile-panel a:focus-visible,
.mobile-panel a[aria-current='page'] { background: var(--yellow); color: var(--ink); }
.mobile-panel a:focus-visible { outline-offset: -3px; }
.menu-close { flex: 0 0 auto; }
@keyframes menu-appear { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .container {
    padding-left: max(var(--phone-gutter), calc(env(safe-area-inset-left, 0px) + 12px));
    padding-right: max(var(--phone-gutter), calc(env(safe-area-inset-right, 0px) + 12px));
  }
  .site-header { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .header-row { gap: 12px; }
  .site-header .brand, .mobile-dialog-header .brand {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
  }
  .brand-mark { flex-shrink: 0; }
  .site-header .brand-name, .mobile-dialog-header .brand-name {
    font-size: clamp(14px, 4.1vw, 22px);
  }
  .mobile-nav > .mobile-panel {
    max-height: calc(100vh - var(--site-header-height));
    max-height: calc(100dvh - var(--site-header-height));
    padding-left: max(var(--phone-gutter), calc(env(safe-area-inset-left, 0px) + 12px));
    padding-right: max(var(--phone-gutter), calc(env(safe-area-inset-right, 0px) + 12px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .grid > *, .reading-layout > *, .hero-grid > *, .page-hero-grid > *, .footer-grid > * { min-width: 0; }
  main h1, main h2, main h3, main h4 { overflow-wrap: anywhere; }
  .prose, .topic-card, .study-card, .feature-card, .download-card, .post-card, .gallery-card {
    overflow-wrap: break-word;
  }
  .button { max-width: 100%; min-height: 46px; touch-action: manipulation; }
  .button > span[aria-hidden='true'], .card-link .arrow { flex-shrink: 0; }
  .card-link { min-height: 44px; }
  .filter-links a, .tag { min-height: 44px; display: inline-flex; align-items: center; }
  .filter-links { gap: 12px; }
  .breadcrumbs { overflow-wrap: anywhere; }
  .breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }
  .download-card pre { max-width: 100%; overscroll-behavior: contain; }
  .site-footer { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .footer-grid a { min-height: 44px; padding-block: 10px; margin-bottom: 2px; }
  .footer-email a, .footer-bottom > a { display: inline-flex; align-items: center; min-height: 44px; }
  .toc { top: calc(var(--site-header-height) + 16px); }
  .toc a { min-height: 44px; display: flex; align-items: center; padding-block: 7px; font-size: 14px; }
  .toc li + li { margin-top: 4px; padding-top: 4px; }
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .page-hero-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  /* Three text-heavy cards need more room than the old tablet columns allowed. */
  .grid.md\:grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.md\:grid-cols-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 991px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 35px !important; }
  .hero-visual { max-width: 520px; margin-right: 8px; }
  .hero h1 { max-width: 760px; }
  .reading-layout { display: flex; flex-direction: column; gap: 26px; }
  .reading-layout .prose { order: 2; width: 100%; }
  .reading-layout .toc { order: 1; width: 100%; position: static; max-height: none; }
  .toc ol { columns: 2; column-gap: 24px; }
  .toc li { break-inside: avoid; }
}
@media (max-width: 767px) {
  :root { --phone-gutter: 22px; }
  .site-header { padding-block: 12px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .mobile-dialog-header { padding-block: 12px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .mobile-dialog-header .brand { gap: 10px; }
  .site-header .brand-name, .mobile-dialog-header .brand-name { font-size: clamp(14px, 4.1vw, 20px); }
  .page-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-caption { flex-wrap: wrap; }
  .hero .highlight { max-width: 100%; }
  .section-intro, .section-heading-row { min-width: 0; }
  .footer-top > div { min-width: 0; }
  .site-footer .brand { max-width: 100%; }
  .site-footer .brand-name { font-size: clamp(18px, 5vw, 22px); }
}
@media (max-width: 575px) {
  .toc ol { columns: 1; }
  .toc li + li { padding-top: 2px; margin-top: 2px; }
  .toc a { font-size: 14px; line-height: 1.5; }
}
@media (max-width: 390px) {
  :root { --phone-gutter: 16px; }
  .header-row, .mobile-dialog-header { gap: 10px; }
  .mobile-dialog-header .brand { gap: 8px; }
  .mobile-nav summary, .mobile-toggle, .menu-close { padding-inline: 8px; min-width: 76px; gap: 6px; }
}
@media (max-width: 359px) {
  .site-header .brand-mark, .mobile-dialog-header .brand-mark { width: 30px; height: 32px; }
  .hero h1 { font-size: 40px; }
  .page-hero h1 { font-size: 28px; }
  .article-hero h1 { font-size: 30px; }
  .hero .eyebrow, .eyebrow { max-width: 100%; overflow-wrap: anywhere; }
  .button-row .button { width: 100%; }
}
@media (max-width: 1100px) and (max-height: 480px) and (orientation: landscape) {
  .site-header, .mobile-dialog-header { padding-block: 8px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .mobile-dialog .mobile-panel { padding-top: 4px; }
  .hero { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-dialog[open] { animation: none; }
  html { scroll-behavior: auto; }
}
@media print {
  .mobile-dialog, .mobile-nav { display: none !important; }
  html.menu-open { overflow: visible; }
}


/* Audit revision: let enlarged text reflow instead of overlapping the menu or
   extending past the viewport. Normal-size typography and desktop styling stay
   unchanged. This also covers the cloned brand inside the mobile dialog. */
@media (max-width: 1100px) {
  .brand-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .page-hero .subhead, .footer-grid a {
    overflow-wrap: anywhere;
  }
  .section-heading-row > a {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
