/* ==========================================================================
   Reporthink Template Editor
   Paper on a dark desk: A4 pages with real shadows, an emerald accent for the
   editor's own UI, and the template's palette inside the page.
   ========================================================================== */

.theme-rpt {
  --accent: #34d399;
  --accent-2: #6ee7b7;
  --paper-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 12px 24px -8px rgba(0, 0, 0, 0.5), 0 50px 90px -30px rgba(0, 0, 0, 0.75);
}

.theme-rpt ::selection {
  background: rgba(52, 211, 153, 0.4);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.rp-hero {
  position: relative;
  padding-top: calc(var(--nav-h) + 56px);
  overflow: hidden;
  isolation: isolate;
}

.rp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(45% 50% at 80% 55%, rgba(52, 211, 153, 0.14), transparent 70%),
    radial-gradient(30% 40% at 20% 90%, rgba(241, 90, 36, 0.08), transparent 70%);
}

/* A drafting-table grid, barely there. */
.rp-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(70% 60% at 70% 50%, #000, transparent 75%);
  mask-image: radial-gradient(70% 60% at 70% 50%, #000, transparent 75%);
}

.rp-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  margin-top: 36px;
}

.rp-hero h1 {
  margin-top: 22px;
  font-size: clamp(44px, 5.2vw, 76px);
  font-weight: 650;
  letter-spacing: -0.052em;
  line-height: 0.96;
}

.rp-hero h1 span {
  display: block;
  color: var(--fg-3);
}

.rp-promise {
  margin-top: 22px;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.rp-promise .dim {
  color: rgba(255, 255, 255, 0.42);
}

.rp-hero .lead {
  margin-top: 20px;
  max-width: 540px;
}

.rp-hero .btn-row {
  margin-top: 30px;
}

.rp-hero__art {
  position: relative;
  padding: 20px 0 40px;
}

.rp-hero__art .browser {
  transform: perspective(2000px) rotateY(-9deg) rotateX(4deg);
  transform-origin: 0 50%;
  transition: transform 1.2s var(--ease-out);
}

.rp-hero__art:hover .browser {
  transform: perspective(2000px) rotateY(-3deg) rotateX(1deg);
}

.rp-float {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  animation: rp-bob 6s var(--ease-in-out) infinite;
}

.rp-float .i {
  font-size: 16px;
  color: var(--accent);
}

.rp-float--pdf {
  right: -2%;
  top: 4%;
}

.rp-float--saved {
  left: -4%;
  bottom: 10%;
  animation-delay: -2.5s;
}

@keyframes rp-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (max-width: 900px) {
  .rp-hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rp-float--saved {
    left: 2%;
  }

  .rp-float--pdf {
    right: 2%;
  }
}

/* ── Before / after ──────────────────────────────────────────────────────── */

.rp-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(48px, 6vw, 80px);
}

.rp-duo .card {
  padding: clamp(24px, 3vw, 36px);
}

.rp-duo__tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.rp-duo .card:last-child {
  border-color: rgba(52, 211, 153, 0.28);
  background:
    radial-gradient(80% 100% at 100% 0%, rgba(52, 211, 153, 0.12), transparent 60%),
    var(--surface);
}

.rp-duo .card:last-child .rp-duo__tag {
  color: var(--accent-2);
}

.rp-duo h3 {
  margin-top: 16px;
  font-size: clamp(21px, 2vw, 26px);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.rp-duo p {
  margin-top: 12px;
  color: var(--fg-2);
  line-height: 1.6;
}

.rp-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
}

.rp-flow span {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.rp-flow .is-dead {
  color: #ff8f8f;
  border-color: rgba(255, 107, 107, 0.35);
  text-decoration: line-through;
}

.rp-flow .is-new {
  color: var(--accent-2);
  border-color: rgba(52, 211, 153, 0.4);
}

@media (max-width: 860px) {
  .rp-duo {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── The editor ──────────────────────────────────────────────────────────── */

.desk {
  /* The template palette. The page and the thumbnails both read these, so a
     swatch recolours everything at once. */
  --pg: #4a3f38;
  --c1: #f15a24;
  --c2: #f7c331;
  --c3: #8cc63f;
  --ink: #ffffff;
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: #16171b;
  border: 1px solid var(--line-2);
  box-shadow: 0 60px 120px -60px rgba(0, 0, 0, 0.9);
}

.desk__panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: #1c1d22;
  border-right: 1px solid var(--line);
}

.desk__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}

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

.swatch {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-radius: 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-2);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: border-color 0.25s, background-color 0.25s, color 0.25s;
}

