:root {
  --bg-color: #e8f0f6;
  --dark: #1a1a18;
  --grey: #c4d0da;
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  width: 100%;
  background-color: var(--bg-color);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  color: var(--dark);
  font-family: 'DM Sans', sans-serif;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  padding: 1em 1.5em;
  background-color: var(--bg-color);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  border-bottom: 1px solid var(--grey);
  height: 54px;
}

.navbar_inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.navbar_wrapper {
  display: flex;
  gap: 2em;
  align-items: center;
}

.nav-link {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--dark);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.nav-link:hover {
  opacity: 1;
}

.aerogramme-wordmark {
  font-family: 'Knewave', cursive;
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--dark);
  text-decoration: none;
  line-height: 1;
}

/* Grid */
.canvas-wrapper {
  width: 100%;
  margin-top: 54px;
  background-color: var(--bg-color);
}

.canvas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 320px;
  gap: 32px;
  padding: 60px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Paper Grain Overlay */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='8' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.6  0 0 0 0 0.75  0 0 0 0 0.85  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 400px 400px;
  mix-blend-mode: multiply;
}


/* Stamps */
.stamp {
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stamp img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stamp:hover {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.28));
}


/* Detail View - Left Half Split Screen */
.detail {
  position: fixed;
  top: 54px;
  left: 0;
  width: 50%;
  height: calc(100vh - 54px);
  background-color: var(--bg-color);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  visibility: hidden;
  z-index: 9999;
  opacity: 0;
}

.detail-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 80px;
  box-sizing: border-box;
}

/* Fixed frame for stamp image */
.detail-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  outline: none;
  box-shadow: none;
}

.detail-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  box-shadow: none;
}

.detail .content {
  position: absolute;
  bottom: 60px;
  right: 60px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  color: var(--dark);
  line-height: 1.8;
  max-width: 300px;
  overflow: hidden;
}

.detail-country,
.detail-year,
.detail-event {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Vertical Divider */
.divider {
  position: fixed;
  top: 54px;
  left: 50%;
  width: 1px;
  height: calc(100vh - 54px);
  background: #000;
  visibility: hidden;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
}

/* Close Button */
.close-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 51px;
  height: 51px;
  background-color: var(--bg-color);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  border: 1px solid var(--dark);
  border-radius: 4px;
  cursor: pointer;
  font-size: 19px;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  z-index: 10000;
  opacity: 0;
  transition: none;
  padding: 10px;
}

.close-btn:hover {
  background-color: var(--dark);
  color: var(--bg-color);
}

/* Info Pages */
.info-page {
  width: 100%;
  min-height: 100vh;
  background-color: #ffffff;
  padding: 80px;
  box-sizing: border-box;
  scroll-behavior: smooth;
  opacity: 0;
}

.info-page-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* Footer */
.site-footer {
  width: 100%;
  padding: 1.6em 1.5em;
  border-top: 1px solid var(--grey);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  font-size: 0.78rem;
  opacity: 0.45;
}

.footer-link {
  color: var(--dark);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 0.8;
}

.footer-sep {
  opacity: 0.5;
}
