/* ==========================================================================
   Custom Sandbox Page Styles (sandbox-custom.css)
   Exact match to GregBot React SPA design, layout, animations & interactions
   Inherits Ghost's native header & footer via default.hbs
   ========================================================================== */

/* Scoped layout rules within Ghost's theme */
body.page-sandbox #gh-head {
  position: relative !important;
  z-index: 200 !important;
}

body.page-sandbox .site-content {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  background: #ffffff !important;
}

body.page-sandbox #gregBotTrigger,
body.page-sandbox #gregBotContainer {
  display: none !important;
}

.sandbox-page-wrapper {
  background-color: #ffffff;
  color: #191b1e;
  min-height: calc(100vh - 100px);
  position: relative;
  overflow-x: hidden;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

/* ==========================================================================
   Keyframes & Animations
   ========================================================================== */

@keyframes ambientFloat1 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  35% { transform: translate(-6px, -10px) rotate(1.0deg); }
  70% { transform: translate(5px, -4px) rotate(-0.6deg); }
}

@keyframes ambientFloat2 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  30% { transform: translate(7px, 11px) rotate(-1.1deg); }
  65% { transform: translate(-5px, 6px) rotate(0.9deg); }
}

@keyframes ambientFloat3 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  40% { transform: translate(-8px, 9px) rotate(-1.0deg); }
  75% { transform: translate(6px, -7px) rotate(0.8deg); }
}

@keyframes ambientFloat4 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  35% { transform: translate(9px, -11px) rotate(1.2deg); }
  70% { transform: translate(-6px, 5px) rotate(-0.7deg); }
}

@keyframes ambientFloat5 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  45% { transform: translate(-7px, -12px) rotate(-1.0deg); }
  80% { transform: translate(5px, 8px) rotate(0.9deg); }
}

@keyframes ambientFloat6 {
  0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
  30% { transform: translate(7px, 10px) rotate(1.1deg); }
  65% { transform: translate(-8px, -6px) rotate(-0.9deg); }
}

.animate-ambient-1 { animation: ambientFloat1 7.8s ease-in-out infinite; backface-visibility: hidden; }
.animate-ambient-2 { animation: ambientFloat2 9.2s ease-in-out infinite; backface-visibility: hidden; }
.animate-ambient-3 { animation: ambientFloat3 8.4s ease-in-out infinite; backface-visibility: hidden; }
.animate-ambient-4 { animation: ambientFloat4 10.0s ease-in-out infinite; backface-visibility: hidden; }
.animate-ambient-5 { animation: ambientFloat5 8.9s ease-in-out infinite; backface-visibility: hidden; }
.animate-ambient-6 { animation: ambientFloat6 10.6s ease-in-out infinite; backface-visibility: hidden; }

@keyframes sandboxSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sandbox-spin-icon {
  animation: sandboxSpin 1s linear infinite;
}

@keyframes sandboxPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sandbox-loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: #52525b;
  animation: sandboxPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.sandbox-loading-indicator .sandbox-loading-text {
  font-weight: 600;
  color: #27272a;
}

/* ==========================================================================
   1. PROMPT STAGE (Default View)
   ========================================================================= */

.sandbox-prompt-stage {
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 64px 16px;
  z-index: 10;
}

/* Page Load Entrance Animation (Matching gregj.ca/about: Subtle Y + Opacity) */
@keyframes pageLoadEntrance {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Floating Stage Background */
.sandbox-floating-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  animation: pageLoadEntrance 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

/* Center Stage Content */
.sandbox-center-stage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 20;
  gap: 28px;
}

/* Feathered Radial Halo: keeps center prompt crystal-clear */
.sandbox-halo {
  position: absolute;
  inset: -64px -160px;
  border-radius: 9999px;
  filter: blur(48px);
  opacity: 0.95;
  pointer-events: none;
  z-index: 15;
  background: radial-gradient(ellipse 85% 75% at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.9) 45%, rgba(255, 255, 255, 0.5) 75%, rgba(255, 255, 255, 0) 100%);
}

