/* Page builder — matches profile.html spacing, type scale, and components */

:root {
  --bg-deep: #0a0b0d;
  --bg-elevated: #12141a;
  --bg-card: rgba(18, 20, 26, 0.82);
  --stroke: rgba(255, 255, 255, 0.09);
  --text: #e6e8ed;
  --muted: #8b909c;
  --accent: #6d8fc4;
  --accent-muted: rgba(109, 143, 196, 0.22);
  --font: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.pb-page {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  background-image: linear-gradient(180deg, #0f1116 0%, var(--bg-deep) 38%, #08090c 100%);
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.68;
  overflow-x: hidden;
}

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: paint;
}
.bg-mesh {
  position: absolute;
  inset: 0;
  transform: translateZ(0);
  background:
    radial-gradient(ellipse 100% 80% at 50% -20%, rgba(109, 143, 196, 0.07), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 50%, rgba(255, 255, 255, 0.02), transparent 50%);
}
.bg-dots {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.5) 1px, transparent 1.4px);
  background-size: 24px 24px;
}
.bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 35%, black 15%, transparent 75%);
}
.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 65% at 50% 45%, transparent 0%, rgba(5, 6, 9, 0.5) 100%);
  pointer-events: none;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.028;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

header {
  padding: 2.25rem 0 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--font);
  font-weight: 700;
  font-size: 2.35rem;
  letter-spacing: -0.02em;
}
.logo span {
  color: var(--accent);
  font-weight: 600;
}

nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  padding: 0.4rem 0;
  transition: color 0.25s var(--ease);
}
nav a:hover {
  color: var(--text);
}

body.pb-page > .wrap > section {
  margin-bottom: 4.5rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.section-head h2 {
  font-family: var(--font);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 36rem;
}

.section-head-aside {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category {
  margin-bottom: 2.5rem;
}

.category-label {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.pb-hint {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pb-field > .pb-hint:last-child {
  margin-bottom: 0;
}
.pb-hint code {
  font-size: 0.85em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--stroke);
}

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

.pb-layout {
  display: grid;
  gap: 2rem 2.75rem;
  align-items: start;
}

.pb-col {
  min-width: 0;
}

@media (min-width: 900px) {
  .pb-layout {
    /* Give the form column enough width so fields do not collapse */
    grid-template-columns: minmax(380px, 1.12fr) minmax(300px, 0.88fr);
  }
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  padding: 1.5rem 1.65rem;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.card.pb-preview-card:hover {
  transform: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

/* Image row: one column by default; two columns only when the *form column* is wide enough */
.pb-col:first-child {
  container-type: inline-size;
  container-name: pbform;
}

.pb-images {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  margin-top: 0.35rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--stroke);
}

.pb-images > .pb-field {
  min-width: 0;
}

@container pbform (min-width: 520px) {
  .pb-images {
    grid-template-columns: 1fr 1fr;
  }
}

.pb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pb-toolbar .category-label {
  margin-bottom: 0;
}

.category > .pb-hint:first-of-type {
  margin-top: 0;
  margin-bottom: 1rem;
}

.pb-preview-card .case-label {
  display: block;
  margin-bottom: 0.85rem;
}

/* Form controls — same rhythm as profile copy blocks */
.pb-field {
  margin-bottom: 1.15rem;
}
.pb-field:last-child {
  margin-bottom: 0;
}

.case-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.pb-field input[type="text"],
.pb-field input[type="url"],
.pb-field textarea,
.pb-field select,
.pb-field input[type="file"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
}

.pb-field input[type="file"] {
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.pb-field textarea {
  min-height: 6.5rem;
  resize: vertical;
}

#field-title,
#field-description {
  padding-left: 1.15rem;
  padding-right: 1rem;
}

.pb-field input:focus-visible,
.pb-field textarea:focus-visible,
.pb-field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pb-colors {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) {
  .pb-colors {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pb-color-field .case-label {
  margin-bottom: 0.3rem;
}

.pb-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pb-row-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.pb-row-head .pb-spacer {
  flex: 1;
}

.pb-drag {
  cursor: grab;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  user-select: none;
  padding: 0.25rem 0.35rem;
  touch-action: none;
}
.pb-drag:active {
  cursor: grabbing;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-pill:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.btn-remove {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-remove:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.pb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--accent);
  color: #0a0b0d;
  box-shadow: none;
}
.btn-primary:not(:disabled):hover {
  background: #7c9ed0;
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}
.btn-ghost:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.pb-iframe {
  width: 100%;
  min-height: min(48vh, 480px);
  max-height: min(70vh, 720px);
  border: 0;
  border-radius: 10px;
  background: #fff;
  display: block;
}

.pb-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.65;
}
.pb-status.ok {
  color: #9dcda3;
}

.pb-col-preview {
  position: sticky;
  top: 1rem;
}
@media (max-width: 899px) {
  .pb-col-preview {
    position: static;
  }
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  body.pb-page {
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
  }
  .card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(18, 20, 26, 0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .btn:hover,
  .card:hover {
    transform: none;
  }
}
