/* styles.css */

:root {
  --bg: #000;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.6);
  --gridLine: rgba(255, 255, 255, 0.12);
  --gridLineBold: rgba(255, 255, 255, 0.16);
  --hoverOverlay: rgba(255, 255, 255, 0.05);

  --uiBase: rgba(255, 255, 255, 0.06);
  --uiBorder: rgba(255, 255, 255, 0.14);
  --uiHover: rgba(255, 255, 255, 0.1);

  --acid: #39ff14;
  --acidSoft: rgba(57, 255, 20, 0.35);
  --acidGlow: rgba(57, 255, 20, 0.85);

  --cell: 20px;
  --radius: 14px;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI,
    Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Prevent layout shifts */
.page {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top {
  padding: 28px 18px 14px;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  user-select: none;
}

.logoMark {
  width: 48px;
}

.logoText {
  letter-spacing: 0.22em;
  font-weight: 600;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.controls {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--uiBorder);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  color: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset,
    0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, background 120ms ease,
    border-color 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06)
  );
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset,
    0 0 14px rgba(57, 255, 20, 0.12), 0 14px 40px rgba(0, 0, 0, 0.42);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  border-color: rgba(255, 255, 255, 0.28);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.stage {
  display: grid;
  place-items: center;
  padding: 14px 18px 22px;
}

.grid {
  touch-action: none;
}

/* Allow scroll on smaller screens; keep centered on larger screens */
.gridViewport {
  width: min(100%, 980px);
  overflow: auto;
  padding: 14px;
  /* border-radius: var(--radius); */
  background: rgba(255, 255, 255, 0.03);
  /* border: 1px solid rgba(255, 255, 255, 0.08); */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6) inset,
    0 24px 70px rgba(0, 0, 0, 0.55);
}

/* Container that defines the exact drawing bounds */
.gridWrap {
  position: relative;
  width: fit-content;
  height: fit-content;
  margin: 0 auto;
  /* Disable selection during drag; JS also toggles class for safety */
  user-select: none;
}

/* SVG sits ABOVE the grid and obscures lines beneath blobs */
.blobSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Grid sits below SVG; still receives input */
.grid {
  position: relative;
  z-index: 1;
  display: grid;
  /* columns/rows set via JS */
  background: transparent;
  /* crisp grid lines via borders on cells */
}

/* Each cell draws the grid lines */
.cell {
  width: var(--cell);
  height: var(--cell);
  border-right: 1px solid var(--gridLine);
  border-bottom: 1px solid var(--gridLine);
  background: transparent;
  position: relative;
}

/* top/left edges for the whole grid */
.cell.isTopEdge {
  border-top: 1px solid var(--gridLineBold);
}
.cell.isLeftEdge {
  border-left: 1px solid var(--gridLineBold);
}

/* Subtle hover feedback that doesn't overpower blobs */
.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 80ms ease, box-shadow 80ms ease;
}

.cell:hover::after {
  background: var(--hoverOverlay);
  box-shadow: 0 0 0 1px rgba(57, 255, 20, 0.08) inset;
}

.dragging * {
  cursor: crosshair;
}

/* Footer */
.footer {
  padding: 10px 18px 18px;
  display: grid;
  justify-items: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

/* Projects Section */
.projects {
  padding: 48px 18px;
  display: grid;
  justify-items: center;
}

.projects-container {
  width: 100%;
  max-width: 680px;
  display: grid;
  gap: 32px;
}

h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.projects h2,
.about h2 {
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid var(--uiBorder);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: transform 200ms ease, box-shadow 200ms ease,
    border-color 200ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 0 20px rgba(57, 255, 20, 0.08), 0 24px 72px rgba(0, 0, 0, 0.5);
}

.card h3 {
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.card p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 24px 0;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  border: 1px solid var(--uiBorder);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  color: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset, 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 120ms ease, background 120ms ease,
    border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
  position: relative;
  overflow: hidden;
}

.btn-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(57, 255, 20, 0.1),
    rgba(57, 255, 20, 0.05)
  );
  opacity: 0;
  transition: opacity 120ms ease;
}

.btn-link span {
  position: relative;
  z-index: 1;
}

.btn-link svg {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: transform 120ms ease;
}

.btn-link:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06)
  );
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset,
    0 0 14px rgba(57, 255, 20, 0.12), 0 12px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.btn-link:hover::before {
  opacity: 1;
}

.btn-link:hover svg {
  transform: translate(2px, -2px);
}

.btn-link:active {
  transform: translateY(0) scale(0.98);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Focus states for accessibility */
.btn-link:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
  border-color: var(--acid);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset,
    0 0 0 3px rgba(57, 255, 20, 0.2), 0 0 20px rgba(57, 255, 20, 0.15),
    0 12px 32px rgba(0, 0, 0, 0.4);
}

/* About Section */
.about {
  padding: 48px 18px;
  display: grid;
  justify-items: center;
}

.about-container {
  width: 100%;
  max-width: 680px;
  display: grid;
  gap: 20px;
}

.about p {
  font-size: clamp(16px, 3vw, 18px);
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  max-width: 65ch;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .projects,
  .about {
    padding: 36px 18px;
  }

  .projects-container,
  .about-container {
    gap: 24px;
  }

  .card {
    padding: 24px;
  }

  .buttons {
    flex-direction: column;
  }

  .btn-link {
    width: 100%;
    justify-content: center;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .card,
  .btn-link,
  .btn-link svg,
  .btn-link::before {
    transition: none;
  }

  .card:hover {
    transform: none;
  }

  .btn-link:hover {
    transform: none;
  }

  .btn-link:hover svg {
    transform: none;
  }
}

.section-divider {
  margin: 24px auto 32px;
  border: 0;
  border-top: 1.5px solid rgba(255, 255, 255, 0.2);
  width: 60%;
  max-width: 340px;
}
