/* ============================================================
   Project Detail Page Styles — j1.silva Portfolio
   ============================================================ */

body {
  background: var(--bg-dark);
  color: var(--ink-dark);
  font-family: var(--font-base);
  margin: 0; padding: 0;
  overflow-x: hidden;
}

/* ── Variables locais ── */
:root {
  --color-surface:    hsla(135, 7%, 89%, 0.1);
  --color-text:       #e2e6e3;
  --color-text-muted: rgba(226, 230, 227, 0.5);
  --sidebar-width:    390px;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-dark);
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(226,230,227,0.2) transparent;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 100;
  border-right: 1px solid rgba(226,230,227,0.06);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(226,230,227,0.2); border-radius: 2px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-header { display: flex; flex-direction: column; gap: 4px; }
.sidebar-logo { font-size: 14px; font-weight: 500; color: var(--color-text); }
.sidebar-datetime { font-size: 14px; font-weight: 400; color: var(--color-text-muted); }
.sidebar-section-label {
  font-size: 12px; color: var(--color-text-muted);
  margin: 0 0 8px; font-weight: 400;
}

.sidebar-search { margin-bottom: 8px; }
.sidebar-search-input {
  width: 100%; background: var(--color-surface);
  border: none; outline: none;
  border-radius: var(--card-radius);
  padding: 8px 12px;
  font-size: 13px; font-family: var(--font-base);
  color: var(--color-text);
}
.sidebar-search-input::placeholder { color: var(--color-text-muted); }
.sidebar-search-input:focus { background: rgba(226,230,227,0.15); }

.project-list { display: flex; flex-direction: column; gap: 0; }
.project-item {
  display: block;
  padding: 8px 0;
  text-decoration: none; color: var(--color-text);
  opacity: 0.55;
  transition: opacity 0.2s;
  font-size: 14px; font-weight: 400;
}
.project-item:hover { opacity: 1; }
.project-item.active { opacity: 1; font-weight: 500; }

.project-name {
  font-size: 14px; color: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}

/* ── CONTENT AREA ── */
.content {
  margin-left: var(--sidebar-width);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── BLOCK HEADER ── */
.block-header {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: flex-end;
}
.header-left {
  padding: 20px;
  display: flex; flex-direction: column;
  justify-content: flex-end; gap: 0;
  max-width: 720px;
}
.header-left h1 {
  font-size: 24px; font-weight: 500;
  line-height: 1.2; color: var(--color-text);
  margin: 0 0 20px;
}
.header-left p {
  font-size: 15px; font-weight: 400;
  line-height: 24px; color: var(--color-text);
  margin: 0 0 12px; transition: color 0.5s;
}
.header-left p:last-of-type { margin-bottom: 20px; }

.scope-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.scope-tag {
  font-size: 13px; font-weight: 400; line-height: 18px;
  color: var(--color-text);
  padding: 4px 8px;
  border: 1px solid var(--color-text-muted);
  border-radius: 20px;
}

/* header-right hidden — credits only in footer block */
.header-right { display: none; }

/* ── BLOCK A — full media ── */
.block-full-media {
  width: 100%; border-radius: var(--card-radius);
  overflow: hidden; position: relative;
}
.block-full-media[data-ratio="wide"]     { aspect-ratio: 16 / 9; }
.block-full-media[data-ratio="classic"]  { aspect-ratio: 3 / 2; }
.block-full-media[data-ratio="square"]   { aspect-ratio: 1 / 1; }
.block-full-media[data-ratio="portrait"] { aspect-ratio: 3 / 4; }
.block-full-media img, .block-full-media video {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: opacity 0.5s;
}
.block-full-media:hover img, .block-full-media:hover video { opacity: 0.85; }
.block-full-media .caption {
  font-size: 12px; line-height: 16px; color: var(--color-text-muted);
  margin-top: 6px; padding: 0 4px;
  position: absolute; bottom: -22px; left: 0;
}

.video-mock {
  width: 100%; height: 100%; background: #111;
  display: flex; align-items: center; justify-content: center;
  position: absolute; inset: 0;
}
.video-label {
  font-size: 14px; font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  font-family: var(--font-base);
}

/* ── BLOCK B — dual media ── */
.block-dual-media { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap); }
.block-dual-media .media-item { border-radius: var(--card-radius); overflow: hidden; }
.block-dual-media[data-ratio="portrait"] .media-item { aspect-ratio: 3 / 4; }
.block-dual-media[data-ratio="square"]   .media-item { aspect-ratio: 1 / 1; }
.block-dual-media[data-ratio="classic"]  .media-item { aspect-ratio: 3 / 2; }
.block-dual-media .media-item img, .block-dual-media .media-item video {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: opacity 0.5s;
}
.block-dual-media .media-item:hover img { opacity: 0.85; }