.sandbox-headline {
  position: relative;
  z-index: 25;
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: #27272a;
  margin: 0;
  text-shadow: 0 0 28px #ffffff, 0 0 14px rgba(255, 255, 255, 0.95);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: pageLoadEntrance 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (min-width: 640px) {
  .sandbox-headline {
    font-size: 2.5rem;
  }
}

/* Prompt Container */
.sandbox-prompt-container {
  width: 100%;
  position: relative;
  z-index: 25;
  animation: pageLoadEntrance 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.14s both;
}

.sandbox-prompt-capsule {
  width: 100%;
  background: #ffffff;
  border-radius: 9999px;
  border: 2px solid #18181b;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  padding: clamp(6px, 1vh, 8px) clamp(8px, 1vw, 10px) clamp(6px, 1vh, 8px) clamp(12px, 1.5vw, 16px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.sandbox-prompt-capsule:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
}

.sandbox-prompt-capsule:focus-within {
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.20);
}

.sandbox-config-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #71717a;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sandbox-config-toggle-btn:hover {
  color: #18181b;
  background: #f4f4f5;
}

.sandbox-prompt-input {
  flex: 1 1 0%;
  background: transparent;
  border: none;
  outline: none;
  padding: clamp(5px, 0.8vh, 8px) 10px;
  font-size: clamp(14px, 1.6vh, 16px);
  color: #18181b;
  font-family: inherit;
}

.sandbox-prompt-input::placeholder {
  color: #777777;
}

.sandbox-camera-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: #fafafa;
  border: 1px solid #e4e4e7;
  border-radius: 9999px;
  font-size: 12px;
  color: #52525b;
  margin-right: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .sandbox-camera-pill {
    display: flex;
  }
}

.sandbox-camera-pill:hover {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #000000;
}

/* Rainbow Loop Animation matching the header "Sandbox" hover effect */
@keyframes rainbowButtonLoop {
  0%, 100% {
    background: #ff0055;
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.6), 0 0 18px rgba(255, 0, 85, 0.3);
  }
  20% {
    background: #ff7700;
    box-shadow: 0 0 8px rgba(255, 119, 0, 0.6), 0 0 18px rgba(255, 119, 0, 0.3);
  }
  40% {
    background: #ffdd00;
    box-shadow: 0 0 8px rgba(255, 221, 0, 0.6), 0 0 18px rgba(255, 221, 0, 0.3);
  }
  60% {
    background: #00e676;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.6), 0 0 18px rgba(0, 230, 118, 0.3);
  }
  80% {
    background: #00b0ff;
    box-shadow: 0 0 8px rgba(0, 176, 255, 0.6), 0 0 18px rgba(0, 176, 255, 0.3);
  }
}

