/* Editorial Studio Shell, Masthead, Inspector Rail, Swatches, Controls & Modals */

.studio-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface-rail);
}

/* Top Architectural Masthead */
.masthead {
  position: relative;
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px 0 24px;
  background: var(--surface-rail);
  border-bottom: 1px solid var(--border-hairline);
  z-index: 20;
}

.masthead-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1.5px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 200ms ease;
}

.masthead-progress.active {
  opacity: 1;
}

.masthead-progress::after {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 35%;
  height: 100%;
  background: var(--fp-accent, var(--accent-ochre));
  animation: progress-slide 1.15s var(--ease-editorial) infinite;
}

@keyframes progress-slide {
  0% { left: -35%; }
  100% { left: 105%; }
}

.masthead-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-primary);
  text-decoration: none;
  line-height: 1;
  padding-right: 2px;
}

.brand-seal-mark {
  display: inline-flex;
  width: 17px;
  height: 17px;
  color: var(--ink-primary);
  transition: transform 180ms var(--ease-editorial);
}

.brand-seal-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.masthead-divider {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

.telemetry-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-edition-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-primary);
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--surface-elevated);
  flex-shrink: 0;
}

.studio-edition-swatch {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(26, 25, 23, 0.25);
  display: inline-block;
}

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

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.015em;
  transition:
    background var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) ease;
  white-space: nowrap;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--ink-primary);
  color: var(--ink-inverse);
  border: 1px solid var(--ink-primary);
}

.btn-primary:hover:not(:disabled) {
  background: #2D2B28;
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: var(--ink-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--ink-primary);
  background: var(--surface-subtle);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-lg {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

/* Main Split Workspace */
.studio-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.canvas-column {
  flex: 1;
  min-width: 0;
  padding: 78px 48px 86px;
}

/* Top Floating Specimen & Upload Pill */
.specimen-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-hud);
  max-width: calc(100% - 32px);
}

.wall-alcove .specimen-bar,
.wall-alcove .canvas-hud {
  background: var(--surface-glass-dark);
  border-color: rgba(247, 245, 240, 0.12);
  color: var(--ink-inverse);
}

.specimen-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  padding-right: 4px;
}

.wall-alcove .specimen-label {
  color: rgba(247, 245, 240, 0.55);
}

.specimen-chips {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.specimen-chips::-webkit-scrollbar {
  display: none;
}

.specimen-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.wall-alcove .specimen-chip {
  color: rgba(247, 245, 240, 0.68);
}

.specimen-chip:hover {
  background: rgba(26, 25, 23, 0.06);
  color: var(--ink-primary);
}

.wall-alcove .specimen-chip:hover {
  background: rgba(247, 245, 240, 0.1);
  color: var(--ink-inverse);
}

.specimen-chip.active {
  background: var(--ink-primary);
  color: var(--ink-inverse);
}

.wall-alcove .specimen-chip.active {
  background: var(--ink-inverse);
  color: var(--ink-primary);
}

.specimen-sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
  margin: 0 3px;
  flex-shrink: 0;
}

.wall-alcove .specimen-sep {
  background: rgba(247, 245, 240, 0.16);
}

.upload-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--accent-ochre);
  color: #FCFBF8;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter var(--dur-fast) ease;
}

.upload-pill-btn:hover {
  filter: brightness(0.92);
}

.upload-pill-btn svg {
  width: 12px;
  height: 12px;
}

/* Bottom Floating Frame HUD */
.canvas-hud {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 4px;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-hud);
}

.hud-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  white-space: nowrap;
}

.hud-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.wall-alcove .hud-btn {
  color: rgba(247, 245, 240, 0.68);
}

.hud-btn:hover {
  background: rgba(26, 25, 23, 0.06);
  color: var(--ink-primary);
}

.wall-alcove .hud-btn:hover {
  background: rgba(247, 245, 240, 0.10);
  color: var(--ink-inverse);
}

.hud-btn.active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(26, 22, 17, 0.12);
}

.wall-alcove .hud-btn.active {
  background: rgba(247, 245, 240, 0.18);
  color: var(--ink-inverse);
  box-shadow: none;
}

.hud-sep {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
  margin: 0 2px;
}

