/* === PATTERNSMITH OVERRIDES === */

/* Keep GridSmith's visual system, but simplify the layout for a single preview canvas. */

/* === SHELL LAYOUT (2-COLUMN) ============================================ */

/* GridSmith uses a 3-column shell (tools | splitter | stage | inspector).
   PatternSmith only needs (tools | stage). Override the shell grid so the
   stage column is actually visible (instead of landing in the 6px splitter
   column).
*/

.wrap,
.shell {
  grid-template-columns: var(--toolsW) 1fr;
}

/* We are not using GridSmith's splitter or inspector in PatternSmith. */
#splitter,
#inspWrap {
  display: none !important;
}

/* Stage: simpler scroll container (no rulers grid). */
.stageWrap {
  display: block;
  overflow: auto;
  background: #0b0b10;
}

.patternsmith-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  border: 1px solid var(--stroke-soft);
  border-radius: 0;
  background: #0c0c10;
}

.patternsmith-stage canvas {
  display: block;
  /* JS controls the preview scale for 1:1 vs Fit-to-Screen */
  width: auto;
  height: auto;
  max-width: none;
  image-rendering: auto;
}

/* === SEAMLESS PREVIEW OVERLAY ========================================= */

.seamlessOverlay{
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.seamlessCanvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.seamlessHud{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 60;

  width: min(460px, calc(100% - 20px));
  padding: 12px 14px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  border: 1px solid var(--stroke);
  background: rgba(17,17,22,.92);
  box-shadow: var(--shadow);
  border-radius: 14px;

  pointer-events: auto;
}

.seamlessHud[hidden]{
  display: none !important;
}

.seamlessOverlay[hidden]{
  display: none !important;
}


.seamlessHudRow{
  display: flex;
  align-items: center;
  gap: 8px;
}

.seamlessBadge{
  font-size: 12px;
  color: var(--ink);
  opacity: .95;
  padding: 4px 8px;
  border: 1px solid var(--stroke-soft);
  background: var(--panel2);
}

.seamlessSpacer{ flex: 1; }

.seamlessScale{
  flex: 1;
  min-width: 180px;

  /* Make the track feel "full length" and readable at both ends */
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--spPct, 50%),
    rgba(255,255,255,.14) var(--spPct, 50%),
    rgba(255,255,255,.14) 100%
  );
}

/* Range thumb/track (WebKit) */
.seamlessScale::-webkit-slider-runnable-track{
  height: 6px;
  background: transparent;
  border-radius: 999px;
}
.seamlessScale::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 999px;
  background: #e8e8ec;
  border: 1px solid rgba(0,0,0,.35);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* Range thumb/track (Firefox) */
.seamlessScale::-moz-range-track{
  height: 6px;
  background: transparent;
  border-radius: 999px;
}
.seamlessScale::-moz-range-thumb{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #e8e8ec;
  border: 1px solid rgba(0,0,0,.35);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}


.seamlessScaleNum{
  width: 76px;
}

.seamlessChips{
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pills */
.seamlessChips .chip{
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke-soft);
  background: var(--panel2);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .5px;
  line-height: 1;
}

.seamlessChips .chip:hover{
  border-color: var(--accent);
}

.seamlessChips .chip.active{
  background: var(--accent);
  border-color: var(--accent);
  color: #0f0f12;
}

.seamlessChips .chip:hover{
  border-color: var(--accent);
}

@media (max-width: 520px){
  .seamlessHud{ right: 6px; top: 6px; padding: 8px; }
  .seamlessScaleNum{ width: 70px; }
}

/* === FIT TO SCREEN BUTTON STATE ======================================= */

#btnFit.isOn {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(106, 163, 255, .25) inset;
}

/* Fit-to-screen button state */
#btnFit.isOn {
  border-color: var(--accent);
  color: var(--ink);
}

/* Tighten the sidebar sections */
.ps-section {
  border-top: 1px solid var(--stroke-soft);
  padding-top: 10px;
  margin-top: 10px;
}

.ps-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ps-row .field {

  margin: 0;
}

.field.svgSlotCard{
  margin-top:8px;
  margin-bottom:8px;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.ps-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

@media (max-width: 980px) {
  .ps-row {
    grid-template-columns: 1fr;
  }
}


/* === SEAMLESS PREVIEW OVERLAY === */
.seamlessOverlay{
  /* Fixed to viewport so low-zoom tiling can fill the whole screen */
  position:fixed;
  inset:0;
  z-index:40;
  background:#0b0b10;
}

.seamlessOverlay canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
}

