/* ==========================================================================
   SysAdmin Wiki — responsive и печать
   ========================================================================== */

@media (max-width: 1320px) {
  .app {
    padding-right: 32px;
    padding-left: 32px;
  }

  .hero {
    gap: 30px;
  }

  .topnav a {
    padding-right: 8px;
    padding-left: 8px;
  }
}

@media (max-width: 1240px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-toc {
    display: none;
  }

  .article-body {
    max-width: none;
  }
}

@media (max-width: 1120px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 0.85fr);
    gap: 26px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .path-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    padding-top: 12px;
  }

  .about-grid,
  .about-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-publish {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__content {
    max-width: 720px;
  }

  .hero__visual {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
  }

  .hero__lead {
    max-width: 640px;
  }

  .block__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }

  .block__head--row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .cta {
    grid-template-columns: minmax(0, 1fr);
  }

  .cta__stats {
    max-width: 430px;
  }

  .section-hero {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 16px;
    padding: 22px;
  }

  .section-hero__icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .section-hero__progress {
    grid-column: 1 / -1;
    padding: 14px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .section-hero__percent {
    display: inline-block;
    font-size: 1.6rem;
  }

  .section-hero__progress-label {
    display: inline-block;
    margin: 0 0 0 8px;
  }

  .section-hero__progress .progress {
    margin-top: 9px;
  }
}

