/* =========================================================
   J.E.T. PC SIDE RAILS
   Left  = persistent site navigation
   Right = automatic H2/H3 table of contents
   ========================================================= */

.desktop-left-nav,
.desktop-right-toc {
  display: none;
}

/* Heading anchors generated by desktop-toc.js */
body main h2[id],
body main h3[id] {
  scroll-margin-top: 88px;
}

@media (min-width: 1000px) {
  .desktop-left-nav,
  .desktop-right-toc {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: calc((100vw - 430px) / 2);
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .desktop-left-nav::-webkit-scrollbar,
  .desktop-right-toc::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .desktop-left-nav {
    left: 0;
    background:
      radial-gradient(circle at 18% 10%, rgba(255,255,255,.72), transparent 28%),
      linear-gradient(155deg, #dff5ef 0%, #c9e9e0 100%);
  }

  .desktop-right-toc {
    right: 0;
    background:
      radial-gradient(circle at 82% 14%, rgba(255,255,255,.76), transparent 26%),
      linear-gradient(205deg, #faedf0 0%, #f3dce2 100%);
  }

  /* Keep rail content close to the central 430px column. */
  .desktop-left-inner,
  .desktop-toc-inner {
    width: min(310px, calc(100% - 36px));
    min-height: 100%;
    padding-top: 30px;
    padding-bottom: 34px;
  }

  .desktop-left-inner {
    margin-left: auto;
    margin-right: clamp(18px, 2.2vw, 42px);
  }

  .desktop-toc-inner {
    margin-right: auto;
    margin-left: clamp(18px, 2.2vw, 42px);
  }

  /* ---------------------------------------------------------
     LEFT: brand + compact version of the SP menu
  --------------------------------------------------------- */

  .desktop-left-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #17171f;
    text-decoration: none;
  }

  .desktop-left-brand > span:first-child {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1.5px solid #17171f;
    border-radius: 50%;
    background: #ff00e9;
    color: #fff;
    font-size: .68rem;
    font-weight: 950;
    box-shadow: 2px 2px 0 #17171f;
  }

  .desktop-left-brand > span:last-child {
    min-width: 0;
  }

  .desktop-left-brand strong,
  .desktop-left-brand small {
    display: block;
  }

  .desktop-left-brand strong {
    font-size: .77rem;
    font-weight: 950;
    line-height: 1.2;
    letter-spacing: .02em;
  }

  .desktop-left-brand small {
    margin-top: 3px;
    color: #4e5653;
    font-size: .55rem;
    font-weight: 800;
    line-height: 1.3;
  }

  .desktop-left-heading {
    margin: 28px 0 14px;
  }

  .desktop-left-kicker {
    display: block;
    margin-bottom: 6px;
    color: #ff00e9;
    font-size: .61rem;
    font-weight: 950;
    letter-spacing: .15em;
  }

  .desktop-left-heading strong {
    display: block;
    color: #17171f;
    font-family: "Arial Black", "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: clamp(1.22rem, 1.6vw, 1.65rem);
    font-weight: 950;
    line-height: 1.28;
    letter-spacing: -.045em;
  }

  .desktop-left-nav .jet-menu-diagnosis {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 66px;
    padding: 10px 11px;
    border-radius: 13px;
    box-shadow: 3px 3px 0 #17171f;
  }

  .desktop-left-nav .jet-menu-diagnosis-icon {
    width: 36px;
    height: 36px;
  }

  .desktop-left-nav .jet-menu-diagnosis-icon svg {
    width: 22px;
    height: 22px;
  }

  .desktop-left-nav .jet-menu-diagnosis-copy strong {
    font-size: .82rem;
  }

  .desktop-left-nav .jet-menu-diagnosis-copy small {
    font-size: .54rem;
  }

  .desktop-left-nav .jet-menu-new {
    top: 4px;
    right: 6px;
    font-size: .45rem;
  }

  .desktop-left-nav .jet-menu-arrow {
    font-size: 1rem;
  }

  .desktop-left-section {
    margin-top: 22px;
  }

  .desktop-left-section-title {
    display: flex;
    margin-bottom: 8px;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: #17171f;
  }

  .desktop-left-section-title span {
    font-size: .61rem;
    font-weight: 950;
    letter-spacing: .13em;
  }

  .desktop-left-section-title small {
    color: #626763;
    font-size: .54rem;
    font-weight: 800;
  }

  .desktop-left-nav .jet-menu-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .desktop-left-nav .jet-menu-card {
    grid-template-columns: 35px minmax(0, 1fr);
    gap: 8px;
    min-height: 55px;
    padding: 7px 9px;
    border-radius: 10px;
    box-shadow: 2px 2px 0 #17171f;
  }

  .desktop-left-nav .jet-menu-card:nth-child(n) {
    background: rgba(255,255,255,.82);
  }

  .desktop-left-nav .jet-menu-card.is-current {
    background: #d8ee56;
  }

  .desktop-left-nav .jet-menu-card-icon {
    width: 34px;
    height: 34px;
  }

  .desktop-left-nav .jet-menu-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .desktop-left-nav .jet-menu-card-copy strong {
    font-size: .72rem;
  }

  .desktop-left-nav .jet-menu-card-copy small {
    margin-top: 2px;
    font-size: .52rem;
  }

  .desktop-left-nav .jet-menu-card.is-current::after {
    top: 4px;
    right: 5px;
    font-size: .4rem;
  }

  .desktop-left-nav .jet-menu-area-links {
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 6px;
  }

  .desktop-left-nav .jet-menu-area-links a {
    min-height: 37px;
    border-radius: 8px;
    background: rgba(255,255,255,.72);
    font-size: .62rem;
  }

  .desktop-left-apply {
    display: flex;
    margin-top: 20px;
    min-height: 57px;
    padding: 10px 13px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1.5px solid #17171f;
    border-radius: 999px;
    background: #ff00e9;
    color: #fff;
    text-decoration: none;
    box-shadow: 3px 3px 0 #17171f;
  }

  .desktop-left-apply span,
  .desktop-left-apply small,
  .desktop-left-apply strong {
    display: block;
  }

  .desktop-left-apply small {
    margin-bottom: 2px;
    font-size: .48rem;
    font-weight: 800;
  }

  .desktop-left-apply strong {
    font-size: .72rem;
    font-weight: 950;
  }

  .desktop-left-apply b {
    font-size: 1rem;
  }

  .desktop-left-apply:hover,
  .desktop-left-nav .jet-menu-diagnosis:hover {
    transform: translateY(-2px);
  }

  /* ---------------------------------------------------------
     RIGHT: editorial table of contents
  --------------------------------------------------------- */

  .desktop-toc-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .desktop-toc-topline {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: #ff00e9;
  }

  .desktop-toc-topline span {
    font-size: .65rem;
    font-weight: 950;
    letter-spacing: .15em;
  }

  .desktop-toc-topline strong {
    color: #17171f;
    font-family: Georgia, "Times New Roman", serif;
    font-size: .88rem;
    font-weight: 800;
  }

  .desktop-reading-bar {
    height: 5px;
    margin: 8px 0 18px;
    overflow: hidden;
    border: 1px solid #17171f;
    border-radius: 99px;
    background: rgba(255,255,255,.72);
  }

  .desktop-reading-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #ff00e9;
    transition: width .12s linear;
  }

  .desktop-toc-page {
    margin-bottom: 14px;
  }

  .desktop-toc-page small,
  .desktop-toc-page strong {
    display: block;
  }

  .desktop-toc-page small {
    margin-bottom: 5px;
    color: #66605f;
    font-size: .56rem;
    font-weight: 900;
    letter-spacing: .12em;
  }

  .desktop-toc-page strong {
    color: #17171f;
    font-family: "Arial Black", "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: clamp(1.25rem, 1.6vw, 1.72rem);
    font-weight: 950;
    line-height: 1.3;
    letter-spacing: -.045em;
  }

  .desktop-toc-list {
    position: relative;
    display: grid;
    gap: 3px;
    max-height: min(62vh, 610px);
    padding: 12px 0 12px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(23,23,31,.25) transparent;
  }

  .desktop-toc-list::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 15px;
    width: 1px;
    background: rgba(23,23,31,.19);
  }

  .desktop-toc-loading,
  .desktop-toc-empty {
    margin: 0;
    padding: 12px;
    border: 1px dashed rgba(23,23,31,.35);
    border-radius: 10px;
    background: rgba(255,255,255,.5);
    color: #655f60;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.55;
  }

  .desktop-toc-link {
    position: relative;
    z-index: 1;
    display: grid;
    color: #17171f;
    text-decoration: none;
    transition: background .16s ease, transform .16s ease;
  }

  .desktop-toc-link[data-level="2"] {
    grid-template-columns: 31px minmax(0,1fr);
    gap: 7px;
    margin-top: 5px;
    padding: 7px 8px 7px 0;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 950;
    line-height: 1.35;
  }

  .desktop-toc-link[data-level="3"] {
    margin-left: 31px;
    padding: 6px 9px 6px 15px;
    border-radius: 8px;
    color: #554f50;
    font-size: .62rem;
    font-weight: 800;
    line-height: 1.45;
  }

  .desktop-toc-number {
    display: grid;
    width: 31px;
    min-height: 31px;
    place-items: center;
    border: 1px solid #17171f;
    border-radius: 50%;
    background: #fffefa;
    font-family: Georgia, "Times New Roman", serif;
    font-size: .58rem;
    font-weight: 900;
  }

  .desktop-toc-link[data-level="3"]::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a99fa1;
    transform: translateY(-50%);
  }

  .desktop-toc-text {
    align-self: center;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .desktop-toc-link:hover {
    background: rgba(255,255,255,.62);
  }

  .desktop-toc-link.is-active {
    background: #d8ee56;
    color: #17171f;
    transform: translateX(3px);
  }

  .desktop-toc-link.is-active .desktop-toc-number {
    background: #ff00e9;
    color: #fff;
  }

  .desktop-toc-link[data-level="3"].is-active::before {
    background: #ff00e9;
    box-shadow: 0 0 0 3px rgba(255,0,233,.14);
  }

  .desktop-back-to-top {
    display: flex;
    width: 100%;
    min-height: 43px;
    margin-top: 13px;
    padding: 8px 11px;
    align-items: center;
    justify-content: space-between;
    border: 1.5px solid #17171f;
    border-radius: 10px;
    background: rgba(255,255,255,.72);
    color: #17171f;
    font: inherit;
    font-size: .62rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 2px 2px 0 #17171f;
  }

  .desktop-back-to-top b {
    color: #ff00e9;
    font-size: .9rem;
  }

  .desktop-right-toc.toc-empty .desktop-toc-list {
    max-height: none;
  }

  /* At the lower edge of "desktop", keep both rails useful but tighter. */
  @media (max-width: 1199px) {
    .desktop-left-inner,
    .desktop-toc-inner {
      width: min(245px, calc(100% - 24px));
    }

    .desktop-left-inner {
      margin-right: 12px;
    }

    .desktop-toc-inner {
      margin-left: 12px;
    }

    .desktop-left-heading strong,
    .desktop-toc-page strong {
      font-size: 1.15rem;
    }

    .desktop-left-nav .jet-menu-card {
      grid-template-columns: 30px minmax(0, 1fr);
      padding-inline: 7px;
    }

    .desktop-left-nav .jet-menu-card-icon {
      width: 29px;
      height: 29px;
    }

    .desktop-left-nav .jet-menu-card-icon svg {
      width: 18px;
      height: 18px;
    }

    .desktop-left-nav .jet-menu-card-copy small {
      display: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .desktop-toc-link,
  .desktop-reading-bar span,
  .desktop-left-apply,
  .desktop-left-nav .jet-menu-diagnosis {
    transition: none;
  }
}
