/* =============================================================
   PORTFOLIO — CSS
   Full-screen portfolio / personal website layer
   ============================================================= */

/* ---- Custom properties ---- */
:root {
  --p-accent:          #ffffff;
  --p-overlay-opacity: 0.35;
  --p-font-heading:    'Playfair Display', Georgia, serif;
  --p-font-body:       'Inter', system-ui, sans-serif;
  --p-transition:      0.35s ease;
  --p-panel-bg:        #111114;
  --p-panel-border:    rgba(255,255,255,0.08);
  --p-input-bg:        rgba(255,255,255,0.06);
  --p-input-border:    rgba(255,255,255,0.14);
}

/* ---- Reset & base ---- */
*, *::before, *::after {box-sizing: border-box;padding: 0;}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--p-font-body);
  color: #fff;
  background: #000;
}
/* Scrollable pages (layout pages, text pages) */
body.p-page-scrollable { overflow-y: auto; overflow-x: hidden; height: auto; }
/* html element must also allow scroll — otherwise it clips body */
html:has(body.p-page-scrollable) { overflow-y: auto; height: auto; }

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

/* =============================================================
   BACKGROUND LAYER
   ============================================================= */
#p-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
  overflow: hidden;
}

/* ---- Ken Burns Slideshow ---- */
.p-slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}
.p-slide.active { opacity: 1; }

.slide-inner {
  position: absolute;
  inset: -15%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* 6 Ken Burns animations */
@keyframes kb1 { 0%{transform:scale(1)    translate( 0%,  0%)} 100%{transform:scale(1.2)  translate(-4%,  3%)} }
@keyframes kb2 { 0%{transform:scale(1.2)  translate( 4%, -3%)} 100%{transform:scale(1)    translate(-2%,  1%)} }
@keyframes kb3 { 0%{transform:scale(1)    translate(-3%,  1%)} 100%{transform:scale(1.15) translate( 3%, -2%)} }
@keyframes kb4 { 0%{transform:scale(1.1)  translate( 1%,  3%)} 100%{transform:scale(1)    translate(-1%, -3%)} }
@keyframes kb5 { 0%{transform:scale(1)    translate( 2%, -2%)} 100%{transform:scale(1.2)  translate(-3%,  2%)} }
@keyframes kb6 { 0%{transform:scale(1.15) translate(-2%,  1%)} 100%{transform:scale(1)    translate( 2%, -1%)} }

/* ---- Static background ---- */
.p-static-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* ---- Video background ---- */
.p-bg-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* ---- Default (no bg set) ---- */
.p-default-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a2e 50%, #0d0d0d 100%);
}

/* ---- Overlay darkening ---- */
#p-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, var(--p-overlay-opacity));
  pointer-events: none;
  transition: background 0.4s;
}

/* =============================================================
   HEADER (persistent)
   ============================================================= */
#p-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 30px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
  pointer-events: none;
}
#p-header > * { pointer-events: auto; }

/* ---- Logo zone ---- */
.p-logo-zone { flex-shrink: 0; }

.p-logo-img {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}
.p-logo-text {
  font-family: var(--p-font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
}

/* ---- Nav zone ---- */
.p-nav-zone {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ---- Inline nav links ---- */
#p-nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  transition: opacity 0.2s;
}
#p-nav-links.p-nav-hidden { display: none !important; }

.p-nav-item { position: relative; }

.p-nav-link {
  display: block;
  color: rgba(255,255,255,0.85);
  font-family: var(--p-font-body);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  transition: color 0.2s;
  white-space: nowrap;
}
.p-nav-link:hover { color: #fff; }

/* sub-menu */
.p-sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  min-width: 170px;
  padding: 6px 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  pointer-events: none;
}
/* Transparent bridge fills the 8px gap so hover isn't lost when moving to sub-menu */
.p-nav-item::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 10px;
  background: transparent;
}
.p-nav-item:hover .p-sub-menu,
.p-nav-item:focus-within .p-sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.p-sub-link {
  display: block;
  color: rgba(255,255,255,0.7);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  transition: color 0.2s, background 0.2s;
}
.p-sub-link:hover { color: #fff; background: rgba(255,255,255,0.07); }

/* ---- Hamburger button ---- */
.p-hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
}
.p-hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.p-hamburger-btn.p-hbg-visible { display: flex; }