.sandbox-send-btn {
  background: #ff0055;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: clamp(38px, 4.5vh, 44px);
  height: clamp(38px, 4.5vh, 44px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  animation: rainbowButtonLoop 2.5s linear infinite;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.sandbox-send-btn svg {
  color: #ffffff;
  fill: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.sandbox-send-btn:hover:not(:disabled) {
  transform: scale(1.06);
  filter: brightness(1.1);
}

.sandbox-send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.sandbox-send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.9;
}

/* In-Flow Writing Configuration Panel */
.sandbox-config-panel {
  position: relative;
  margin-top: 12px;
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e4e4e7;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 16px 20px;
  text-align: left;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: panelSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelSlideDown {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.sandbox-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f4f4f5;
  padding-bottom: 8px;
}

.sandbox-config-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-config-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a1a1aa;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sandbox-config-close:hover {
  color: #000000;
  background: #f4f4f5;
}

.sandbox-config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  font-size: 12px;
}

@media (min-width: 640px) {
  .sandbox-config-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.sandbox-label {
  display: block;
  font-weight: 600;
  color: #3f3f46;
  margin-bottom: 4px;
}

.sandbox-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  color: #18181b;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.sandbox-select:focus {
  border-color: #71717a;
}

/* Below-input Pills */
.sandbox-pills-row {
  position: relative;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
  animation: pageLoadEntrance 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

.sandbox-pill-btn {
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(228, 228, 231, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: #3f3f46;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sandbox-pill-btn:hover {
  border-color: #d4d4d8;
  color: #000000;
  background: #ffffff;
}

/* ==========================================================================
   Floating Ambient Cards (Rendered in DOM)
   ========================================================================== */

.sandbox-floating-item {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  left: var(--card-left-mobile, var(--card-left));
  top: var(--card-top);
  transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) and (max-width: 1023px) {
  .sandbox-floating-item {
    left: var(--card-left-tablet, var(--card-left));
  }
}

@media (min-width: 1024px) {
  .sandbox-floating-item {
    left: var(--card-left);
  }
}

.sandbox-floating-item.tier-mobile { display: block; }
.sandbox-floating-item.tier-tablet { display: none; }
.sandbox-floating-item.tier-desktop { display: none; }

@media (min-width: 1024px) {
  .sandbox-floating-item.tier-tablet { display: block; }
  .sandbox-floating-item.tier-desktop { display: block; }
}

/* Card Smooth Bloom Entrance & Exit Animations */
@keyframes cardSmoothFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.sandbox-floating-item.card-entering {
  animation: cardSmoothFadeIn 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sandbox-floating-item.card-exiting {
  opacity: 0 !important;
  transform: scale(0.94) !important;
  transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1), transform 1.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
  pointer-events: none !important;
}

/* Intermediate Repulsion Layer: decouples proximity translate from entrance/exit scale/opacity */
.sandbox-floating-repulsion {
  will-change: transform;
  transition: transform 0.18s ease-out;
}

.sandbox-floating-card {
  width: 145px;
  background: #ffffff;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(228, 228, 231, 0.8);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  text-align: left;
  transition: transform 0.5s ease-out, box-shadow 0.5s ease-out;
}

@media (min-width: 640px) {
  .sandbox-floating-card {
    width: 190px;
    padding: 10px;
    border-radius: 16px;
  }
}

@media (min-width: 768px) {
  .sandbox-floating-card { width: 210px; }
}

@media (min-width: 1024px) {
  .sandbox-floating-card { width: 220px; }
}

.sandbox-floating-card:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.14);
}

.sandbox-card-thumb-wrap {
  width: 100%;
  height: 90px;
  overflow: hidden;
  border-radius: 8px;
  background: #f4f4f5;
  position: relative;
  margin-bottom: 8px;
}

@media (min-width: 640px) {
  .sandbox-card-thumb-wrap { height: 110px; }
}

.sandbox-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease-out, transform 0.5s ease;
}

.sandbox-card-thumb.is-loaded {
  opacity: 1;
}

.sandbox-floating-card:hover .sandbox-card-thumb {
  transform: scale(1.04);
}

.sandbox-floating-card:hover .sandbox-card-thumb {
  transform: scale(1.04);
}

.sandbox-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.sandbox-card-meta {
  font-size: 9px;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .sandbox-card-meta { font-size: 10px; }
}

.sandbox-card-title {
  font-size: 11px;
  font-weight: 700;
  color: #18181b;
  margin: 0 0 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .sandbox-card-title { font-size: 12px; }
}

.sandbox-card-excerpt {
  display: none;
  font-size: 10px;
  color: #71717a;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .sandbox-card-excerpt { display: -webkit-box; font-size: 11px; }
}

.sandbox-card-action {
  display: none;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #f4f4f5;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 500;
  color: #52525b;
}

@media (min-width: 640px) {
  .sandbox-card-action { display: flex; }
}

/* ==========================================================================
   2. FULL GHOST ARTICLE VIEW
   ========================================================================== */

.sandbox-article-stage {
  padding: 40px 0;
}

.sandbox-article-toolbar {
  max-width: 1000px;
  margin: 0 auto 32px auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.sandbox-toolbar-back {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #52525b;
  font-weight: 600;
  transition: color 0.15s ease;
  padding: 0;
  font-family: inherit;
}

.sandbox-toolbar-back:hover {
  color: #000000;
}

.sandbox-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sandbox-toolbar-btn {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #3f3f46;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  font-family: inherit;
}

.sandbox-toolbar-btn:hover {
  border-color: #a1a1aa;
  color: #000000;
}

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

.sandbox-sparkle-icon {
  color: #f59e0b;
}

/* Article Hero Figure */
.sandbox-hero-figure {
  position: relative;
  cursor: pointer;
  max-width: 1000px;
  margin: 0 auto 2.5rem auto;
  border-radius: 12px;
  overflow: hidden;
}

.sandbox-hero-figure img {
  width: 100%;
  max-height: 600px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  transition: opacity 0.2s ease;
}

.sandbox-hero-figure:hover img {
  opacity: 0.95;
}

.sandbox-hero-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-hero-expand {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sandbox-hero-figure:hover .sandbox-hero-expand {
  opacity: 1;
}

.sandbox-hero-caption {
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  color: #999999;
  margin-top: 10px;
  font-family: inherit;
}

/* Ghost Canvas & Native Typography (Matching real Ghost articles like /the-bird-pic/) */
.gh-article {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.gh-canvas {
  max-width: 760px;
  margin: 0 auto;
}

.gh-article-title {
  font-family: inherit;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: rgb(21, 23, 26);
  margin-bottom: 2rem;
  word-break: break-word;
}

.gh-content {
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.6;
  color: rgb(21, 23, 26);
}

.gh-content p {
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: normal;
  color: rgb(21, 23, 26);
  margin-top: calc(1.6em * var(--content-spacing-multiplier, 1));
  margin-bottom: 0;
}

.gh-content h2 {
  font-family: inherit;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: rgb(21, 23, 26);
  margin-top: 2.5em;
  margin-bottom: 0.8em;
}

.gh-content h3 {
  font-family: inherit;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: rgb(21, 23, 26);
  margin-top: 2em;
  margin-bottom: 0.6em;
}

.gh-content ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

.gh-content li {
  margin-bottom: 0.5rem;
  font-size: 1.6rem;
  line-height: 1.6;
}

.gh-content blockquote {
  border-left: 3px solid rgb(21, 23, 26);
  padding-left: 1.25rem;
  font-style: italic;
  margin: 2rem 0;
  color: #555555;
}

/* Ghost Koenig Gallery Cards */
.kg-gallery-card {
  --gap: 1.2rem;
  box-sizing: border-box;
  margin: 2.5rem 0;
  width: 100%;
}

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
}

.kg-gallery-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: var(--gap);
  width: 100%;
}

.kg-gallery-image {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  background-color: #f4f4f5;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.kg-gallery-image:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.kg-gallery-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 6px;
}

.kg-gallery-card figcaption {
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  color: #71717a;
  margin-top: 0.85rem;
  font-style: italic;
}

@media (max-width: 640px) {
  .kg-gallery-card { --gap: 0.6rem; }
  .kg-gallery-row { flex-direction: column; }
}

/* Related Posts Section */
.sandbox-related-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 24px 48px 24px;
}

.related-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #18181b;
  margin-bottom: 32px;
  font-family: inherit;
}

