@charset "UTF-8";

/* ==========================================================================
   SNS.KEYBOARD - Smart Side Scroll Spy
   - Desktop (>1360px): Integrated into right #widget column below #loveletter
   - Mobile/Tablet (<=1360px): Right-edge mid-screen indicator + slide drawer
   - Never placed at top or bottom of viewport
   ========================================================================== */

/* Desktop layout integration with existing #widget & #loveletter */
@media screen and (min-width: 1361px) {
  body.has-scrollspy div#wrap div#widget {
    display: flex !important;
    flex-direction: column;
    top: 52px;
    bottom: 98px;
    height: auto;
    pointer-events: none;
  }

  body.has-scrollspy div#wrap div#widget>* {
    pointer-events: auto;
  }

  body.has-scrollspy div#wrap div#widget div#loveletter {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    max-height: min(260px, 34vh);
  }

  body.has-scrollspy div#wrap div#widget div#loveletter ul#savedData {
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d7d7d7 transparent;
  }

  body.has-scrollspy div#wrap div#widget div#loveletter ul#savedData::-webkit-scrollbar {
    width: 4px;
  }

  body.has-scrollspy div#wrap div#widget div#loveletter ul#savedData::-webkit-scrollbar-thumb {
    background: #d7d7d7;
    border-radius: 4px;
  }
}

/* Desktop Scroll Spy Card */
#sspyDesktop {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  background: #f7f7f7;
  border-radius: 5px;
  margin: 14px 0 0 20px;
  padding: 16px;
  font-family: var(--font);
  color: #333;
  overflow: hidden;
  transition: var(--transition);
}

@media screen and (max-width: 1360px) {
  #sspyDesktop {
    display: none !important;
  }
}

/* Header (matches div#wrap div#widget div#loveletter .tt exactly) */
.sspy-header {
  position: relative;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 6px;
  color: #000;
  border-bottom: 1px solid var(--color-border);
  padding: 0 0 15px 0;
  flex-shrink: 0;
}

.sspy-title {
  display: inline-block;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
}

.sspy-nospacing {
  letter-spacing: 0;
  font-style: normal;
}

.sspy-counter {
  margin-left: 6px;
  letter-spacing: 0;
}

/* Sub-controls bar (prev/next 50% / 50%) */
.sspy-controls {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 6px;
  margin-top: 10px;
  flex-shrink: 0;
}

.sspy-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50%;
  flex: 1 1 50%;
  height: 28px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.sspy-step-btn:hover:not(:disabled) {
  border-color: var(--color-1);
  color: var(--color-1);
  background: var(--color-1-element_focus);
}

.sspy-step-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Progress Bar */
.sspy-progress-track {
  width: 100%;
  height: 3px;
  background: #e4e4e4;
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0;
  flex-shrink: 0;
}

.sspy-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-1);
  border-radius: 3px;
  transition: width 0.14s ease-out;
}

/* Quick Search Filter (uses type="search" to avoid global input[type="text"] rules) */
.sspy-search-wrap {
  position: relative;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.sspy-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px !important;
  color: #999;
  pointer-events: none;
}

.sspy-search-input {
  display: block;
  width: 100%;
  height: 32px;
  padding: 0 28px 0 29px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: var(--font-weight-1);
  color: #222;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  box-shadow: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.sspy-search-input::placeholder {
  color: #9b9b9b;
}

.sspy-search-input:focus {
  border-color: var(--color-1);
  box-shadow: 0 0 0 2px rgba(8, 222, 152, 0.2);
}

.sspy-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.sspy-search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.sspy-search-clear.is-visible {
  display: inline-flex;
}

.sspy-search-clear:hover {
  color: #333;
  background: #efefef;
}

/* Section List */
.sspy-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 3px;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #d7d7d7 transparent;
}

#sspyDesktop .sspy-list {
  flex: 0 1 auto;
  max-height: 280px;
}

.sspy-list::-webkit-scrollbar {
  width: 4px;
}

.sspy-list::-webkit-scrollbar-track {
  background: transparent;
}

.sspy-list::-webkit-scrollbar-thumb {
  background: #d7d7d7;
  border-radius: 4px;
}

.sspy-list::-webkit-scrollbar-thumb:hover {
  background: #b9b9b9;
}

.sspy-list-item {
  margin-bottom: 3px;
}

.sspy-list-item:last-child {
  margin-bottom: 0;
}

.sspy-list-item.is-hidden {
  display: none;
}

.sspy-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #555;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: var(--font-weight-1);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.sspy-link:hover {
  background: #ececec;
  color: #111;
}

.sspy-link.is-active {
  background: #fff;
  color: #111;
  font-weight: var(--font-weight-2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.sspy-link-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.sspy-link-badge {
  flex-shrink: 0;
  font-family: 'Montserrat', var(--font);
  font-size: 10px;
  font-weight: 600;
  color: #999;
  background: rgba(0, 0, 0, 0.045);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}

.sspy-link.is-active .sspy-link-badge {
  color: #068f61;
  background: var(--color-1-element_focus);
}

.sspy-empty {
  display: none;
  padding: 24px 10px;
  text-align: center;
  font-size: 12px;
  color: #999;
}

.sspy-empty.is-visible {
  display: block;
}

/* Active sync highlight on existing top #sorting chips */
#sorting a.sspy-chip-active {
  background: var(--color-1) !important;
  border-color: var(--color-1) !important;
  color: #fff !important;
  font-weight: var(--font-weight-2);
}

/* ==========================================================================
   Mobile / Tablet (<= 1360px): Right-Side Vertical Edge Indicator + Drawer
   - Positioned along the RIGHT mid-edge (never top or bottom)
   ========================================================================== */

#sspyEdgeWrap {
  display: none;
}