/* animate to X when menu open */
.p-hamburger-btn.p-hbg-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.p-hamburger-btn.p-hbg-open span:nth-child(2) { opacity: 0; }
.p-hamburger-btn.p-hbg-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .p-hamburger-btn { display: flex !important; }
  #p-nav-links     { display: none !important; }
}

/* =============================================================
   FULLSCREEN MENU OVERLAY
   ============================================================= */
#p-menu {
  position: fixed;
  inset: 0;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
#p-menu.p-menu-open {
  opacity: 1;
  visibility: visible;
}

#p-menu-bg {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  background-size: cover;
  background-position: center;
}
/* subtle vignette */
#p-menu-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.6) 100%);
}

.p-menu-close-btn {
  position: absolute;
  top: 22px; right: 26px;
  background: none; border: none;
  cursor: pointer;
  z-index: 2;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}
.p-menu-close-btn:hover { opacity: 1; transform: rotate(90deg); }
.p-menu-close-btn span {
  position: absolute;
  width: 28px; height: 2px;
  background: #fff; border-radius: 2px;
}
.p-menu-close-btn span:first-child { transform: rotate(45deg); }
.p-menu-close-btn span:last-child  { transform: rotate(-45deg); }

.p-menu-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  overflow-y: auto;
}

.p-menu-nav { text-align: center; }

.p-menu-links { list-style: none; }

.p-menu-item { overflow: hidden; }

.p-menu-link {
  display: block;
  font-family: var(--p-font-heading);
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.85);
  padding: 6px 0;
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1), opacity 0.5s ease,
              color 0.2s;
  transition-delay: calc(var(--i,0) * 60ms);
}
#p-menu.p-menu-open .p-menu-link {
  transform: translateY(0);
  opacity: 0.85;
}
.p-menu-link:hover { color: #fff; opacity: 1 !important; }

/* sub-links in fullscreen menu */
.p-menu-sub-links {
  list-style: none;
  margin: 0 0 14px;
}
.p-menu-sub-link {
  display: inline-block;
  font-family: var(--p-font-body);
  font-size: clamp(0.8rem, 2.2vw, 1.1rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 3px 10px;
  transition: color 0.2s;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1), opacity 0.4s ease,
              color 0.2s;
  transition-delay: calc(var(--i,0) * 60ms + 80ms);
}
#p-menu.p-menu-open .p-menu-sub-link {
  transform: translateY(0);
  opacity: 1;
}
.p-menu-sub-link:hover { color: rgba(255,255,255,0.85); }
.p-menu-sub-sep { color: rgba(255,255,255,0.15); font-size: 0.7rem; }

/* =============================================================
   MAIN CONTENT (hero / center)
   ============================================================= */
#p-main {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#p-main > * { pointer-events: auto; }

.p-hero {
  text-align: center;
  padding: 20px;
}
.p-hero-title {
  font-family: var(--p-font-heading);
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-bottom: 14px;
  text-shadow: 0 2px 24px rgba(0,0,0,0.4);
}
.p-hero-tagline {
  font-family: var(--p-font-body);
  font-size: clamp(0.85rem, 2.5vw, 1.2rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 12px rgba(0,0,0,0.5);
}

/* =============================================================
   FOOTER (persistent)
   ============================================================= */
#p-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  padding: 0 30px 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 100%);
  pointer-events: none;
}
#p-footer > * { pointer-events: auto; }

/* ---- Copyright (left) ---- */
.p-copyright-zone {
  justify-self: start;
  color: rgba(255,255,255,0.38);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  font-family: var(--p-font-body);
  max-width: 220px;
  line-height: 1.4;
}

/* ---- Universe button (center) ---- */
.p-footer-center {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.p-universe-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--p-font-body);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.55);
  padding: 9px 22px;
  border-radius: 30px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(255,255,255,0.07);
  transition: background 0.3s, border-color 0.3s, transform 0.2s;
  white-space: nowrap;
}
.p-universe-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.9);
  transform: translateY(-1px);
}
.p-universe-btn svg { flex-shrink: 0; }

/* ---- Social icons (right) ---- */
.p-footer-right {
  justify-self: end;
  display: flex;
  align-items: center;
}

