/* SHELL / GUIDE LAYOUT
   This file assumes site.css was already loaded first.
*/

/* Make the shell page behave like an "app" instead of a normal scrolling doc:
   - lock outer body so the browser itself doesn't scroll
   - inner panels handle scroll instead
*/
html,
body {
  height:100vh;
  min-height:100vh;

  margin:0;
  padding:0;

  display:flex;
  flex-direction:column;

  overflow-y:hidden;
  overflow-x:hidden;
  background:var(--bg);
  color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,Cantarell,"Noto Sans",sans-serif;
  line-height:1.55;
}

/* Let header still sit at the top and not shrink weirdly */
header.site-header {
  flex-shrink:0;
}

/* -------------------------------------------------
   MAIN SHELL GRID (desktop)
   ------------------------------------------------- */

.shell-layout{
  max-width:1200px;
  margin:14px auto 0;
  padding:0 16px 16px;

  display:grid;
  gap:14px;

  /* left nav is ~300px, right viewer up to 800px */
  grid-template-columns:300px minmax(0,800px);
  align-items:start;

  /* fill the rest of the viewport below header */
  flex:1 0 auto;
  min-height:0;
}

.shell-panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
}

/* sticky left nav, sticky right viewer */
.shell-nav,
.shell-viewer{
  position:sticky;
  top:0;
  height:var(--panel-h);

  display:flex;
  flex-direction:column;
  overflow:hidden;
}

/* -------------------------------------------------
   LEFT NAV (search + TOC)
   ------------------------------------------------- */

.shell-search{
  padding:10px;
  border-bottom:1px solid var(--line);
  display:flex;
  gap:8px;
  align-items:center;
  background:#fff;
  z-index:1;
}
.shell-search input{
  width:100%;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  outline:0;
}

.shell-toc{
  list-style:none;
  margin:0;
  padding:8px 0 12px;

  flex:1 1 auto;
  overflow:auto;
  overscroll-behavior:contain;
}
.shell-toc .level{
  margin:10px 12px 6px;
  color:var(--muted);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.5px;
}
.shell-item{
  display:block;
  text-decoration:none;
  color:var(--ink);

  padding:8px 12px;
  border-left:3px solid transparent;
  border-radius:8px;
  margin:2px 8px;

  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden;
}
.shell-item.h1{
  font-weight:700;
}
.shell-item.h2{
  color:var(--muted);
  padding-left:24px;
}
.shell-item:hover{
  background:#f3f6fb;
}
.shell-item.active{
  background:#f0f6ff;
  border-left-color:var(--brand2);
}

/* -------------------------------------------------
   RIGHT VIEWER PANEL
   ------------------------------------------------- */

.shell-viewer{
  min-width:0;
  max-width:800px;
  width:100%;
}

.shell-bar{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:10px;
  background:#fff;
}
.shell-crumb{
  font-size:13px;
  color:var(--muted);
}
.shell-crumb strong{
  color:#1c345e;
}

.shell-actions{
  margin-left:auto;
  display:flex;
  gap:8px;
  align-items:center;
}
.btn-ghost{
  padding:6px 10px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--ink);
  border-radius:10px;
  font-size:13px;
  cursor:pointer;
  transition:background .12s ease;
}
.btn-ghost:hover{
  background:#f3f6fb;
}
.btn-ghost2{
  padding:6px 10px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--ink);
  border-radius:10px;
  font-size:13px;
  cursor:pointer;
}
.btn-ghost2:hover{
  background:#f3f6fb;
}

/* Scrollable guide body */
.shell-content{
  padding:16px;
  flex:1 1 auto;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}
.shell-content img{
  max-width:100%;
  width:100%;
  height:auto;
  display:block;

  border:1px solid #5BA3F9;
  box-shadow:1px 1px 3px 3px #BBBBBC;
  border-radius:4px;
  margin:8px 0;

  aspect-ratio:16/9;
  object-fit:contain;
  background-color:#f8f9fa;
}
.shell-content table{
  display:block;
  overflow-x:auto;
  max-width:100%;
}
.shell-content pre,
.shell-content code{
  overflow:auto;
  max-width:100%;
}

/* -------------------------------------------------
   STEP BANNER / PROCEDURE STRIP
   ------------------------------------------------- */

