/* Screen UI sizing at normal OS/browser scale. Loaded after the page styles.
 * Keep the established type hierarchy; enlarge controls and reading space more
 * than headings. No ancestor zoom/transform and no document/export selectors.
 * Small screens keep their existing layout and type sizes.
 */
@media screen and (min-width: 1024px) {
  :root {
    --ui-caption: 13px;
    --ui-small: 15px;
    --ui-body: 16px;
    --ui-lead: 18px;
    --ui-heading: 21px;
    --ui-title: 28px;
    --ui-content-width: 1450px;
  }

  /* Shared navigation: retain its relationship to the existing header artwork. */
  .nav-bar { top: 12px; height: 100px; gap: 20px; }
  .header-hero { min-width: 1750px; }
  .logo img { width: 212px; }
  .auth-banner { font-size: var(--ui-small); margin-left: 12px; }
  .nav { gap: 10px; }
  .nav > a,
  .nav > a[aria-current="page"],
  .nav > .nav-item > a {
    font-size: var(--ui-small);
    padding: 9px 16px;
    gap: 8px;
  }
  .dropdown { min-width: 300px; padding: 8px 0; }
  .dropdown-item,
  .nav .dropdown a.dropdown-item { font-size: var(--ui-small); padding: 12px 20px; }
  .login-btn { font-size: var(--ui-small); min-width: 130px; height: 42px; padding: 0 24px; }
  .burger { width: 44px; height: 44px; }
  .drawer { width: 330px; right: -350px; padding: 24px; }
  .drawer-nav a,
  .drawer-login,
  .drawer-auth-banner { font-size: var(--ui-small); }

  /* Keep the permanent hero copy lighter, with more air around the heading.
     The temporary notice keeps its existing typography and spacing. */
  body.home-document > main {
    --hero-top-space: calc(clamp(150px, 10.15625vw, 195px) - clamp(0px, 60px - 3.125vw, 10px));
    margin-top: clamp(70px, 4.58vw, 88px);
    padding-top: calc(var(--hero-top-space) * 0.9);
    padding-bottom: calc(24px + var(--hero-top-space) * 0.1);
  }
  .main-hero {
    --hero-heading-air: clamp(15px, 1.15vw, 20px);
    height: auto;
    min-height: clamp(400px, 29.16667vw, 560px);
    gap: clamp(10px, 0.72vw, 11px);
  }
  .main-hero p { font-size: clamp(19.95px, 1.4546875vw, 22.325px); }
  .main-hero .gi-line .initial { font-size: clamp(24.7px, 1.7936vw, 27.55px); }
  .main-hero h1 {
    width: min(665px, 100%);
    font-size: clamp(53.2px, 4.0078125vw, 76.95px);
    margin-top: calc(clamp(12px, 0.88vw, 13.5px) + var(--hero-heading-air));
    text-indent: clamp(49.4px, 3.591vw, 55.1px);
  }
  .main-hero h1 + p { margin-top: var(--hero-heading-air); }
  .main-hero p.main-hero-role {
    font-size: clamp(15.2px, 1.11328125vw, 17.1px);
    border-left-width: 3px;
    padding-left: clamp(12px, 0.88vw, 13.5px);
    margin-top: 9px;
  }
  .main-hero p.main-hero-test-note {
    font-size: clamp(16px, 1.171875vw, 18px);
    max-width: min(100%, clamp(700px, 51.3vw, 790px));
    margin-top: 20px;
  }
  footer { padding: 44px 0; }
  .footer-content.footer-only-contact { gap: 20px; min-height: 62px; }
  .footer-contact-item a,
  .footer-contact-item span { font-size: var(--ui-small); }
  .footer-bottom p,
  .footer-bottom a { font-size: var(--ui-caption); }

  /* Public lists and profile use the same readable desktop measure. */
  main.documents-page,
  main.registry-page {
    width: 84%;
    max-width: var(--ui-content-width);
    margin-top: max(88px, 3.65vw);
    padding: max(120px, 5.2vw) 0 70px;
  }
  main:has(> .my-grid) {
    width: 84%;
    max-width: var(--ui-content-width);
    margin-top: max(183px, 8vw);
    padding: 25px 0 70px;
  }
  .documents-page h1,
  .registry-page h1,
  .page-section h1 { font-size: var(--ui-title); }
  .documents-page .documents-toolbar,
  .registry-page .registry-controls { padding: 25px 30px; margin-bottom: 22px; gap: 20px; }
  .documents-page .documents-search-field { max-width: 525px; flex-basis: 400px; }
  .documents-page .documents-search,
  .registry-page .registry-search,
  .registry-page .registry-sort select { height: 48px; font-size: var(--ui-small); }
  .documents-page .documents-count-badge,
  .registry-page .registry-count-badge { font-size: var(--ui-caption); padding: 5px 12px; }
  .documents-page .documents-grid,
  .registry-page .registry-list { gap: 12px; }
  .documents-page .doc-public-card,
  .registry-page .registry-card { padding: 19px 25px; gap: 20px; }
  .documents-page .doc-public-title,
  .registry-page .registry-name { font-size: var(--ui-lead); }
  .documents-page .doc-public-index { width: 46px; height: 46px; font-size: var(--ui-small); }
  .documents-page .doc-public-code,
  .registry-page .registry-code,
  .registry-page .registry-code span { font-size: var(--ui-caption); }
  .documents-page .doc-public-view-btn,
  .documents-page .doc-public-pdf-btn,
  .registry-page .registry-reset { font-size: var(--ui-small); min-height: 42px; padding: 8px 17px; }
  .documents-page .doc-public-view-btn > span,
  .documents-page .doc-public-pdf-btn > span { font-size: inherit; }
  .registry-page .registry-field-label,
  .registry-page .registry-check span,
  .registry-page .registry-qualification { font-size: var(--ui-small); }
  .registry-page .registry-check { padding: 10px 16px; }
  .registry-page .registry-check input { width: 18px; height: 18px; }
  .registry-page .registry-avatar { width: 57px; height: 70px; }
  .registry-page .registry-code strong { font-size: var(--ui-body); }
  .registry-page .registry-status,
  .registry-page .registry-rating { font-size: var(--ui-caption); }
  .registry-page .registry-pagination button,
  .registry-page .registry-refresh-error button { font-size: var(--ui-small); min-height: 42px; }
  .documents-page .documents-empty,
  .documents-page .documents-error,
  .registry-page .registry-empty { font-size: var(--ui-body); }

  .page-section.page-section--with-photo { padding: 20px 28px; gap: 22px; margin-bottom: 22px; }
  .page-header-photo { width: 80px; height: 105px; }
  .my-grid { gap: 25px; }
  .my-grid .profile-card,
  .my-grid .cert-card,
  .my-grid .reviews-card,
  .my-grid .expert-card { padding: 22px 25px; }
  .my-grid .profile-card h2,
  .my-grid .cert-head h2,
  .my-grid .reviews-head h2,
  .my-grid .expert-head h2 { font-size: var(--ui-lead); }
  .profile-grid,
  .cert-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 10px 15px; }
  .profile-row,
  .cert-row { padding: 11px 16px; flex-wrap: wrap; }
  .my-grid .profile-label,
  .my-grid .cert-label { font-size: var(--ui-small); }
  .my-grid .profile-value,
  .my-grid .cert-value,
  .my-grid .comment-text,
  .my-grid .comment-form textarea { font-size: var(--ui-body); overflow-wrap: anywhere; }
  .my-grid .profile-value,
  .my-grid .cert-value { white-space: normal; }
  .my-grid #myCode,
  .my-grid #myCertCode { font-size: var(--ui-small); }
  .my-grid .comment-meta,
  .my-grid .cert-card #myCertStatus { font-size: var(--ui-caption); }
  .profile-edit-btn,
  .cert-download,
  .comment-submit,
  .expert-btn,
  .my-grid .file-choose { font-size: var(--ui-small); min-height: 42px; padding: 9px 17px; }
  .profile-edit-input,
  .my-grid .expert-field input[type="text"],
  .expert-search { font-size: var(--ui-body); }
  .expert-label,
  .file-link,
  .file-chosen,
  .expert-item .meta,
  .expert-item .files a,
  .rating-note { font-size: var(--ui-caption); }
  .expert-item > summary { font-size: var(--ui-small); }

  /* Dialog chrome and form controls only. Official document typography is
     deliberately owned by its existing stylesheet and PDF renderer. */
  .login-modal .modal-content { width: min(90%, 525px); padding: 40px; gap: 24px; }
  .login-modal.registration-consent-open .modal-content { width: min(92%, 1000px); }
  .modal-content > h3,
  .site-info-head h3,
  .site-info-content > h3,
  #userStatementsOverlay .results-modal-titles h2 { font-size: var(--ui-heading); }
  .modal-btn,
  .field input,
  .field textarea,
  .submit,
  .back-to-login,
  .otp-resend,
  .verification-info,
  .site-info-download-btn { font-size: var(--ui-small); }
  .field input,
  .modal-btn,
  .submit { min-height: 44px; }
  .forgot-password-link a,
  .password-strength-label,
  .otp-countdown { font-size: var(--ui-caption); }
  .registration-consent h3 { font-size: var(--ui-heading); }
  .registration-consent-copy,
  .registration-consent-copy p,
  .registration-consent-copy strong,
  .registration-consent-copy a,
  .registration-consent-choice,
  .registration-consent-choice span { font-size: var(--ui-body); }
  .site-info-content { width: min(100%, 1150px); }
  .site-info-head { padding: 20px 30px; }
  .site-info-close { flex-shrink: 0; }
  .guide-intro-text,
  .guide-video-public-title,
  .site-info-state { font-size: var(--ui-body); }
  .guide-video-public-meta { font-size: var(--ui-caption); }
  .team-list-public li,
  .team-list-public li > strong { font-size: var(--ui-body); }
  .team-contacts,
  .team-email,
  .team-phone { font-size: var(--ui-caption); }
  #userStatementsOverlay .results-modal { width: min(100%, 1100px); }
  #userStatementsOverlay .statement-field-label,
  #userStatementsOverlay textarea { font-size: var(--ui-body); }
  #userStatementsOverlay .statement-hint,
  #userStatementsOverlay .meta-item,
  #userStatementsOverlay .statement-required-badge { font-size: var(--ui-caption); }
  #userStatementsOverlay .statement-history h3 { font-size: var(--ui-lead); }
  .ai-assistant-panel { width: min(650px, calc(100vw - 32px)); }
  .ai-assistant-panel.is-expanded { width: min(1100px, calc(100vw - 32px)); }
  .ai-panel-title { font-size: var(--ui-body); }
  .ai-msg-bubble,
  .ai-msg-p,
  .ai-msg-bubble li,
  .ai-empty-chat-hint,
  .ai-chat-input,
  .ai-chat-send-btn { font-size: var(--ui-small); }
  .ai-msg-heading { font-size: var(--ui-body); }
  .toast-message { font-size: var(--ui-body); }
}