@media (max-width: 760px) {
  .hero {
    gap: 34px;
    min-height: 0;
  }

  .hero__content h1 {
    font-size: clamp(2.5rem, 9.5vw, 3.5rem);
  }

  .floating-card--top {
    top: -16px;
    right: -4px;
  }

  .floating-card--bottom {
    bottom: -18px;
    left: -4px;
  }

  .terminal {
    transform: none;
  }

  .terminal__body {
    min-height: 200px;
    font-size: 0.7rem;
  }

  .section-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards-grid--3,
  .cards-grid--2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .path-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .path-step {
    min-height: 0;
  }

  .cta {
    padding: 24px;
  }

  .cta__stats {
    max-width: none;
  }

  .toolbar {
    align-items: stretch;
  }

  .filter-chips {
    width: 100%;
  }

  .filter-chip {
    flex: 1;
    text-align: center;
  }

  .toolbar .field {
    flex: 1 1 100%;
    max-width: none;
  }

  .article-head {
    padding: 21px;
  }

  .article-meta {
    gap: 7px 12px;
  }

  .article-actions .btn {
    flex: 1 1 auto;
  }

  .step {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 13px;
    padding-bottom: 30px;
  }

  .step__marker {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 0.72rem;
  }

  .step:not(:last-child)::before {
    left: 18px;
    top: 40px;
  }

  .article-intro {
    padding: 17px;
    font-size: 0.9rem;
  }

  .step__text {
    font-size: 0.85rem;
  }

  .goals ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .checklist {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-panel__head {
    flex-direction: column;
    gap: 5px;
  }

  .section-footnote--actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-footnote__buttons {
    width: 100%;
  }

  .section-footnote__buttons .btn {
    flex: 1;
  }

  .article-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-link--next {
    justify-content: flex-start;
    text-align: left;
  }

  .cmd__pre {
    padding: 13px;
    font-size: 0.73rem;
  }

  .cmd__copy span {
    display: none;
  }

  .cmd__copy {
    padding: 6px;
  }

  .page-head h1 {
    font-size: clamp(2rem, 8vw, 2.6rem);
  }

  .quick-note {
    padding: 16px;
  }

  .quick-note__foot {
    align-items: stretch;
  }

  .quick-note__foot .btn {
    width: 100%;
  }

  .search-modal {
    padding: 16px 10px;
  }

  .search-modal__panel {
    max-height: calc(100vh - 32px);
  }

  .search-result__snippet {
    -webkit-line-clamp: 3;
  }

  .search-modal__hint {
    display: none;
  }

  .about-publish {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-keys {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .hero__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-search {
    flex: 1 1 auto;
    max-width: none;
  }

  .hero__actions > .btn {
    width: 100%;
  }

  .hero__tags {
    font-size: 0.68rem;
  }

  .floating-card {
    padding: 8px 10px;
    border-radius: 10px;
  }

  .floating-card--top {
    top: -12px;
  }

  .floating-card--bottom {
    bottom: -14px;
  }

  .floating-card strong {
    font-size: 0.7rem;
  }

  .floating-card small {
    font-size: 0.57rem;
  }

  .floating-card__icon {
    width: 27px;
    height: 27px;
  }

  .floating-card__ring {
    width: 32px;
    height: 32px;
  }

  .terminal__body {
    min-height: 180px;
    padding: 14px;
    font-size: 0.64rem;
    line-height: 1.75;
  }

  .terminal__bar {
    padding: 8px 10px;
  }

  .section-hero {
    grid-template-columns: 46px minmax(0, 1fr);
    padding: 18px;
  }

  .section-hero__icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .section-hero__icon .icon {
    width: 24px;
    height: 24px;
  }

  .section-hero h1 {
    font-size: 1.7rem;
  }

  .section-hero__body > p {
    font-size: 0.8rem;
  }

  .section-hero__meta {
    gap: 5px 10px;
  }

  .meta-item--muted {
    flex-basis: 100%;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    gap: 9px;
    padding: 12px;
  }

  .stat-card__icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
  }

  .stat-card strong {
    font-size: 1.1rem;
  }

  .section-card {
    min-height: 0;
  }

  .article-head h1 {
    font-size: 1.75rem;
  }

  .article-head__lead {
    font-size: 0.86rem;
  }

  .article-actions {
    gap: 6px;
  }

  .article-actions .btn {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 0.78rem;
  }

  .article-actions .btn--icon-label {
    flex: 0 0 auto;
  }

  .notes-panel {
    padding: 16px;
  }

  .notes-panel__foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .goals {
    padding: 16px;
  }

  .callout {
    padding: 11px 12px;
  }

  .search-modal {
    padding: 0;
  }

  .search-modal__panel {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .search-modal__field {
    padding-top: 18px;
  }

  .search-modal__meta {
    padding: 9px 14px;
  }

  .search-suggest {
    padding: 6px 2px;
  }

  .cta {
    padding: 20px;
    border-radius: 20px;
  }

  .cta__stats {
    padding: 14px 10px;
  }

  .breadcrumbs {
    margin-bottom: 15px;
  }

  .footer__inner {
    padding: 26px 16px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__content h1 {
    font-size: 2.25rem;
  }

  .filter-chip {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 0.68rem;
  }

  .brand__text span {
    display: none;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --text: #111;
    --text-soft: #333;
    --muted: #555;
    --border: #ccc;
    --border-strong: #bbb;
    --surface: #fff;
    --surface-solid: #fff;
    --surface-2: #f5f5f7;
    --surface-3: #eee;
    --bg: #fff;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
  }

  .ambient,
  .topbar,
  .sidebar,
  .sidebar-scrim,
  .footer,
  .reading-progress,
  .article-toc,
  .article-actions,
  .breadcrumbs,
  .article-pager,
  .related,
  .search-modal,
  .toast,
  .no-print,
  .cmd__copy,
  .notes-panel__foot .text-btn,
  .section-footnote,
  .hero__visual,
  .floating-card {
    display: none !important;
  }

  .shell {
    display: block;
    padding-top: 0;
    min-height: 0;
  }

  .app {
    max-width: none;
    padding: 0;
    animation: none;
  }

  .article-head,
  .article-intro,
  .goals,
  .notes-panel,
  .cmd,
  .callout,
  .check-item,
  .section-hero,
  .article-card {
    background: #fff !important;
    border-color: #ccc !important;
    box-shadow: none !important;
  }

  .article-head h1 {
    font-size: 24pt;
    color: #111 !important;
  }

  .article-head__lead,
  .article-intro,
  .step__text,
  .callout__body p,
  .check-text,
  .note-card__text {
    color: #222 !important;
  }

  .article-layout {
    display: block;
    margin-top: 16px;
  }

  .article-body {
    max-width: none;
  }

  .step {
    page-break-inside: avoid;
    grid-template-columns: 30px 1fr;
    padding-bottom: 16px;
  }

  .step__marker {
    width: 30px;
    height: 30px;
    background: #f0f0f0 !important;
    color: #333 !important;
    font-size: 8pt;
  }

  .step:not(:last-child)::before {
    display: none;
  }

  .cmd {
    page-break-inside: avoid;
  }

  .cmd__head {
    background: #eee !important;
    border-color: #ccc;
  }

  .cmd__pre {
    background: #f8f8fa !important;
    color: #111 !important;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 9pt;
  }

  .tok-comment { color: #666; }
  .tok-cmd { color: #1d4ed8; }
  .tok-sudo { color: #7e22ce; }
  .tok-string { color: #166534; }
  .tok-section { color: #92400e; }

  .notes-panel textarea {
    min-height: 90px;
    border: 1px solid #ccc;
    background: #fff !important;
    color: #111 !important;
  }

  a {
    color: #111 !important;
    text-decoration: none !important;
  }

  .check-item.is-checked .check-text {
    color: #444 !important;
  }

  .step h2,
  .section-title-row h2,
  .goals h2 {
    page-break-after: avoid;
  }
}

@media (max-width: 700px) {
  .cta {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 22px 18px;
  }

  .cta__content,
  .cta__stats {
    min-width: 0;
    width: 100%;
  }

  .cta__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 14px 8px;
  }

  .cta__stats strong {
    font-size: 1.25rem;
  }

  .cta__stats span {
    font-size: 0.68rem;
    overflow-wrap: anywhere;
  }
}