/* Pocket Austin — Track 3.3: Postcard & Lock-Screen Studio Modal */

#pa-studio-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(22, 17, 12, 0.62);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink, #2c221a);
}

#pa-studio-backdrop.open {
  display: flex;
}

#pa-studio-modal {
  width: min(1040px, 100%);
  max-height: calc(100vh - 28px);
  background: rgba(251, 246, 234, 0.98);
  border: 1.5px solid var(--border, #4a3b2c);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(14, 10, 6, 0.52);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: paStudioPop 0.18s ease-out;
}

@keyframes paStudioPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pa-studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1.2px solid rgba(74, 59, 44, 0.24);
  background: rgba(244, 236, 220, 0.85);
  flex-shrink: 0;
}

.pa-studio-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.pa-studio-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink, #2c221a);
}

.pa-studio-edition {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent, #c45735);
  background: rgba(196, 87, 53, 0.1);
  border: 1px solid rgba(196, 87, 53, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.pa-studio-close {
  appearance: none;
  border: 1.2px solid rgba(74, 59, 44, 0.4);
  background: #fffaf0;
  color: var(--ink, #2c221a);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.pa-studio-close:hover {
  background: #efe5cf;
  border-color: var(--border, #4a3b2c);
}

.pa-studio-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

/* Left Archival Printmaker Preview Desk */
.pa-studio-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 22px 16px;
  background-color: #212a27;
  background-image:
    radial-gradient(ellipse at center, rgba(64, 86, 78, 0.22) 0%, rgba(16, 20, 18, 0.65) 100%),
    radial-gradient(rgba(251, 246, 234, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 18px 18px;
  min-height: 340px;
  overflow: hidden;
}

.pa-studio-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 175px);
}

#pa-studio-preview {
  display: block;
  max-width: 100%;
  max-height: min(560px, calc(100vh - 195px));
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.52),
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(251, 246, 234, 0.22);
  background: #f4ecdc;
}

.pa-studio-stage-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: rgba(251, 246, 234, 0.84);
  letter-spacing: 0.02em;
}

.pa-studio-dim-pill {
  background: rgba(251, 246, 234, 0.12);
  border: 1px solid rgba(251, 246, 234, 0.24);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

/* Right Controls Sidebar */
.pa-studio-controls {
  border-left: 1.2px solid rgba(74, 59, 44, 0.22);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  overflow-y: auto;
  background: rgba(251, 246, 234, 0.96);
}

.pa-studio-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted, #665848);
  margin: 0 0 6px;
}

/* 4 Aspect Ratio Preset Cards */
.pa-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.pa-preset-btn {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1.3px solid rgba(74, 59, 44, 0.36);
  background: #fffaf0;
  color: var(--ink, #2c221a);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.pa-preset-btn:hover {
  background: #efe5cf;
  border-color: var(--border, #4a3b2c);
}

.pa-preset-btn.active {
  background: rgba(196, 87, 53, 0.1);
  border-color: var(--accent, #c45735);
  box-shadow: 0 0 0 1.5px rgba(196, 87, 53, 0.25);
}

.pa-preset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
}

.pa-preset-ratio-glyph {
  border: 1.5px solid var(--ink, #2c221a);
  background: rgba(76, 142, 136, 0.16);
  border-radius: 2px;
  flex-shrink: 0;
}

.pa-preset-btn.active .pa-preset-ratio-glyph {
  border-color: var(--accent, #c45735);
  background: rgba(196, 87, 53, 0.2);
}

.pa-preset-ratio-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted, #665848);
}

.pa-preset-btn.active .pa-preset-ratio-tag {
  color: var(--accent, #c45735);
}

.pa-preset-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.18;
  color: var(--ink, #2c221a);
}

.pa-preset-dims {
  font-size: 10px;
  color: var(--ink-muted, #665848);
}

/* Custom Caption Field */
.pa-caption-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#pa-studio-caption {
  flex: 1 1 auto;
  min-width: 0;
  border: 1.3px solid rgba(74, 59, 44, 0.52);
  border-radius: 7px;
  background: #fffdf7;
  color: var(--ink, #2c221a);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 9px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

#pa-studio-caption:focus {
  border-color: var(--accent, #c45735);
  box-shadow: 0 0 0 2px rgba(196, 87, 53, 0.16);
}

#pa-studio-caption-reset {
  appearance: none;
  border: 1.2px solid rgba(74, 59, 44, 0.42);
  background: #fffaf0;
  color: var(--ink-muted, #665848);
  height: 33px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease;
}

#pa-studio-caption-reset:hover {
  background: #efe5cf;
  color: var(--ink, #2c221a);
}

.pa-caption-hint {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-muted, #665848);
}

/* Studio Toggles */
.pa-studio-toggles {
  display: grid;
  gap: 6px;
}

.pa-studio-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(74, 59, 44, 0.06);
  border: 1px solid rgba(74, 59, 44, 0.14);
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease;
}

.pa-studio-toggle:hover {
  background: rgba(74, 59, 44, 0.11);
}

.pa-studio-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pa-studio-toggle-title {
  font-size: 12.2px;
  font-weight: 600;
  color: var(--ink, #2c221a);
}

.pa-studio-toggle-sub {
  font-size: 10.2px;
  color: var(--ink-muted, #665848);
}

.pa-studio-toggle input {
  accent-color: var(--accent, #c45735);
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

/* Live Stamp Summary Box */
.pa-studio-stamp-summary {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4ecdc;
  border: 1px dashed rgba(74, 59, 44, 0.42);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-muted, #665848);
}

.pa-studio-stamp-summary strong {
  color: var(--ink, #2c221a);
}

/* Export Actions */
.pa-studio-actions {
  margin-top: auto;
  display: grid;
  gap: 7px;
  padding-top: 4px;
}

.pa-studio-btn-primary,
.pa-studio-btn-secondary {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.8px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.pa-studio-btn-primary {
  background: var(--accent, #c45735);
  border: 1.4px solid var(--border, #4a3b2c);
  color: #fbf6ea;
  box-shadow: 0 3px 10px rgba(196, 87, 53, 0.26);
}

.pa-studio-btn-primary:hover {
  background: #b14a2a;
}

.pa-studio-btn-primary:active,
.pa-studio-btn-secondary:active {
  transform: translateY(1px);
}

.pa-studio-btn-secondary {
  background: #fffaf0;
  border: 1.3px solid var(--border, #4a3b2c);
  color: var(--ink, #2c221a);
}

.pa-studio-btn-secondary:hover {
  background: #efe5cf;
}

.pa-studio-btn-primary:disabled,
.pa-studio-btn-secondary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pa-studio-status {
  min-height: 16px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--teal, #4c8e88);
}

.pa-studio-status.error {
  color: #b43224;
}

/* Mobile / Narrow Responsive Stack */
@media (max-width: 820px) {
  #pa-studio-backdrop {
    padding: 8px;
  }

  #pa-studio-modal {
    max-height: calc(100vh - 16px);
    border-radius: 12px;
  }

  .pa-studio-head h2 {
    font-size: 15.5px;
  }

  .pa-studio-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .pa-studio-stage {
    min-height: 230px;
    padding: 14px 14px 10px;
  }

  .pa-studio-canvas-wrap {
    max-height: 36vh;
  }

  #pa-studio-preview {
    max-height: 34vh;
  }

  .pa-studio-controls {
    border-left: none;
    border-top: 1.2px solid rgba(74, 59, 44, 0.22);
    overflow-y: visible;
    padding: 12px 14px 14px;
  }
}
