/* Questions panel + Global polish + Panel collapse + Responsive +
 * Splash screen + ORi "O" mark + Phone landscape layouts.
 *
 * Extracted from styles.css 2026-05-20 (Phase 7 bucket 3 follow-up)
 * to bring styles.css under the 700-LoC hard cap. Cascade order is
 * preserved: loads after styles-help-dashboard.css and before
 * styles-signals.css. These sections were a contiguous mid-to-late
 * block in the original styles.css; extracting them as one preserves
 * the global polish + landscape rules' position in the cascade.
 */

    /* ── Questions panel ── */
    .questions-expand-hint { display: none; }
    .questions-clear-btn {
      font-size: var(--fs-xs); color: var(--red); background: none;
      border: 1px solid var(--border); border-radius: var(--radius-sm);
      padding: var(--btn-pad-sm); cursor: pointer;
      transition: background var(--duration-fast), border-color var(--duration-fast);
    }
    .questions-clear-btn:hover { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: var(--red); }
    .question-item {
      display: flex; align-items: flex-start; gap: 8px;
      padding: 8px 10px; margin-bottom: 4px;
      background: var(--surface-lo); border: 1px solid var(--border-card);
      border-radius: var(--radius-sm); font-size: var(--fs-sm);
      line-height: var(--lh-normal); color: var(--text);
      animation: popIn 0.25s var(--ease-out);
      transition: opacity 0.3s, transform 0.3s;
    }
    .question-item.checked { opacity: 0.5; }
    .question-item.checked .question-text { text-decoration: line-through; color: var(--text-3); }
    .question-item input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; cursor: pointer; accent-color: var(--purple); }
    .question-item .question-content { flex: 1; }
    .question-item .question-thread { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 3px; }
    .question-item .question-term { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 3px; }
    .question-item .question-dismiss {
      background: transparent; border: none; color: var(--text-3);
      font-size: 16px; line-height: 1; cursor: pointer; padding: 0 6px;
      flex-shrink: 0; align-self: flex-start;
    }
    .question-item .question-dismiss:hover { color: var(--text); }
    .clickable-question:hover { background: color-mix(in srgb, var(--purple) 12%, transparent); }
    .clickable-question.added { opacity: 0.5; pointer-events: none; }

    /* ── Global polish ── */
    ::selection { background: rgba(96, 165, 250, 0.3); }
    html.light ::selection { background: rgba(37, 99, 235, 0.2); }
    ::placeholder { color: var(--text-3); opacity: 0.7; }
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

    /* ── Panel collapse (mobile only — desktop panels never collapse) ── */

    /* ── Responsive ── */
    .kept-expand-hint { display: none; }

    @media (max-width: 900px) {
      /*
       * Stacked layout: panels fill the screen vertically.
       * Empty panels collapse to header-only; panels with content expand.
       */
      .root { overflow: hidden; }
      .panels { flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }

      .panel {
        flex: 1 1 0; min-height: 0;
        max-height: none;
      }
      .panel.panel-collapsed {
        flex: 0 0 auto; min-height: 0;
      }
      .panel.panel-collapsed .panel-body {
        display: none;
      }
      .panel-header { cursor: pointer; }
      .panel-body {
        flex: 1 1 0; min-height: 0;
        max-height: none;
      }
      .kept-expand-hint { display: inline; }
      .questions-expand-hint { display: inline; }
    }
    @media (max-width: 540px) {
      .root { padding: 4px; gap: 4px; }
      header { padding: 8px 12px; }
      header h1 { font-size: var(--fs-base); }
      .btn { padding: var(--btn-pad-sm); font-size: var(--fs-xs); }
      .panel-header { font-size: var(--fs-xs); }
      .bubble-term { font-size: var(--fs-base); }
    }
    /* ── Splash screen (inside Incoming panel) ── */
    #kp-feed { position: relative; }
    #splash {
      position: absolute; inset: 0; z-index: 10;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      background: transparent;
      pointer-events: none;
      transition: opacity 0.6s ease-out;
    }
    #splash.fade-out { opacity: 0; }
    #splash-logo-dark, #splash-logo-light { width: 360px; height: 360px; }

    /* Pipeline warmup indicator */
    .pipeline-indicator {
      margin-top: 24px;
      display: flex; flex-direction: column; align-items: center; gap: 10px;
      opacity: 0; animation: pip-fadeIn 0.6s ease-out 0.5s forwards;
    }
    @keyframes pip-fadeIn { to { opacity: 1; } }
    .pipeline-steps { display: flex; align-items: center; }
    .pipeline-step {
      display: flex; align-items: center; gap: 6px;
      opacity: 0.35; transition: opacity 0.4s ease;
    }
    .pipeline-step.active { opacity: 1; }
    .pipeline-step.done   { opacity: 0.6; }
    .pip-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--text-3, #5c6490);
      transition: background 0.4s, box-shadow 0.4s;
    }
    .pipeline-step.active .pip-dot {
      background: var(--green, #10b981);
      box-shadow: 0 0 8px rgba(16,185,129,0.5);
      animation: pip-pulse 1.2s ease-in-out infinite;
    }
    .pipeline-step.done .pip-dot { background: var(--green, #10b981); }
    @keyframes pip-pulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.3); opacity: 0.7; }
    }
    .pip-label {
      font-size: 11px; font-weight: 600; color: var(--text-3, #5c6490);
      letter-spacing: 0.3px; transition: color 0.4s;
    }
    .pipeline-step.active .pip-label { color: var(--text, #e0e0e0); }
    .pipeline-connector {
      width: 24px; height: 2px; background: var(--text-3, #5c6490);
      opacity: 0.3; margin: 0 4px;
    }
    .pipeline-status {
      font-size: 12px; color: var(--text-3, #5c6490); letter-spacing: 0.3px;
    }
    #splash-logo-light { display: none; }
    html.light #splash-logo-dark  { display: none; }
    html.light #splash-logo-light { display: block; }

    /* ── ORi "O" mark used in compact landscape header (hidden in portrait) ── */
    .ori-mark-landscape { display: none; }

    /* ── Phone landscape: shared layout for Bubbles and Cards ────────── */
    @media (orientation: landscape) and (max-width: 1024px) {
      /* Root becomes flex-row so the header sits as a left-edge strip */
      .root { flex-direction: row; padding: 0; gap: 0; }

      /* Header: 48px-wide vertical strip on the left edge */
      header {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 48px; flex: 0 0 48px;
        height: 100%;
        padding: 8px 4px;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border);
        min-height: 0;
      }
      header h1 { margin: 0; padding: 0; }
      header h1 img { display: none; }
      header h1 .ori-mark-landscape { display: inline-block; color: var(--text-1); }
      header .header-actions { flex-direction: column; gap: 12px; flex-wrap: nowrap; }
      header #layout-btn { display: none; }
      header #toolbar-status .toolbar-label { display: none; }
      header #toolbar-status { padding: 4px 6px; min-width: 0; }

      /* Hamburger menu opens as popover to the RIGHT of the button */
      .hamburger-menu {
        left: 56px; right: auto; top: auto; bottom: 8px; transform: none;
        max-height: calc(100dvh - 24px);
      }

      /* Content area takes the rest of the width */
      .content-area { flex-direction: row; flex: 1; min-width: 0; padding: 8px; gap: 8px; }
      .panels { flex-direction: row; flex: 1; min-width: 0; }

      /* ── Cards landscape — Incoming maximized; Q and K mini-collapse ── */
      .root:not(.bubble-layout) #incoming-panel { flex: 1 1 0; min-width: 0; }

      /* Two-column card flow in Incoming and History */
      .root:not(.bubble-layout) #kp-feed,
      .root:not(.bubble-layout) #history-feed {
        column-count: 2; column-gap: 8px;
      }
      .root:not(.bubble-layout) #kp-feed > *,
      .root:not(.bubble-layout) #history-feed > * {
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 8px;
      }

      /* Q and K panels: mini-collapsed = 48px vertical icon strip */
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed {
        flex: 0 0 48px;
        min-width: 0;
      }
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .panel-body,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed .panel-body {
        display: none;
      }
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .panel-header,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed .panel-header {
        flex-direction: column;
        padding: 8px 4px;
        gap: 4px;
        justify-content: flex-start;
      }
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .panel-mini-label,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed .panel-mini-label,
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .questions-expand-hint,
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .questions-clear-btn,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed .kept-expand-hint {
        display: none;
      }

      /* When expanded in landscape, take ~50% of .panels width */
      .root:not(.bubble-layout) #questions-panel:not(.panel-mini-collapsed),
      .root:not(.bubble-layout) #kept-panel:not(.panel-mini-collapsed) {
        flex: 0 0 50%;
      }
    }

    /* Default (portrait + desktop): mini-icon hidden, label shown */
    .panel-mini-icon { display: none; }
    @media (orientation: landscape) and (max-width: 1024px) {
      .root:not(.bubble-layout) #questions-panel.panel-mini-collapsed .panel-mini-icon,
      .root:not(.bubble-layout) #kept-panel.panel-mini-collapsed .panel-mini-icon {
        display: block;
      }
    }