.step-banner {
  position:sticky;
  top:0;
  z-index:20;
  background:linear-gradient(to right,#dfecff 0%,#b9d8ff 100%);
  color:#000;
  font-size:0.9rem;
  line-height:1.0;
  padding:0.6rem 0.75rem;
  border-top:1px solid #71a8ff;
  border-bottom:1px solid #71a8ff;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
}
.step-banner > div:first-child{
  font-weight:600;
  display:flex;
  align-items:center;
  gap:0.5rem;
  color:#000;
}
.step-banner > div:last-child{
  color:#003366;
  font-weight:400;
  font-size:0.8rem;
  margin-left:calc(1.75rem + 0.5rem);
}

.qt-dot-btn{
  background:#ffd400;
  color:#000;
  border-radius:999px;
  font-size:0.8rem;
  font-weight:700;
  line-height:1;
  min-width:1.75rem;
  min-height:1.75rem;
  padding:0.3rem 0.4rem;
  border:2px solid #000;
  box-shadow:0 2px 3px rgba(0,0,0,0.4);
  text-align:center;
  cursor:pointer;
  transition:all .12s ease;
}
.qt-dot-btn.active-dot{
  background:#000;
  color:#ffd400;
  box-shadow:0 0 3px 2px #57c0f7,0 0 10px 3px rgba(0,0,0,0.75);
  border:2px solid #ffd400;
  z-index:9999;
  transition:all .12s ease;
}

/* Row under the banner that holds tooltip + prev/next buttons */
.qt-bar{
  background:transparent;
  color:#000;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:0.5rem;
  padding:0.5rem 0.75rem 0.25rem 0.75rem;
  box-shadow:none;
  border:none;
}
.qt-tooltip{
  background:#000;
  color:#fff;
  font-size:0.8rem;
  line-height:1.4;
  padding:0.5rem 0.6rem;
  border-radius:0.4rem;
  box-shadow:0 2px 6px rgba(0,0,0,0.3);
  min-width:10rem;
  max-width:40rem;
  display:none;
}
.qt-tooltip.show{
  display:block;
}
.qt-tooltip .qt-num{
  font-weight:700;
  color:#ffd400;
  margin-right:0.4rem;
}
.qt-actions{
  display:flex;
  align-items:center;
  gap:0.5rem;
}
.qt-actions .btn-ghost{
  width:auto;
  text-align:center;
  padding:6px 10px;
  font-size:13px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--ink);
  border-radius:10px;
  cursor:pointer;
}
.qt-actions .btn-ghost:hover{
  background:#f3f6fb;
}

/* Procedure list highlighting */
.procedure{
  margin:0 0 1.25rem 1.25rem;
  padding:0;
  counter-reset:stepcount;
  font-size:0.9rem;
  line-height:1.4;
}
.procedure li{
  margin:0.4rem 0;
  margin-left:0.75rem;
  cursor:pointer;
}
.procedure li.active{
  background:#fff8cc;
  border-left:4px solid #ffd400;
  padding-left:0.75rem;
  margin-left:0.25rem;
  border-radius:2px;
  font-weight:600;
  color:#000;
}

/* Screenshot group wrapper */
.qt-group{
  margin-bottom:2rem;
  border:1px solid #ccc;
  background:#fafafa;
  border-radius:4px;
  box-shadow:0 2px 4px rgba(0,0,0,0.07);
  overflow:hidden;
}

/* -------------------------------------------------
   NAV TOGGLE (Hide Navigator button behavior)
   ------------------------------------------------- */

#toggleNavBtn{
  background:#fff;
  border:1px solid var(--line);
  color:var(--ink);
  border-radius:10px;
  font-size:13px;
  padding:6px 10px;
  cursor:pointer;
}
#toggleNavBtn:hover{
  background:#f3f6fb;
}

/* hide-nav on desktop: collapse nav column */
.shell-layout.hide-nav{
  grid-template-columns:0 minmax(0,1fr);
}
.shell-layout.hide-nav .shell-viewer{
  max-width:none;
  width:100%;
}
.shell-layout.hide-nav .shell-nav{
  visibility:hidden;
  pointer-events:none;
  width:0;
  padding:0;
  margin:0;
  border:0;
}

/* -------------------------------------------------
   TOAST / ERROR BUBBLE
   ------------------------------------------------- */