.swatch__chips {
  display: flex;
}

.swatch__chips i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: -4px;
  box-shadow: 0 0 0 2px #1c1d22;
}

.swatch:hover {
  color: var(--fg);
  border-color: var(--line-2);
}

.swatch[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--accent);
  background: rgba(52, 211, 153, 0.08);
}

.tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.tool {
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-2);
  transition: background-color 0.2s, color 0.2s;
}

.tool .i {
  font-size: 15px;
}

.tool:hover:not([aria-disabled="true"]) {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.07);
}

.tool[aria-pressed="true"] {
  color: #062a1c;
  background: var(--accent);
}

.tool[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
}

.tools__hint {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--fg-3);
}

.desk__export {
  position: relative;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #06281b;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.4s var(--ease-out), filter 0.2s;
}

.desk__export:hover {
  filter: brightness(1.08);
}

.desk__export:active {
  transform: scale(0.97);
}

.desk__export .i {
  font-size: 17px;
}

.desk__export.is-done {
  background: #fff;
  color: #0b0c0f;
}

.desk__main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(60% 60% at 50% 40%, rgba(255, 255, 255, 0.035), transparent 70%),
    #121316;
}

.desk__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--fg-2);
}

.desk__bar b {
  color: var(--fg);
  font-weight: 600;
}

.desk__saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-3);
  transition: color 0.3s;
}

.desk__saved.is-saving {
  color: var(--accent-2);
}

.desk__canvas {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 36px);
  min-height: 560px;
}

/* The page itself: an A4 sheet whose colours are all variables. */
.a4 {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  background: var(--pg);
  color: var(--ink);
  box-shadow: var(--paper-shadow);
  font-family: "Montserrat", var(--font-sans);
  transition: background-color 0.6s var(--ease-out), transform 0.8s var(--ease-out), opacity 0.6s;
  container-type: inline-size;
}

.a4 * {
  transition: background-color 0.6s var(--ease-out), color 0.6s var(--ease-out), border-color 0.6s;
}

.a4__page {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(var(--from, 6%));
  transition: opacity 0.45s var(--ease-out), transform 0.6s var(--ease-out), visibility 0s linear 0.45s;
}

.a4__page.is-current {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.45s var(--ease-out), transform 0.6s var(--ease-out);
}

[contenteditable] {
  outline: none;
  border-radius: 3px;
  cursor: text;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.2s, background-color 0.2s !important;
}

[contenteditable]:hover {
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}

[contenteditable]:focus {
  box-shadow: 0 0 0 2px #34d399;
  background: rgba(52, 211, 153, 0.08);
}

.is-b { font-weight: 800 !important; }
.no-b { font-weight: 500 !important; }
.is-i { font-style: italic; }

/* The block the toolbar will act on, once focus has moved to the toolbar. */
.a4 .is-target:not(:focus) {
  box-shadow: 0 0 0 1.5px rgba(52, 211, 153, 0.6);
}
.a4 .al-left { text-align: left; }
.a4 .al-center { text-align: center; }
.a4 .al-right { text-align: right; }

/* Cover */
.cv__shapes {
  position: absolute;
  left: 0;
  top: 0;
  width: 32%;
  height: 58%;
}

.cv__shapes::before,
.cv__shapes::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--c1);
}

.cv__shapes::before {
  top: 0;
  border-radius: 0 0 100% 0 / 0 0 100% 0;
}

.cv__shapes::after {
  bottom: 0;
  border-radius: 0 100% 0 0 / 0 100% 0 0;
}

.cv__logo {
  position: absolute;
  left: 7%;
  top: 4%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 1cqw;
  width: 18%;
  font-size: 3cqw;
  line-height: 1.1;
  text-align: center;
  color: #fff;
}

.cv__logo i {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d9d9d9;
}

.cv__photo {
  position: absolute;
  right: 0;
  top: 0;
  width: 68%;
  height: 58%;
  overflow: hidden;
  background: #2c2622;
}

.cv__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s;
}

.cv__drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 30, 22, 0.55);
  border: 2px dashed rgba(110, 231, 183, 0.8);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.25s;
}

.cv__drop .i {
  font-size: 22px;
}

.cv__photo:hover .cv__drop,
.cv__photo.is-drag .cv__drop,
.cv__drop:focus-visible {
  opacity: 1;
}

.cv__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  padding: 5% 7% 0;
}

.cv__kicker {
  font-size: 4.2cqw;
  font-weight: 700;
  color: var(--c3);
}

.cv__years {
  position: absolute;
  right: 7%;
  top: 6%;
  font-size: 7.2cqw;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  color: var(--c3);
}

