/* Shared responsive and accessibility fixes. Loaded after page styles. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
img { max-width: 100%; }
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--text, #6366f1) !important;
  outline-offset: 3px !important;
}
.workspace-brand-menu { display: none; }
.workspace-topbar-left, .workspace-topbar-right, #main-view { min-width: 0; }
.brand-link, .nav-controls { flex-shrink: 0; }
.nav-links { min-width: 0; }
.nav-links a { white-space: nowrap; }
.shared-block-card { overflow-wrap: anywhere; }
.shared-block-card pre { max-width: 100%; overflow-x: auto; }

/* Intermediate screens need compact navigation before the mobile drawer. */
@media (min-width: 769px) and (max-width: 1199px) {
  .nav-wrapper { gap: 12px; padding-inline: 20px; }
  .nav-links { gap: 12px; font-size: 12px; }
  .nav-controls { gap: 6px; }
  .nav-controls .btn { padding-inline: 12px; font-size: 12px; }
  .brand-img { height: 40px; max-height: 40px; }
  .brand-link { gap: 8px; font-size: 20px; }
}
@media (min-width: 769px) and (max-width: 1023px) {
  .nav-links { display: none !important; }
}

@media (max-width: 820px) {
  #app-container {
    height: 100vh !important;
    height: 100dvh !important;
  }
  .workspace-brand-menu {
    display: inline-flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 5px;
    border-radius: 10px;
    cursor: pointer;
  }
  .workspace-brand-menu img { width: 34px; height: 34px; border-radius: 8px; }
  .workspace-topbar-left { gap: 6px; flex: 1; overflow: hidden; }
  .workspace-topbar-right { flex-shrink: 0; gap: 4px; }
  #topbar-page-title { max-width: 100%; min-width: 0; }
  .sidebar-logo-img { height: 36px !important; max-height: 36px !important; }
  .page-icon-btn, .page-header-more-btn,
  .workspace-topbar .mode-toggle-btn, .workspace-topbar .btn-lang,
  .block-more-btn.mobile-only-more-btn { min-width: 44px !important; min-height: 44px !important; }
  .page-item { min-height: 44px; }
  .modal { max-height: 100dvh; }
  #sidebar:not(.open) { visibility: hidden; }
  #sidebar.open { visibility: visible; }
  .modal input:not([type="checkbox"]):not([type="radio"]), .modal textarea,
  .modal select { font-size: max(16px, 1em); }
}

@media (max-width: 768px) {
  html { scroll-padding-top: 76px; }
  .brand-img { width: 36px !important; height: 36px !important; max-height: 36px !important; }
  .brand-link { min-height: 44px; font-size: 19px !important; }
  .mobile-drawer-brand .brand-img { width: 40px !important; height: 40px !important; max-height: 40px !important; }
  .mobile-menu-toggle, .mobile-drawer-close-btn { min-width: 44px; min-height: 44px; }
  .hero-wrapper-outer {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 28px 14px 32px !important;
  }
  .hero-container { transform: none !important; opacity: 1 !important; }
  .hero-title { font-size: clamp(23px, 6.4vw, 34px) !important; height: auto !important; max-height: none !important; min-height: 3.7em !important; }
  .hero-desc { max-width: 52ch; }
  #cookie-banner { bottom: max(12px, env(safe-area-inset-bottom)) !important; max-height: 70dvh; overflow-y: auto; }
  #cookie-banner .cookie-actions { flex-wrap: wrap; }
  #cookie-banner .cookie-actions .btn { min-height: 44px; font-size: 13px; }
  .auth-card input, .auth-card select { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-container, .hero-word { transform: none !important; opacity: 1 !important; filter: none !important; }
  .hero-silk-canvas { display: none !important; }
}