.p-social-links {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.p-social-link {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s, transform 0.2s;
}
.p-social-link:hover { color: #fff; transform: scale(1.18) translateY(-1px); }
.p-social-link svg   { width: 19px; height: 19px; display: block; }

/* ---- Mobile footer ---- */
@media (max-width: 768px) {
  #p-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px 20px;
    gap: 10px;
  }
  .p-footer-center  { order: 1; }
  .p-footer-right   { order: 2; justify-self: unset; }
  .p-social-links   { justify-content: center; }
  .p-copyright-zone { order: 3; text-align: center; max-width: 100%; font-size: 0.65rem; }
}

/* =============================================================
   EDIT TOGGLE BUTTON
   ============================================================= */
.p-edit-toggle-btn {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.8);
  padding: 5px 14px 5px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.p-edit-toggle-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

/* =============================================================
   EDIT PANEL
   ============================================================= */
.p-edit-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
  background: var(--p-panel-bg);
  border-left: 1px solid var(--p-panel-border);
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}
.p-edit-panel.p-panel-open { transform: translateX(0); }

@media (max-width: 480px) {
  .p-edit-panel { width: 100%; border-left: none; }
}

.p-edit-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Panel header */
.p-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--p-panel-border);
  flex-shrink: 0;
}
.p-panel-header h2 {
  font-family: var(--p-font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.p-panel-close-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.5);
  font-size: 1.4rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.p-panel-close-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Panel tabs */
.p-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--p-panel-border);
  flex-shrink: 0;
}
.p-tab-btn {
  flex: 1;
  background: none; border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  font-family: var(--p-font-body);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.p-tab-btn:hover { color: rgba(255,255,255,0.7); }
.p-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--p-accent);
}

/* Tab content */
.p-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.p-tab-content.hidden { display: none; }

