*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* fonts: the user's picks first, then metric-compatible fallbacks */
:root {
  --font-display: "Segoe UI Variable Display Light", "Segoe UI Variable Display", "Segoe UI Light", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-button: "Liberation Sans", Arial, Helvetica, sans-serif;
  --font-mono: "Liberation Mono", "Courier New", Courier, monospace;

  /* layout proportions taken from the reference image (1352 x 696) */
  --menu-top: 13vh;          /* first button's top edge */
  --menu-bottom: 15vh;       /* space under the last button */
  --menu-w: 55vw;            /* label + tab together */
  --tab-w: 3.9vw;
  --tab-gap: 1.9vw;
  --btn-h: clamp(36px, 7.2vh, 60px);
  --console-left: 66.5vw;
  --console-top: 28vh;
  --edge-right: 3vw;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: #e6ecff;
  font-family: var(--font-display);
  background-color: #000318;
  background-image: url("images/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* ---- blue grid that follows the cursor ---- */
.grid {
  position: fixed;
  inset: -120px;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(90, 120, 255, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(90, 120, 255, 0.16) 1px, transparent 1px);
  background-size: 180px 180px;
  transform: translate3d(var(--gx, 0px), var(--gy, 0px), 0);
  transition: transform 0.25s ease-out;
  will-change: transform;
}

/* ---- header, top right ---- */
.brand {
  position: absolute;
  top: 4.5vh;
  right: var(--edge-right);
  z-index: 2;
  width: max-content;
  max-width: calc(100vw - var(--console-left) - var(--edge-right));
  text-align: left;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(18px, 2.25vw, 34px);
  line-height: 1.3;
  white-space: nowrap;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 0.3em;
  vertical-align: -0.18em;
  background: #ffffff;
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ---- menu, evenly spaced down the left ---- */
.menu {
  position: absolute;
  top: var(--menu-top);
  left: 0;
  bottom: var(--menu-bottom);
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: var(--menu-w);
}

.menu-btn {
  all: unset;
  display: flex;
  align-items: stretch;
  gap: var(--tab-gap);
  width: 100%;
  height: var(--btn-h);
  cursor: pointer;
  transform-origin: left center;
  transition: transform 0.18s ease-out, filter 0.18s ease-out;
}

.menu-label {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding: 0 1.5vw 0 5.9vw;
  background: #7f90ff;
  color: #000a2e;
  font-family: var(--font-button);
  font-weight: 700;
  font-size: clamp(13px, 1.65vw, 26px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.18s ease-out;
}

.menu-tab {
  flex: 0 0 var(--tab-w);
  background: #7f90ff;
  transition: background 0.18s ease-out;
}

.menu-btn:hover,
.menu-btn:focus-visible {
  transform: translateX(14px) scale(1.04);
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.55));
}

.menu-btn:hover .menu-label,
.menu-btn:hover .menu-tab,
.menu-btn:focus-visible .menu-label,
.menu-btn:focus-visible .menu-tab {
  background: #ffffff;
}

.menu-btn:active {
  transform: translateX(14px) scale(1.01);
}

/* ---- console, right of the menu under the header ---- */
.terminal {
  position: absolute;
  top: var(--console-top);
  left: var(--console-left);
  right: 6vw;
  z-index: 2;
  color: #6b7fe8;
  font-family: var(--font-mono);
  font-size: clamp(10px, min(1.04vw, 2.1vh), 15px);
  line-height: 1.24;
}

.term-log,
.term-prompt {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- access info, bottom right ---- */
.meta {
  position: fixed;
  right: 2vw;
  bottom: 3vh;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(9px, 0.82vw, 12px);
  line-height: 1.35;
  color: #d8def8;
}

/* ---- small screens: stack everything ---- */
@media (max-width: 900px) {
  .brand {
    position: static;
    max-width: none;
    padding: 24px 20px 0;
    white-space: normal;
  }

  .menu {
    position: static;
    width: 100%;
    gap: 22px;
    padding: 30px 0;
  }

  .menu-btn {
    height: 44px;
  }

  .menu-label {
    padding-left: 24px;
    white-space: normal;
  }

  .terminal {
    position: static;
    margin: 0 20px 24px;
    font-size: 12px;
  }

  .meta {
    position: static;
    margin: 0 20px 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid,
  .menu-btn {
    transition: none;
  }
}
