/*
 * Shared Image Builder presentation layer.
 * Scope: controls, labels, swatches, helper overlays, and responsive access.
 * Excluded by design: React state, dimensions, frame geometry/miter paths,
 * artwork rendering structure, texture selection, and Capture behavior.
 */

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
  color: var(--muted);
}
.format-card:hover:not(:disabled) { border-color: var(--accent); }
.format-card.active {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transform: scale(0.98);
}
.format-card:disabled { opacity: 0.3; cursor: not-allowed; }
.format-icon-box { height: 28px; display: flex; align-items: center; justify-content: center; }
.format-icon { border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.format-icon.standard { width: 18px; height: 24px; }
.format-icon.panoramic { width: 28px; height: 12px; }
.format-icon.square { width: 20px; height: 20px; }
.format-card span { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.format-card:focus-visible,
.tab-btn:focus-visible,
.orient-btn:focus-visible,
.reset-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.custom-size-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.custom-size-field { display: flex; flex-direction: column; gap: 4px; }
.custom-size-field label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.custom-size-field input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.2s;
}
.custom-size-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.custom-size-field input::placeholder { color: var(--muted); font-family: var(--font-body); }

.select-group label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.option-grid { display: grid; grid-template-columns: repeat(4, 64px); gap: 8px; }
.swatch {
  position: relative;
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-size: cover;
  cursor: pointer;
  transition: transform 0.2s;
}
.swatch:hover { transform: scale(1.1); z-index: 10; }
.swatch.active::after { content: ''; position: absolute; inset: -4px; border: 2px solid var(--accent); border-radius: 10px; }

.print-hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  font-family: var(--font-body);
}
.print-hint-card { width: 380px; max-width: 90vw; padding: 36px 40px; border-radius: 16px; background: #fff; color: #222; text-align: center; }
.print-hint-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.print-hint-card p { margin: 0 0 20px; color: #666; font-size: 14px; line-height: 1.6; }
.print-hint-card kbd { display: inline-block; padding: 4px 10px; border: 1px solid #ddd; border-radius: 6px; background: #f0f0f0; color: #333; font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.print-hint-card .ok-btn { padding: 10px 32px; border: none; border-radius: 99px; background: #111; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.print-screen-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.detection-badge { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 6px 12px; border-radius: 99px; background: var(--fg); color: var(--bg); font-size: 11px; font-weight: 700; }

.orientation-toggle { display: flex; gap: 8px; }
.orient-btn { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color 0.2s, background-color 0.2s, color 0.2s; }
.orient-btn.active { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.orient-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.vision-toggle { position: relative; display: flex; width: 140px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 99px; background: var(--bg); }
.vision-btn { position: relative; z-index: 1; display: flex; flex: 1; align-items: center; justify-content: center; gap: 6px; padding: 6px; border: none; border-radius: 99px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; cursor: pointer; transition: color 0.3s; }
.vision-btn.active { color: var(--fg); }
.vision-slider { position: absolute; top: 2px; left: 2px; width: calc(50% - 2px); height: calc(100% - 4px); border-radius: 99px; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1); }
[data-theme='dark'] .vision-slider { transform: translateX(100%); }

.snapshot-hint {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 10001;
  display: none;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 99px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
body.snapshot-active .snapshot-hint { display: block; }

/* Presentation-only mobile access rules. Frame measurements remain provided by existing inline variables. */
@media (max-width: 768px) {
  .app-container { min-height: 100vh; min-height: 100dvh; }
  .preview-area { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .preview-content { padding: 32px 16px calc(84px + env(safe-area-inset-bottom)); }
  .art-wrapper { width: max-content; max-width: none; margin: 24px auto !important; }
  .preview-placeholder { width: min(var(--art-width-px), calc(100vw - 32px)); max-width: calc(100vw - 32px); }
  .sidebar { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .sidebar-toggle { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); min-height: 44px; }
}
@media (max-width: 480px) {
  .preview-header { padding: max(16px, env(safe-area-inset-top)) 16px 12px; gap: 12px; }
  .site-logo { height: 42px; }
  .preview-content { padding: 24px 12px calc(88px + env(safe-area-inset-bottom)); }
  .format-grid { gap: 8px; }
  .format-card { min-height: 78px; gap: 8px; padding: 12px 4px; }
  .option-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .swatch { width: 100%; height: auto; aspect-ratio: 1; }
  .orient-btn { min-height: 44px; padding: 10px 8px; }
  .print-hint-card { width: min(100% - 24px, 380px); max-height: calc(100dvh - 32px); padding: 28px 20px; overflow-y: auto; }
  .snapshot-hint { max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
}
