@import url("gigi.css");

:root {
  --purple: #270949;
  --charcoal: #3d404c;
  --light-grey: #f8f8fb;
  --white: #ffffff;
  --bg-bottom: #cbc5d7;
  --error: #b3261e;
  --success: #1e6b3a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--purple);
  background: linear-gradient(to top, var(--bg-bottom), var(--white)) fixed;
  overflow-x: hidden;
}

button { font: inherit; cursor: pointer; }

/* ---------- Toppmeny ---------- */
.topbar {
  position: relative;
  z-index: 10;
  max-width: 1584px;
  margin: 0 auto;
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  position: relative;
  display: block;
  width: 111px;
  height: 68px;
  overflow: hidden;
  flex-shrink: 0;
}
.brand img {
  position: absolute;
  width: 119.82%;
  height: 130.23%;
  left: -8.84%;
  top: -13.95%;
  max-width: none;
}

.nav { display: flex; align-items: center; gap: 40px; }
.nav-links { display: flex; gap: 56px; }
.nav-links a {
  color: var(--purple);
  text-decoration: none;
  font-weight: 500;
  font-size: 18px;
}
.nav-links a:hover { text-decoration: underline; }
.nav-actions { display: flex; gap: 16px; }

.btn {
  font-weight: 500;
  font-size: 18px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--purple);
  white-space: nowrap;
}
.btn-solid { background: var(--purple); color: var(--white); }
.btn-outline { background: transparent; color: var(--purple); }
.btn:hover { opacity: .85; }

/* ---------- Ytan ---------- */
.stage {
  position: relative;
  min-height: calc(100vh - 92px);
  min-height: 1025px;
  max-width: 1728px;
  margin: 0 auto;
}

/* ---------- Nätverket till vänster ---------- */
.network {
  position: absolute;
  top: 0;
  left: calc(50% - 628px);
  width: 568px;
  height: 1025px;
  pointer-events: none;
  /* Klipper bara nederkanten, så tråden får fortsätta upp bakom menyn */
  clip-path: inset(-300px -1000px 0 -1000px);
}
.network-inner { position: relative; width: 100%; height: 100%; }

/* Den röda tråden (animeras i thread.js) */
.thread {
  position: absolute;
  width: 1892.35px;
  height: 324.2px;
  left: -677px;
  top: 534px;
  transform: rotate(-90deg);
}

.org, .person {
  left: var(--x);
  top: var(--y);
  opacity: 0;
  transition: left 1.4s ease-in-out, top 1.4s ease-in-out, opacity .6s ease var(--reveal-delay, 0ms);
}
.network.is-drawn .org,
.network.is-drawn .person { opacity: 1; }
body.signed-in .org,
body.signed-in .person {
  left: var(--x2);
  top: var(--y2);
}

.org {
  position: absolute;
  width: 75px;
  height: 75px;
  border-radius: 150px;
  overflow: hidden;
}
.org img { position: absolute; max-width: none; }
.org-co img { width: 164.12%; height: 115.51%; left: 0; top: -15.51%; }
.org-co { border-radius: 0; }
.org-saulo { background: #532f3c; }
.org-saulo img { width: 69px; height: 69px; left: 3px; top: 3px; object-fit: cover; }
.org-ilse { background: var(--light-grey); }
.org-ilse img { width: 84.2px; height: 80.4px; left: -2.76px; top: 0.22px; }
.org-qte { background: #080808; }
.org-qte img { left: 19%; right: -13%; top: 26%; bottom: 27%; width: 94%; height: 47%; }

.person {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 18px;
  white-space: nowrap;
  color: var(--purple);
}
.dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--dot) center / contain no-repeat;
}

