/* ============================================================
   Rui Rodrigues — 3D CV  ·  space theme
   ============================================================ */
:root {
  --bg: #04060f;
  --ink: #eaf2ff;
  --ink-dim: #9fb3d1;
  --cyan: #4dd2ff;
  --amber: #ffb54d;
  --violet: #c77dff;
  --mint: #8effc1;
  --pink: #ff7ab8;
  --card-bg: rgba(9, 15, 31, 0.78);
  --card-border: rgba(120, 180, 255, 0.16);
  --chip-bg: rgba(77, 210, 255, 0.1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* cinematic vignette over the 3D scene, under the UI */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 4, 10, 0.5) 100%);
}
#scene:active { cursor: grabbing; }

/* ---------- generic helpers ---------- */
.hidden { display: none !important; }
.hidden-soft { opacity: 0 !important; pointer-events: none !important; }

/* ---------- HUD name ---------- */
.hud-name {
  position: fixed;
  top: 18px;
  left: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 15px;
  opacity: 0.9;
  transition: opacity 0.6s ease;
  z-index: 20;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.hud-name span { color: var(--ink-dim); font-weight: 400; }

/* ---------- language toggle ---------- */
.lang-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 40;
  display: flex;
  gap: 2px;
  background: rgba(10, 18, 38, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.lang-toggle button.active {
  background: var(--cyan);
  color: #04121e;
}

/* ---------- intro ---------- */
.intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 30;
  /* soft edge-to-edge veil — no visible shape, just calms the scene behind the text */
  background: radial-gradient(ellipse at 50% 45%, rgba(4, 6, 15, 0.38) 0%, rgba(4, 6, 15, 0.62) 100%);
  transition: opacity 0.8s ease;
  padding: 24px;
  /* let touches/drags pass through to the canvas — only links stay interactive */
  pointer-events: none;
}
.intro-links a { pointer-events: auto; }
.intro-inner { max-width: 680px; }
.intro-hello {
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #ffffff 10%, var(--cyan) 55%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 24px rgba(77, 210, 255, 0.25));
}
.intro-subtitle {
  margin-top: 6px;
  font-size: clamp(15px, 2.4vw, 22px);
  font-weight: 500;
  color: var(--ink);
  opacity: 0.95;
  text-shadow: 0 2px 14px rgba(2, 4, 10, 0.9);
}
.intro-about {
  margin: 22px auto 0;
  max-width: 560px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #dce8fa;
  text-shadow: 0 1px 3px rgba(2, 4, 10, 0.95), 0 2px 18px rgba(2, 4, 10, 0.85);
}
.intro-links {
  margin-top: 18px;
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}
.intro-links a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(77, 210, 255, 0.35);
  padding-bottom: 1px;
}
.intro-links a:hover { border-bottom-color: var(--cyan); }

.scroll-cue { margin-top: 48px; }
.scroll-cue p { font-size: 13px; color: var(--ink-dim); margin-top: 12px; }
.scroll-cue .keys-hint { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.mouse {
  width: 24px;
  height: 38px;
  border: 2px solid var(--ink-dim);
  border-radius: 14px;
  margin: 0 auto;
  position: relative;
}
.wheel {
  width: 3px;
  height: 7px;
  background: var(--cyan);
  border-radius: 3px;
  position: absolute;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  animation: wheel 1.6s ease-in-out infinite;
}
@keyframes wheel {
  0% { transform: translate(-50%, 0); opacity: 1; }
  70% { transform: translate(-50%, 12px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 0; }
}

/* ---------- milestone card ---------- */
.card {
  position: fixed;
  top: 50%;
  right: 4vw;
  transform: translateY(-50%);
  width: min(420px, 42vw);
  max-height: 76vh;
  z-index: 25;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(160, 210, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: cardIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow: hidden;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(calc(-50% + 22px)); }
  to { opacity: 1; transform: translateY(-50%); }
}
.card-scroll {
  overflow-y: auto;
  max-height: 76vh;
  padding: 24px 26px 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 180, 255, 0.35) transparent;
}
.card-scroll::-webkit-scrollbar { width: 6px; }
.card-scroll::-webkit-scrollbar-thumb { background: rgba(120, 180, 255, 0.3); border-radius: 3px; }

.card-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--chip-bg);
  color: var(--cyan);
}
.badge-chip { color: var(--violet); background: rgba(199, 125, 255, 0.12); border-color: rgba(199, 125, 255, 0.3); }
.current-chip { color: #072613; background: var(--mint); border-color: var(--mint); }

.card h2 { font-size: 21px; line-height: 1.25; letter-spacing: 0.01em; }
.card-meta { margin-top: 6px; font-size: 13.5px; color: var(--ink-dim); }

.card-bullets { margin-top: 14px; list-style: none; }
.card-bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #cfe0f5;
  margin-bottom: 7px;
}
.card-bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(77, 210, 255, 0.8);
}