.wall-alcove .hud-sep {
  background: rgba(247, 245, 240, 0.16);
}

/* Status & Warning Pill (centered cleanly above the bottom Frame HUD) */
.canvas-status-pill {
  position: absolute;
  bottom: 62px;
  left: 50%;
  z-index: 9;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-secondary);
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  max-width: calc(100% - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.canvas-status-pill.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.wall-alcove .canvas-status-pill {
  background: var(--surface-glass-dark);
  color: rgba(247, 245, 240, 0.72);
  border-color: rgba(247, 245, 240, 0.12);
}

/* Full-Stage Drag-and-Drop Linen Veil */
.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 245, 240, 0.90);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-editorial);
}

.drop-veil.active {
  opacity: 1;
  pointer-events: auto;
}

.drop-veil-frame {
  width: min(560px, 86vw);
  padding: 56px 40px;
  text-align: center;
  border: 1px dashed rgba(26, 25, 23, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(252, 251, 248, 0.85);
}

.drop-veil-title {
  font-family: var(--font-display, 'Inter Tight', var(--font-sans));
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 10px;
  color: var(--ink-primary);
}

.drop-veil-sub {
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin: 0;
}

/* Right Editorial Inspector Rail */
.inspector-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-rail);
  border-left: 1px solid var(--border-hairline);
  min-height: 0;
}

.inspector-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px var(--space-rail-px) 28px;
}

.inspector-section {
  padding-bottom: var(--space-section);
  margin-bottom: var(--space-section);
  border-bottom: 1px solid var(--border-hairline);
}

.inspector-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-kicker {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

/* Hairline Identity Inputs */
.editorial-input-title {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-strong);
  padding: 4px 0 6px;
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--ink-primary);
  outline: none;
  transition: border-color var(--dur-fast) ease;
}

.editorial-input-title:focus {
  border-bottom-color: var(--border-focus);
}

.editorial-input-title::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

.editorial-input-sub {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-hairline);
  padding: 5px 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-secondary);
  outline: none;
  transition: border-color var(--dur-fast) ease;
}

.editorial-input-sub:focus {
  border-bottom-color: var(--border-focus);
  color: var(--ink-primary);
}

.identity-meta-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Tactile Print Specimen Theme Cards */
.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.theme-specimen {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 5px 10px 5px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: transparent;
  text-align: left;
  transition:
    background var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.theme-specimen:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.theme-specimen.active {
  background: var(--surface-elevated);
  border-color: var(--ink-primary);
  box-shadow: 0 0 0 1px var(--ink-primary);
}

.specimen-swatch {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(26, 25, 23, 0.14);
  position: relative;
}

.specimen-swatch svg {
  width: 100%;
  height: 100%;
  display: block;
}

.specimen-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.specimen-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-primary);
  line-height: 1.25;
}

.specimen-desc {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.3;
}

.specimen-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(26, 25, 23, 0.14);
  flex-shrink: 0;
}

/* Segmented Controls */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
}

.segmented-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
}

.seg-btn {
  height: 27px;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--ink-primary);
}

.seg-btn.active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(26, 22, 17, 0.10);
}

.control-group {
  margin-bottom: 14px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.control-label {
  font-size: 12.5px;
  font-weight: 450;
  color: var(--ink-primary);
}

.control-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

/* Hairline Toggle Rows */
.toggle-list {
  display: flex;
  flex-direction: column;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  cursor: pointer;
  user-select: none;
}

.toggle-row-text {
  display: flex;
  flex-direction: column;
}

.toggle-row-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: rgba(26, 25, 23, 0.16);
  transition: background var(--dur-fast) var(--ease-editorial);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-elevated);
  box-shadow: 0 1px 2px rgba(20, 17, 13, 0.22);
  transition: transform var(--dur-fast) var(--ease-editorial);
}

.switch input:checked + .switch-track {
  background: var(--ink-primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(15px);
}

/* Precision Hairline Sliders */
.editorial-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: rgba(26, 25, 23, 0.18);
  border-radius: 2px;
  outline: none;
  margin: 6px 0;
}

