/* Image Studio — approved comparison, theme, size, and FAQ */
html:has(body.image-studio-page) {
  background: #fcfcfa;
}

html:has(body.image-studio-page.studio-dark),
html.studio-dark {
  background: #101820;
  color-scheme: dark;
}

body.image-studio-page {
  margin: 0;
  background: var(--labs-paper, #fcfcfa);
}

.image-studio-page #image-studio-status:empty {
  display: none;
}

.image-studio-page [hidden] {
  display: none !important;
}

.labs-shell.studio-dark {
  --labs-paper: #101820;
  --labs-workspace: #101820;
  --labs-ink: #f4f5f1;
  --labs-muted: #c9d4da;
  --labs-line: #2c3e4e;
  --labs-surface: #1a2834;
  --studio-accent-text: #a8d4cf;
}

.labs-shell {
  --studio-accent-text: var(--labs-action);
}

.labs-shell.studio-dark .labs-workspace,
.labs-shell.studio-dark .site-footer {
  background: var(--labs-paper);
  color: var(--labs-ink);
}

.labs-shell.studio-dark .site-footer-brand,
.labs-shell.studio-dark .studio-quality,
.labs-shell.studio-dark .studio-quality span {
  color: var(--labs-ink);
}

.image-studio-page .studio-theme {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid rgb(255 255 255 / 40%);
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.image-studio-page .studio-theme + .labs-corporate-return {
  margin-left: 0.75rem;
}

.image-studio-page .studio-theme-track {
  position: relative;
  display: inline-block;
  flex: none;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: rgb(255 255 255 / 28%);
  transition: background-color 160ms ease;
}

.image-studio-page .studio-theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #172c3f;
  transition: transform 160ms ease;
}

.image-studio-page .studio-theme[aria-checked="true"] .studio-theme-track {
  background: #a8d4cf;
}

.image-studio-page .studio-theme[aria-checked="true"] .studio-theme-thumb {
  transform: translateX(20px);
}

.image-studio-page .studio-theme svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-studio-page .studio-theme[aria-checked="false"] .studio-theme-moon,
.image-studio-page .studio-theme[aria-checked="true"] .studio-theme-sun {
  display: none;
}

.image-studio-page .studio-theme:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.labs-shell .labs-image-studio-shell {
  max-width: var(--site-content-max);
  padding-bottom: var(--labs-s4);
}

.image-studio-page #image-studio-fullscreen {
  background: var(--labs-surface);
  color: var(--labs-ink);
  border-color: var(--labs-muted);
  font: inherit;
  font-weight: 600;
}

.labs-shell .image-studio-section-title {
  margin: var(--labs-s3) 0 var(--labs-s2);
  font-size: 1.05rem;
}

.labs-shell .image-studio-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--labs-s2);
}

.labs-shell .image-studio-example-card {
  display: flex;
  flex-direction: column;
  gap: var(--labs-s1);
  margin: 0;
  padding: 0;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  background: var(--labs-paper);
  color: var(--labs-ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  min-height: var(--labs-target-min);
}

.labs-shell .image-studio-example-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.labs-shell .image-studio-example-card span {
  padding: 12px 16px;
  font-weight: 700;
}

.labs-shell .image-studio-example-card:hover,
.labs-shell .image-studio-example-card:focus-visible {
  border-color: var(--labs-action);
  outline: none;
}

.labs-shell .image-studio-drop {
  margin-top: var(--labs-s1);
  padding: var(--labs-s3);
  border: 1px dashed var(--labs-line);
  border-radius: var(--labs-radius);
  background: var(--labs-surface);
  text-align: center;
}

.labs-shell .image-studio-drop.is-dragover {
  border-color: var(--labs-action);
  background: var(--labs-paper);
}

.labs-shell .image-studio-drop .labs-btn-primary {
  margin-top: var(--labs-s2);
  min-height: var(--labs-target-min);
}

.labs-shell .image-studio-comparison {
  margin-top: var(--labs-s2);
}

.labs-shell .studio-frame {
  position: relative;
  height: 22.5rem;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  overflow: hidden;
  background: var(--labs-surface);
  --image-studio-split: 50%;
  touch-action: pan-y;
}

.labs-shell .studio-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--labs-surface);
}

