/* ============================================
   Sky Relics — screen.css
   Shared stylesheet for all pages
   ============================================ */

/* --- Reset --- */
:root { color-scheme: light dark; }
* { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Base --- */
body {
  background: #222;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Lift all page content above the background slides */
body > *:not(.bg-slideshow):not(.lightbox-overlay) {
  position: relative;
  z-index: 1;
}

/* --- Background slideshow --- */
.bg-slideshow {
  position: fixed;
  left: 0; right: 0; top: -15%; height: 130%;
  z-index: 0;
  opacity: var(--bg-slide-opacity, 1);
  mix-blend-mode: var(--bg-slide-blend, normal);
  overflow: hidden;
}

.bg-slide {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 3s ease;
  animation: bg-slide-pan 30s linear infinite;
}

.bg-slide.active { opacity: 1; }

@media (max-width: 600px) {
  .bg-slideshow { display: none; }
}

@keyframes bg-slide-pan {
  from { transform: translateY(-7.5%) }
  to   { transform: translateY(7.5%) }
}

/* --- Page header --- */
.page-header {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.page-header h1 {
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #fff;
}

.page-header p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #888;
  letter-spacing: 0.1em;
}

.page-header .header-logo {
  height: auto;
  width: 60px;
  margin-bottom: 1rem;
}
@media (prefers-color-scheme: dark) {
  .page-header .header-logo { filter: invert(1); }
}

/* --- Section title --- */
.section-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #888;
  margin: 2rem 0 1.5rem;
}

/* --- Photo grid --- */
.photo-grid {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 1100px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .photo-grid { grid-template-columns: 1fr; } }

.photo-grid-item {
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.photo-grid-item img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.photo-grid-item:hover img {
  transform: scale(1.03);
  filter: brightness(1.1);
}

/* --- Lightbox overlay --- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.95);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-overlay.active { display: flex; }

/* Image viewer area */
.lightbox-viewer {
  position: relative;
  width: 92vw;
  height: 84vh;
  flex-shrink: 0;
}

.lightbox-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox-viewer img.loaded { opacity: 1; }
.lightbox-viewer img.crossfade-out { transition: opacity 0.4s ease; }

/* Mouse zoom (desktop only) */
@media (hover: hover) {
  .lightbox-viewer {
    overflow: hidden;
    cursor: zoom-in;
  }

  .lightbox-viewer.zoomed {
    cursor: none;
  }

  .lightbox-viewer img {
    transform-origin: 0 0;
  }
}

/* Loading spinner */
.lightbox-spinner {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: #999;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: #aaa;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  z-index: 1001;
  transition: color 0.2s;
}

.lightbox-close:hover { color: #fff; }

/* Prev / next arrows */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  color: #aaa;
  cursor: pointer;
  background: none;
  border: none;
  padding: 1rem;
  z-index: 1001;
  transition: color 0.2s;
  user-select: none;
}

.lightbox-nav:hover { color: #fff; }
.lightbox-nav-prev { left: 0.5rem; }
.lightbox-nav-next { right: 0.5rem; }

/* Bottom toolbar: meta, counter, download */
.lightbox-toolbar {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}

.lightbox-meta {
  font-size: 0.85rem;
  color: #999;
  letter-spacing: 0.15em;
}

.lightbox-counter {
  font-size: 0.85rem;
  color: #777;
  letter-spacing: 0.15em;
}

.lightbox-download {
  font-size: 0.85rem;
  color: #d0e8d0;
  text-decoration: none;
  letter-spacing: 0.1em;
  background: #1a3a1a;
  border: 1px solid #2a5a2a;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.lightbox-download:hover {
  color: #fff;
  background: #254d25;
  border-color: #3a7a3a;
}

/* --- Video embed (16:9) --- */
.video-player {
  max-width: 960px;
  width: 100%;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.video-player-frame {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 6px;
}

.video-player-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Project copy --- */
.project-copy,
.project-note {
  max-width: 920px;
  width: 100%;
  margin: 0 auto 2rem;
  padding: 0 1rem;
  text-align: center;
}

.project-copy {
  color: #aaa;
  line-height: 1.8;
}

.project-copy p + p,
.project-note p + p {
  margin-top: 0.9rem;
}

.project-note {
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.project-note h2 {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 0.8rem;
}

.project-note p {
  color: #aaa;
  line-height: 1.8;
}

.project-note a {
  color: inherit;
  text-decoration-color: rgba(255,255,255,0.35);
}

.project-media-grid,
.project-download-grid {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 2rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.project-media-card,
.project-download-card {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.project-media-card video {
  width: 100%;
  display: block;
  background: rgba(0,0,0,0.35);
}

.project-media-card-body,
.project-download-card {
  padding: 1rem;
}

.project-media-card h3,
.project-download-card h3 {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.project-media-card p,
.project-download-card p {
  margin-top: 0.6rem;
  color: #999;
  line-height: 1.7;
  font-size: 0.9rem;
}

.project-media-actions,
.project-download-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.project-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.55rem 0.9rem;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.04);
  color: #ddd;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.project-action-link:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}

/* --- Service cards (homepage) --- */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 800px;
  width: 100%;
}

@media (max-width: 600px) {
  .service-grid { grid-template-columns: 1fr; }
}

.service-card {
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  text-align: left;
  transition: border-color 0.3s, backdrop-filter 0.3s;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.service-card:hover {
  border-color: #666;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}

.service-card h2 {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 0.6rem;
}

.service-card p {
  font-size: 0.9rem;
  color: #888;
  line-height: 1.6;
}

/* --- Page footer --- */
.page-footer {
  margin-top: auto;
  text-align: center;
  padding: 3rem 1rem;
  color: #999;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.page-footer p {
  padding: 0.4rem 0;
}

.page-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: none;
}

.inline-logo {
  filter: invert(1);
}

/* --- Generic action button ---
   Capsule-rounded pill with backdrop-blur, lift-on-hover, press-on-click.
   Add `.revealed` to swap to a monospace, selectable label — used when the
   button reveals a value the user might want to read or copy. */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 1rem 2.6rem;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 4px 14px rgba(0,0,0,0.45),
    0 1px 3px rgba(0,0,0,0.3);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.12s ease;
}
.btn:hover,
.btn:focus-visible {
  background: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 10px 24px rgba(0,0,0,0.5),
    0 2px 6px rgba(0,0,0,0.35);
  outline: none;
}
.btn:active {
  transform: translateY(1px);
  background: rgba(255,255,255,0.12);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 2px 6px rgba(0,0,0,0.4);
  transition-duration: 0.05s;
}
.btn.revealed {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  user-select: text;
  -webkit-user-select: text;
}

/* --- Light mode --- */
@media (prefers-color-scheme: light) {
  body {
    background-color: #ccc;
    color: #222;
  }

  .page-header h1 { color: #000; text-shadow: none; }
  .page-header p { color: #444; }
  .section-title { color: #333; }
  .page-footer { color: #333; }
  .inline-logo { filter: none; }

  .service-card {
    border-color: rgba(0,0,0,0.15);
    background: rgba(255,255,255,0.6);
  }

  .project-copy { color: #444; }
  .project-note {
    border-color: rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.6);
  }
  .project-note h2 { color: #111; }
  .project-note p { color: #444; }
  .project-media-card,
  .project-download-card {
    border-color: rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.6);
  }
  .project-media-card h3,
  .project-download-card h3 { color: #111; }
  .project-media-card p,
  .project-download-card p { color: #444; }
  .project-action-link {
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.12);
    color: #222;
  }
  .project-action-link:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(0,0,0,0.2);
    color: #000;
  }

  .service-card h2 { color: #111; }
  .service-card p { color: #444; }
  .service-card:hover { border-color: #999; }

  .lightbox-meta { color: #444; }
  .lightbox-counter { color: #555; }

  .btn {
    background: #111;
    color: #fff;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.08) inset,
      0 4px 14px rgba(0,0,0,0.25),
      0 1px 3px rgba(0,0,0,0.18);
  }
  .btn:hover,
  .btn:focus-visible {
    background: #000;
    color: #fff;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.12) inset,
      0 10px 24px rgba(0,0,0,0.32),
      0 2px 6px rgba(0,0,0,0.22);
  }
  .btn:active {
    background: #222;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.05) inset,
      0 2px 6px rgba(0,0,0,0.25);
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .photo-grid-item img,
  .photo-grid-item:hover img,
  .lightbox-viewer img,
  .lightbox-viewer img.crossfade-out,
  .lightbox-close,
  .lightbox-nav,
  .lightbox-download,
  .bg-slide {
    transition-duration: 0s !important;
  }

  .bg-slide { animation: none !important; }
  .lightbox-spinner { animation-duration: 2.4s !important; }

  .btn { transition: none; }
  .btn:hover,
  .btn:focus-visible,
  .btn:active { transform: none; }
}