.editorial-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-primary);
  cursor: pointer;
  border: 2px solid var(--surface-rail);
  box-shadow: 0 0 0 1px var(--ink-primary);
  transition: transform 120ms ease;
}

.editorial-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.editorial-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-primary);
  border: 2px solid var(--surface-rail);
  box-shadow: 0 0 0 1px var(--ink-primary);
  cursor: pointer;
}

/* Accent Ink Dots */
.accent-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.accent-dot-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(26, 25, 23, 0.18);
  position: relative;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.accent-dot-btn:hover {
  transform: scale(1.12);
}

.accent-dot-btn.active {
  box-shadow: 0 0 0 2px var(--surface-rail), 0 0 0 3.5px var(--ink-primary);
}

.accent-reset-btn {
  font-size: 11px;
  color: var(--ink-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
}

.accent-reset-btn.active {
  border-color: var(--ink-primary);
  color: var(--ink-primary);
  background: var(--surface-elevated);
}

/* Collapsible Drawer */
.drawer-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 2px 0;
}

.drawer-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-muted);
  transition: transform 220ms var(--ease-editorial);
}

.drawer-trigger[aria-expanded="true"] .drawer-chevron {
  transform: rotate(180deg);
}

.drawer-body {
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-body[hidden] {
  display: none;
}

/* Connected Sources Teaser Card (Strava / Garmin / Apple Health) */
.integrations-card {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--surface-elevated);
}

.integrations-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.integration-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  background: var(--surface-rail);
}

/* Calm Archival Print Quality Preflight Advisory */
.quality-advisory-host {
  flex-shrink: 0;
  padding: 10px var(--space-rail-px) 0;
  background: var(--surface-rail);
  border-top: 1px solid var(--border-hairline);
}

.quality-advisory-host[hidden] {
  display: none;
}

.quality-advisory {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  border-left: 2.5px solid var(--accent-ochre);
}

.quality-advisory.sev-blocker {
  border-left-color: #9E3B33;
  background: #FAF3F1;
}

.quality-advisory.sev-warn {
  border-left-color: var(--accent-terracotta);
}

.quality-advisory.sev-tip {
  border-left-color: var(--accent-ochre);
}

.quality-advisory-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-primary);
  line-height: 1.3;
}

.quality-advisory-msg {
  font-size: 11px;
  color: var(--ink-secondary);
  line-height: 1.45;
  margin-top: 2px;
}

.quality-fix-btn {
  align-self: flex-start;
  height: 25px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--surface-rail);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-primary);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.quality-fix-btn:hover {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
  color: var(--ink-inverse);
}

.preflight-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-rail);
}

.preflight-pill.grade-archival,
.preflight-pill.grade-good {
  color: var(--accent-sage);
  background: rgba(79, 109, 90, 0.08);
  border-color: rgba(79, 109, 90, 0.22);
}

.preflight-pill.grade-caution {
  color: #9C5332;
  background: rgba(201, 103, 83, 0.09);
  border-color: rgba(201, 103, 83, 0.26);
}

.preflight-pill.grade-blocked {
  color: #8E3535;
  background: rgba(142, 53, 53, 0.09);
  border-color: rgba(142, 53, 53, 0.28);
}

.preflight-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-secondary);
}

/* Sticky Inspector Export Footer */
.inspector-footer {
  flex-shrink: 0;
  padding: 14px var(--space-rail-px) 16px;
  background: var(--surface-rail);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Editorial Modal (Share Poster & Export Options) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 18, 15, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  width: min(440px, 100%);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  box-shadow: 0 28px 72px rgba(18, 15, 11, 0.26);
  padding: 24px 26px;
}

.modal-card-social {
  width: min(396px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.modal-title {
  font-family: var(--font-display, 'Inter Tight', var(--font-sans));
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink-primary);
  margin: 0;
  line-height: 1.2;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.modal-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.modal-close:hover {
  background: var(--surface-subtle);
  border-color: var(--border-hairline);
  color: var(--ink-primary);
}

.modal-desc {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.modal-field-box {
  background: var(--surface-rail);
  border: 1px solid var(--border-hairline);
  border-radius: 2px;
  padding: 13px 14px;
  margin-bottom: 14px;
}

.modal-field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 8px;
}

.modal-email-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-primary);
  outline: none;
  margin-bottom: 10px;
  transition: border-color var(--dur-fast) ease;
}

