/* Simple Stack v2 - deployed client styles
   Clean, modern Linktree-style centered column. Visuals mirror the editor's
   ss-* preview rules (NewEditor.css) so the live page matches the builder. */

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #f3f4f6;
  color: #111827;
  font-family: 'Inter', 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Center the card; the frame (below) sits behind it on desktop. On mobile the
   card fills the screen. */
#root {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Desktop backdrop behind the card — a blurred version of the page/avatar image
   (set by the client) or a light neutral. Hidden on mobile. */
.ss-frame { display: none; }

.ss-root {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #ffffff;
  color: #111827;
}

.ss-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ss-scroll {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: calc(30px + env(safe-area-inset-top, 0px)) 20px 36px;
  -webkit-overflow-scrolling: touch;
}

.ss-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Desktop: a centered 566px card on the frame — the original Simple Stack layout. */
@media (min-width: 768px) {
  #root { align-items: center; padding: 40px; }
  .ss-frame {
    display: block;
    position: fixed;
    inset: -40px;
    z-index: 0;
    background-color: #f3f4f6;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(22px);
    transform: scale(1.08);
  }
  .ss-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(243, 244, 246, 0.5);
  }
  .ss-root {
    width: 566px;
    max-width: calc(100vw - 48px);
    height: 80vh;
    min-height: 600px;
    max-height: 900px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  }
  .ss-scroll { padding: 40px 30px; }
}

