/* ============================================================
   Guido Possi — Portfólio Orbital
   Aesthetic: deep-space observatory · bone white · amber accent
   ============================================================ */

:root {
  --bg:        #06060a;
  --bg-2:      #0c0d14;
  --ink:       #ECE7DE;   /* bone white */
  --ink-dim:   #8d8a84;
  --ink-faint: #4a4842;
  --amber:     #E8A33D;   /* warm accent */
  --amber-soft:#f6cf94;
  --line:      rgba(236, 231, 222, 0.14);

  --serif: "Fraunces", Georgia, serif;
  --mono:  "Space Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

body { position: fixed; inset: 0; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#scene.dragging { cursor: grabbing; }
#scene.hovering  { cursor: pointer; }

/* ---------- Texture overlays ---------- */
.grain {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  opacity: 0.05; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background:
    radial-gradient(115% 115% at 50% 50%, transparent 42%, rgba(0,0,0,0.45) 72%, rgba(0,0,0,0.85) 100%);
}

/* desfoque suave só nas extremidades (profundidade, estilo phantom) */
.edge-blur {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  -webkit-mask: radial-gradient(ellipse 62% 66% at 50% 50%,
    transparent 44%, rgba(0,0,0,0.6) 72%, #000 100%);
  mask: radial-gradient(ellipse 62% 66% at 50% 50%,
    transparent 44%, rgba(0,0,0,0.6) 72%, #000 100%);
}

/* Sombras escuras nos 4 cantos (atrás dos textos HUD) */
.corner-shadows {
  position: fixed; inset: 0; z-index: 19; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 0% 0%,    rgba(6,6,10,0.82) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 100% 0%,   rgba(6,6,10,0.82) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 0% 100%,   rgba(6,6,10,0.82) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 100% 100%,  rgba(6,6,10,0.82) 0%, transparent 100%);
}

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity 0.8s var(--ease);
}
.loader.is-done { opacity: 0; pointer-events: none; }
.loader__inner { width: min(280px, 70vw); text-align: center; }
.loader__label {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.5em;
  color: var(--ink-dim); margin-bottom: 1.4rem; padding-left: 0.5em;
}
.loader__bar {
  height: 1px; width: 100%; background: var(--ink-faint); overflow: hidden;
}
.loader__bar span {
  display: block; height: 100%; width: 0%;
  background: var(--amber);
}
.loader__pct {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.3em;
  color: var(--ink-dim); margin-top: 0.9rem;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(1rem, 3vw, 2.2rem) clamp(1.1rem, 4vw, 3rem);
  pointer-events: none;
  opacity: 0;
}
.hud--top { top: 0; }
.hud--bottom { bottom: 0; align-items: flex-end; }
.hud a, .hud button { pointer-events: auto; }

.hud__brand { display: flex; flex-direction: column; gap: 0.3rem; }
.hud__name {
  font-family: var(--serif); font-weight: 400; font-size: clamp(1.1rem, 2.4vw, 1.55rem);
  letter-spacing: 0.01em; line-height: 1;
}
.hud__role {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--ink-dim);
}
.hud__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.hud__coord {
  font-size: 0.6rem; letter-spacing: 0.18em; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.hud__link {
  font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
  padding-bottom: 2px; transition: color 0.3s, border-color 0.3s;
}
.hud__link:hover { color: var(--amber); border-color: var(--amber); }

.hud__hint { display: flex; align-items: center; gap: 0.65rem;
  font-size: 0.62rem; letter-spacing: 0.18em; color: var(--ink-dim);
  text-transform: uppercase; }
.hud__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%,100%{opacity:.35;transform:scale(.8)} 50%{opacity:1;transform:scale(1.15)} }
.hud__count {
  font-size: 0.7rem; letter-spacing: 0.16em; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.hud__count span:first-child { color: var(--ink); }

/* ---------- Floating focus title ---------- */
.focus {
  position: fixed; left: 50%; bottom: clamp(4rem, 12vh, 7rem);
  transform: translate(-50%, 12px);
  z-index: 15; text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  max-width: min(90vw, 680px);
  padding: 0.85rem 1.7rem 0.95rem;
  border-radius: 16px;
  background: rgba(6, 6, 10, 0.55);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid rgba(236, 231, 222, 0.10);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.focus.is-visible { opacity: 1; transform: translate(-50%, 0); }
.focus__idx {
  display: block; font-family: var(--mono); font-size: 0.6rem;
  letter-spacing: 0.4em; color: var(--amber); margin-bottom: 0.5rem;
}
.focus__title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(1.3rem, 3.4vw, 2.2rem);
  line-height: 1.1; color: var(--ink);
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
}

/* ---------- Detail "page" (rolável) ---------- */
.detail {
  position: fixed; inset: 0; z-index: 60;
  opacity: 0; visibility: hidden;
  background: var(--bg);
}
.detail.is-open { visibility: visible; }

/* barra de progresso de leitura */
.detail__progress {
  position: absolute; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--amber); z-index: 6; pointer-events: none;
  transition: width 0.1s linear;
}

/* barra superior fixa (sempre permite fechar) */
.detail__bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(0.9rem, 2.5vw, 1.5rem) clamp(1.1rem, 4vw, 2.6rem);
  background: linear-gradient(to bottom, rgba(6,6,10,0.85), rgba(6,6,10,0));
  pointer-events: none;
}
.detail__bar-title {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-dim);
  max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail__close {
  pointer-events: auto;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(236,231,222,0.06); border: 1px solid var(--line);
  cursor: pointer; display: grid; place-items: center; position: relative;
  transition: background 0.3s, transform 0.3s var(--ease);
}
.detail__close:hover { background: rgba(236,231,222,0.16); transform: rotate(90deg); }
.detail__close:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.detail__close span { position: absolute; width: 16px; height: 1px; background: var(--ink); }
.detail__close span:first-child { transform: rotate(45deg); }
.detail__close span:last-child  { transform: rotate(-45deg); }

