/*
==========================================================
SPOT SKETCH v1.4
Tone Guide

Purpose:
Presentation-only styling for the optional DARK / MIDTONE / LIGHT image
analysis guide. Tone Guide is deliberately visually quieter than a real
Spot Reading and temporarily owns image taps while active, without changing
Spot Reading data or persistence.
==========================================================
*/

.tone-guide-controls{
  position:absolute;
  z-index:42;
  left:14px;
  bottom:14px;
  display:flex;
  align-items:center;
  pointer-events:auto;
}

.tone-guide-controls[hidden]{
  display:none !important;
}

.tone-guide-histogram{
  position:fixed;
  z-index:calc(var(--layer-header) - 1);
  width:188px;
  min-width:188px;
  padding:6px 7px 7px;
  border:1px solid rgba(120,120,128,.15);
  border-radius:9px;
  background:rgba(250,250,251,.86);
  box-shadow:0 2px 8px rgba(0,0,0,.075);
  pointer-events:auto;
  touch-action:none;
  user-select:none;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}

.tone-guide-histogram[hidden]{
  display:none !important;
}

.tone-guide-histogram-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:-2px -2px 4px;
  padding:3px 2px;
  color:var(--muted);
  font-size:7px;
  font-weight:780;
  line-height:1;
  letter-spacing:.09em;
  cursor:grab;
  touch-action:none;
}

.tone-guide-histogram.is-dragging .tone-guide-histogram-head{
  cursor:grabbing;
}

.tone-guide-histogram-hint{
  max-width:78px;
  overflow:hidden;
  color:var(--muted);
  opacity:.62;
  text-align:right;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.tone-guide-histogram-plot{
  position:relative;
  height:34px;
  border-bottom:1px solid rgba(120,120,128,.22);
  cursor:crosshair;
}

.tone-guide-histogram-bars{
  position:absolute;
  inset:0 0 1px;
  display:flex;
  align-items:flex-end;
  gap:1px;
}

.tone-guide-histogram-bar{
  flex:1 1 0;
  min-width:1px;
  border-radius:1px 1px 0 0;
  background:rgba(80,80,86,.38);
}

.tone-guide-histogram-marker{
  appearance:none;
  position:absolute;
  z-index:2;
  top:0;
  bottom:-2px;
  width:8px;
  min-width:0;
  height:auto;
  min-height:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  transform:translateX(-50%);
  cursor:pointer;
}

.tone-guide-histogram-marker::before{
  content:"";
  position:absolute;
  left:50%;
  top:0;
  bottom:0;
  width:2px;
  border-radius:2px;
  background:currentColor;
  transform:translateX(-50%);
  box-shadow:0 0 0 1px rgba(255,255,255,.62);
}

.tone-guide-histogram-marker::after{
  content:"";
  position:absolute;
  left:50%;
  top:-1px;
  width:6px;
  height:6px;
  border:1px solid rgba(255,255,255,.72);
  border-radius:50%;
  background:currentColor;
  transform:translate(-50%,-50%);
  transition:width .14s ease,height .14s ease,box-shadow .14s ease;
}

.tone-guide-histogram-marker.is-selected::after{
  width:9px;
  height:9px;
  box-shadow:0 0 0 2px rgba(255,255,255,.78);
}

body.dark .tone-guide-histogram-marker.is-selected::after{
  box-shadow:0 0 0 2px rgba(31,31,35,.86);
}

.tone-guide-histogram-marker-dark{
  color:rgb(191,90,242);
}

.tone-guide-histogram-marker-mid{
  color:rgb(10,132,255);
}

.tone-guide-histogram-marker-light{
  color:rgb(255,159,10);
}

.tone-guide-histogram-marker-custom{
  color:rgba(110,110,118,.92);
  pointer-events:none;
}

.tone-guide-histogram-marker-custom::before{
  width:1px;
  box-shadow:none;
}

.tone-guide-histogram-marker-custom::after{
  width:7px;
  height:7px;
  border:1.5px solid currentColor;
  background:transparent;
  box-shadow:none;
}

body.dark .tone-guide-histogram-marker-custom{
  color:rgba(215,215,222,.88);
}

body.dark .tone-guide-histogram{
  border-color:rgba(255,255,255,.10);
  background:rgba(31,31,35,.80);
  box-shadow:0 1px 6px rgba(0,0,0,.18);
}

body.dark .tone-guide-histogram-bar{
  background:rgba(235,235,240,.34);
}

body.dark .tone-guide-histogram-marker::before{
  box-shadow:0 0 0 1px rgba(31,31,35,.78);
}

.tone-guide-toggle,
body.dark .tone-guide-toggle{
  width:auto;
  min-width:0;
  height:auto;
  min-height:30px;
  padding:5px 7px;
  border:0;
  border-radius:8px;
  background:transparent;
  box-shadow:none;
  color:var(--muted);
  font-size:9px;
  font-weight:780;
  line-height:1;
  letter-spacing:.09em;
  text-transform:uppercase;
  opacity:.78;
}

.tone-guide-toggle::before{
  content:"";
  width:5px;
  height:5px;
  margin-right:6px;
  display:inline-block;
  border:1px solid currentColor;
  border-radius:50%;
  vertical-align:1px;
  opacity:.7;
}

.tone-guide-toggle:hover{
  color:var(--text);
  background:rgba(120,120,128,.07);
  opacity:1;
}

.tone-guide-toggle.is-active,
body.dark .tone-guide-toggle.is-active{
  color:var(--accent);
  background:rgba(10,132,255,.07);
  opacity:1;
}

.tone-guide-toggle.is-active::before{
  border-color:var(--accent);
  background:var(--accent);
}

.tone-guide-layer{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
}

.tone-guide-layer[hidden]{
  display:none !important;
}

.tone-guide-region{
  --tone-guide-rgb:10,132,255;
  position:absolute;
  min-width:0;
  min-height:0;
  border:2px solid rgb(var(--tone-guide-rgb));
  border-radius:4px;
  background:rgba(var(--tone-guide-rgb),.045);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.48) inset,
    0 0 0 1px rgba(var(--tone-guide-rgb),.16);
  pointer-events:auto;
}

