/* ========================================
   0. GLOBAL FOUNDATION (Docs Only)
======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

/* Override global layout grid for docs pages */
.layout__main.docs-main {
  display: block;
  padding-top: 24px;
}


/* ========================================
   1. SUB NAV (Docs Home link)
======================================== */

.docs-subnav {
  margin-top: 10px;
  margin-bottom: 18px;
}

.docs-subnav a {
  font-size: 0.95rem;
  color: #5a2ca0;
  text-decoration: none;
}

.docs-subnav a:hover {
  text-decoration: underline;
}


/* ========================================
   2. SEARCH
======================================== */

.docs-search-wrapper {
  margin-bottom: 20px;
}

#docsSearch {
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}


/* ========================================
   3. ELEMENT INDEX GRID
======================================== */

.docs-list {
  list-style: none;
  padding: 0;
  margin: 0;

  display: grid;
  /* align-content: start; */ /* new */
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  row-gap: 10px;
  column-gap: 28px;
}

.docs-list li {
  list-style: none;
}

.docs-list a {
  display: block;
  padding: 4px 0;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 500;
  color: #2a2f36;
  text-decoration: none;
}

.docs-list a:hover {
  text-decoration: underline;
}

/* Slightly wider columns on large screens */
@media (min-width: 900px) {
  .docs-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}


/* ========================================
   4. DOC LEVEL INDICATORS
======================================== */

/* Basic */
.docs-list li.doc-basic a::after {
  content: " 📄";
  opacity: 0.7;
}

/* Extended */
.docs-list li.doc-extended a::after {
  content: " 📘";
}

.docs-list li.doc-extended a {
  font-weight: 600;
  color: #3c1c85;
}

/* Super */
.docs-list li.doc-super a::after {
  content: " ⭐";
}


/* ========================================
   5. ELEMENT DETAIL PAGE
======================================== */

.docs-image-wrapper {
  position: relative;
  margin-top: 20px;
}

.docs-image-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}

.element-overlay {
  position: absolute;
  border: 2px solid red;
  pointer-events: none;
}


/* ========================================
   6. ELEMENT NOTES
======================================== */

.element-note {
  margin-top: 20px;
  padding: 12px 14px;
  background: #f4f4f6;
  border-left: 4px solid #5a2ca0;
  border-radius: 6px;
}

.element-note p {
  margin: 6px 0 0 0;
  line-height: 1.5;
}


/* ========================================
   7. HEADER TYPOGRAPHY SAFETY
======================================== */

.app-header h1 {
  line-height: 1.2;
  word-break: break-word;
}

/* ========================================
   FIX: Remove grid layout for docs pages
======================================== */

.docs__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/*
.layout__container.docs-layout {
  display: block;
  min-height: auto;
}
*/




/* New css since adding 11ty */

.element-preview {
  max-width: 900px;
  margin: 1rem 0;
}

.image-wrapper {
  position: relative;
  display: inline-block;
}

.image-wrapper img {
  max-width: 100%;
  border: 1px solid #ccc;
}

.highlight {
  position: absolute;
  border: 3px solid red;
  box-sizing: border-box;
  pointer-events: none;
}






/* =========================================
   STEP IMAGE + OVERLAY (CLEAN)
======================================== */

/* Wrapper used in BOTH thumbnails and modal */

.step-image-wrapper {
  position: relative;
  display: inline-block;
}

/* Image scales properly inside modal */
.step-image-wrapper img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Red highlight box */
.step-overlay {
  position: absolute;
  border: 3px solid red;
  /* Was making the background red with low opacity */
  /* background: rgba(255, 0, 0, 0.15); */ 
  pointer-events: none;
}
.step-overlay--scroll {
  /* border-color: green; */
  border: 15px solid green;
}

.step-overlay--structural {
  border-color: #ff9800;
}


/* =========================================
   STEP MODAL (CLEAN + CORRECT)
======================================== */

.step-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
}

/* Centered modal */
.step-modal__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 90vw;
  height: 92vh;

  background: #111;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 16px;
}

/* Close button */
.step-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;

  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* Viewer container */
.step-modal__viewer {
  flex: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: auto; /* 🔥 THIS fixes cut-off issues */
}

/* IMPORTANT: wrapper must follow image size */
.step-modal__viewer .step-image-wrapper {
  position: relative;
  display: inline-block;

  max-width: 100%;
  max-height: 100%;
}

/* IMPORTANT: image controls scaling */
.step-modal__viewer img {
  display: block;

  width: auto;
  height: auto;

  max-width: 90%;
  max-height: 75vh;

  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

/* Step counter */
.step-modal__counter {
  margin-top: 10px;
  color: #ccc;
  font-size: 14px;
}

/* =========================================
   STEP THUMBNAILS (LEFT SIDE / LIST)
======================================== */

.step-item {
  margin-bottom: 14px;
}

.step-item .step-image-wrapper {
  max-width: 260px; /* thumbnail size */
}

.step-item img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid #333;
}

/* =========================================
   STEP MODAL CONTROLS
======================================== */

.step-modal__controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.step-modal__controls button {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.step-modal__controls button:hover {
  background: #333;
}

/* =========================================
   MOBILE FIX (NO HORIZONTAL SCROLL)
======================================== */

@media (max-width: 768px) {

  /* Modal should fill screen cleanly */
  .step-modal__content {
    width: 100vw;
    height: 95vh;

    top: 0;
    left: 0;
    transform: none;

    border-radius: 0;
    padding: 12px;

    box-sizing: border-box;
  }

  /* Prevent any overflow */
  .step-modal,
  .step-modal__content,
  .step-modal__viewer {
    overflow-x: hidden;
  }

  /* Image sizing for mobile */
  .step-modal__viewer img {
    max-width: 100%;
    max-height: 65vh;
  }

  /* Controls layout */
  .step-modal__controls {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .step-modal__controls button {
    flex: 1;
    padding: 10px 6px;
    font-size: 14px;
  }

  /* Counter spacing */
  .step-modal__counter {
    margin-top: 6px;
    font-size: 13px;
  }
}