@import url('https://fonts.googleapis.com/css?family=Arapey:400italic');

:root {
  --page-bg: #0a0a0a;
  --page-fg: #242424;
  --accent: turquoise;

  /* JS will overwrite --tile-gap and --row-overlap at runtime.
     These are just sensible defaults so nothing breaks before JS runs. */
  --tile-size: 220px;   /* Change this to set your desired hex size */
  --tile-gap: 10px;
  --row-overlap: 58px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }

body {
  background: var(--page-bg);
  color: var(--page-fg);
  -webkit-font-smoothing: antialiased;
  font-family: Arial, sans-serif;
}

.page {
  padding: 20px 0 100px 3vw;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  padding: 0 20px;
}

.topbar h1 {
  margin: 0;
  font-family: 'Arapey', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.meta {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.6);
}

/* Gallery fills full width — no max-width, no centering padding */
.hex-gallery {
  display: flex;
  flex-direction: column;
  align-items: flex-start;   /* rows start from the left */
  width: 100%;
  overflow: hidden;
}

.hex-row {
  display: flex;
  gap: var(--tile-gap);
  margin-top: calc(var(--row-overlap) * -1);
  flex-shrink: 0;
}

.hex-row:first-child {
  margin-top: 0;
}

/* Offset rows shift right by half a tile so they interlock */
.hex-row.offset {
  transform: translateX(calc((var(--tile-size) / 2) + (var(--tile-gap) / 2)));
}

.hex-cell {
  width: var(--tile-size);
  height: calc(var(--tile-size) * 1.1547);
  position: relative;
  flex: 0 0 auto;
}

.hex-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  -webkit-clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #fff;
}

.hex-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.hex-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.45), rgba(0,0,0,0.08));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hex-overlay h2 {
  margin: 0;
  font-family: 'Arapey', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.hex-cell:hover .hex-media { transform: scale(1.04); }
.hex-cell:hover .hex-overlay { opacity: 1; }

.hex-overlay-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hex-date {
  font-size: 13px;
  line-height: 1.2;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.28);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(0,0,0,0.78);
  z-index: 9999;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  border-radius: 10px;
  background: #111;
}

.lightbox video.lightbox-media {
  width: auto;
  height: auto;
}

.lightbox-meta {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  backdrop-filter: blur(8px);
}

.lightbox-title {
  font-family: 'Arapey', serif;
  font-style: italic;
  font-size: 26px;
  line-height: 1.05;
}

.lightbox-date {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(255,255,255,0.72);
}

.lightbox-open-original {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 56px;
  border: 0;
  border-radius: 0 12px 12px 0;
  background: #22c7c9;
  color: #062b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

.lightbox-open-original svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 559px) {
  .hex-date {
    font-size: 11px;
  }

  .lightbox-open-original {
    right: 8px;
    top: auto;
    bottom: 8px;
    transform: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
  }

  .lightbox-meta {
    left: 8px;
    right: 60px;
    bottom: 8px;
  }

  .lightbox-title {
    font-size: 22px;
  }
}





@media (min-width: 1401px) {
  :root { --tile-size: 450px; }
}

@media (max-width: 1400px) {
  :root { --tile-size: 370px; }
}

@media (max-width: 1100px) {
  :root { --tile-size: 300px; }
}

@media (max-width: 900px) {
  :root { --tile-size: 200px; }
}

@media (max-width: 559px) {
  :root { --tile-size: 150px; }

  .page {
    padding: 14px 8px 60px 8px;
  }

  .hex-gallery {
    align-items: flex-start;  /* ← NOT center, this fights with translateX */
    padding-left: calc(
      (100vw - 2 * var(--tile-size) - var(--tile-gap)) / 2
    );                        /* ← center the 2-column group via padding instead */
  }

  .hex-row {
    justify-content: flex-start;
  }

  .topbar { flex-direction: column; align-items: flex-start; }
  .hex-overlay h2 { font-size: 18px; }
}