/* ==========================================================================
   SHARED STUDIO VIEWER, 3D FLIP STAGE & EXACT PRINT ENGINE (90×54mm / 94×58mm)
   ========================================================================== */

@page {
  size: 90mm 54mm;
  margin: 0;
}

html, body {
  margin: 0;
  padding: 0;
}

@media screen {
  body {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 0%, #1b382b 0%, #0a1611 72%);
    color: #f4efe4;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    padding: 84px 18px 56px;
    overflow-x: hidden;
  }

  /* Top Studio Navigation & Print Toolbar */
  .studio-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 60px;
    z-index: 9999;
    background: rgba(11, 22, 17, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(198, 165, 104, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .sb-left, .sb-right {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
  }

  .sb-home {
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #f2dfb8;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid rgba(198, 165, 104, 0.45);
    background: rgba(198, 165, 104, 0.12);
    white-space: nowrap;
    transition: background 0.2s;
  }

  .sb-home:hover {
    background: rgba(198, 165, 104, 0.24);
  }

  .sb-tab {
    text-decoration: none;
    color: rgba(244, 239, 228, 0.78);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.2s ease;
    white-space: nowrap;
  }

  .sb-tab:hover {
    color: #fff;
    border-color: rgba(198, 165, 104, 0.55);
  }

  .sb-tab.active {
    background: #c6a568;
    color: #0f2219;
    border-color: #c6a568;
    font-weight: 700;
  }

  .sb-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #f4efe4;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
  }

  .sb-btn:hover {
    border-color: #c6a568;
    color: #f2dfb8;
  }

  .sb-btn.active {
    background: rgba(198, 165, 104, 0.24);
    border-color: #c6a568;
    color: #f2dfb8;
    font-weight: 600;
  }

  .sb-btn-print {
    background: #236b48;
    border-color: #39996a;
    color: #fff;
    font-weight: 600;
  }

  .sb-btn-print:hover {
    background: #2b8258;
    border-color: #52bd88;
    color: #fff;
  }

  /* Studio Intro Header */
  .studio-head {
    max-width: 1120px;
    margin: 0 auto 26px;
    text-align: center;
  }

  .studio-kicker {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #c6a568;
    margin-bottom: 6px;
  }

  .studio-head h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 600;
    margin: 0 0 8px;
    color: #fff;
    line-height: 1.08;
  }

  .studio-head p {
    margin: 0 auto;
    max-width: 720px;
    font-size: 13.8px;
    color: rgba(244, 239, 228, 0.8);
    line-height: 1.55;
  }

  /* Main Two-Up Stage */
  .card-stage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 32px;
    max-width: 1240px;
    margin: 0 auto;
  }

  .card-stage.one-up {
    flex-direction: column;
    align-items: center;
  }

  .card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .side-label {
    margin-bottom: 11px;
    padding: 5px 15px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(198, 165, 104, 0.42);
    color: #f2dfb8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .card-shadow {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

  /* Interactive 3D Flip Stage (Hidden unless 3D mode is active) */
  .flip-stage-wrap {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 6px auto 0;
  }

  body.mode-3d .card-stage {
    display: none;
  }

  body.mode-3d .flip-stage-wrap {
    display: flex;
  }

  .flip-hint {
    margin-bottom: 12px;
    font-size: 12px;
    color: #f2dfb8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
  }

  .flip-scene {
    perspective: 1600px;
    cursor: pointer;
  }

  .flip-inner {
    position: relative;
    width: calc(90 * var(--u) + 2 * var(--bleed));
    height: calc(54 * var(--u) + 2 * var(--bleed));
    transform-style: preserve-3d;
    transition: transform 0.78s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .flip-scene.is-flipped .flip-inner {
    transform: rotateY(180deg);
  }

  .flip-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(198, 165, 104, 0.32);
  }

  .flip-face.is-back {
    transform: rotateY(180deg);
  }

  .flip-cta-btn {
    margin-top: 16px;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid #c6a568;
    background: rgba(198, 165, 104, 0.16);
    color: #f2dfb8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .flip-cta-btn:hover {
    background: rgba(198, 165, 104, 0.28);
  }

  /* Quick Test & Print Specs Footer Box */
  .studio-specs {
    max-width: 1060px;
    margin: 34px auto 0;
    background: rgba(11, 24, 18, 0.8);
    border: 1px solid rgba(198, 165, 104, 0.34);
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .specs-info {
    font-size: 13px;
    color: rgba(244, 239, 228, 0.84);
    line-height: 1.5;
  }

  .specs-info strong {
    color: #f2dfb8;
  }

  .specs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .sp-link {
    text-decoration: none;
    padding: 8px 13px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(198, 165, 104, 0.45);
    background: rgba(198, 165, 104, 0.12);
    color: #f2dfb8;
    cursor: pointer;
    font-family: inherit;
  }

  .sp-link:hover {
    background: rgba(198, 165, 104, 0.24);
  }

  @media (max-width: 820px) {
    body {
      padding: 112px 12px 42px;
    }
    .studio-bar {
      padding: 8px 12px;
      gap: 6px;
    }
    .sb-tab, .sb-btn, .sb-home {
      font-size: 11px;
      padding: 6px 9px;
    }
    #toggleEditBtn, #toggleLargeBtn {
      display: none;
    }
  }
}

/* ==========================================================================
   EXACT PRINT OUTPUT (2-Page Vector PDF: Front + Back at 90×54mm or 94×58mm)
   ========================================================================== */
@media print {
  :root {
    --u: 1mm !important;
  }

  body.bleed-mode {
    --bleed: 2mm !important;
  }

  html, body {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
  }

  .no-print,
  .studio-bar,
  .studio-head,
  .side-label,
  .flip-stage-wrap,
  .studio-specs {
    display: none !important;
  }

  .card-stage,
  .card-slot,
  .card-shadow {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .biz-card {
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .card-front {
    page-break-after: always !important;
    break-after: page !important;
  }

  .card-back {
    page-break-after: auto !important;
    break-after: auto !important;
  }
}