.tone-guide-region-dark{ --tone-guide-rgb:191,90,242; }
.tone-guide-region-mid{ --tone-guide-rgb:10,132,255; }
.tone-guide-region-light{ --tone-guide-rgb:255,159,10; }

/*
  CUSTOM is a neutral, empty sample footprint. Its geometry is the actual
  luminance sample area, not a decorative target or minimum-size icon.
*/
.tone-guide-region-custom{
  border:1.5px solid rgba(88,88,94,.92);
  border-radius:50%;
  background:transparent;
  box-shadow:0 0 0 1px rgba(255,255,255,.62);
  pointer-events:none;
}

.tone-guide-region-custom::before,
.tone-guide-region-custom::after{
  content:none;
}

body.dark .tone-guide-region-custom{
  border-color:rgba(235,235,240,.92);
  background:transparent;
  box-shadow:0 0 0 1px rgba(31,31,35,.72);
}

.tone-guide-region::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:6px;
  height:6px;
  border:2px solid rgb(var(--tone-guide-rgb));
  border-radius:50%;
  background:rgba(255,255,255,.68);
  transform:translate(-50%,-50%);
}

.tone-guide-region::after{
  content:none;
}

.tone-guide-region-label{
  position:absolute;
  left:0;
  max-width:72px;
  padding:2px 4px;
  border-radius:4px;
  background:rgba(var(--tone-guide-rgb),.94);
  color:#fff;
  font-size:7px;
  font-weight:820;
  line-height:1;
  letter-spacing:.06em;
  text-transform:uppercase;
  white-space:nowrap;
  box-shadow:0 1px 3px rgba(0,0,0,.16);
  pointer-events:none;
}

.tone-guide-region-label.is-below{
  top:calc(100% + 4px);
}

.tone-guide-region-label.is-above{
  bottom:calc(100% + 4px);
}