.toast{
  position:fixed;
  right:16px;
  bottom:16px;
  z-index:9999;
  background:#0f172a;
  color:#fff;
  border-radius:10px;
  padding:8px 12px;
  box-shadow:0 8px 24px rgba(2,8,23,.22);
  font-size:13px;
  opacity:0;
  transform:translateY(6px);
  transition:.18s ease;
}
.toast.show{
  opacity:1;
  transform:translateY(0);
}
.shell-error{
  padding:12px;
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#7f1d1d;
  border-radius:10px;
}

/* -------------------------------------------------
   WORD IMPORT CLEANUP (still needed in shell)
   ------------------------------------------------- */

.list-tight1,
.list-tight2,
.list-tight3,
.list-tightParagraph,
.list-tightParagraphCxSpFirst,
.list-tightParagraphCxSpMiddle,
.list-tightParagraphCxSpLast {
  margin-top:0.2em !important;
  margin-bottom:0.2em !important;
  line-height:1.3 !important;
  padding-left:1.2em;
}
.list-tight2{padding-left:2em;}
.list-tight3{padding-left:3em;}
.list-tight1 li,
.list-tightParagraph li{
  margin-bottom:0.2em !important;
  line-height:1.3 !important;
}
.h4{
  margin-top:0.6em;
  margin-bottom:0.3em;
  line-height:1.25;
  font-weight:600;
}
h4,
.MsoHeading4,
.Heading4,
p.MsoHeading4 {
  background:#b0cfff66;
  border-top:2px solid #71a8ff;
  border-radius:6px;
  padding:6px 10px;
  margin-top:0.8em;
  margin-bottom:0.4em;
  line-height:1.25;
  font-weight:600;
}

/* -------------------------------------------------
   MOBILE HIDE BUTTON (visible only on small screens)
   ------------------------------------------------- */

.shell-nav-header-mobile {
  display: none;                  /* hidden on desktop */
  background:#fff;
  border-bottom:1px solid var(--line);
  padding:10px;
  z-index:5;

  /* layout: button on left, search on right */
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:8px;
}

.shell-nav-header-mobile .btn-ghost {
  flex:0 0 auto;                  /* button keeps natural size */
  font-size:13px;
  padding:8px 10px;
  border-radius:10px;
  white-space:nowrap;
}

.shell-nav-search-input {
  flex:1 1 auto;                  /* search takes remaining width */
  min-width:0;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  font-size:13px;
  line-height:1.3;
  outline:0;
}


/* -------------------------------------------------
   MOBILE (<900px) BEHAVIOR FOR SHELL
   ------------------------------------------------- */

@media (max-width:900px){

  /* On mobile we STOP pretending the app is a 2-pane desktop app.
     We just let the page scroll normally again.
     That means: unlock body and stack panels. */


 /* Show the mobile nav header and make it sticky */
  .shell-nav-header-mobile {
    display:block;
    position:sticky;
    top:0;
    z-index:5;
    background:#fff;
    border-bottom:1px solid var(--line);
    padding:10px;
  }
  
  
  html,
  body {
    height:auto;
    min-height:100%;
    display:block;
    overflow-x:hidden;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
  }

  .shell-layout{
    display:block;
    max-width:100%;
    padding:0 12px 12px;
  }

  .shell-nav{
    position:static;
    top:auto;
    height:auto;
    max-height:none;

    overflow:visible;
    border-radius:14px;
    margin-bottom:12px;
    box-shadow:0 1px 4px rgba(0,0,0,0.08);
  }

  .shell-viewer{
    position:static;
    top:auto;
    height:auto;
    max-height:none;

    overflow:visible;
    border-radius:14px;
    width:100%;
    max-width:100%;
    box-shadow:0 1px 4px rgba(0,0,0,0.08);
  }

  .shell-content{
    padding:16px;
    max-height:none;
    overflow:visible;
    scrollbar-gutter:auto;
  }

  .shell-content img{
    aspect-ratio:auto;
    object-fit:contain;
    width:100%;
    max-width:100%;
    background-color:#f8f9fa;
  }

  /* hide-nav on mobile should fully remove nav so viewer fills width */
  .shell-layout.hide-nav .shell-nav{
    display:none;
  }
  .shell-layout.hide-nav .shell-viewer{
    width:100%;
    max-width:100%;
    margin-top:0;
  }

  footer{
    display:block;
    margin-top:24px;
  }
}