.cv__title {
  margin-top: 2.5%;
  max-width: 78%;
  font-size: 6.2cqw;
  font-weight: 800;
  line-height: 1.02;
  text-transform: uppercase;
  color: var(--c2);
}

.cv__text {
  margin-top: 3.5%;
  max-width: 56%;
  font-family: var(--font-sans);
  font-size: 2.3cqw;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.8);
}

.cv__pie {
  position: absolute;
  right: -8%;
  bottom: -18%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 270deg, transparent 0 25%, var(--c2) 25% 100%);
}

.cv__dots {
  position: absolute;
  left: 7%;
  bottom: 3.2%;
  width: 30%;
  height: 5.4%;
  background-image: radial-gradient(circle, var(--c3) 32%, transparent 36%);
  background-size: 10% 50%;
  opacity: 0.85;
}

/* Highlights */
.hl {
  padding: 9% 8%;
}

.hl__n {
  font-size: 22cqw;
  font-weight: 800;
  line-height: 0.9;
  color: var(--c1);
}

.hl__title {
  margin-top: 3%;
  font-size: 7cqw;
  font-weight: 800;
  line-height: 1.05;
  color: var(--c2);
}

.hl__rule {
  width: 22%;
  height: 1.2cqw;
  margin: 6% 0;
  background: var(--c3);
}

.hl__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5cqw 4cqw;
}

.hl__stats b {
  display: block;
  font-size: 10cqw;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.hl__stats span {
  display: block;
  margin-top: 1.5cqw;
  font-family: var(--font-sans);
  font-size: 2.6cqw;
  color: rgba(255, 255, 255, 0.72);
}

.hl__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9%;
  background: linear-gradient(90deg, var(--c1) 0 40%, var(--c2) 40% 72%, var(--c3) 72%);
}

/* Message */
.msg {
  padding: 9% 8%;
}

.msg__head {
  display: flex;
  align-items: center;
  gap: 5cqw;
}

.msg__face {
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #d9d0c7 0 22%, transparent 23%), radial-gradient(circle at 50% 110%, #d9d0c7 0 45%, transparent 46%), var(--c1);
  flex-shrink: 0;
}

.msg__title {
  font-size: 6.4cqw;
  font-weight: 800;
  line-height: 1.05;
  color: var(--c2);
}

.msg__lines {
  display: grid;
  gap: 2.4cqw;
  margin-top: 9%;
}

.msg__lines i {
  height: 1.8cqw;
  border-radius: 2cqw;
  background: rgba(255, 255, 255, 0.22);
}

.msg__lines i:nth-child(4n) {
  width: 62%;
}

.msg__sign {
  position: absolute;
  left: 8%;
  bottom: 8%;
  font-family: var(--font-sans);
  font-size: 3cqw;
  color: var(--c3);
}

/* Thank you */
.ty {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 10%;
  text-align: center;
}

.ty__big,
.ty__sub {
  position: relative;
}

.ty__big {
  font-size: 15cqw;
  font-weight: 800;
  line-height: 0.95;
  color: var(--c2);
}

.ty__sub {
  margin-top: 6%;
  font-family: var(--font-sans);
  font-size: 3cqw;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
}

.ty__ring {
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3cqw solid var(--c1);
  opacity: 0.35;
  top: -18%;
  right: -22%;
}

.ty__ring--2 {
  top: auto;
  right: auto;
  bottom: -26%;
  left: -24%;
  border-color: var(--c3);
}