.modal-email-input:focus {
  border-color: var(--ink-primary);
}

.modal-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-secondary);
  cursor: pointer;
}

.modal-checkbox-row input[type="checkbox"] {
  margin: 2px 0 0;
  accent-color: #161614;
  cursor: pointer;
}

.social-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-rail);
  border: 1px solid var(--border-hairline);
  border-radius: 2px;
  padding: 14px;
  margin-bottom: 14px;
  min-height: 280px;
}

.social-preview-img {
  display: block;
  max-height: 310px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 1px;
  box-shadow: 0 8px 24px rgba(18, 15, 11, 0.14);
}

.social-format-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.social-format-btn {
  border: none;
  background: var(--surface-elevated);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.social-format-btn + .social-format-btn {
  border-left: 1px solid var(--border-strong);
}

.social-format-btn.is-active {
  background: var(--ink-primary);
  color: var(--ink-inverse);
}

.social-meta-line {
  margin: 0 0 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.social-download-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.social-download-link:hover {
  color: var(--ink-primary);
}

.share-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  background: var(--surface-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.share-url-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-primary);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.export-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-rail);
  text-align: left;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.export-option-card:hover:not(:disabled) {
  border-color: var(--ink-primary);
  background: var(--surface-elevated);
}

.export-option-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-primary);
}

.export-option-sub {
  font-size: 11.5px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.export-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  flex-shrink: 0;
}

/* Packing Slip & Data Attribution Disclosure */
.credit-inline-link {
  text-decoration: none;
  color: var(--ink-primary);
}

.credit-inline-link:hover {
  text-decoration: underline;
}

.credit-slip-box {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--surface-rail);
}

.credit-slip-box.is-clear {
  background: rgba(79, 109, 90, 0.06);
  border-color: rgba(79, 109, 90, 0.22);
}

.credit-slip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.credit-slip-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.credit-slip-box.is-clear .credit-slip-title {
  color: var(--accent-sage);
}

.credit-copy-btn {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--ink-primary);
}

.credit-copy-btn:hover {
  background: var(--ink-primary);
  border-color: var(--ink-primary);
  color: var(--ink-inverse);
}

.credit-slip-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.credit-slip-foot {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: var(--ink-muted);
}

.credit-slip-foot a,
.credit-slip-link {
  font-size: 10.5px;
  color: var(--accent-ochre);
  text-decoration: none;
}

.credit-slip-foot a:hover,
.credit-slip-link:hover {
  text-decoration: underline;
}

.plaque-credits {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.plaque-credits a {
  color: var(--accent-ochre);
  text-decoration: none;
  white-space: nowrap;
}

.plaque-credits a:hover {
  text-decoration: underline;
}

/* Map Rotation Snap Row */
.rotation-snap-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.rotation-snap-btn {
  height: 25px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
  white-space: nowrap;
}

.rotation-snap-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
  background: var(--surface-elevated);
}

.rotation-snap-btn.active {
  background: var(--surface-elevated);
  border-color: var(--ink-primary);
  color: var(--ink-primary);
}

/* Wall AR HUD Button & Modal */
.hud-btn-ar {
  color: var(--ink-primary);
}

.wall-alcove .hud-btn-ar {
  color: rgba(247, 245, 240, 0.88);
}

.ar-modal-card {
  width: min(440px, 100%);
}

.ar-modal-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-secondary);
}

.ar-dims-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--surface-rail);
  font-size: 11.5px;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}

.ar-dims-pill strong {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-primary);
}

.ar-qr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 16px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-rail);
  border: 1px solid var(--border-hairline);
}

.ar-qr-frame {
  padding: 10px;
  border-radius: 6px;
  background: #FCFBF8;
  border: 1px solid rgba(26, 25, 23, 0.12);
  box-shadow: 0 6px 20px rgba(26, 22, 17, 0.08);
}

.ar-qr-img {
  display: block;
  width: 176px;
  height: 176px;
  image-rendering: pixelated;
}

.ar-qr-caption {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-secondary);
  max-width: 320px;
}