/* ---------- Kortet ---------- */
.card {
  position: absolute;
  left: calc(50% + 381.5px);
  top: 175px;
  transform: translateX(-50%);
  width: 525px;
  min-height: 583px;
  padding: 48px 32px;
  border-radius: 43px;
  background: rgba(39, 9, 73, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
}

.card-head { text-align: center; }
.card-head h1 { margin: 0; font-weight: 600; font-size: 36px; }
.card-head p { margin: 8px 0 0; font-weight: 500; font-size: 24px; opacity: .5; }

#auth-form { width: 414px; max-width: 100%; display: flex; flex-direction: column; gap: 32px; }
.fields { display: flex; flex-direction: column; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-row .field { padding: 8px 20px; min-width: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 32px;
  background: var(--white);
  border: 1px solid rgba(39, 9, 73, 0.4);
  border-radius: 8px;
  color: var(--charcoal);
  cursor: text;
}
.field:focus-within { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(39, 9, 73, .15); }
.field-label { font-size: 12px; opacity: .7; }
.field-hint { margin: 0 0 0 4px; font-size: 12px; color: var(--charcoal); opacity: .7; }
.field input {
  border: 0;
  outline: 0;
  padding: 0;
  font: inherit;
  font-size: 18px;
  color: var(--charcoal);
  background: transparent;
  width: 100%;
}
.field input::placeholder { color: var(--charcoal); opacity: .45; }
.field-password { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field-text { display: flex; flex-direction: column; gap: 2px; flex: 1; cursor: text; }
#password { letter-spacing: 1.44px; }
.eye { border: 0; background: none; padding: 0; width: 24px; height: 24px; flex-shrink: 0; }

.btn-primary {
  height: 58px;
  border: 0;
  border-radius: 8px;
  background: var(--purple);
  color: var(--white);
  font-weight: 600;
  font-size: 18px;
}
.btn-primary:disabled { opacity: .6; cursor: wait; }

.message { margin: -16px 0 0; font-size: 14px; line-height: 1.4; text-align: center; }
.message.error { color: var(--error); }
.message.success { color: var(--success); }

.switch { margin: -16px 0 0; text-align: center; font-size: 14px; color: var(--charcoal); }
.link { border: 0; background: none; padding: 0; color: var(--purple); font-weight: 600; text-decoration: underline; }

/* ---------- Välkommen ---------- */
.welcome {
  position: absolute;
  right: max(48px, calc(50% - 744px));
  top: 375px;
  text-align: center;
  color: var(--purple);
  animation: fade-in .9s ease both;
}
.welcome-title { margin: 0; font-family: "Sacramento", cursive; font-size: 96px; line-height: 1.2; white-space: nowrap; }
.welcome-hello { margin: 24px 0 0; font-size: 28px; }
.welcome-next {
  display: inline-block;
  margin-top: 32px;
  padding: 14px 28px;
  border-radius: 8px;
  background: var(--purple);
  color: var(--white);
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
}
.welcome-next:hover { opacity: .9; }


@keyframes fade-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Mindre skärmar ---------- */
@media (max-width: 1400px) {
  .network { left: 24px; transform: scale(.8); transform-origin: top left; }
  .card { left: auto; right: 48px; transform: none; }
  .welcome-title { font-size: 72px; }
}

@media (max-width: 1000px) {
  .nav-links { display: none; }
  /* På mobil syns bara tråden, i bakgrunden bakom rutan */
  .network { left: calc(50% - 188px); top: -40px; transform: scale(.7); transform-origin: top left; }
  .network .org, .network .person { display: none; }
  .thread { opacity: .7; }
  .stage { min-height: auto; padding: 48px 16px 64px; overflow: hidden; }
  .card, .welcome { position: relative; z-index: 1; left: auto; right: auto; top: auto; transform: none; margin: 0 auto; }
  .card { width: 100%; max-width: 525px; min-height: 0; }
  .welcome { padding-top: 40px; }
  .welcome-title { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .org, .person { transition: none; }
  .welcome { animation: none; }
}

@media (max-width: 560px) {
  .topbar { padding: 16px 16px 0; }
  .brand { width: 80px; height: 49px; }
  .btn { font-size: 15px; padding: 6px 12px; }
  .nav-actions { gap: 8px; }
  .card { padding: 40px 20px; border-radius: 28px; gap: 32px; }
  .card-head h1 { font-size: 28px; }
  .card-head p { font-size: 18px; }
  .field { padding: 8px 20px; }
  .welcome-title { font-size: 56px; }
  .welcome-hello { font-size: 20px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  /* Plats för Gigi under rutan */
  .stage { padding-bottom: 120px; }
}