.labs-shell .studio-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--image-studio-split));
}

.labs-shell .studio-frame[data-display="before"] #image-studio-after,
.labs-shell .studio-frame[data-display="before"] #image-studio-after-layer,
.labs-shell .studio-frame[data-display="after"] #image-studio-before {
  display: none !important;
}

.labs-shell .studio-frame[data-display="after"] #image-studio-after-layer {
  display: block !important;
  clip-path: none;
}

.labs-shell .studio-frame[data-display="after"] #image-studio-after {
  display: block !important;
  clip-path: none;
}

.labs-shell .studio-frame[data-display="split"] #image-studio-before {
  display: block !important;
}

.labs-shell .studio-tag {
  position: absolute;
  top: 0.75rem;
  z-index: 2;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  background: rgb(252 252 250 / 92%);
  color: #172c3f;
  font-size: 0.8125rem;
  font-weight: 700;
}

.labs-shell.studio-dark .studio-tag {
  background: rgb(16 24 32 / 88%);
  color: #f4f5f1;
}

.labs-shell .studio-tag-before { left: 0.75rem; }
.labs-shell .studio-tag-after { right: 0.75rem; }

.labs-shell .studio-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--image-studio-split);
  z-index: 3;
  width: 44px;
  transform: translateX(-50%);
  border: 0;
  padding: 0;
  background: linear-gradient(to right, transparent 21px, #172c3f 21px, #172c3f 23px, transparent 23px);
  cursor: ew-resize;
}

.labs-shell .studio-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border: 2px solid #172c3f;
  border-radius: 50%;
  background: #fff;
}

.labs-shell .studio-divider:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
  box-shadow: 0 0 0 5px var(--labs-action);
}

.labs-shell .image-studio-switch {
  display: none;
  gap: 8px;
  margin-bottom: 12px;
}

.labs-shell .image-studio-switch button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  background: var(--labs-paper);
  color: var(--labs-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.labs-shell .image-studio-switch button[aria-pressed="true"] {
  background: var(--labs-action);
  border-color: var(--labs-action);
  color: #fff;
}

.labs-shell .image-studio-facts {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0 0;
  color: var(--labs-ink);
  font-size: 0.875rem;
}

.labs-shell .studio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
}

.labs-shell .studio-format-group { display: grid; gap: 0.35rem; }
.labs-shell .studio-group-label,
.labs-shell .studio-units-wrap > span,
.labs-shell .studio-quality,
.labs-shell .studio-quality span {
  font-weight: 600;
  color: var(--labs-ink);
}

.labs-shell .image-studio-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.labs-shell .image-studio-formats label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  background: #fff;
  color: var(--labs-ink);
  font-weight: 600;
  cursor: pointer;
}

.labs-shell .image-studio-formats input,
.labs-shell .studio-units input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.labs-shell .image-studio-formats label:has(input:checked),
.labs-shell .studio-units label:has(input:checked) {
  background: var(--labs-action);
  border-color: var(--labs-action);
  color: #fff;
}

.labs-shell .image-studio-formats label:has(input:disabled) {
  opacity: 1;
  color: var(--labs-muted);
  background: var(--labs-paper);
  border-color: var(--labs-muted);
  cursor: not-allowed;
}

.labs-shell.studio-dark .image-studio-formats label:has(input:disabled),
.labs-shell.studio-dark .image-studio-formats label:has(input:disabled) span {
  color: #c9d4da;
  background: #101820;
  border-color: #8aa0ab;
}

.labs-shell .image-studio-formats label:focus-within,
.labs-shell .studio-units label:focus-within {
  outline: 2px solid var(--studio-accent-text, var(--labs-action));
  outline-offset: 2px;
}

.labs-shell .studio-quality,
.labs-shell .studio-quality label,
.labs-shell .image-studio-quality,
.labs-shell .image-studio-quality label,
.labs-shell .studio-group-label,
.labs-shell .studio-size-field,
.labs-shell .studio-units-wrap > span {
  color: var(--labs-ink);
}