.tone-guide-region-controls{
  position:absolute;
  z-index:2;
  top:50%;
  display:flex;
  align-items:center;
  gap:2px;
  padding:2px;
  border-radius:6px;
  background:rgba(250,250,251,.92);
  box-shadow:0 1px 4px rgba(0,0,0,.13);
  pointer-events:auto;
  transform:translateY(-50%);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.tone-guide-region-controls.is-right{
  left:calc(100% + 6px);
}

.tone-guide-region-controls.is-left{
  right:calc(100% + 6px);
}

.tone-guide-region-action,
body.dark .tone-guide-region-action{
  appearance:none;
  width:22px;
  min-width:22px;
  height:20px;
  min-height:20px;
  padding:0;
  border:0;
  border-radius:4px;
  background:transparent;
  box-shadow:none;
  color:rgb(var(--tone-guide-rgb));
  font:700 13px/20px system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  text-align:center;
  cursor:pointer;
}

.tone-guide-region-action:hover{
  background:rgba(var(--tone-guide-rgb),.11);
}

.tone-guide-region-action:focus-visible{
  outline:1px solid rgb(var(--tone-guide-rgb));
  outline-offset:1px;
}

.tone-guide-region-action:disabled,
body.dark .tone-guide-region-action:disabled{
  opacity:.26;
  cursor:default;
}

.tone-guide-region-action:disabled:hover{
  background:transparent;
}

body.dark .tone-guide-region-controls{
  background:rgba(31,31,35,.90);
  box-shadow:0 1px 5px rgba(0,0,0,.24);
}

body.dark .tone-guide-region{
  border-color:rgb(var(--tone-guide-rgb));
  background:rgba(var(--tone-guide-rgb),.075);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.24) inset,
    0 0 0 1px rgba(var(--tone-guide-rgb),.20);
}

body.dark .tone-guide-region::before{
  background:rgba(31,31,35,.84);
}

@media (max-width:900px){
  body.mobile-shell-active .tone-guide-controls{
    position:fixed;
    z-index:calc(var(--layer-header) - 1);
    left:auto;
    right:max(12px,var(--safe-area-right));
    bottom:calc(var(--safe-area-bottom) + 58px);
    display:flex;
    align-items:center;
  }

  body.mobile-shell-active .tone-guide-histogram{
    width:min(188px,calc(100vw - 20px));
    min-width:0;
  }

  body.mobile-shell-active .tone-guide-toggle,
  body.dark.mobile-shell-active .tone-guide-toggle{
    height:auto;
    min-height:0;
    padding:5px 7px;
    border-radius:0;
    background:transparent !important;
    box-shadow:none !important;
    font-size:8px;
    line-height:normal;
    opacity:.72;
    vertical-align:baseline;
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }

  body.mobile-shell-active .tone-guide-toggle:hover,
  body.dark.mobile-shell-active .tone-guide-toggle:hover,
  body.mobile-shell-active .tone-guide-toggle.is-active,
  body.dark.mobile-shell-active .tone-guide-toggle.is-active{
    background:transparent !important;
  }

  .tone-guide-region-label{
    font-size:6.5px;
  }

  .tone-guide-region-action,
  body.dark .tone-guide-region-action{
    width:24px;
    min-width:24px;
    height:22px;
    min-height:22px;
    line-height:22px;
  }
}

@media (prefers-reduced-motion:reduce){
  .tone-guide-toggle{
    transition:none !important;
  }
}


/*
==========================================================
TONE GUIDE v1.9 — MOBILE BASELINE CORRECTION
==========================================================
The mobile Tone Guide control and DAVIDHOSSZU.COM share the exact same fixed
bottom offset already. This override aligns their text line boxes as well:
the Guide inherits the backlink-like normal line-height, and its state dot is
positioned independently so it cannot raise/lower the text baseline.
*/
@media (max-width:900px){
  body.mobile-shell-active .tone-guide-toggle{
    position:relative;
    display:inline-block;
  }

  body.mobile-shell-active .tone-guide-toggle::before{
    position:absolute;
    left:-4px;
    top:50%;
    margin:0;
    transform:translateY(-50%);
    vertical-align:baseline;
  }
}