.ss-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Avatar — round headshot with a thin border + gray person placeholder */
.ss-avatar {
  width: var(--ss-avatar-size, 112px);
  height: var(--ss-avatar-size, 112px);
  border-radius: 50%;
  margin: 0 auto 4px;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  font-size: calc(var(--ss-avatar-size, 112px) * 0.4);
  font-weight: 700;
  color: #9ca3af;
  border: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: none;
  overflow: hidden;
}
.ss-avatar.is-image { background: #ffffff; }
.ss-avatar.is-empty { background: #f3f4f6; color: #9ca3af; }
.ss-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.ss-avatar-placeholder { width: 46%; height: 46%; color: #9ca3af; }

/* Profile */
.ss-profile {
  width: 100%;
  text-align: center;
  padding: 2px 6px 0;
}
.ss-name { color: #111827; line-height: 1.15; letter-spacing: -0.01em; }
.ss-handle { margin-top: 3px; color: #6b7280; line-height: 1.25; }
.ss-bio {
  max-width: 380px;
  margin: 9px auto 0;
  color: #4b5563;
  line-height: 1.55;
  white-space: pre-wrap;
}
/* Online status + location — plain stacked text rows with a pulsing green dot
   (authentic original Simple Stack style, not bordered chips). */
.ss-pills {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.ss-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  white-space: nowrap;
  line-height: 1.2;
}
.ss-pill-icon { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.8; }
.ss-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: #22c55e;
  animation: ss-pulse-online 2s infinite ease-in-out;
}
@keyframes ss-pulse-online {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .ss-status-dot { animation: none !important; }
}

/* Links */
.ss-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
  padding: 0;
  list-style: none;
}
.ss-link-anchor {
  display: block;
  position: relative;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  outline-offset: 4px;
}
.ss-link-anchor:focus-visible { outline: 2px solid rgba(120, 170, 255, 0.7); }

/* Simple button — full-width black button, inline centered icon */
.ss-link-simple {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid var(--ss-link-border, rgba(0, 0, 0, 0.1));
  background: var(--ss-link-bg, #000000);
  color: var(--ss-link-text, #ffffff);
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 2px 6px var(--ss-link-shadow, rgba(0, 0, 0, 0.12));
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.ss-link-anchor:hover .ss-link-simple { transform: scale(1.02); opacity: 0.96; }
.ss-link-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-link-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  line-height: 0;
}
.ss-link-button-icon img,
.ss-link-featured-icon img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.ss-link-button-icon span,
.ss-link-featured-icon span { font-size: 10px; font-weight: 800; line-height: 1; }

/* Featured card */
.ss-link-featured {
  position: relative;
  border: 1px solid var(--ss-card-border, #e5e7eb);
  border-radius: 12px;
  background: var(--ss-card-bg, #ffffff);
  color: var(--ss-card-title, #111827);
  box-shadow: 0 2px 10px var(--ss-card-shadow, rgba(17, 24, 39, 0.07));
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.ss-link-anchor:hover .ss-link-featured { transform: translateY(-2px); box-shadow: 0 8px 22px var(--ss-card-shadow, rgba(17, 24, 39, 0.12)); }
.ss-link-featured-image {
  width: 100%;
  height: 168px;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.ss-link-featured-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  line-height: 0;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.4));
}
.ss-link-featured-text { padding: 13px 16px 15px; }
.ss-link-featured.has-image .ss-link-featured-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0) 100%);
  padding: 28px 16px 14px;
}
.ss-link-featured-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ss-card-title, #111827);
  overflow-wrap: anywhere;
}
.ss-link-featured-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--ss-card-subtitle, #6b7280);
  margin-top: 4px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Mini gallery */
.ss-link-gallery {
  border: 1px solid var(--ss-gallery-border, #e5e7eb);
  border-radius: 12px;
  background: var(--ss-gallery-bg, #ffffff);
  color: var(--ss-gallery-text, #111827);
  box-shadow: 0 2px 10px var(--ss-gallery-shadow, rgba(17, 24, 39, 0.07));
  padding: 12px;
  overflow: hidden;
}
.ss-link-gallery-title { font-weight: 700; font-size: 14px; line-height: 1.2; margin: 0 0 10px; }
.ss-link-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--ss-gallery-columns, 2), minmax(0, 1fr));
  gap: 8px;
}
.ss-link-gallery-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--ss-gallery-border, #e5e7eb);
  border-radius: 10px;
  padding: 0;
  background: #f3f4f6;
  color: inherit;
  overflow: hidden;
}
.ss-link-gallery-tile.is-clickable { cursor: zoom-in; }
.ss-link-gallery-tile.is-clickable:focus-visible { outline: 2px solid rgba(120, 170, 255, 0.7); outline-offset: 2px; }
.ss-link-gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.ss-link-gallery-empty {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(14, 165, 233, 0.12)),
    repeating-linear-gradient(45deg, rgba(17, 24, 39, 0.06) 0 6px, transparent 6px 12px);
}
.ss-link-gallery-label {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 4px 6px;
  border: 1px solid var(--ss-gallery-pill-border, rgba(255, 255, 255, 0.26));
  border-radius: 8px;
  background: var(--ss-gallery-pill-bg, rgba(17, 24, 39, 0.68));
  color: var(--ss-gallery-pill-text, #ffffff);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Media embed */
.ss-link-media {
  border: 1px solid var(--ss-media-border, #e5e7eb);
  border-radius: 12px;
  background: var(--ss-media-bg, #ffffff);
  color: var(--ss-media-title, #111827);
  box-shadow: 0 2px 10px var(--ss-media-shadow, rgba(17, 24, 39, 0.07));
  overflow: hidden;
}
.ss-link-media-frame,
.ss-link-media-placeholder {
  width: 100%;
  display: block;
  border: none;
  background: #0f172a;
}
.ss-link-media-frame { overflow: hidden; }
.ss-link-media-frame.is-youtube,
.ss-link-media-placeholder.is-youtube { aspect-ratio: 16 / 9; height: auto; }
.ss-link-media-frame.is-spotify,
.ss-link-media-placeholder.is-spotify { height: var(--ss-media-frame-height, 352px); min-height: var(--ss-media-frame-height, 352px); }
.ss-link-media-frame.is-soundcloud,
.ss-link-media-placeholder.is-soundcloud { height: var(--ss-media-frame-height, 166px); min-height: var(--ss-media-frame-height, 166px); }
.ss-link-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 120px;
}
.ss-link-media-text { padding: 11px 14px 13px; }
.ss-link-media-title { color: var(--ss-media-title, #111827); font-size: 15px; font-weight: 700; line-height: 1.2; }
.ss-link-media-caption { color: var(--ss-media-caption, #6b7280); font-size: 12px; font-weight: 500; line-height: 1.35; margin-top: 4px; }

/* Section header */
.ss-link-header {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7280;
  background: var(--ss-header-bg, transparent);
  padding: 12px 2px 6px;
  border-bottom: 1px solid var(--ss-header-border, rgba(17, 24, 39, 0.12));
  text-align: left;
}

/* Text block */
.ss-link-text {
  font-size: 13px;
  line-height: 1.55;
  color: #4b5563;
  padding: 12px 14px;
  background: var(--ss-text-bg, #ffffff);
  border: 1px solid var(--ss-text-border, rgba(17, 24, 39, 0.1));
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Divider */
.ss-link-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  color: var(--ss-divider-color, #9ca3af);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4em;
}
.ss-link-divider span {
  width: 100%;
  height: var(--ss-divider-thickness, 2px);
  background: var(--ss-divider-color, #e5e7eb);
  border-radius: 2px;
}
.ss-link-divider-chars span {
  width: auto;
  height: auto;
  background: transparent;
  line-height: 1;
}

/* Socials */
.ss-socials {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding: 0;
}
.ss-social {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.1);
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}
.ss-social:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(17, 24, 39, 0.12); }
.ss-social.is-disabled { cursor: default; opacity: 0.7; }
.ss-social.is-disabled:hover { transform: none; box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06); }
.ss-social-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.ss-social span { font-size: 11px; font-weight: 800; }
/* Icon-only — no chip */
.ss-socials.is-icon-only .ss-social {
  width: 38px;
  height: 38px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.ss-socials.is-icon-only .ss-social:hover { box-shadow: none; }
.ss-socials.is-icon-only .ss-social-icon { width: 32px; height: 32px; }
/* Monochrome — gray round chip + desaturated icon (the original Simple Stack
   "SVG" social style). Default for Simple Stack. */
.ss-socials.is-mono .ss-social {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  border-color: transparent;
  box-shadow: none;
  color: #4b5563;
}
.ss-socials.is-mono .ss-social:hover { background: #e5e7eb; transform: scale(1.1); box-shadow: none; }
.ss-socials.is-mono .ss-social-icon { width: 16px; height: 16px; filter: grayscale(1) opacity(0.7); }

/* Link animations */
.ss-link-anim-bounce { animation: ss-link-bounce 2s ease-in-out infinite; }
.ss-link-anim-pulse { animation: ss-link-pulse 2s ease-in-out infinite; }
.ss-link-anim-glow { animation: ss-link-glow 2.4s ease-in-out infinite; }
.ss-link-anim-neon {
  box-shadow: 0 0 5px var(--ss-link-bg, #000000),
              0 0 12px var(--ss-link-bg, #000000),
              0 0 22px var(--ss-link-bg, #000000);
}
.ss-link-anim-shine { position: relative; isolation: isolate; }
.ss-link-anim-shine::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -100%;
  z-index: 4;
  width: 60%;
  height: 200%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0.05) 75%, transparent 100%);
  transform: skewX(-15deg);
  animation: ss-link-shine 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ss-link-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes ss-link-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
/* Neon halo + flicker driven by the button colour (--ss-link-bg) — the
   original Simple Stack / Spotlight Card button effects. */
@keyframes ss-link-glow {
  0%, 100% {
    box-shadow: 0 0 4px var(--ss-link-bg, #000000),
                0 0 9px var(--ss-link-bg, #000000);
  }
  50% {
    box-shadow: 0 0 14px var(--ss-link-bg, #000000),
                0 0 26px var(--ss-link-bg, #000000);
  }
}
@keyframes ss-link-shine {
  0% { left: -100%; opacity: 0; }
  10% { opacity: 1; }
  50% { left: 100%; opacity: 1; }
  55% { opacity: 0; }
  100% { left: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ss-link-anim-bounce,
  .ss-link-anim-pulse,
  .ss-link-anim-glow,
  .ss-link-anim-neon { animation: none !important; }
  .ss-link-anim-shine::before { display: none; }
}

/* Empty state */
.ss-empty-prompt {
  margin-top: 8px;
  padding: 20px 16px;
  text-align: center;
  border: 1px dashed rgba(17, 24, 39, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: #6b7280;
}
.ss-empty-title { color: #111827; font-size: 15px; font-weight: 700; }
.ss-empty-sub { margin-top: 5px; font-size: 12px; line-height: 1.45; }

/* Adult content inline warning */
.ss-link-anchor.has-adult-warning { overflow: hidden; }
.ss-adult-inline {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 10px;
  background: rgba(8, 8, 10, 0.96);
  color: #ffffff;
  text-align: center;
  border-radius: inherit;
}
.ss-adult-inline-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 100%;
  max-width: 300px;
}
.ss-adult-inline-title { display: block; color: #ffffff; font-size: 12px; font-weight: 900; line-height: 1.15; text-transform: uppercase; }
.ss-adult-inline-body { display: block; color: rgba(255, 255, 255, 0.68); font-size: 11px; font-weight: 700; line-height: 1.28; }
.ss-adult-actions { display: flex; justify-content: center; gap: 8px; width: 100%; }
.ss-adult-btn {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.ss-adult-btn.secondary { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.82); }
.ss-adult-btn.primary { border-color: #ffffff; background: #ffffff; color: #111827; }
.ss-link-anchor-simple .ss-adult-inline { padding: 7px 10px; }
.ss-link-anchor-simple .ss-adult-inline-title { display: none; }
.ss-link-anchor-simple .ss-adult-inline-body { margin-bottom: 7px; color: #ffffff; font-size: 11px; font-weight: 500; white-space: nowrap; }
.ss-link-anchor-simple .ss-adult-btn { min-height: 21px; border-radius: 6px; padding: 4px 10px; font-size: 10px; font-weight: 500; }
.ss-link-anchor-simple .ss-adult-btn.secondary { background: rgba(255, 255, 255, 0.1); color: #ffffff; border-color: rgba(255, 255, 255, 0.2); }
.ss-link-anchor-simple .ss-adult-btn.primary { background: #ffffff; color: #000000; border-color: #ffffff; }

/* Gallery image lightbox */
.ss-image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.ss-image-panel { position: relative; width: min(760px, 100%); max-height: min(82vh, 760px); display: grid; gap: 10px; }
.ss-image-preview {
  width: 100%;
  max-height: min(76vh, 700px);
  display: block;
  border-radius: 16px;
  object-fit: contain;
  background: #111827;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
  user-select: none;
  -webkit-user-drag: none;
}
.ss-image-close {
  justify-self: end;
  min-height: 34px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 999px;
  padding: 0 14px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}
.ss-image-caption {
  justify-self: center;
  max-width: min(560px, 100%);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 430px) {
  .ss-scroll { padding: 32px 16px 30px; }
  .ss-link-simple { min-height: 52px; padding: 13px 42px; }
}
