/* ========================================
   LAYOUT SYSTEM
   Structure, Grid, and Spacing Utilities
   ======================================== */

/* 
   NOTE: This file manages all structural aspects of the site.
   - Spacing (Variables & Utilities)
   - Grid System
   - Flexbox Utilities
   - Container & Section Wrappers
*/

/* 1. SPACING SCALE (Tighter) */
:root {
  --tight-xs: 4px;
  --tight-sm: 8px;
  --tight-md: 12px;
  --tight-lg: 16px;
  --tight-xl: 24px;

  /* Inherited from system.css but useful to reference here for layout logic */
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --space-xl: 64px;
}

/* 2. CONTAINERS */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2vw, 24px);
}

.container-wide {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* 3. SECTIONS */
.section {
  padding: clamp(24px, 4vw, 48px) 0;
}

.section-tight {
  padding: var(--tight-xl) 0;
}

.section-normal {
  padding: var(--space-lg) 0;
}

.section-spacious {
  padding: var(--space-xl) 0;
}

/* 4. GRID SYSTEM */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Portfolio Grid (Atelier Axis) */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}

.work-card {
  height: 320px;
  background: var(--line);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.work-card.featured {
  /* No special spanning in simple grid */
}

.work-card .skeleton-loader {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}


/* 5. FLEXBOX UTILITIES */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

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

.justify-end {
  justify-content: flex-end;
}

/* 6. SPACING UTILITIES (Padding/Margin) */
/* Padding */
.p-0 {
  padding: 0;
}

.p-xs {
  padding: var(--tight-xs);
}

.p-sm {
  padding: var(--tight-sm);
}

.p-md {
  padding: var(--tight-md);
}

.p-lg {
  padding: var(--tight-lg);
}

.p-xl {
  padding: var(--tight-xl);
}

.px-0 {
  padding-left: 0;
  padding-right: 0;
}

.px-sm {
  padding-left: var(--tight-sm);
  padding-right: var(--tight-sm);
}

.px-md {
  padding-left: var(--tight-md);
  padding-right: var(--tight-md);
}

.px-lg {
  padding-left: var(--tight-lg);
  padding-right: var(--tight-lg);
}

.py-0 {
  padding-top: 0;
  padding-bottom: 0;
}

.py-sm {
  padding-top: var(--tight-sm);
  padding-bottom: var(--tight-sm);
}

.py-md {
  padding-top: var(--tight-md);
  padding-bottom: var(--tight-md);
}

.py-lg {
  padding-top: var(--tight-lg);
  padding-bottom: var(--tight-lg);
}

.pt-sm {
  padding-top: var(--tight-sm);
}

.pt-md {
  padding-top: var(--tight-md);
}

.pt-lg {
  padding-top: var(--tight-lg);
}

.pb-sm {
  padding-bottom: var(--tight-sm);
}

.pb-md {
  padding-bottom: var(--tight-md);
}

.pb-lg {
  padding-bottom: var(--tight-lg);
}

.pl-sm {
  padding-left: var(--tight-sm);
}

.pl-md {
  padding-left: var(--tight-md);
}

.pl-lg {
  padding-left: var(--tight-lg);
}

.pr-sm {
  padding-right: var(--tight-sm);
}

.pr-md {
  padding-right: var(--tight-md);
}

.pr-lg {
  padding-right: var(--tight-lg);
}

/* Margin */
.m-0 {
  margin: 0;
}

.m-xs {
  margin: var(--tight-xs);
}

.m-sm {
  margin: var(--tight-sm);
}

.m-md {
  margin: var(--tight-md);
}

.m-lg {
  margin: var(--tight-lg);
}

.m-xl {
  margin: var(--tight-xl);
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.mx-0 {
  margin-left: 0;
  margin-right: 0;
}

.mx-sm {
  margin-left: var(--tight-sm);
  margin-right: var(--tight-sm);
}

.mx-md {
  margin-left: var(--tight-md);
  margin-right: var(--tight-md);
}

.my-0 {
  margin-top: 0;
  margin-bottom: 0;
}

.my-sm {
  margin-top: var(--tight-sm);
  margin-bottom: var(--tight-sm);
}

.my-md {
  margin-top: var(--tight-md);
  margin-bottom: var(--tight-md);
}

.my-lg {
  margin-top: var(--tight-lg);
  margin-bottom: var(--tight-lg);
}

.my-xl {
  margin-top: var(--tight-xl);
  margin-bottom: var(--tight-xl);
}

.mt-0 {
  margin-top: 0;
}

.mt-sm {
  margin-top: var(--tight-sm);
}

.mt-md {
  margin-top: var(--tight-md);
}

.mt-lg {
  margin-top: var(--tight-lg);
}

.mt-xl {
  margin-top: var(--tight-xl);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-sm {
  margin-bottom: var(--tight-sm);
}

.mb-md {
  margin-bottom: var(--tight-md);
}

.mb-lg {
  margin-bottom: var(--tight-lg);
}

.mb-xl {
  margin-bottom: var(--tight-xl);
}

.ml-0 {
  margin-left: 0;
}

.ml-sm {
  margin-left: var(--tight-sm);
}

.ml-md {
  margin-left: var(--tight-md);
}

.ml-lg {
  margin-left: var(--tight-lg);
}

.ml-xl {
  margin-left: var(--tight-xl);
}

.mr-sm {
  margin-right: var(--tight-sm);
}

.mr-md {
  margin-right: var(--tight-md);
}

.mr-lg {
  margin-right: var(--tight-lg);
}

/* Gap */
.gap-0 {
  gap: 0;
}

.gap-xs {
  gap: var(--tight-xs);
}

.gap-sm {
  gap: var(--tight-sm);
}

.gap-md {
  gap: var(--tight-md);
}

.gap-lg {
  gap: var(--tight-lg);
}

.gap-xl {
  gap: var(--tight-xl);
}


/* 7. SEMANTIC LAYOUT WRAPPERS */
.page-header {
  padding: 0;
  border-bottom: none;
}

/* ALIEN STRIP - Aged Parchment Inspiration (hidden by default, use world-strip instead) */
#alien-strip-container {
  display: none;
  width: 100%;
  max-width: 100vw;
  /* Prevent sideways spill */
  height: clamp(100px, 20vh, 180px);
  /* Responsive height */
  background-color: #e8dcc4;
  /* Warmer aged paper */
  /* Heavy vignette + subtle grain texture */
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0) 40%, rgba(60, 40, 20, 0.25) 100%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  overflow: hidden;
  position: relative;
  border-bottom: 4px solid #4a3b2e;
  border-top: 2px solid #c8b9a1;
  margin-top: -3px;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.1);
}