/* ── BLOCK C — text pair ── */
.block-text-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap); }
.block-text-pair .text-card {
  background: var(--color-surface);
  border-radius: var(--card-radius);
  padding: 24px; transition: color 0.5s;
}
.block-text-pair .label {
  font-size: 14px; font-weight: 400; line-height: 17.5px;
  color: var(--color-text-muted); margin: 0 0 8px; transition: color 0.5s;
}
.block-text-pair .body-text {
  font-size: 23px; font-weight: 400; line-height: 27px;
  color: var(--color-text); margin: 0; transition: color 0.5s;
}

/* ── BLOCK D — text single ── */
.block-text-single {
  background: var(--color-surface);
  border-radius: var(--card-radius);
  padding: 24px; max-width: 60%;
  transition: color 0.5s;
}
.block-text-single[data-align="right"] { margin-left: auto; }
.block-text-single[data-align="left"]  { margin-right: auto; }
.block-text-single .label {
  font-size: 14px; font-weight: 400;
  color: var(--color-text-muted); margin: 0 0 8px; transition: color 0.5s;
}
.block-text-single .body-text {
  font-size: 15px; font-weight: 400; line-height: 24px;
  color: var(--color-text); margin: 0; transition: color 0.5s;
}

/* ── BLOCK E — media + text ── */
.block-media-text {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: var(--grid-gap); align-items: stretch;
}
.block-media-text[data-layout="media-right"] { direction: rtl; }
.block-media-text[data-layout="media-right"] > * { direction: ltr; }
.block-media-text .media-side { border-radius: var(--card-radius); overflow: hidden; }
.block-media-text .media-side[data-ratio="classic"] { aspect-ratio: 3 / 2; }
.block-media-text .media-side[data-ratio="square"]  { aspect-ratio: 1 / 1; }
.block-media-text .media-side img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: opacity 0.5s;
}
.block-media-text .media-side:hover img { opacity: 0.85; }
.block-media-text .text-side {
  background: var(--color-surface);
  border-radius: var(--card-radius);
  padding: 24px; display: flex; flex-direction: column;
  justify-content: flex-start; transition: color 0.5s;
}
.block-media-text .text-side .label {
  font-size: 14px; font-weight: 400;
  color: var(--color-text-muted); margin: 0 0 8px;
}
.block-media-text .text-side .body-text {
  font-size: 15px; font-weight: 400; line-height: 24px;
  color: var(--color-text); margin: 0;
}