.sandbox-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .sandbox-related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .sandbox-related-grid { grid-template-columns: repeat(3, 1fr); }
}

.sandbox-related-card {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(228, 228, 231, 0.8);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.sandbox-related-card:hover {
  border-color: #a1a1aa;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sandbox-related-thumb-wrap {
  height: 192px;
  background: #f4f4f5;
  overflow: hidden;
  position: relative;
}

.sandbox-related-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.sandbox-related-card:hover .sandbox-related-thumb {
  transform: scale(1.05);
}

.sandbox-related-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.sandbox-related-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  justify-content: space-between;
}

.sandbox-related-meta {
  font-size: 11px;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sandbox-related-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #18181b;
  margin: 0 0 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sandbox-related-card-excerpt {
  font-size: 12px;
  color: #71717a;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sandbox-related-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #52525b;
}

/* ==========================================================================
   3. MODALS
   ========================================================================== */

.sandbox-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000 !important;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sandbox-modal-card {
  background: #ffffff;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #e4e4e7;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.sandbox-modal-card-lg {
  max-width: 900px;
  max-height: 85vh;
  padding: 0;
  overflow: hidden;
}

@keyframes modalPop {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.sandbox-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f4f4f5;
  padding-bottom: 12px;
}

.sandbox-modal-card-lg .sandbox-modal-header {
  padding: 16px 24px;
  background: rgba(250, 250, 250, 0.7);
}

.sandbox-modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sandbox-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #18181b;
  margin: 0;
}