#alien-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  /* Sepia and Contrast to match charcoal on aged paper */
  filter: contrast(120%) sepia(40%) brightness(95%);
  cursor: crosshair;
}

@media (max-width: 768px) {
  #alien-strip-container {
    height: 100px;
    /* Slimmer for mobile height */
    overflow-x: hidden;
  }
}

/* WORLD PANORAMA STRIP - Journey through landscapes */
#world-strip {
  width: 100%;
  height: 50px;
  overflow: hidden;
  position: relative;
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.world-panorama {
  height: 100%;
  min-width: 200vw;
  flex-shrink: 0;
  animation: world-scroll 120s linear infinite;
  will-change: transform;
}

.world-panorama:nth-child(2) {
  margin-left: -1px; /* seamless join */
}

@keyframes world-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-200vw); }
}

/* Pause on hover for exploration */
#world-strip:hover .world-panorama {
  animation-play-state: paused;
}

@media (max-width: 768px) {
  #world-strip {
    height: 40px;
  }
  .world-panorama {
    min-width: 300vw;
    animation-duration: 80s;
  }
  @keyframes world-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-300vw); }
  }
}

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

/* ========================================
   STUDIO SOUNDS - Audio Player UI
   ======================================== */

.studio-audio-player {
  background: var(--panel);
  border: 4px solid var(--ink);
  /* Brutalist border */
  padding: var(--space-md);
  box-shadow: 6px 6px 0 var(--accent);
  /* Solid offset shadow */
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.studio-audio-player:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--accent);
}

.player-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-md);
  align-items: center;
}

.play-pause-btn {
  width: 48px;
  height: 48px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s, transform 0.1s;
}

.play-pause-btn:hover {
  background: var(--accent);
}

.play-pause-btn:active {
  transform: scale(0.95);
}

.play-pause-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.progress-bar-container {
  flex: 1;
  height: 4px;
  background: var(--line);
  position: relative;
  border-radius: 2px;
  cursor: pointer;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 2px;
  pointer-events: none;
}

.progress-slider {
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 24px;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.waveform-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 32px;
  padding: 0 4px;
}

.waveform-visualizer .bar {
  width: 3px;
  height: 20%;
  background: var(--ink);
  opacity: 0.3;
  transition: height 0.2s ease;
}

.studio-audio-player.playing .bar {
  animation: studio-wave 0.6s infinite alternate ease-in-out;
  opacity: 1;
  background: var(--accent);
}

.studio-audio-player.playing .bar:nth-child(2) {
  animation-delay: 0.1s;
}

.studio-audio-player.playing .bar:nth-child(3) {
  animation-delay: 0.2s;
}

.studio-audio-player.playing .bar:nth-child(4) {
  animation-delay: 0.3s;
}

.studio-audio-player.playing .bar:nth-child(5) {
  animation-delay: 0.4s;
}

.studio-audio-player.playing .bar:nth-child(6) {
  animation-delay: 0.1s;
}

.studio-audio-player.playing .bar:nth-child(7) {
  animation-delay: 0.2s;
}

.studio-audio-player.playing .bar:nth-child(8) {
  animation-delay: 0.3s;
}

@keyframes studio-wave {
  from {
    height: 20%;
  }

  to {
    height: 100%;
  }
}

.hidden {
  display: none !important;
}

.page-body {
  min-height: calc(100vh - 200px);
  padding: var(--tight-xl) 0;
}

/* 8. HELPER UTILITIES */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.hidden {
  display: none;
}

.border {
  border: 1px solid var(--line);
}

.border-accent {
  border: 1px solid var(--accent);
}

.object-cover {
  object-fit: cover;
}

.object-contain {
  object-fit: contain;
}

/* 9. RESPONSIVE UTILITIES */
@media (max-width: 768px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .section {
    padding: var(--space-lg) 0;
  }
}