html {
  width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  /* background: radial-gradient(circle at top, #0b1220, #05070f 70%); */
  background: url("./images/cityscape.webp") no-repeat center center fixed;
  font-family: "IBM Plex Serif", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #e2e8f0;
}

.desktop-only {
  display: flex;
  gap: 20px;
}

.mobile-ui {
  display: none;
}

/* ---------- MOBILE ---------- */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  body {
    display: block;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    padding-top: 100px; /* compensate for top navbar height */
    box-sizing: border-box;
  }

  .scene .controls {
    display: none;
  }

  /* disable cube completely */
  .cube {
    display: none;
  }

  /* layout */
  .scene {
    width: 92%;
    max-width: 420px;
    margin: 60px auto 0;
    position: relative;
  }

  .mobile-ui {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
  }

  .mobile-face {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(0, 255, 0, 0.7);
    border-radius: 12px;
    transition: transform 0.3s ease, opacity 0.3s ease;

    padding: 20px;
    color: #e2e8f0;

    min-height: 320px;
    overflow-y: auto;
  }

  .mobile-face {
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
  }

  .mobile-face.flip {
    transform: rotateY(90deg);
  }

  .mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
}

/* ---------- TOP NAVBAR ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 0 30px;
  box-sizing: border-box;

  background: rgba(10, 15, 25, 0.01);
  backdrop-filter: blur(10px);

  border-bottom: 1px solid rgba(255, 255, 255, 0.1);

  z-index: 1000;
}

.name {
  font-family: "Sora", serif;
  font-size: 20px;
  letter-spacing: 0.05em;
  color: #e2e8f0;
}

.topbar-right {
  display: flex;
  gap: 20px;
}

.topbar a {
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: rgba(226, 232, 240, 0.7);
  transition: all 0.2s ease;
}

.topbar a:hover {
  color: #38bdf8;
}

.scene {
  width: min(90vw, 420px);
  height: min(90vw, 420px);
  perspective: 900px;
  position: relative;
  margin-top: 40px;
}

.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.85s ease;
  transform: rotateX(-20deg) rotateY(20deg);
  cursor: grab;
  pointer-events: auto; /* allow pointer events on the cube */
}

.cube:active {
  cursor: grabbing;
}

/* ---------- FACE BASE ---------- */

.face {
  position: absolute;
  width: 100%;
  height: 100%;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;

  padding: 40px;
  overflow-y: auto;

  font-size: 18px;
  line-height: 1.4;

  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(160, 160, 160, 0.25);
  color: #e2e8f0;

  backdrop-filter: blur(10px);
  pointer-events: auto; /* allow pointer events on the cube */

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* typography */
.face h2 {
  font-family: "Fraunces", serif;
  font-weight: 700;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
  text-align: center;
  color: rgba(56, 191, 248, 0.705);
  width: 100%;
  margin: 0 0 10px 0;
  font-size: 28px;
  letter-spacing: +0.05em;
}

.face p {
  margin: 0 0 10px 0;
  opacity: 0.9;
  z-index: 1;  
}

/* ---------- CUBE GEOMETRY ---------- */

.front  { transform: translateZ(calc(min(90vw, 420px) / 2)); }
.back   { transform: rotateY(180deg) translateZ(calc(min(90vw, 420px) / 2)); }
.right  { transform: rotateY(90deg) translateZ(calc(min(90vw, 420px) / 2)); }
.left   { transform: rotateY(-90deg) translateZ(calc(min(90vw, 420px) / 2)); }
.top    { transform: rotateX(90deg) translateZ(calc(min(90vw, 420px) / 2)); }
.bottom { transform: rotateX(-90deg) translateZ(calc(min(90vw, 420px) / 2)); }

/* ---------- GLOW ---------- */

.front  { box-shadow: inset 0 0 60px rgba(0, 200, 255, 0.35), 0 0 20px rgba(0, 200, 255, 0.15); }
.right  { box-shadow: inset 0 0 60px rgba(0, 255, 170, 0.35), 0 0 20px rgba(0, 255, 170, 0.15); }
.back   { box-shadow: inset 0 0 60px rgba(140, 90, 255, 0.35), 0 0 20px rgba(140, 90, 255, 0.15); }
.left   { box-shadow: inset 0 0 60px rgba(255, 60, 200, 0.35), 0 0 20px rgba(255, 60, 200, 0.15); }
.top    { box-shadow: inset 0 0 60px rgba(255, 200, 0, 0.35), 0 0 20px rgba(255, 200, 0, 0.15); }
.bottom { box-shadow: inset 0 0 60px rgba(255, 80, 80, 0.35), 0 0 20px rgba(255, 80, 80, 0.15); }

/* ---------- CONTROLS ---------- */

.controls {
  position: absolute;
  bottom: -180px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

button {
  padding: 8px 12px;

  font-family: "Sora", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  font-weight: 500;
  border-radius: 20px;

  border: 4px solid rgba(56, 189, 248, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;

  cursor: pointer;
  transition: all 0.2s ease;
  align-self: flex-start;
}

button:hover {
  transform: translateY(-2px);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

input, textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #e2e8f0;
  padding: 10px;
  border-radius: 8px;
  font-family: inherit;
}

textarea {
  min-height: 40px;
  resize: none;
}