.card-groups { margin-top: 6px; }
.card-groups h4, .card-tech h4 {
  margin: 14px 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(77, 210, 255, 0.08);
  border: 1px solid rgba(120, 180, 255, 0.14);
  color: #cfe0f5;
  line-height: 1.4;
}

/* contact block */
.card-contact { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.card-contact p { font-size: 13.5px; line-height: 1.6; color: #cfe0f5; margin-bottom: 4px; }
.btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(77, 210, 255, 0.1);
  border: 1px solid rgba(77, 210, 255, 0.3);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, transform 0.15s;
  font-family: inherit;
}
.btn:hover { background: rgba(77, 210, 255, 0.22); transform: translateY(-1px); }
.btn.ghost { background: transparent; border-color: var(--card-border); color: var(--ink-dim); justify-content: center; }
.btn.ghost:hover { color: var(--ink); }

/* ---------- progress / minimap ---------- */
.progress {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(680px, 86vw);
  z-index: 20;
}
.progress-line {
  height: 2px;
  background: rgba(120, 180, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--violet), var(--cyan), var(--mint), var(--pink));
  transition: width 0.15s linear;
}
.progress-dots {
  position: relative;
  height: 26px;
  margin-top: -14px;
}
.progress-dots button {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.progress-dots button::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--dot, var(--cyan));
  opacity: 0.5;
  transition: transform 0.25s, opacity 0.25s, box-shadow 0.25s;
}
.progress-dots button:hover::after { opacity: 1; transform: scale(1.3); }
.progress-dots button.active::after {
  opacity: 1;
  transform: scale(1.55);
  box-shadow: 0 0 10px var(--dot, var(--cyan));
}
.progress-dots button .tip {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  font-size: 11px;
  color: var(--ink);
  background: rgba(10, 18, 38, 0.92);
  border: 1px solid var(--card-border);
  padding: 4px 9px;
  border-radius: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.progress-dots button:hover .tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- fallback (no WebGL) ---------- */
.fallback {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  z-index: 50;
  background: var(--bg);
  padding: 48px 20px 80px;
}
.fallback .fb-inner { max-width: 760px; margin: 0 auto; }
.fallback h1 { font-size: 34px; margin-bottom: 4px; }
.fallback .fb-sub { color: var(--cyan); margin-bottom: 6px; font-weight: 600; }
.fallback .fb-note { color: var(--ink-dim); font-size: 13px; margin-bottom: 30px; }
.fallback section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 14px;
}
.fallback section h2 { font-size: 18px; margin-bottom: 2px; }
.fallback section .fb-meta { color: var(--ink-dim); font-size: 13px; margin-bottom: 10px; }
.fallback ul { list-style: none; }
.fallback li { font-size: 13.5px; line-height: 1.6; color: #cfe0f5; padding-left: 16px; position: relative; }
.fallback li::before { content: "•"; position: absolute; left: 0; color: var(--cyan); }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .card {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 52vh;
    border-radius: 18px 18px 0 0;
    animation: cardInMobile 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  @keyframes cardInMobile {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
  }
  .card-scroll { max-height: 52vh; padding: 18px 18px 16px; }
  .card h2 { font-size: 18px; }
  .progress { bottom: auto; top: 58px; width: 90vw; }
  .progress-dots button .tip { display: none; }
  .hud-name { font-size: 13px; top: 16px; left: 16px; }
  .intro-about { font-size: 13.5px; }
  .scroll-cue { margin-top: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .wheel { animation: none; }
  .card { animation: none; }
}
