/* MOS-Navigation: Textlinks erscheinen als Buttons. Bereits gestaltete
   Buttons, Bild-Links, Karten und Kalenderzellen behalten ihre Geometrie. */
@media screen {
  :is(main.wrap, .mos-pdf-preview main) a[href]:not(
    .btn, .billing-choice-link, .appointment, .free-cell, .teacher-week-ap,
    .appointment-details, .planner-ap-top, .planner-date-button, .planner-create,
    .planner-today, .mos-teacher-blue-details, .teacher-week-open, .sb-sheet-image,
    .branch-filters a, .appointment-actions a
  ) {
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    padding: .32em .62em;
    border: 1px solid #d2e2d5;
    border-radius: 7px;
    background: #eaf1eb;
    color: #254c38;
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-decoration: none;
    vertical-align: middle;
  }
  main.wrap a.mos-icon-link,
  main.wrap .contact-actions a[href] {
    min-width: 2.25rem;
    text-align: center;
  }
  :is(main.wrap a[href], .mos-pdf-preview :is(a[href],button), .btn,
      .toolbar :is(button,.close-preview), #sb-chapters .sb-sheet-controls button,
      #sb-chapters .sb-file-more > summary):not(:disabled,[aria-disabled="true"]):focus-visible {
    outline: 2px solid #315e4d;
    outline-offset: 2px;
  }
  @media (pointer: coarse) {
    main.wrap a.mos-icon-link, main.wrap .contact-actions a[href] {
      min-width: 44px;
      padding-block: 10px;
    }
  }
  @media (hover: hover) and (pointer: fine) {
    :is(main.wrap a[href], .mos-pdf-preview :is(a[href],button), .btn,
        .toolbar :is(button,.close-preview), #sb-chapters .sb-sheet-controls button,
        #sb-chapters .sb-file-more > summary):not(:disabled,[aria-disabled="true"],.free-cell):hover {
      filter: brightness(.92);
      box-shadow: 0 6px 0 -2px #264d3d70, 0 10px 14px -6px #123b2a88;
      text-decoration: none;
    }
    #sb-chapters :is(.sb-uk-title,.sb-legacy-tools > summary):hover {
      background: #edf5ee;
      border-radius: 8px;
    }
    @media (prefers-reduced-motion: no-preference) {
      :is(main.wrap a[href], .mos-pdf-preview :is(a[href],button), .btn,
          .toolbar :is(button,.close-preview), #sb-chapters .sb-sheet-controls button,
          #sb-chapters .sb-file-more > summary):not(:disabled,[aria-disabled="true"],.free-cell) {
        transition: transform .2s ease, filter .18s ease, box-shadow .2s ease, background-color .18s ease;
      }
      :is(main.wrap a[href], .mos-pdf-preview :is(a[href],button), .btn,
          .toolbar :is(button,.close-preview), #sb-chapters .sb-sheet-controls button,
          #sb-chapters .sb-file-more > summary):not(:disabled,[aria-disabled="true"],.free-cell):hover {
        transform: translateY(var(--mos-lift, -5px));
      }
      :is(main.wrap a[href], .mos-pdf-preview :is(a[href],button), .btn,
          .toolbar :is(button,.close-preview), #sb-chapters .sb-sheet-controls button,
          #sb-chapters .sb-file-more > summary):not(:disabled,[aria-disabled="true"],.free-cell):active {
        transform: none;
        box-shadow: none;
      }
      /* Enge Terminraster: Der Effekt bleibt sichtbar, ohne Nachbarzellen zu verdecken. */
      main.wrap :is(.appointment,.appointment-details,.planner-ap-top,.teacher-week-ap,
                    .teacher-week-open,.mos-teacher-blue-details,.appointment-actions a) {
        --mos-lift: -2px;
      }
    }
  }
}

/* Hauptnavigation im gleichen Grün wie die primären MOS-Buttons. */
@media screen {
  main.wrap :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn) {
    background-color: #35664b;
    color: #fff;
  }
}

/* Variante „Schwebt nach oben“ auch für die Hauptnavigation. */
@media screen and (hover: hover) and (pointer: fine) {
  main.wrap :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn):not(:disabled,[aria-disabled="true"]):hover {
    background-color: #244c38;
    color: #fff;
    filter: none;
    box-shadow: 0 7px 0 -2px #688673, 0 11px 14px -6px #123b2a88;
  }
  @media (prefers-reduced-motion: no-preference) {
    :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn) {
      position: relative;
      transition: transform .2s ease, background-color .18s ease, color .18s ease, box-shadow .2s ease;
    }
    :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn):not(:disabled,[aria-disabled="true"]):hover {
      transform: translateY(-5px);
    }
    /* Der untere Rand bleibt beim Anheben unter dem Mauszeiger erreichbar. */
    :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn):not(:disabled,[aria-disabled="true"]):hover::after {
      content: "";
      position: absolute;
      inset: 100% 0 -5px;
    }
    :is(.mos-top-nav > a.btn, .mos-userline button.btn, .mos-nav-logout button.btn):not(:disabled,[aria-disabled="true"]):active {
      transform: none;
      box-shadow: none;
    }
  }
}
