:root {
  --grid-size: 26px;
  --viewport-width: 100vw;
  --viewport-height: 100vh;

  --bg-light: #f5d8b5;
  --card-light: #f9e6cc;
  --line-light: #5b4b3a;
  --text-light: var(--line-light);
  --grid-light: rgba(91, 75, 58, 0.18);

  --bg-dark: #1e1711;
  --card-dark: #2a2119;
  --line-dark: #d9c6ac;
  --text-dark: var(--line-dark);
  --grid-dark: rgba(207, 192, 169, 0.1);
}

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

::selection {
  background: var(--bg-dark);
  color: var(--text-dark);
}

body[data-theme="dark"] ::selection {
  background: var(--bg-light);
  color: var(--text-light);
}

body {
  --bg: var(--bg-light);
  --card: var(--card-light);
  --line: var(--line-light);
  --text: var(--text-light);
  --grid: var(--grid-light);
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  line-height: 1.4;
  background-color: var(--bg);
  min-height: var(--viewport-height, 100vh);
  color: var(--text);
  overflow: hidden;
}

body[data-theme="dark"] {
  --bg: var(--bg-dark);
  --card: var(--card-dark);
  --line: var(--line-dark);
  --text: var(--text-dark);
  --grid: var(--grid-dark);
}

body[data-grid-interacting="true"],
body[data-grid-interacting="true"] * {
  -webkit-user-select: none;
  user-select: none;
}

button,
a {
  font: inherit;
  color: inherit;
}

#viewport {
  position: relative;
  width: var(--viewport-width, 100vw);
  height: var(--viewport-height, 100vh);
  overflow: auto;
  scroll-snap-type: both mandatory;
  scrollbar-width: none;
  overscroll-behavior: none;
  scroll-behavior: smooth;
}

#viewport.is-animating {
  scroll-snap-type: none;
}

#viewport::-webkit-scrollbar {
  display: none;
}

#grid {
  position: relative;
  display: grid;
  grid-template-columns: var(--viewport-width, 100vw) var(--viewport-width, 100vw);
  grid-template-rows: var(--viewport-height, 100vh) var(--viewport-height, 100vh);
  width: calc(var(--viewport-width, 100vw) * 2);
  height: calc(var(--viewport-height, 100vh) * 2);
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--viewport-width, 100vw) * 2);
  height: calc(var(--viewport-height, 100vh) * 2);
  z-index: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

.hover-marker {
  position: fixed;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease;
  transform: translate(-50%, -50%);
  background: var(--bg);
}

.hover-marker[data-visible="true"] {
  opacity: 1;
}

#grid .panel {
  width: var(--viewport-width, 100vw);
  height: var(--viewport-height, 100vh);
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  pointer-events: none;
  scroll-snap-align: start;
}

.panel-content,
.card {
  width: min(90vw, 420px);
  border: 2px solid var(--line);
  background: var(--card);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: auto;
}

.bio-panel {
  width: min(95vw, 640px);
  padding: clamp(2.5rem, 4vw, 3.75rem);
  text-align: left;
  gap: 2rem;
}

.bio-panel .badge {
  margin: 0;
}

.bio-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.1rem;
  line-height: 1.9;
  letter-spacing: 0.05em;
}

.bio-highlight {
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 500;
}

.bio-panel .chip {
  align-self: flex-start;
}

.badge {
  border: 2px solid var(--line);
  background: var(--line);
  color: var(--bg);
  width: fit-content;
  margin: 0 auto;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.badge:hover {
  cursor: url("resources/cat.svg") 8 4, pointer;
}

.card-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.card-nav button {
  background: none;
  border: none;
  padding: 0.25rem 0;
  color: var(--text);
  font-size: 1.25rem;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.card-nav button:hover {
  transform: translateY(-2px);
}

.card-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chip,
.quadrant-nav button {
  border: 2px solid var(--line);
  padding: 0.35rem 0.9rem;
  background: transparent;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip:hover,
.quadrant-nav button:hover {
  transform: translateY(-2px);
}

.chip.theme-toggle {
  width: 2.5rem;
}

.chip-solid {
  background: var(--card);
}

.quadrant-nav {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
}

.quadrant-nav button {
  width: 100%;
  background: var(--card);
}

@media (max-width: 480px) {
  .panel-content,
  .card {
    padding: 1.5rem;
  }

  #grid .panel {
    padding: 1.5rem;
  }

  .quadrant-nav {
    right: 0.5rem;
    top: 0.5rem;
  }
}

@media (max-width: 640px) {
  .quadrant-nav {
    display: none;
  }
}
