/* Greeting Card editor styles.

   Layers on top of print-editor.css (.ws-* workspace shell) and
   photo-book.css (.pb-* shared elements). All selectors are .gc-*
   prefixed so they only affect /greeting-card pages.

   The 2x2 stage is a CSS grid: inside_left | inside_right on row 1,
   outside_back | outside_front on row 2. data-card-view=folded
   collapses to single-column showing outside_front only.
*/

.gc-editor.ws-shell {
  /* print-editor.css restricts max-width via :has(> .pb-editor.ws-shell)
     and :has(> .tshirt-editor.ws-shell). Greeting Card adds its own
     class, so we explicitly remove the cap here. */
  max-width: none;
}
#main-content:has(> .gc-editor.ws-shell) {
  max-width: none;
}

.gc-view-toggle {
  display: inline-flex;
  gap: 4px;
  margin: 8px 0 16px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 2px;
  background: #f7f7f7;
}

.gc-view-tab {
  background: transparent;
  border: none;
  color: #333;
  font-size: 0.9rem;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 4px;
}

.gc-view-tab.is-active {
  background: #1a4d80;
  color: #fff;
  font-weight: 600;
}

.gc-view-tab:focus-visible {
  outline: 3px solid #2a6db3;
  outline-offset: 2px;
}

/* 2x2 stage. Each panel is a flex column with the slot area on top
   and an absolutely-positioned text overlay above it.
   I.93.c — was sized by panel min-height (~200px) which left the stage
   stuck at ~308px on a 1496px canvas (huge blank space). Now we let the
   grid fill the available width up to a sensible max — a typical A6 card
   in 1:1 print scale would be ~800px at 100% zoom; we cap at 900px so the
   editor still feels like a "card" rather than a billboard. */
.gc-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 18px 24px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.gc-stage[data-card-view="folded"] {
  /* Folded view: single column, only outside_front visible. */
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  max-width: 480px;
}

.gc-stage[data-card-view="folded"] .gc-panel-inside-left,
.gc-stage[data-card-view="folded"] .gc-panel-inside-right,
.gc-stage[data-card-view="folded"] .gc-panel-outside-back {
  display: none;
}

.gc-panel {
  position: relative;
  background: #fffaf3;
  border: 2px solid #c9a961;
  border-radius: 4px;
  aspect-ratio: var(--panel-aspect, 105 / 148);
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  /* I.93.c — was `min-height: 200px` which (combined with the aspect-
     ratio) forced the parent grid to ~308px on a 1496px canvas. The
     stage already centers + caps at 900px; we just need the panels to
     fill whatever width the grid hands them, with the aspect-ratio
     deriving the height. A small min-height keeps the panel legible
     when the parent ever ends up at sub-200px (mobile portrait). */
  min-height: 160px;
}

.gc-panel:hover,
.gc-panel:focus-visible {
  box-shadow: 0 0 0 4px rgba(26, 77, 128, 0.25);
  border-color: #1a4d80;
  outline: none;
}

.gc-panel.is-selected {
  box-shadow: 0 0 0 4px rgba(26, 77, 128, 0.5);
  border-color: #1a4d80;
}

/* Panel label sits in the top-left corner. */
.gc-panel-label {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6a4a1f;
  background: rgba(255, 250, 243, 0.85);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

.gc-panel-slots,
.gc-panel-texts {
  position: absolute;
  inset: 0;
}

.gc-panel-slot {
  position: absolute;
  border: 2px dashed #c9a961;
  background: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a4a1f;
  font-size: 0.78rem;
  cursor: pointer;
  overflow: hidden;
}

.gc-panel-slot.is-filled {
  border-style: solid;
  background: #fff;
}

.gc-panel-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gc-panel-slot.is-selected {
  border-color: #1a4d80;
  box-shadow: 0 0 0 3px rgba(26, 77, 128, 0.45);
}

.gc-panel-text {
  position: absolute;
  background: transparent;
  border: 1px dashed transparent;
  padding: 4px 8px;
  font-family: inherit;
  cursor: text;
  color: inherit;
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

.gc-panel-text:hover {
  border-color: rgba(26, 77, 128, 0.4);
}

.gc-panel-text:focus,
.gc-panel-text.is-selected {
  border-color: #1a4d80;
  outline: none;
  background: rgba(255, 255, 255, 0.7);
}

.gc-panel-text[data-role="title"]   { font-size: 1.4rem; font-weight: 700; }
.gc-panel-text[data-role="body"]    { font-size: 1rem; }
.gc-panel-text[data-role="signature"] { font-size: 0.9rem; font-style: italic; }

/* Side panel sub-controls. */
.gc-text-list {
  display: grid;
  gap: 8px;
}

.gc-text-list-item {
  display: block;
  padding: 8px 10px;
  background: #f5ede0;
  border: 1px solid #c9a961;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.gc-text-list-item small {
  display: block;
  color: #6a4a1f;
  font-size: 0.75rem;
}

.gc-photo-tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.gc-photo-thumb {
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0f0;
  aspect-ratio: 1 / 1;
}

.gc-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gc-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.gc-drafts-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  gap: 12px;
}

.gc-drafts-row a {
  display: block;
  padding: 12px 16px;
  background: #fffaf3;
  border: 1px solid #c9a961;
  border-radius: 6px;
  color: #1a4d80;
  text-decoration: none;
}

.gc-drafts-row a small {
  display: block;
  color: #6a4a1f;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Mobile: stack panels into a single column. */
@media (max-width: 720px) {
  .gc-stage {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
