/* Florin Bejera — portofoliu 3D
   Scena WebGL ocupă tot ecranul; HTML-ul de deasupra conține doar numele proiectului și controalele. */

@font-face { font-family: "Bricolage"; src: url("./fonts/bricolage-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("./fonts/manrope-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("./fonts/manrope-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --bg: #0e0e0e;
  --ink: #ededea;
  --muted: #8a8a85;
  --line: rgba(237, 237, 234, 0.18);
  --display: "Bricolage", "Helvetica Neue", Arial, sans-serif;
  --text: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 2.6vw, 40px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, p, ol { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--bg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* Bara de sus */
.top {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--pad);
  font-weight: 600; font-size: 14px;
}
.top-nav { display: flex; gap: clamp(18px, 2.4vw, 32px); }
.logo, .top-nav button { position: relative; }
.logo::after, .top-nav button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .8s var(--ease-out);
}
.logo:hover::after, .top-nav button:hover::after, .top-nav button[aria-pressed="true"]::after { transform: scaleX(1); transform-origin: left; }

/* Lista proiectelor: ascunsă vizual când scena 3D funcționează */
.projects { list-style: none; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Legenda proiectului: număr și tip, nume, descriere, tehnologii */
.caption {
  position: fixed; left: var(--pad); bottom: var(--pad); z-index: 5;
  max-width: min(560px, calc(100vw - 2 * var(--pad)));
  pointer-events: none;
}
.caption-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.caption-sep::before { content: "—"; margin: 0 10px; }
.caption-title { font: 600 clamp(1.9rem, 4vw, 3.8rem)/1 var(--display); letter-spacing: -0.03em; }
.caption-desc { margin-top: 14px; max-width: 44ch; color: rgba(237, 237, 234, 0.78); font-size: 15px; line-height: 1.5; }
.caption-stack { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.caption-stack li { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; line-height: 1.4; }

/* Lista fără WebGL afișează aceleași informații */
.project-desc, .project-stack { display: none; }
.mask { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.mask > span { display: inline-block; will-change: transform; }

.controls {
  position: fixed; right: var(--pad); bottom: var(--pad); z-index: 5;
  display: flex; align-items: center; gap: 8px;
}
.round, .open {
  height: 44px; border: 1px solid var(--line); border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; isolation: isolate;
  transition: border-color .4s var(--ease-out), color .4s var(--ease-out), transform .16s ease-out;
}
.round { width: 44px; font-size: 16px; }
.open { padding: 0 20px; font-weight: 600; font-size: 14px; gap: 6px; margin-left: 8px; }
.round::before, .open::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink);
  transform: translateY(101%); transition: transform .8s var(--ease-out);
}
.round:hover, .open:hover { border-color: var(--ink); color: var(--bg); }
.round:hover::before, .open:hover::before { transform: none; }
.round:active, .open:active { transform: scale(.96); }

.hint {
  position: fixed; left: 50%; bottom: calc(var(--pad) + 14px); z-index: 5;
  transform: translateX(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
  transition: opacity .8s var(--ease-out);
}
.hint.is-gone { opacity: 0; }

/* În modul grilă legenda și controalele se ascund */
.is-grid .caption, .is-grid .controls { opacity: 0; pointer-events: none; }
.caption, .controls { transition: opacity .9s var(--ease-out); }

/* Panoul Info */
.info {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  display: grid; align-content: end;
  padding: var(--pad);
}
.info[hidden] { display: none; }
.info-close { position: absolute; top: var(--pad); right: var(--pad); font-weight: 600; font-size: 14px; }
.info-body { max-width: 1100px; }
.info-lead { font: 600 clamp(1.8rem, 4.4vw, 4.2rem)/1.04 var(--display); letter-spacing: -0.03em; max-width: 20ch; }
.info-stack { color: var(--muted); margin-top: 24px; }
.info-links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: clamp(40px, 8vh, 96px); padding-top: 20px; border-top: 1px solid var(--line); font-weight: 600; }
.info-links a { background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px; transition: background-size .6s var(--ease-out); padding-bottom: 2px; }
.info-links a:hover { background-position: 0 100%; background-size: 100% 1px; }
.info-email { margin-right: auto; }

/* Stări inițiale pentru intrare (le animă site.js) */
.js .caption, .js .controls, .js .top, .js .hint { opacity: 0; }
.is-ready .top, .is-ready .hint { opacity: 1; transition: opacity 1s var(--ease-out) .2s; }
.is-ready:not(.is-grid) .caption, .is-ready:not(.is-grid) .controls { opacity: 1; }
.is-ready .hint.is-gone, .is-grid .hint { opacity: 0; }
.is-ready.is-grid.has-hover .caption { opacity: 1; }

/* Fără WebGL: grilă HTML simplă */
.no-gl body { overflow: auto; }
.no-gl .stage, .no-gl .caption, .no-gl .controls, .no-gl .hint, .no-gl [data-view-toggle] { display: none; }
.no-gl .top { opacity: 1; position: static; }
.no-gl .projects {
  position: static; width: auto; height: auto; clip: auto; overflow: visible;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 40px 24px;
  padding: 24px var(--pad) 64px;
}
.no-gl .projects img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.no-gl .projects span { display: block; margin-top: 12px; font: 600 1.15rem/1.2 var(--display); }
.no-gl .project-desc { display: block; margin-top: 6px; color: var(--muted); }
.no-gl .project-stack { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .caption { bottom: calc(var(--pad) + 64px); }
  .caption-desc { font-size: 14px; margin-top: 10px; }
  .caption-stack { margin-top: 12px; }
  .controls { left: var(--pad); right: var(--pad); }
  .open { margin-left: auto; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