/* Page strip with drag-to-reorder */
.strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.thumb {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 78px;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.thumb.is-dragging {
  z-index: 5;
  cursor: grabbing;
  transition: none !important;
}

.thumb__page {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  border-radius: 4px;
  overflow: hidden;
  background: var(--thumb-bg, #4a3f38);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7);
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.25s, transform 0.3s var(--ease-out);
}

.thumb.is-current .thumb__page {
  outline-color: var(--accent);
}

.thumb.is-dragging .thumb__page {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.8);
}

.thumb__page svg {
  width: 100%;
  height: 100%;
}

.thumb__page .tb { fill: var(--pg); }
.thumb__page .t1 { fill: var(--c1); }
.thumb__page .t2 { fill: var(--c2); }
.thumb__page .t3 { fill: var(--c3); }
.thumb__page .tw { fill: rgba(255, 255, 255, 0.55); }
.thumb__page .tp { fill: #5f7a4a; }

.thumb__page rect,
.thumb__page circle,
.thumb__page path {
  transition: fill 0.6s var(--ease-out);
}

.thumb__name {
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
}

.thumb.is-current .thumb__name {
  color: var(--fg);
}

.thumb__move {
  position: absolute;
  top: -6px;
  display: none;
  gap: 2px;
}

.thumb:focus-within .thumb__move {
  display: flex;
}

.thumb__move button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #2a2b31;
  border: 1px solid var(--line-2);
  color: var(--fg);
}

.thumb__move .i {
  font-size: 12px;
}

.thumb__hit {
  position: absolute;
  inset: 0;
  border-radius: 6px;
}

/* The export flight */
.fly {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  box-shadow: var(--paper-shadow);
  transform-origin: 0 0;
}

@media (max-width: 860px) {
  .desk {
    grid-template-columns: minmax(0, 1fr);
  }

  .desk__panel {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .swatches {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .desk__canvas {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .swatches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strip {
    gap: 8px;
    padding-inline: 10px;
  }

  .thumb {
    width: 62px;
  }
}

/* ── Annotated editor ────────────────────────────────────────────────────── */

.anno {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}

.anno__shot {
  position: relative;
}

.anno__img {
  position: relative;
}

.hotspot {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: #06281b;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.25), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(52, 211, 153, 0.6);
  animation: ping 2.6s var(--ease-out) infinite;
}

@media (max-width: 600px) {
  .hotspot {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    font-size: 11px;
  }
}

.hotspot:hover,
.hotspot.is-active {
  transform: scale(1.15);
  box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.35), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
}

.anno__list {
  display: grid;
  gap: 4px;
}

.anno__item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 14px;
  border-radius: 16px;
  text-align: left;
  transition: background-color 0.3s;
}

.anno__item:hover,
.anno__item.is-active {
  background: rgba(255, 255, 255, 0.04);
}

.anno__n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  transition: background-color 0.3s, color 0.3s;
}

.anno__item.is-active .anno__n {
  background: var(--accent);
  color: #06281b;
}

.anno__item h3 {
  font-size: 16px;
  letter-spacing: -0.015em;
}

.anno__item p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-2);
}

@media (max-width: 960px) {
  .anno {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── ERD ─────────────────────────────────────────────────────────────────── */

.erd {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 46px 56px;
  align-items: start;
  padding: clamp(22px, 3vw, 36px);
  border-radius: var(--r-l);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.5px) 0 0 / 18px 18px,
    #17181c;
  border: 1px solid var(--line-2);
}

.erd__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.erd__svg path {
  fill: none;
  stroke: rgba(52, 211, 153, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  animation: rp-march 1.6s linear infinite;
}

@keyframes rp-march {
  to {
    stroke-dashoffset: -20;
  }
}

.erd__svg text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--accent-2);
  stroke: none;
}

.entity {
  position: relative;
  z-index: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #1f2025;
  border: 1px solid var(--line-2);
  box-shadow: 0 16px 30px -18px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono);
  font-size: 12px;
}

.entity__name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--fg);
  background: rgba(52, 211, 153, 0.1);
  border-bottom: 1px solid var(--line-2);
}

.entity__name span {
  color: var(--fg-3);
  font-weight: 400;
}

.entity ul {
  padding: 8px 14px 12px;
}

.entity li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  color: var(--fg-2);
}

.entity li em {
  font-style: normal;
  color: var(--fg-3);
}

.entity li b {
  font-weight: 500;
  color: #fbbf24;
}

.entity--master .entity__name {
  background: rgba(241, 90, 36, 0.12);
}

@media (max-width: 640px) {
  .erd {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .erd__svg {
    display: none;
  }
}

.rp-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--fg-3);
}

/* ── Gallery ─────────────────────────────────────────────────────────────── */

.rp-gallery {
  padding-inline: max(var(--gutter), calc((100vw - var(--maxw)) / 2));
  scroll-padding-inline: max(var(--gutter), calc((100vw - var(--maxw)) / 2));
}

.rp-gallery figure {
  width: min(78vw, 760px);
}

.rp-gallery .browser {
  cursor: zoom-in;
}

.rail-controls .icon-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.rp-gallery figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--fg-3);
}

.rp-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(80% 140% at 0% 50%, rgba(52, 211, 153, 0.12), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
}

.rp-callout b {
  font-size: clamp(56px, 7vw, 96px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rp-callout h3 {
  font-size: clamp(20px, 2vw, 26px);
  letter-spacing: -0.03em;
}

.rp-callout p {
  margin-top: 8px;
  color: var(--fg-2);
  line-height: 1.6;
}

@media (max-width: 560px) {
  .rp-callout {
    grid-template-columns: minmax(0, 1fr);
  }
}
