/* Responsive */

@media (max-width: 1120px) {
  .home-hero {
    grid-template-columns: minmax(200px, 0.8fr) minmax(250px, 1.2fr);
  }

  .home-hero-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .sessions-layout {
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  }

}

@media (max-width: 860px) {
  .home-hero, .sessions-layout {
    grid-template-columns: 1fr;
  }

  .timeline-container {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .session-reading-mode .timeline-container {
    display: none;
  }

  .view-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #codexView .view-header {
    align-items: flex-start;
  }

  #codexView .view-header .filter-bar {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 2.5rem;
    padding-bottom: 0.25rem;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2rem), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2rem), transparent 100%);
    scrollbar-width: thin;
  }

  #codexView .view-header .filter-btn {
    flex: 0 0 auto;
  }

}

@media (max-width: 680px) {
  html {
    --mobile-nav-height: 4.5rem;
    scroll-padding-block: 72px calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  .slide-panel,
  .dialog-scrim {
    top: var(--shell-header-height);
  }

  .slide-panel,
  #detailPanel,
  #entityPanel,
  #threadPanel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    border-left: 0;
  }

  .slide-panel .panel-content {
    padding-bottom: calc(1.35rem + env(safe-area-inset-bottom));
  }

  .content-area {
    width: 100%;
    min-width: 0;
    padding: 1.25rem 1rem 2.5rem;
  }

  .view-header {
    margin-bottom: 1.15rem;
  }

  .view-header h2 {
    font-size: 2rem;
  }

  .home-last-time-card::before,
  .home-last-time-card::after,
  .session-article-hero::after {
    display: none;
  }

  .home-last-time-card > *,
  .session-article-hero > * {
    max-width: 100%;
  }
  .home-last-time-card .last-time-header,
  .primary-recap-header,
  .home-section-header,
  .detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-latest-actions,
  .home-hero-actions,
  .session-actions,
  .ask-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .home-latest-actions button,
  .home-hero-actions button,
  .session-actions button,
  .ask-actions button {
    width: 100%;
  }

  .home-checklist {
    gap: 0;
    border-top: 1px solid var(--weave-rule);
  }

  .home-checklist-copy .meta {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.2rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .home-checklist-item > .home-latest-actions button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
  }

  .home-checklist-item > .home-latest-actions button::after {
    content: "→";
    font-size: 1rem;
    line-height: 1;
  }

  .home-checklist-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    padding: 0.8rem 0.1rem;
    border: 0;
    border-bottom: 1px solid var(--weave-rule);
    border-radius: 0;
  }

  .home-checklist-item > .home-latest-actions {
    width: auto;
    align-items: center;
    gap: 0.35rem;
  }

  .home-checklist-item .status-pill {
    min-width: 44px;
    text-align: center;
  }

  .session-detail-panel {
    padding: 1rem;
    border-radius: 8px;
  }

  .session-article-hero h4 {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  .session-article-hero {
    min-height: 0;
    padding: 1.6rem 1.2rem;
  }

  .primary-recap-section {
    padding: 1.25rem 1rem 1.4rem;
  }

  .session-summary-full {
    font-size: 1rem;
    line-height: 1.72;
  }

  .session-article-section-summary,
  .evidence-section > summary {
    min-height: 68px;
    padding: 0.75rem 0.2rem;
  }

  .session-article-section-description {
    display: none;
  }

  .session-article-section-summary h4 {
    display: -webkit-box;
    overflow: hidden;
    max-width: 22ch;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 1rem;
    line-height: 1.25;
  }

  .session-article-section-meta {
    overflow: hidden;
    max-width: 8rem;
    line-height: 1.25;
    white-space: normal;
    text-overflow: clip;
  }

  .session-guide-content {
    padding: 0.65rem;
  }

  .session-article-metrics, .session-chronicle-metrics, .session-library-metrics, .knowledge-hub-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .session-article-metric, .session-chronicle-metric, .session-library-metric, .knowledge-hub-metric {
    min-width: 0;
    border-right: 1px solid var(--weave-rule);
    border-bottom: 1px solid var(--weave-rule);
  }

  .knowledge-hub-metrics > :last-child:nth-child(odd), .session-article-metrics > :last-child:nth-child(odd), .session-chronicle-metrics > :last-child:nth-child(odd), .session-library-metrics > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .quest-workbench-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .quest-workbench-toolbar > *, .quest-search-field, .ask-prompt-chips {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
  }

  .ask-prompt-chips button,
  .filter-btn {
    min-height: 44px;
  }

  .ask-query-row {
    grid-template-columns: 1fr;
  }

  .ask-query-row .primary-btn {
    width: 100%;
  }

  #searchView:has(#globalSearchResults .search-result-card) .ask-prompt-panel {
    display: none;
  }

  #searchView:has(#globalSearchResults .search-result-card) > .view-header .eyebrow,
  #searchView:has(#globalSearchResults .search-result-card) > .view-header .view-subtitle {
    display: none;
  }

  .search-results-section {
    margin-top: 0.65rem;
    padding-top: 0.75rem;
  }

  button:not(.nav-tab),
  select,
  input[type="search"],
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  input[type="time"] {
    min-height: 44px !important;
  }

  button:not(.nav-tab):not(.people-segment) {
    min-width: 44px !important;
  }

  .filter-bar {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .filter-btn {
    flex: 0 0 auto;
  }

  .mobile-scroll-hint {
    display: block;
    margin-top: -0.15rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 650;
  }

  .thread-grid {
    grid-template-columns: 1fr;
  }

  .ask-prompt-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-screen {
    align-items: start;
    padding: 1rem;
  }

  #createCampaignForm .form-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  #createCampaignForm .form-actions button {
    width: 100%;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .archive-insights > summary small,
  .session-production-tools > summary small,
  .session-guide-disclosure > summary small {
    display: none;
  }

  .archive-insights > summary,
  .session-production-tools > summary,
  .session-guide-disclosure > summary {
    min-height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body,
  .content-area {
    background: #fff;
  }

  .top-bar,
  .left-nav,
  .detail-header,
  .session-production-tools,
  .evidence-sections,
  .skip-link {
    display: none !important;
  }

  .app-container,
  .app-container.session-reading-mode {
    display: block;
  }

  .session-detail-panel,
  .primary-recap-section {
    border-color: #aaa;
    box-shadow: none;
  }
}
