/* ========================================
   relativity.studio — Styles
   ======================================== */

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --canvas: #f5f0e8;
  --surface: #e8e2d8;
  --accent-primary: #3d8b8b;
  --accent-secondary: #6b9e8a;
  --deep: #1a1f2e;
  --text-primary: #2a2a3a;
  --text-secondary: #6a7a8a;
  --text-body: #3a3a4a;
  --glitch-red: #e85a5a;
  --glitch-blue: #5a7ae8;
  --highlight: #c8e8e0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Libre Baskerville', serif;
  background-color: var(--canvas);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Marble background layer */
#marble-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: url(#marble-bg);
  pointer-events: none;
  z-index: 0;
}

/* Cursor trail container */
#cursor-trail {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.glitch-fragment {
  position: fixed;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease-out;
  z-index: 9999;
}

.glitch-fragment.fade {
  opacity: 0;
}

/* ========================================
   Signature Stamp
   ======================================== */
#signature-stamp {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: default;
}

.stamp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  animation: stamp-pulse 3s ease-in-out infinite;
}

@keyframes stamp-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

.stamp-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

#signature-stamp:hover .stamp-text {
  opacity: 1;
}

/* ========================================
   Hero — The Threshold
   ======================================== */
#hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  overflow: hidden;
}

.hero-wordmark {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(4rem, 12vw, 10rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.hero-dot {
  color: var(--accent-primary);
}

.hero-fern {
  position: absolute;
  bottom: 5vh;
  right: 10vw;
  width: clamp(120px, 15vw, 220px);
  opacity: 0.6;
  animation: fern-drift 12s ease-in-out infinite;
}

@keyframes fern-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-10px) rotate(1deg); }
  50% { transform: translateY(-5px) rotate(-0.5deg); }
  75% { transform: translateY(-12px) rotate(0.8deg); }
}

/* ========================================
   Gallery — The Portfolio Grid
   ======================================== */
#gallery {
  position: relative;
  z-index: 1;
  padding: clamp(4rem, 8vw, 8rem) 0;
}

.gallery-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(2rem, 5vw, 6rem);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
}

.grid-cell {
  grid-column: span 2;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.grid-cell.visible {
  opacity: 1;
  transform: translateY(0);
}

.grid-cell.span-1-col { grid-column: span 1; }
.grid-cell.span-2-col { grid-column: span 2; }
.grid-cell.span-3-col { grid-column: span 3; }
.grid-cell.span-2-row { grid-row: span 2; }

.cell-frame {
  position: relative;
  border: 2px solid var(--surface);
  background: rgba(245, 240, 232, 0.5);
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              border-color 0.3s ease;
  cursor: default;
  overflow: hidden;
}

.cell-frame:hover {
  transform: skewX(1.5deg);
  border-color: var(--accent-primary);
}

.cell-frame:hover .botanical-svg {
  filter: url(#glitch-intense);
}

.botanical-svg {
  width: 100%;
  flex: 1;
  min-height: 0;
  transition: filter 0.3s ease;
}

.cell-info {
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cell-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.cell-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  color: var(--text-primary);
}

/* Chromatic aberration on hover */
.cell-frame:hover .botanical-svg {
  animation: chromatic-shift 0.3s ease-out;
}

@keyframes chromatic-shift {
  0% { filter: url(#glitch-subtle); }
  50% { filter: url(#glitch-intense); }
  100% { filter: url(#glitch-intense); }
}

/* ========================================
   About — The Inscription
   ======================================== */
#about {
  position: relative;
  z-index: 1;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4rem, 8vw, 8rem) 2rem;
}

.about-container {
  max-width: 640px;
  position: relative;
}

.glitch-band {
  position: absolute;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  height: 3px;
  top: 40%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--glitch-red) 20%,
    var(--glitch-blue) 50%,
    var(--accent-primary) 80%,
    transparent 100%
  );
  opacity: 0.4;
  animation: band-drift 20s linear infinite;
  pointer-events: none;
}

@keyframes band-drift {
  0% { top: 20%; }
  100% { top: 80%; }
}

.about-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.about-text.secondary {
  font-family: 'Libre Baskerville', serif;
  font-style: normal;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  line-height: 1.75;
  color: var(--text-body);
}

.about-line {
  display: block;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.about-line.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   Footer — The Colophon
   ======================================== */
#colophon {
  position: relative;
  z-index: 1;
  min-height: 40vh;
  background-color: var(--deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  overflow: hidden;
}

.footer-tendril {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 300px;
  pointer-events: none;
}

.tendril-svg {
  width: 100%;
  height: 100%;
}

.tendril-path path {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  transition: stroke-dashoffset 2s ease-out;
}

.tendril-path.animate path {
  stroke-dashoffset: 0;
}

.footer-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-name {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: #c8d8e4;
  text-transform: lowercase;
}

.footer-email {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #8a9aaa;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cell.span-3-col { grid-column: span 3; }
  .grid-cell.span-2-col { grid-column: span 2; }
  .grid-cell.span-1-col { grid-column: span 1; }
  .grid-cell.span-2-row { grid-row: span 1; }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .grid-cell,
  .grid-cell.span-1-col,
  .grid-cell.span-2-col,
  .grid-cell.span-3-col {
    grid-column: span 1;
  }
  .hero-wordmark {
    text-shadow:
      -1px 0 var(--glitch-red),
      1px 0 var(--glitch-blue);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #cursor-trail { display: none; }
}