/* ---- Form elements ---- */
.p-field-group {
  margin-bottom: 16px;
}
.p-field-group label, .p-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 7px;
}
.p-text-input {
  width: 100%;
  background: var(--p-input-bg);
  border: 1px solid var(--p-input-border);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-family: var(--p-font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.p-text-input:focus { border-color: rgba(255,255,255,0.35); }
.p-text-input::placeholder { color: rgba(255,255,255,0.2); }

.p-select {
  width: 100%;
  background: var(--p-input-bg);
  border: 1px solid var(--p-input-border);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-family: var(--p-font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.p-select:focus { border-color: rgba(255,255,255,0.35); }
.p-select option { background: #1a1a1e; }

.p-radio-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.p-radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
}
.p-radio-group input[type=radio] { accent-color: var(--p-accent); }

input[type=color] {
  width: 48px; height: 32px;
  border: 1px solid var(--p-input-border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
}
input[type=range] {
  width: 100%;
  accent-color: var(--p-accent);
}

/* ---- Upload / action buttons ---- */
.p-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.p-upload-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

.p-save-btn {
  width: 100%;
  margin-top: 8px;
  background: var(--p-accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-family: var(--p-font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.p-save-btn:hover { opacity: 0.85; transform: translateY(-1px); }

.p-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.2s, color 0.2s;
}
.p-add-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

.p-divider { border: none; border-top: 1px solid var(--p-panel-border); margin: 18px 0; }

/* ---- Slides list ---- */
.p-slides-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.p-slide-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: #1a1a1e;
  cursor: grab;
}
.p-slide-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.p-slide-thumb .p-slide-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.p-slide-thumb:hover .p-slide-del { opacity: 1; }

/* ---- BG sections ---- */
.p-bg-section { margin-top: 12px; }
.p-bg-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  background: #1a1a1e;
  border: 1px solid var(--p-panel-border);
  overflow: hidden;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.2);
  font-size: 0.75rem;
}
.p-bg-preview img, .p-bg-preview video {
  width: 100%; height: 100%; object-fit: cover;
}

/* ---- Social links list ---- */
.p-social-item {
  display: grid;
  grid-template-columns: 110px 1fr 28px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.p-social-item .p-select { padding: 7px 10px; font-size: 0.8rem; }
.p-social-item .p-text-input { padding: 7px 10px; font-size: 0.8rem; }
.p-social-del-btn {
  background: none; border: none;
  cursor: pointer; color: rgba(255,255,255,0.3);
  font-size: 1.1rem; padding: 4px;
  transition: color 0.2s;
  text-align: center;
}
.p-social-del-btn:hover { color: #f87171; }

/* ---- Pages list ---- */
.p-page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  margin-bottom: 6px;
}
.p-page-item.p-page-child { margin-left: 16px; opacity: 0.85; }
.p-page-item-title {
  flex: 1;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-page-item-slug {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}
.p-page-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 0.75rem; color: rgba(255,255,255,0.35);
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s;
}
.p-page-toggle:hover { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.25); }
.p-page-toggle.published { color: #6ee7b7; border-color: rgba(110,231,183,0.3); }
.p-page-del-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.25);
  font-size: 1rem;
  padding: 4px;
  transition: color 0.2s;
}
.p-page-del-btn:hover { color: #f87171; }

/* Add-page row */
.p-add-page-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.p-add-page-row .p-text-input,
.p-add-page-row .p-select { padding: 7px 10px; font-size: 0.82rem; }
.p-add-page-row .p-add-btn { flex-shrink: 0; padding: 7px 12px; margin: 0; }

/* Page list items — drag handle */
.p-page-item {
  cursor: default;
}
.p-page-drag-handle {
  cursor: grab;
  color: rgba(255,255,255,0.2);
  font-size: 0.9rem;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}
.p-page-drag-handle:active { cursor: grabbing; }
.p-page-item.dragging {
  opacity: 0.4;
}
.p-page-item.drag-over-top {
  border-top: 2px solid rgba(255,255,255,0.4);
}
.p-page-item.drag-over-bottom {
  border-bottom: 2px solid rgba(255,255,255,0.4);
}
.p-page-item.drag-over-child {
  outline: 2px dashed var(--p-accent, #fff);
  outline-offset: 2px;
  border-radius: 6px;
}
.p-page-item.drag-over-child::after {
  content: '↳ make subpage';
  font-size: 0.68rem;
  color: var(--p-accent, #fff);
  opacity: 0.8;
  margin-left: auto;
  padding-right: 6px;
}

/* logo options */
.p-logo-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.p-or {
  color: rgba(255,255,255,0.3);
  font-size: 0.75rem;
}
.p-btn-sm { padding: 6px 12px; font-size: 0.75rem; }

/* utility */
.hidden { display: none !important; }
.p-saving { opacity: 0.6; pointer-events: none; }

/* =============================================================
   PAGE TEMPLATE (scrollable content pages)
   ============================================================= */
.p-page-content {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding: 120px 40px 120px;
  max-width: 860px;
  margin: 0 auto;
}
.p-page-title {
  font-family: var(--p-font-heading);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.15;
}
.p-page-tagline {
  font-family: var(--p-font-body);
  font-size: 1.05rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 28px;
  font-style: italic;
  line-height: 1.5;
}
.p-page-body {
  font-family: var(--p-font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: rgba(255,255,255,0.8);
}
.p-page-body p { margin-bottom: 1em; }
.p-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 40px;
  transition: color 0.2s;
}
.p-back-link:hover { color: rgba(255,255,255,0.8); }

/* =============================================================
   PAGE WITH LAYOUT — body override when pv-* layout is active
   The layout owns all backgrounds; portfolio bg is suppressed.
   ============================================================= */
body.p-has-layout {
  background: #000; /* fallback if layout has transparent page bg */
}
/* Header becomes transparent (no gradient) so layout bg shows behind it */
body.p-has-layout #p-header {
  background: transparent;
}
/* Footer also transparent so layout bg is visible edge-to-edge */
body.p-has-layout #p-footer {
  background: transparent;
}

/* =============================================================
   PAGE VIEW — layout renderer (pv-*)
   Used on /page/<slug> for server-rendered layouts
   ============================================================= */
.pv-page     { min-height: 100vh; position: relative; }
.pv-section  {position: relative;display: flex;flex-direction: column;padding-top: 80px;}
.pv-row      { display: flex; flex-direction: row;    flex: 1 0 0%; min-height: 0; }
.pv-col      { display: flex; flex-direction: column; flex: 1 0 0%; min-width: 0; }
.pv-cell     { position: relative; overflow: hidden; min-width: 0; display: flex; flex-direction: column; flex: 1 0 0%; }
.pv-cell-inner { position: relative; z-index: 4; padding: 0; flex: 1; min-width: 0; overflow: hidden; }
.pv-ov       { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.pv-img-ovl  { position: absolute; inset: 0; pointer-events: none; z-index: 2;
               background-size: cover; background-position: center; background-repeat: no-repeat; }
/* First section: top-edge cells (tagged pv-nav-cell) get nav clearance padding.
   Only cells at the very top edge of the first section receive this treatment —
   cells in lower rows of a vertically-split section keep normal 40px padding.
   Inline styles set by the editor/renderer take precedence; this is a fallback. */
.pv-page .pv-section:first-child .pv-nav-cell .pv-cell-inner { padding-top: 80px; }

/* ── Modern thin scrollbar for scroll-overflow cells ───────────────────────── */
.pv-cell-scrollable {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.pv-cell-scrollable::-webkit-scrollbar { width: 4px; height: 4px; }
.pv-cell-scrollable::-webkit-scrollbar-track { background: transparent; }
.pv-cell-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
}
.pv-cell-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.38);
}

/* ── Images & media inside cell-inner ──────────────────────────────────────── */
/* Primary sizing is set via inline styles by the editor (width as %, height:auto).
   max-width:100% here is a responsive safety net only — it prevents any image from
   overflowing its container on narrow viewports without imposing a height cap.
   The old max-height:60vh and object-fit:contain have been removed; those caused
   an invisible wall that fought the editor's inline resize controls. */
.pv-cell-inner img {
  max-width: 100%;
  height: auto;
  display: block;
}
/* Responsive YouTube / iframe wrapper injected by the inline editor */
.pv-cell-inner .pe-yt-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  margin: 8px 0;
}
.pv-cell-inner .pe-yt-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── Mobile responsive layout ──────────────────────────────────────────────
   At ≤768px: columns stack vertically, section heights collapse to content.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sections collapse to content height; only hero keeps viewport height */
  .pv-section {
    min-height: auto !important;
  }
  .pv-page .pv-section:first-child {
    min-height: 100vh;
  }

  /* Stack side-by-side columns vertically */
  .pv-row {
    flex-direction: column !important;
  }

  /* Full-width: override inline flex sizes from the layout engine */
  .pv-col,
  .pv-cell {
    flex: none !important;
    width: 100% !important;
    min-height: auto !important;
  }

  /* Mobile: don't force padding — inline styles from renderer take precedence.
     Nav clearance is still enforced on top-edge cells only. */
  .pv-page .pv-section:first-child .pv-nav-cell .pv-cell-inner {
    padding-top: 80px !important;
  }
}

/* Page edit button (admin) */
.p-page-edit-btn {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.p-page-edit-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Page content editor (inline) */
.p-inline-editor {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
}
.p-inline-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.p-inline-editor-title {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.p-inline-editor-save {
  background: #fff; color: #000;
  border: none; border-radius: 6px;
  padding: 7px 18px; font-size: 0.8rem;
  font-weight: 600; cursor: pointer;
  transition: opacity 0.2s;
}
.p-inline-editor-save:hover { opacity: 0.85; }
.p-inline-editor-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 1.4rem; cursor: pointer; padding: 2px 8px;
  transition: color 0.2s;
}
.p-inline-editor-close:hover { color: #fff; }
.p-inline-editor textarea {
  flex: 1;
  background: #0d0d0d;
  border: none;
  color: rgba(255,255,255,0.85);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  padding: 24px;
  resize: none;
  outline: none;
}

/* =============================================================
   TOAST NOTIFICATIONS
   ============================================================= */
.p-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.p-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =============================================================
   DRAG-OVER for slides reordering
   ============================================================= */
.p-slide-thumb.drag-over { outline: 2px dashed rgba(255,255,255,0.5); }

/* =============================================================
   LIGHTBOX
   ============================================================= */
.p-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(4px);
}
.p-lightbox.p-lb-open {
  opacity: 1;
  pointer-events: auto;
}
.p-lightbox-inner {
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 60px rgba(0,0,0,0.7);
  display: block;
  user-select: none;
}
.p-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  z-index: 1;
}
.p-lightbox-close:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Images with lightbox enabled: show a pointer cursor */
img[data-lightbox="true"] { cursor: zoom-in; }

/* =============================================================
   PAGE LAYOUT — header / footer clearance
   Ensure pv-page content is never hidden behind fixed header/footer.
   Values derived from: header (22px top + 22px bottom + ~40px logo = 84px)
   and footer (28px bottom + ~32px content = ~60px). JS re-measures on
   load and resize to keep these exact.
   ============================================================= */
.pv-page {
  /* padding-top:    var(--p-header-h, 84px); */
  padding-bottom: var(--p-footer-h, 60px);
}
/* First-section nav-cell no longer needs its own top padding —
   the page-level padding already provides header clearance.
   Override the old rule so it doesn't add extra space. */
.pv-page .pv-section:first-child .pv-nav-cell .pv-cell-inner { padding-top: 0; }
@media (max-width: 768px) {
  .pv-page .pv-section:first-child .pv-nav-cell .pv-cell-inner { padding-top: 0 !important; }
}