.labs-shell.studio-dark .studio-quality,
.labs-shell.studio-dark .studio-quality label,
.labs-shell.studio-dark .studio-quality span,
.labs-shell.studio-dark .image-studio-quality,
.labs-shell.studio-dark .image-studio-quality label,
.labs-shell.studio-dark .studio-group-label {
  color: #f4f5f1;
}

.labs-shell .studio-quality,
.labs-shell .image-studio-quality {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 16rem;
  min-width: 12rem;
  margin: 0;
  font-weight: 600;
}

.labs-shell .image-studio-quality input[type="range"] {
  flex: 1;
  min-height: 44px;
  accent-color: var(--labs-action);
}

.labs-shell .studio-hint {
  margin: 0.75rem 0 0;
  color: var(--labs-ink);
}

.labs-shell .studio-size {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin-top: 1rem;
}

.labs-shell .studio-size-field {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--labs-ink);
}

.labs-shell .studio-unit-input { position: relative; display: block; }

.labs-shell .studio-unit-input input[type="number"] {
  box-sizing: border-box;
  width: 7.5rem;
  min-height: 44px;
  padding: 0 2.4rem 0 0.75rem;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  background: #fff;
  color: var(--labs-ink);
  font: inherit;
}

.labs-shell .studio-suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--labs-muted);
  font-weight: 600;
  pointer-events: none;
}

.labs-shell .studio-lock {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  background: var(--labs-surface);
  color: var(--labs-ink);
  cursor: pointer;
}

.labs-shell .studio-lock[aria-pressed="true"] {
  color: var(--studio-accent-text, var(--labs-action));
  border-color: var(--studio-accent-text, var(--labs-action));
}

.labs-shell .studio-lock[aria-pressed="true"] .lock-open,
.labs-shell .studio-lock[aria-pressed="false"] .lock-closed { display: none; }

.labs-shell .studio-lock svg,
.labs-shell .studio-icon-btn svg,
.labs-shell .studio-mbtn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.labs-shell .studio-units { display: flex; }

.labs-shell .studio-units label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--labs-line);
  background: #fff;
  color: var(--labs-ink);
  font-weight: 600;
  cursor: pointer;
}

.labs-shell .studio-units label:first-child { border-radius: var(--labs-radius) 0 0 var(--labs-radius); }
.labs-shell .studio-units label:last-child { border-radius: 0 var(--labs-radius) var(--labs-radius) 0; margin-left: -1px; }

.labs-shell .studio-size-note {
  align-self: center;
  margin: 0 0 0 auto;
  color: var(--labs-muted);
  font-size: 0.875rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.labs-shell .studio-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: 0.6;
  transition: opacity 180ms ease;
}

.labs-shell .studio-frame:hover .studio-overlay,
.labs-shell .studio-overlay:focus-within { opacity: 1; }

.labs-shell .studio-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: rgb(23 44 63 / 72%);
  color: #fff;
  cursor: pointer;
}

.labs-shell .studio-icon-btn:hover,
.labs-shell .studio-icon-btn:focus-visible { background: var(--labs-action); }

.labs-shell .studio-icon-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

