/* =========================================================
   Web Toys & T-Shape Generator Custom Stylesheet
   Complementing Tailwind CSS
   ========================================================= */

:root {
  --graph-max-height: 800px;
  --handle-color: #334155;
}

/* Constrain graph container dimensions with definite heights */
#graph-stage {
  height: 520px;
  min-height: 420px;
  max-height: 900px;
  position: relative;
  overflow: visible;
  display: flex;
  width: 100%;
}

@media (min-height: 800px) {
  #graph-stage {
    height: 580px;
  }
}

@media (min-height: 1000px) {
  #graph-stage {
    height: 680px;
  }
}

@media (max-width: 640px) {
  #graph-stage {
    height: 420px;
    min-height: 380px;
  }
}

/* Individual Stripe Column */
.stripe-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0%;
  min-width: 50px;
  height: 100%;
  min-height: 0;
  position: relative;
  z-index: 10;
}

/* Stripe Label Header Area */
.stripe-label-header {
  height: 64px;
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  position: relative;
  z-index: 25;
  background: transparent;
}

/* Label Button: Clean typography, fully visible, zero black bars */
.stripe-label-btn {
  width: 100%;
  padding: 5px 6px;
  font-size: 0.75rem;
  line-height: 1.15;
  font-weight: 600;
  text-align: center;
  border-radius: 8px;
  background-color: #f5f5f4; /* stone-100 */
  color: #1c1917; /* stone-900 */
  border: 1px solid #e7e5e4; /* stone-200 */
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stripe-label-btn:hover {
  background-color: #e7e5e4;
  border-color: #d6d3d1;
  transform: translateY(-1px);
}

.stripe-label-btn:focus-visible {
  outline: 2px solid #1c1917;
  outline-offset: 2px;
}

/* Stripe Track Area */
.stripe-track {
  width: 100%;
  height: calc(100% - 64px); /* Guarantees track never collapses */
  min-height: 300px;
  flex: 1 1 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: rgba(245, 245, 244, 0.55);
  border-radius: 12px;
  border: 1.5px dashed rgba(214, 211, 209, 0.85);
  overflow: visible;
  cursor: pointer;
  touch-action: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stripe-track:hover {
  background-color: rgba(245, 245, 244, 0.85);
  border-color: rgba(168, 162, 158, 0.95);
}

/* The Animated Resizable Bar */
.stripe-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.12);
  transition: height 0.08s ease-out, background-color 0.3s ease;
  user-select: none;
  touch-action: none;
}

.stripe-bar.is-dragging {
  transition: none !important;
  box-shadow: 0 8px 20px -2px rgba(0, 0, 0, 0.22);
}

/* Height percentage badge inside the bar */
.stripe-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
  margin-bottom: 6px;
  pointer-events: none;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Drag Handle at bottom of the bar */
.stripe-handle {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  transition: background 0.15s ease;
  position: relative;
  z-index: 20;
}

.stripe-handle:hover,
.stripe-bar.is-dragging .stripe-handle {
  background: rgba(0, 0, 0, 0.32);
}

.stripe-handle:focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
  background: rgba(0, 0, 0, 0.38);
}

.stripe-handle-pill {
  width: 34px;
  height: 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: width 0.15s ease, background 0.15s ease;
}

.stripe-handle:hover .stripe-handle-pill,
.stripe-bar.is-dragging .stripe-handle-pill,
.stripe-handle:focus-visible .stripe-handle-pill {
  width: 44px;
  background: #ffffff;
}

/* Accessible range input (WCAG Screen Reader Support) */
.accessible-range {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Popover animation */
#label-popover {
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

#label-popover.open {
  display: block;
}

/* Mobile landscape advice */
@media (max-width: 640px) {
  .stripe-label-header {
    height: 72px;
  }
  
  .stripe-label-btn {
    font-size: 0.65rem;
    padding: 3px 4px;
  }

  .stripe-track {
    height: calc(100% - 72px);
  }
}