/* área rolável */
.detail__scroll {
  position: absolute; inset: 0; z-index: 2;
  overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.detail__bg {
  position: absolute; top: 0; left: 0; right: 0; height: 100vh;
  background-size: cover; background-position: center;
  filter: blur(70px) saturate(1.2) brightness(0.35);
  transform: scale(1.25); opacity: 0.55; z-index: -1;
}

/* cabeçalho do projeto */
.detail__hero {
  min-height: 64vh;
  display: flex; flex-direction: column; justify-content: flex-end;
  max-width: 1100px; margin: 0 auto;
  padding: clamp(5rem, 12vh, 9rem) clamp(1.5rem, 6vw, 4rem) clamp(2rem, 5vh, 3.5rem);
}
.detail__index {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.34em;
  color: var(--amber); margin-bottom: 1rem;
}
.detail__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: 1.02;
  letter-spacing: -0.015em; max-width: 16ch;
}
.detail__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.6rem; }
.detail__meta span {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink);
  border: 1px solid var(--line); border-radius: 100px;
  padding: 0.45rem 0.9rem;
}
.detail__scrollcue {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 2.4rem;
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue { 0%,100%{opacity:.4;transform:translateY(0)} 50%{opacity:1;transform:translateY(4px)} }

/* fluxo de mídia */
.detail__media {
  max-width: 1100px; margin: 0 auto;
  padding: 0 clamp(1.5rem, 6vw, 4rem);
  display: flex; flex-direction: column; gap: clamp(1rem, 3vw, 2rem);
}
.detail__img {
  display: block; width: 100%; height: auto; border-radius: 3px;
  background: var(--bg-2);
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  min-height: 120px;
}
.detail__img.is-loaded { opacity: 1; transform: translateY(0); }
.detail__video {
  position: relative; width: 100%; padding-bottom: 56.25%;
  border-radius: 3px; overflow: hidden; background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}
.detail__video iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* rodapé */
.detail__foot {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) clamp(1.5rem, 6vw, 4rem) clamp(3rem, 10vh, 7rem);
  display: flex; flex-direction: column; gap: 2rem;
  align-items: flex-start;
}
.detail__nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.detail__navbtn {
  background: none; border: 1px solid var(--line); cursor: pointer;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink); border-radius: 100px;
  padding: 0.85rem 1.4rem;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.detail__navbtn:hover { color: var(--amber); border-color: var(--amber); }
.detail__navbtn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.detail__behance {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-dim); text-decoration: none;
  border-bottom: 1px solid var(--line); padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}
.detail__behance:hover { color: var(--amber); border-color: var(--amber); }

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 820px) {
  .hud__role, .hud__coord { display: none; }
  .detail__hero { min-height: 52vh; }

  /* Blur de borda mais suave no mobile */
  .edge-blur {
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    -webkit-mask: radial-gradient(ellipse 68% 72% at 50% 50%,
      transparent 40%, rgba(0,0,0,0.5) 68%, #000 100%);
    mask: radial-gradient(ellipse 68% 72% at 50% 50%,
      transparent 40%, rgba(0,0,0,0.5) 68%, #000 100%);
  }

  /* No mobile: sombra apenas em cima e embaixo (onde ficam os HUDs) */
  .corner-shadows {
    background:
      linear-gradient(to bottom, rgba(6,6,10,0.85) 0%, transparent 28%),
      linear-gradient(to top,    rgba(6,6,10,0.85) 0%, transparent 22%);
  }

  /* Título do hover menor no mobile */
  .focus {
    bottom: 4rem;
    padding: 0.55rem 1.1rem 0.65rem;
    max-width: min(88vw, 400px);
  }
  .focus__title {
    font-size: clamp(0.95rem, 4vw, 1.3rem);
    line-height: 1.2;
  }
  .focus__idx {
    font-size: 0.52rem;
    margin-bottom: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.05ms !important; }
}