.labs-shell [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 8px;
  border-radius: 8px;
  background: #172c3f;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.labs-shell .studio-icon-save[data-tip]::after { left: auto; right: 0; transform: none; }
.labs-shell [data-tip]:hover::after,
.labs-shell [data-tip]:focus-visible::after { opacity: 1; }

.labs-shell .studio-mtoolbar { display: none; }

.labs-shell.studio-dark .image-studio-formats label:not(:has(input:checked)),
.labs-shell.studio-dark .studio-units label:not(:has(input:checked)),
.labs-shell.studio-dark .studio-unit-input input,
.labs-shell.studio-dark .studio-lock,
.labs-shell.studio-dark .image-studio-switch button[aria-pressed="false"] {
  background: #1a2834;
  color: #f4f5f1;
  border-color: #2c3e4e;
}

.labs-shell .image-studio-offline-banner {
  color: var(--labs-ink);
  background: var(--labs-surface);
  border: 1px solid var(--labs-line);
  border-radius: var(--labs-radius);
  padding: var(--labs-s2);
}

body.image-studio-page.image-studio--fullscreen {
  background: var(--labs-paper, #fcfcfa);
}

body.image-studio-page.studio-dark.image-studio--fullscreen {
  background: #101820;
}

.labs-shell #main-content.image-studio--fullscreen {
  padding-top: 0;
  margin-top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.labs-shell #main-content.image-studio--fullscreen .labs-image-studio-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 12px 12px 16px;
  box-sizing: border-box;
}

.labs-shell #main-content.image-studio--fullscreen .image-studio-work {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.labs-shell #main-content.image-studio--fullscreen .image-studio-comparison {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  margin-top: 0;
}

.labs-shell #main-content.image-studio--fullscreen .studio-frame {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 12rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.labs-shell #main-content.image-studio--fullscreen .studio-frame img {
  background: transparent;
}

@media (max-width: 768px) {
  .image-studio-page .labs-header-inner {
    gap: 8px;
  }

  .image-studio-page .labs-brand-wordmark {
    display: inline;
    font-size: 0.8125rem;
  }

  .image-studio-page .labs-workspace-header--row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .image-studio-page .labs-workspace-header--row h1,
  .image-studio-page .labs-workspace-header--row p {
    margin: 0;
  }

  .image-studio-page #image-studio-fullscreen {
    justify-self: start;
  }

  .labs-shell .studio-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    width: 100%;
  }

  .labs-shell .studio-format-group,
  .labs-shell .image-studio-quality,
  .labs-shell .studio-quality {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .labs-shell .image-studio-examples { grid-template-columns: 1fr; }
  .labs-shell .studio-split-only { display: none !important; }
  .labs-shell .image-studio-switch:not([hidden]) { display: flex; }
  .labs-shell .studio-frame[data-display="before"] #image-studio-before,
  .labs-shell .studio-frame[data-display="after"] #image-studio-after {
    display: block !important;
    clip-path: none !important;
  }
  .labs-shell .studio-mtoolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }
  .labs-shell .studio-mbtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 56px;
    padding: 6px 4px;
    border: 1px solid var(--labs-line);
    border-radius: var(--labs-radius);
    background: var(--labs-paper);
    color: var(--labs-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
  }
  .labs-shell .studio-mbtn-save {
    background: var(--labs-action);
    border-color: var(--labs-action);
    color: #fff;
  }
  .labs-shell .studio-mbtn[aria-disabled="true"] { opacity: 0.45; }
  .labs-shell .image-studio-formats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .labs-shell .image-studio-formats label { width: 100%; }
  .labs-shell .studio-size {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    gap: 12px;
    align-items: end;
  }
  .labs-shell .studio-unit-input input[type="number"] { width: 100%; }
  .labs-shell .studio-units-wrap {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: start;
    gap: 12px;
  }
  .labs-shell .studio-size-note { grid-column: 1 / -1; margin: 0; min-height: 0; }
  .labs-shell .image-studio-facts { flex-direction: column; gap: 0.25rem; }
  .image-studio-page .labs-corporate-return-text { display: none; }
  .image-studio-page .studio-theme {
    flex: none;
    width: 44px;
    min-width: 44px;
    padding: 0;
    justify-content: center;
  }
  .image-studio-page .studio-theme-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .image-studio-page .studio-theme-track {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
  }
  .image-studio-page .studio-theme-thumb {
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
  }
  .image-studio-page .studio-theme[aria-checked="true"] .studio-theme-track { background: transparent; }
  .image-studio-page .studio-theme[aria-checked="true"] .studio-theme-thumb {
    transform: none;
    background: #a8d4cf;
  }
}

@media (max-width: 420px) {
  .image-studio-page .labs-nav-about { display: none; }
}

@media (max-width: 340px) {
  .image-studio-page .labs-brand-wordmark { display: none; }
}