/* ── BLOCK F — gallery row ── */
.block-gallery-row { display: grid; gap: var(--grid-gap); }
.block-gallery-row[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
.block-gallery-row[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.block-gallery-row .gallery-item { border-radius: var(--card-radius); overflow: hidden; }
.block-gallery-row[data-ratio="square"]   .gallery-item { aspect-ratio: 1 / 1; }
.block-gallery-row[data-ratio="portrait"] .gallery-item { aspect-ratio: 3 / 4; }
.block-gallery-row .gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: opacity 0.5s;
}
.block-gallery-row .gallery-item:hover img { opacity: 0.85; }

/* ── BLOCK G — credits ── */
.block-credits {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: var(--grid-gap); padding: 24px;
  background: var(--color-surface); border-radius: var(--card-radius);
}
.block-credits .credits-group { margin-bottom: 16px; }
.block-credits .credits-group:last-child { margin-bottom: 0; }
.block-credits .credits-role { font-size: 14px; font-weight: 400; color: var(--color-text-muted); margin: 0 0 4px; }
.block-credits .credits-names { font-size: 15px; font-weight: 400; line-height: 22px; color: var(--color-text); margin: 0; }
.block-credits .scope-list { list-style: none; padding: 0; margin: 8px 0 0; }
.block-credits .scope-list li { font-size: 13px; line-height: 24px; color: var(--color-text); }

/* ── MOBILE HEADER ── */
.mobile-header {
  display: none;
  position: sticky; top: 0;
  height: 56px; background: var(--bg-dark);
  border-bottom: 1px solid rgba(226,230,227,0.08);
  align-items: center; justify-content: space-between;
  padding: 0 20px; z-index: 200; flex-shrink: 0;
}
.mobile-back {
  font-size: 14px; font-weight: 500;
  color: var(--color-text); opacity: 0.65;
  display: flex; align-items: center; gap: 6px;
  transition: opacity 0.2s; white-space: nowrap;
}
.mobile-back:hover { opacity: 1; }
.mobile-project-name {
  font-size: 14px; font-weight: 500; color: var(--color-text);
  position: absolute; left: 50%; transform: translateX(-50%);
  pointer-events: none;
}
.mobile-menu-btn {
  background: none; border: none;
  color: var(--color-text); cursor: pointer;
  padding: 8px; margin: -8px;
  opacity: 0.65; transition: opacity 0.2s;
  display: flex; align-items: center;
}
.mobile-menu-btn:hover { opacity: 1; }

/* ── MOBILE DRAWER ── */
.mobile-drawer {
  position: fixed; inset: 0;
  background: var(--bg-dark); z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.38s cubic-bezier(.4,.1,.2,1);
  overflow-y: auto; overscroll-behavior: contain;
}
.mobile-drawer.open { transform: translateX(0); }
.drawer-inner { padding: 24px 20px 48px; }
.drawer-head {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 6px;
}
.drawer-logo { font-size: 14px; font-weight: 500; color: var(--color-text); }
.drawer-close {
  background: none; border: none; color: var(--color-text);
  font-size: 16px; cursor: pointer; padding: 6px; margin: -6px;
  opacity: 0.6; transition: opacity 0.2s; line-height: 1;
}
.drawer-close:hover { opacity: 1; }
.drawer-datetime { font-size: 13px; color: var(--color-text-muted); }

/* ── RESPONSIVE ── */

@media (max-width: 1024px) {
  .mobile-header { display: flex; }
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 8px; }
}

@media (max-width: 900px) {
  .block-header { min-height: auto; }
  .block-text-pair .body-text { font-size: 20px; line-height: 25px; }
  .block-gallery-row[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
  .block-gallery-row[data-cols="3"] { grid-template-columns: repeat(2, 1fr); }
  .block-text-single { max-width: 70%; }
  .block-credits { padding: 20px; }
}

@media (max-width: 768px) {
  .content { padding: 6px; }
  .block-header { min-height: auto; }
  .header-left { padding: 16px; justify-content: flex-start; gap: 16px; max-width: 100%; }
  .header-left h1 { font-size: 22px; margin-bottom: 14px; }
  .header-left p { font-size: 14px; line-height: 22px; margin-bottom: 8px; }

  .block-text-pair { grid-template-columns: 1fr; }
  .block-text-pair .text-card { padding: 18px; }
  .block-text-pair .body-text { font-size: 18px; line-height: 23px; }

  .block-text-single { max-width: 100%; padding: 18px; }
  .block-text-single[data-align="right"] { margin-left: 0; }
  .block-text-single[data-align="left"]  { margin-right: 0; }

  .block-dual-media { grid-template-columns: 1fr; }
  .block-media-text { grid-template-columns: 1fr; }
  .block-media-text[data-layout="media-right"] { direction: ltr; }
  .block-media-text[data-layout="media-right"] > * { direction: ltr; }
  .block-media-text .text-side { padding: 18px; }

  .block-gallery-row[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
  .block-gallery-row[data-cols="3"] { grid-template-columns: repeat(2, 1fr); }

  .block-credits { grid-template-columns: 1fr; padding: 18px; }
  .block-credits .credits-main { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .block-credits .credits-group { margin-bottom: 14px; }

  .project-item:hover { opacity: 0.8; }
}

@media (max-width: 480px) {
  .content { padding: 4px; gap: 4px; }
  .block-text-pair .body-text { font-size: 16px; line-height: 21px; }
  .block-credits .credits-main { grid-template-columns: 1fr; }
  .block-gallery-row[data-cols="4"] { grid-template-columns: 1fr; }
  .mobile-project-name { display: none; }
}