.sandbox-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a1a1aa;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sandbox-modal-close:hover {
  color: #000000;
  background: #f4f4f5;
}

.sandbox-modal-body {
  font-size: 13px;
  color: #52525b;
  line-height: 1.6;
}

.sandbox-modal-body p {
  margin: 0 0 12px 0;
}

.sandbox-modal-body ul {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.sandbox-modal-body li {
  margin-bottom: 8px;
}

.sandbox-modal-footer {
  padding-top: 8px;
  border-top: 1px solid #f4f4f5;
  display: flex;
  justify-content: flex-end;
}

.sandbox-modal-primary-btn {
  background: #000000;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sandbox-modal-primary-btn:hover {
  background: #27272a;
}

/* Archive Grid inside Modal */
.sandbox-archive-grid {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .sandbox-archive-grid { grid-template-columns: repeat(2, 1fr); }
}

.sandbox-archive-card {
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  transition: all 0.2s ease;
}

.sandbox-archive-card:hover {
  border-color: #a1a1aa;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sandbox-archive-thumb-wrap {
  height: 144px;
  border-radius: 8px;
  background: #f4f4f5;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
}

.sandbox-archive-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.sandbox-archive-card:hover .sandbox-archive-thumb {
  transform: scale(1.05);
}

.sandbox-archive-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
}

.sandbox-archive-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #a1a1aa;
  font-weight: 500;
  margin-bottom: 4px;
}

.sandbox-archive-title {
  font-size: 14px;
  font-weight: 700;
  color: #18181b;
  margin: 0 0 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sandbox-archive-excerpt {
  font-size: 12px;
  color: #71717a;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sandbox-archive-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #3f3f46;
}

/* ==========================================================================
   4. LIGHTBOX ZOOM MODAL
   ========================================================================== */

.sandbox-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100 !important;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  cursor: zoom-out;
  user-select: none;
  animation: fadeIn 0.2s ease-out;
}

.sandbox-lightbox-top {
  width: 100%;
  max-width: 1024px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  z-index: 20;
}

.sandbox-lightbox-counter {
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sandbox-lightbox-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #a1a1aa;
  padding: 8px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sandbox-lightbox-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sandbox-lightbox-center {
  position: relative;
  width: 100%;
  max-width: 1024px;
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 8px 0;
}

.sandbox-lightbox-stage {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.sandbox-lightbox-stage img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid #27272a;
}

.sandbox-lightbox-arrow {
  position: absolute;
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sandbox-lightbox-arrow:hover {
  background: rgba(0, 0, 0, 0.95);
  transform: scale(1.08);
}

.sandbox-lightbox-arrow:active {
  transform: scale(0.95);
}

.sandbox-lightbox-arrow-left { left: 8px; }
.sandbox-lightbox-arrow-right { right: 8px; }

@media (min-width: 640px) {
  .sandbox-lightbox-arrow-left { left: 16px; }
  .sandbox-lightbox-arrow-right { right: 16px; }
}

.sandbox-lightbox-bottom {
  width: 100%;
  max-width: 1024px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: default;
  z-index: 20;
}

.sandbox-lightbox-caption {
  font-size: 13px;
  color: #d4d4d8;
  font-weight: 500;
  text-align: center;
  max-width: 600px;
}

.sandbox-lightbox-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.sandbox-lightbox-dot {
  height: 8px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.3);
  width: 8px;
}

.sandbox-lightbox-dot:hover {
  background: rgba(255, 255, 255, 0.6);
}

.sandbox-lightbox-dot.active {
  width: 24px;
  background: #ffffff;
}

.sandbox-lightbox-shortcuts {
  font-size: 11px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sandbox-lightbox-shortcuts kbd {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 10px;
  font-family: monospace;
  color: #e4e4e7;
}
