/* mad.ac + diegator hybrid */
:root {
  --bg-color: #faf6eb;
  --card-bg: #ffffff;
  --text-primary: #111313;
  --text-muted: #4b5353;
  --border-color: #d8dcdc;
  --header-height: 56px;
  --dot-color: rgba(17, 19, 19, 0.1);
  --dot-size: 1.5px;
  --dot-space: 20px;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Helvetica, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-color);
  line-height: 1.1;
  letter-spacing: -0.2px;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'SF Mono', 'InputMono', 'Courier New', Courier, monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.32px;
  text-transform: uppercase;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.6;
}

/* Animations */
@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

/* Global Header (Diegator Style) */
header.global-nav {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  box-sizing: border-box;
  z-index: 100;
}

header.global-nav.transparent-header {
  background-color: transparent;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand span:first-child {
  font-weight: bold;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.brand span:last-child {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links nav a {
  position: relative;
  margin-left: 24px;
}

/* Sliding underline animation */
.nav-links nav a::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 1px;
  bottom: -2px;
  left: 0;
  background-color: var(--text-primary);
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.nav-links nav a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* Base Main Layout */
main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
  box-sizing: border-box;
}

/* Homepage Grid (Diegator Style) */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

.project-card {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  /* Brutalist minimal radius */
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: background-color 0.3s;
}

/* Gradient background placeholders for cards */
.project-card:nth-child(1) {
  background: linear-gradient(135deg, #e0eafc, #cfdef3);
}

.project-card:nth-child(2) {
  background: linear-gradient(135deg, #e8cbc0, #636fa4);
}

.project-card:nth-child(3) {
  background: linear-gradient(135deg, #FFEFBA, #FFFFFF);
}

.project-title-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.85);
  /* Hover overlay */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-title-layer {
  opacity: 1;
}

.project-title-layer h2 {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: -1px;
}

.project-title-layer p {
  margin-top: 8px;
  color: var(--text-muted);
}

/* Standard Single Page Content (CV & internal PF) */
.page-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 24px;
}

.content-box {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 60px;
  border-radius: 4px;
}

/* Typography for content */
.content-box h2 {
  font-weight: bold;
  font-size: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-top: 40px;
  margin-bottom: 24px;
}

.content-box h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.content-box p {
  line-height: 1.5;
  margin-bottom: 16px;
  font-size: 15px;
}

.job-meta {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.job-meta span {
  color: var(--text-muted);
}

.content-box ul {
  padding-left: 20px;
  line-height: 1.5;
  font-size: 15px;
}

.content-box li {
  margin-bottom: 8px;
}

/* Buttons */
.btn-outline {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-outline:hover {
  background-color: var(--text-primary);
  color: var(--card-bg);
}

/* Scatter Interactions */
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  width: 100%;
  max-width: 1000px;
}

.scatter-btn {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  background-color: transparent;
  cursor: pointer;
  overflow: visible;
  gap: 16px;
}

.scatter-btn .btn-label {
  position: relative;
  z-index: 10;
  font-size: 14px;
  font-weight: 700;
  background-color: transparent;
  color: var(--text-muted);
  transition: color 0.3s;
}

.scatter-btn:hover .btn-label {
  color: var(--text-primary);
}

.dots-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  /* Forces square space for math scattering */
  pointer-events: none;
  /* Ignore pointer so primary link retains anchor behavior safely */
}

/* New Physical Background Dots */
.grid-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 50%;
  opacity: 0.25;
  transition: transform 2.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 2.5s ease;
  will-change: transform, opacity;
}

/* ─── Tablet ─── */
@media (max-width: 800px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }

  .grid-3col {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 600px;
  }

  header.global-nav {
    padding: 16px 20px;
    height: auto;
    gap: 8px;
  }

  main {
    padding: 32px 20px;
  }

  .content-box {
    padding: 32px;
  }

  .page-title {
    font-size: 36px;
  }

  .scatter-btn .dots-container {
    max-width: 180px;
    margin: 0 auto;
  }
}

/* ─── Mobile ─── */
@media (max-width: 520px) {
  html {
    scroll-snap-type: y mandatory;
  }

  .grid-2col {
    grid-template-columns: 1fr;
  }

  .grid-3col {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
  }

  /* Each scatter button fills the full viewport height distinctly */
  .scatter-btn {
    height: 100vh;
    min-height: 100vh;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    justify-content: center;
    align-items: center;
    gap: 24px;
    box-sizing: border-box;
  }

  .scatter-btn .dots-container {
    width: 70vw;
    max-width: 280px;
    margin: 0 auto;
  }

  .scatter-btn .btn-label {
    font-size: 16px;
    letter-spacing: 1px;
  }

  header.global-nav {
    padding: 14px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
    gap: 6px;
  }

  .brand span:first-child {
    font-size: 16px;
  }

  .brand span:last-child {
    font-size: 10px;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links nav a {
    margin-left: 16px;
    font-size: 12px;
  }

  .mono {
    font-size: 12px;
  }

  main {
    padding: 0;
  }

  .content-box {
    padding: 20px;
  }

  .page-title {
    font-size: 28px;
    margin-bottom: 16px;
  }

  /* Job meta stacks on very narrow screens */
  .job-meta {
    flex-direction: column;
    gap: 4px;
  }

  .job-meta h3 {
    font-size: 14px;
  }

  .job-meta span {
    font-size: 12px;
  }

  .content-box h2 {
    font-size: 16px;
    margin-top: 28px;
    margin-bottom: 16px;
  }

  .content-box p,
  .content-box ul {
    font-size: 14px;
  }

  .btn-outline {
    padding: 10px 18px;
    font-size: 13px;
  }

  /* Reduce dot grid density on mobile for performance */
  .grid-dot {
    width: 1.5px;
    height: 1.5px;
  }
}