.ar-modal-note {
  margin: 12px 0 0;
  padding: 8px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.ar-modal-note.is-warn {
  border-color: rgba(158, 59, 51, 0.25);
  background: #FAF3F1;
  color: #8E3535;
}

.ar-inline-pixel {
  width: 1px;
  height: 1px;
  opacity: 0.01;
  position: absolute;
  pointer-events: none;
}

/* Mobile Responsive Layout */
@media (max-width: 960px) {
  .studio-layout {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .masthead {
    padding: 0 14px;
  }

  .telemetry-chip,
  .masthead-divider {
    display: none;
  }

  .studio-body {
    flex-direction: column;
  }

  .canvas-column {
    min-height: 64dvh;
    padding: 68px 18px 72px;
  }

  .inspector-rail {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-hairline);
  }

  .inspector-scroll {
    overflow: visible;
  }
}

/* =========================================================================
   Sharp 2px Swiss geometry for floating bars (Brand Guidelines §5)
   ========================================================================= */
.specimen-bar,
.canvas-hud,
.canvas-status-pill,
.hud-btn {
  border-radius: 2px;
}

/* =========================================================================
   Modals: always scrollable inside the viewport (iPhone SE, landscape, keyboard)
   ========================================================================= */
.modal-backdrop {
  overflow-y: auto;
  align-items: safe center;
  padding: 14px;
}

.modal-card {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@media (max-width: 640px), (max-height: 680px) {
  .modal-card {
    padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  }
  .social-preview-stage {
    min-height: 170px;
    padding: 10px;
    margin-bottom: 10px;
  }
  .social-preview-img {
    max-height: min(36dvh, 230px);
  }
}

/* =========================================================================
   Phone layout (<= 760px)
   ========================================================================= */
@media (max-width: 760px) {
  .studio-inline-nav,
  .studio-edition-chip {
    display: none;
  }
  .masthead {
    gap: 10px;
    padding: 0 14px;
  }

  /* Hide the desktop QR code; phone users launch AR directly */
  .ar-qr-stage {
    display: none;
  }

  /* Prevent iOS Safari auto-zoom on focus (inputs must be >= 16px) */
  .editorial-input-title,
  .editorial-input-sub,
  .modal-email-input,
  .share-url-input {
    font-size: 16px;
  }

  .inspector-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .canvas-hud {
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }
  .canvas-hud::-webkit-scrollbar {
    display: none;
  }
  .canvas-hud .hud-btn,
  .canvas-hud .hud-sep,
  .exhibition-frame-bar .hud-btn,
  .exhibition-frame-bar .hud-sep {
    flex-shrink: 0;
  }
  #hud-room-btn {
    display: none;
  }

  .specimen-bar .specimen-label,
  .specimen-bar #gpx-guide-btn {
    display: none;
  }
  .specimen-bar {
    padding-left: 6px;
  }
}

/* Touch-friendly hit areas */
@media (pointer: coarse), (max-width: 760px) {
  .hud-btn,
  .specimen-chip,
  .upload-pill-btn,
  .seg-btn,
  .rotation-snap-btn,
  .social-format-btn {
    min-height: 36px;
  }
  .canvas-hud {
    height: auto;
  }
  .modal-close {
    width: 40px;
    height: 40px;
  }
  .toggle-row {
    min-height: 44px;
  }
  .accent-dot-btn {
    width: 30px;
    height: 30px;
  }
  .editorial-slider {
    height: 28px;
    background: linear-gradient(rgba(26, 25, 23, 0.18), rgba(26, 25, 23, 0.18)) center / 100% 2px no-repeat;
  }
  .editorial-slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }
  .editorial-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }
}

/* Portrait phones: keep the live canvas pinned while scrolling the inspector */
@media (max-width: 960px) and (min-height: 520px) {
  .canvas-column {
    position: sticky;
    top: 0;
    z-index: 15;
    height: 46dvh;
    min-height: 300px;
    max-height: 410px;
    padding: 54px 16px 56px;
  }
  .canvas-hud {
    bottom: 10px;
  }
  .canvas-status-pill {
    bottom: 54px;
  }
  .specimen-bar {
    top: 10px;
  }
}
