/* Global reset + single-font brutalist base. */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: only light;
}

/* Overall page layout and neutral gray background. */
body {
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: 1.5;
  background: #9c9c9c;
  position: relative;
  color: #2b2b2b;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #9d9d9d 0%, #939da1 74.67%, #8f8d9f 100%);
  opacity: 1;
  transition: opacity 1.6s ease;
}

body.is-ready::before {
  opacity: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

a {
  color: inherit;
  text-decoration: underline;
}

ul {
  list-style: none;
  padding-left: 0;
}

li::before {
  content: "~ ";
}

code {
  font-family: "Times New Roman", Times, serif;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.site-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.logo {
  font-weight: normal;
}

/* Grid tiles with square cells on desktop. */
.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  grid-auto-rows: minmax(0, 1fr);
  grid-auto-flow: dense;
  position: relative;
}

.sections.is-physics {
  display: block;
}

/* Each tile is a square viewport for scrolling content. */
.section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease;
  cursor: grab;
  pointer-events: none;
}

.section.is-dragging {
  cursor: grabbing;
}

/* Hide tiles until JS finishes hydration. */
body.is-loading .section {
  opacity: 1;
}

.section--empty {
  padding: 0;
  min-height: 0;
}

/* Helium-like hover/press float. */
.section.is-float {
  transform: translateY(-8px);
  animation: helium-bob 3.5s ease-in-out infinite;
}

/* Content block, padded to create the looping gap. */
.section-content {
  column-count: 1;
  column-gap: 0;
  pointer-events: auto;
  padding: 6px 0;
  opacity: 0;
  animation: content-fade 1.6s ease forwards;
  animation-delay: 0.6s;
}

.section-content--image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0;
  pointer-events: auto;
}

.section-content--image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.4s ease;
}

.section--image:hover .section-content--image img {
  filter: grayscale(0%);
}

.section--image {
  padding: 0;
}

/* Helium bobbing motion. */
@keyframes helium-bob {
  from {
    transform: translateY(-6px);
  }
  to {
    transform: translateY(-10px);
  }
}

@keyframes footer-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes content-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.section-content p,
.section-content ul {
  margin-bottom: 12px;
  break-inside: avoid;
}

.section-meta {
  display: flex;
  gap: 12px;
  text-transform: uppercase;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  opacity: 0;
}

body.is-ready .site-footer {
  animation: footer-fade 2.5s ease forwards;
  animation-delay: 2s;
}

body.image-overlay-open {
  overflow: hidden;
}

.image-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(160, 160, 160, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.image-overlay.is-open {
  opacity: 1;
}

.image-overlay img {
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}

@media (max-width: 900px) {
  .sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-content {
    column-count: 1;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
    padding: 8px;
  }

  .sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 420px) {
  body {
    padding: 16px;
    font-size: 16px;
  }

  .sections {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section {
    animation: none;
    transform: none;
  }

  .section-content {
    animation: none;
    opacity: 1;
  }

  .site-footer {
    animation: none;
    opacity: 1;
  }
}