/* Keep full desktop navigation visible on standard 1200-1440px laptops by
   widening the nav track and tightening horizontal padding slightly. */
@media screen and (min-width: 1181px) and (max-width: 1475px) {
  .nav-bar {
    width: min(94%, 1360px);
    gap: 12px;
  }
  .logo img { width: 176px; }
  .auth-banner {
    font-size: 13.5px;
    margin-left: 6px;
    max-width: 16vw;
  }
  .nav { gap: 4px; }
  .nav > a,
  .nav > a[aria-current="page"],
  .nav > .nav-item > a {
    font-size: 14px;
    padding: 7px 11px;
    gap: 6px;
  }
  .login-btn {
    min-width: 112px;
    height: 38px;
    padding: 0 16px;
    font-size: 14px;
  }
  main.documents-page,
  main.registry-page,
  main:has(> .my-grid) { width: 90%; }
}

/* Switch to the drawer only at <= 1180px (matching header.css). */
@media screen and (min-width: 1024px) and (max-width: 1180px) {
  .nav,
  .auth-banner,
  .login-btn { display: none; }
  .burger { display: flex; position: static; transform: none; }
  .nav-bar { justify-content: space-between; }
  main.documents-page,
  main.registry-page,
  main:has(> .my-grid) { width: 90%; }
}

@media screen and (min-width: 1024px) and (max-width: 1125px) {
  .registry-page .registry-control-row { grid-template-columns: minmax(0, 1fr); }
  .documents-page .documents-search-field { min-width: 0; max-width: none; flex-basis: 100%; }
  .documents-page .doc-public-card { grid-template-columns: auto minmax(0, 1fr); }
  .documents-page .doc-public-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