.seamlessHud{
  position:absolute;
  left:12px;
  right:auto;
  top: 108px; /* below 48px topbar + ~46px palette bar */
  z-index:50;
  width: max-content;
  max-width: calc(100vw - 24px);
  display:flex;
  flex-direction: column;
  align-items:flex-start;
  justify-content:flex-start;
  gap:8px;
  padding:10px 10px;
  /* Subtle "paper" texture + PG-Pro panel tone */
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,0) 2px 8px),
    rgba(17,17,22,.92);
  border:1px solid #24242a;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  border-radius: 22px;
  overflow: hidden;
}

/* Disable accidental text selection during drag */
body.psNoSelect, body.psNoSelect *{ user-select:none !important; }

.seamlessHud .psSeamHudHandle{
  cursor: grab;
  user-select: none;
}

.seamlessHud .psSeamHudHandle.dragging{
  cursor: grabbing;
}

.seamlessHud .badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:#e8e8ec;
  padding:6px 10px;
  border:1px solid #30303a;
  border-radius:999px;
  background:#1b1b22;
  letter-spacing:.2px;
}

.seamlessHudMid{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex: 1;
}

#seamlessScale{
  width: 220px;
  max-width: 36vw;
}

.seamlessHud .num{
  width:72px;
  background:#0f0f12;
  border:1px solid #30303a;
  color:#e8e8ec;
  border-radius:8px;
  padding:6px 8px;
}

.seamlessHud .pct{
  color:#a6a6b3;
  font-size:12px;
  margin-left:-6px;
  margin-right:6px;
}

.btn-mini{
  padding:6px 10px;
  line-height: 1;
  font-size: 12px;
}

.seamlessHud .chips{
  display:flex;
  gap:6px;
  margin-left:6px;
}

.seamlessHud .chip{
  background:#1b1b22;
  border:1px solid #30303a;
  color:#e8e8ec;
  font-size:12px;
  padding:6px 8px;
  border-radius:999px;
  cursor:pointer;
}

.seamlessHud .chip:hover{
  border-color:#6aa3ff;
}

@media (max-width: 720px){
  #seamlessScale{ width: 140px; max-width: 34vw; }
  .seamlessHud .chips{ display:none; }
}
/* === HEX POND CONTROLS — RESPONSIVE === */
.rngRow{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.rngRow input[type="range"]{flex:1;min-width:160px}
.rngRow .rngNum{width:90px;min-width:90px;color:var(--fg)}
@media (max-width: 900px){
  .rngRow input[type="range"]{min-width:120px}
  .rngRow .rngNum{width:84px;min-width:84px}
}

/* === CHAOS BLOOM: SINGLE-LINE COLOR + OPACITY ROWS === */
.cbColorRow{
  display:flex;
  align-items:center;
  gap:10px;
  margin:10px 0;
}

.cbColorRow label{
  flex:0 0 76px; /* keeps rows aligned */
  font-size:13px;
  color:#cfd0d6;
}

.cbColorSwatch{
  width:28px;
  height:28px;
  padding:0;
  border-radius:6px;
  border:1px solid var(--line);
  background:#0f0f12;
  flex:0 0 auto;
}

.cbAlphaRange{
  flex:1 1 auto;
  min-width:110px;
  max-width:170px; /* prevents panel blow-out */
}

.cbAlphaNum{
  width:56px;
  padding:6px 8px;
  text-align:right;
  background:#111116;
  color:#e8e8ec;
  border:1px solid #30303a;
  border-radius:10px;
}

/* Slightly tighter spacing on very narrow panels */
@media (max-width: 640px){
  .cbColorRow label{ flex-basis:70px; }
  .cbAlphaRange{ min-width:90px; max-width:140px; }
  .cbAlphaNum{ width:52px; }
}


/* === SVG STAMP SLOT SPACING (ACTUAL WRAPPER: .field in #patternControls) === */
/* The SVG slot panels are rendered as <div class="field" style="..."> inside #patternControls.
   Add vertical breathing room between each panel. */
#patternControls .field{
  margin-top: 8px;
  margin-bottom: 8px;
}


/* === Watercolor sidebar fit override === */
.rngRow input[type="range"]{
  flex: 1;
  min-width: 117px !important;
}