#sspyDrawerBackdrop,
#sspyDrawer {
  display: none;
}

@media screen and (max-width: 1360px) {
  #sspyEdgeWrap {
    display: block;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    font-family: var(--font);
  }

  /* Compact vertical tab docked on the right side */
  #sspyEdgeBtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 34px;
    padding: 10px 4px;
    border: 1px solid var(--color-border);
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: -2px 4px 14px rgba(0, 0, 0, 0.09);
    color: #444;
    cursor: pointer;
    transition: width 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  #sspyEdgeBtn:hover,
  #sspyEdgeBtn:active {
    width: 38px;
    background: #fff;
    border-color: var(--color-1);
    box-shadow: -3px 4px 18px rgba(8, 222, 152, 0.18);
  }

  .sspy-edge-icon {
    font-size: 17px !important;
    color: var(--color-1);
    line-height: 1;
  }

  .sspy-edge-rail {
    position: relative;
    width: 3px;
    height: 44px;
    border-radius: 3px;
    background: #e5e5e5;
    overflow: hidden;
  }

  .sspy-edge-rail-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: var(--color-1);
    border-radius: 3px;
    transition: height 0.14s ease-out;
  }

  .sspy-edge-count {
    font-family: 'Montserrat', var(--font);
    font-size: 9px;
    font-weight: 700;
    color: #555;
    line-height: 1.1;
    letter-spacing: -0.3px;
    text-align: center;
  }

  /* Scroll Peek Pill: floats to the LEFT of the right-edge tab while scrolling */
  #sspyPeek {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    display: flex;
    align-items: center;
    gap: 5px;
    max-width: 195px;
    padding: 6px 11px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    color: #222;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  #sspyPeek.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
  }

  .sspy-peek-hash {
    color: var(--color-1);
    font-weight: var(--font-weight-2);
    flex-shrink: 0;
  }

  .sspy-peek-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Backdrop */
  #sspyDrawerBackdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.26s ease, visibility 0.26s ease;
  }

  #sspyDrawerBackdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Right Slide-Over Drawer */
  #sspyDrawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(310px, 84vw);
    height: 100dvh;
    background: #fff;
    border-left: 1px solid var(--color-border);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.16);
    z-index: 6;
    font-family: var(--font);
    color: #333;
    transform: translateX(102%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.28s ease;
    will-change: transform;
  }

  #sspyDrawer.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sspy-drawer-top {
    background: #f7f7f7;
    padding: 16px 16px 2px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
  }

  .sspy-drawer-top .sspy-header {
    padding: 0 0 15px 0;
    border-bottom: 1px solid var(--color-border);
  }

  .sspy-drawer-close {
    position: absolute;
    top: -4px;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #000;
    font-size: 18px;
    letter-spacing: 0;
    cursor: pointer;
    transition: var(--transition);
  }

  .sspy-drawer-close:hover {
    color: var(--color-1);
    background: rgba(0, 0, 0, 0.05);
  }

  .sspy-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 12px 14px;
    overflow: hidden;
  }

  #sspyDrawer .sspy-search-input {
    height: 38px;
    padding: 0 32px 0 32px;
    font-size: 16px;
    line-height: 1.25;
    touch-action: manipulation;
  }

  #sspyDrawer .sspy-search-icon {
    left: 10px;
    font-size: 17px !important;
  }

  #sspyDrawer .sspy-search-clear {
    right: 6px;
    width: 24px;
    height: 24px;
  }

  #sspyDrawer .sspy-link {
    padding: 9px 10px;
    font-size: 13.5px;
  }

  #sspyDrawer .sspy-link.is-active {
    background: var(--color-1-element_focus);
    box-shadow: none;
  }

  .sspy-drawer-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px 14px;
    border-top: 1px solid #ececec;
    background: #fafafa;
    flex-shrink: 0;
  }

  .sspy-drawer-navbtn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: #fff;
    color: #444;
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: var(--font-weight-2);
    cursor: pointer;
    transition: var(--transition);
  }

  .sspy-drawer-navbtn:hover:not(:disabled) {
    border-color: var(--color-1);
    color: var(--color-1);
    background: var(--color-1-element_focus);
  }

  .sspy-drawer-navbtn:disabled {
    opacity: 0.35;
    cursor: default;
  }
}

/* Compact right-edge tab on short landscape mobile screens */
@media screen and (max-width: 1360px) and (max-height: 520px) {
  #sspyEdgeWrap {
    top: 34%;
  }

  .sspy-edge-rail {
    height: 28px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

  .sspy-progress-fill,
  .sspy-edge-rail-fill,
  #sspyPeek,
  #sspyDrawer,
  #sspyDrawerBackdrop,
  .sspy-link {
    transition: none !important;
  }
}