html {
  --hero-bg: #0B1030; --hero-dot: #1F2756;
  --rope: #ECE6D6; --rope-ridge: #A29A85; --rope-shine: rgba(255, 255, 255, 0.55); --rope-shadow: rgba(0, 0, 0, 0.45);
  --tip-bg: #FFFFFF; --tip-fg: #0D0D0F; --glow: rgba(201, 242, 77, 0.6);
}
html[data-theme="light"] {
  --hero-bg: #F4F1EA; --hero-dot: #DAD5C8;
  --rope: #3A3833; --rope-ridge: #141310; --rope-shine: rgba(255, 255, 255, 0.28); --rope-shadow: rgba(40, 30, 10, 0.28);
  --tip-bg: #0D0D0F; --tip-fg: #FFFFFF; --glow: rgba(37, 71, 232, 0.45);
}

/* The export wraps the hero with neighbouring canvas frames; show the hero alone. */
body { background: var(--hero-bg) !important; transition: background-color 0.45s ease; }
/* Only the wrapper pen.dev adds around an exported frame; the hosts below get their scaled height from JS. */
body > div:not([data-pencil-name]):not(.preloader):not(.hero-wrap):not(.showcase-host):not(.works-host):not(.journey-host):not(.footer-host):not(.header-host) { width: auto !important; height: auto !important; }
[data-pencil-name="Selected Work"] { display: none !important; }
[data-pencil-name^="12h"], [data-pencil-name^="12i"], [data-pencil-name^="12j"] {
  position: relative !important; left: auto !important; top: auto !important;
  background-color: var(--hero-bg) !important;
  background-image: radial-gradient(circle at 12px 12px, var(--hero-dot) 1.1px, transparent 1.7px) !important;
  background-size: 24px 24px !important;
}

/* Theme switch: a blurred disc that only scales, then only fades. */
.theme-disc {
  position: absolute; z-index: 900; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle closest-side, var(--disc) 50%, transparent 100%);
  transform: scale(0.02); will-change: transform, opacity; contain: strict;
}
html.theme-switching [data-pencil-name="Header"] { z-index: auto !important; }
html.theme-switching [data-pencil-name="Theme Cord"] { z-index: 1000 !important; }

/* Rope */
[data-pencil-name="Theme Cord"] { overflow: visible !important; z-index: 40 !important; }
[data-pencil-name="Theme Cord"] [data-pencil-name="Rope"] { visibility: hidden; }
.cord-svg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; transition: filter 0.3s ease; }
.cord-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cord-svg .rope-shadow { stroke: var(--rope-shadow); stroke-width: 5; }
.cord-svg .rope-body { stroke: var(--rope); stroke-width: 5.4; transition: stroke-width 0.25s ease; }
.cord-svg .rope-strand { stroke: var(--rope-ridge); stroke-width: 3; stroke-dasharray: 1.7 2.1; opacity: 0.85; }
.cord-svg .rope-strand.b { opacity: 0.45; }
.cord-svg .rope-shine { stroke: var(--rope-shine); stroke-width: 1; }
[data-pencil-name="Theme Cord"]:has(.rope-grab:hover) .rope-body,
.is-grabbing .rope-body { stroke-width: 6.2; }
.is-armed .cord-svg { filter: drop-shadow(0 0 6px var(--glow)); }

.rope-grab { position: absolute; z-index: 3; border-radius: 18px; cursor: grab; touch-action: none; outline: none; will-change: transform; }
.is-grabbing .rope-grab { cursor: grabbing; }
.rope-grab:focus-visible { box-shadow: 0 0 0 2px #C9F24D; }

.cord-tip {
  position: absolute; right: 36px; white-space: nowrap;
  font: 500 10px/1 "Geist Mono", ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 8px; border-radius: 6px; background: var(--tip-bg); color: var(--tip-fg);
  opacity: 0; transform: translateX(6px); pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(.2, .9, .3, 1.3);
}
[data-pencil-name="Theme Cord"]:has(.rope-grab:hover) .cord-tip, .rope-grab:focus-visible ~ .cord-tip { opacity: 1; transform: none; }
.is-grabbing .cord-tip, .is-pulled .cord-tip { opacity: 0 !important; }

/* pen.dev keeps the avatar's illustration shader live; the export ships the raw cutout, so swap in the baked render. */
[data-pencil-name="Avatar"] { background-image: url('/images/avatar-stylized.png') !important; background-size: 100% 100% !important; }
