/* ============================================================
   Archive page (archive.html): an endless, curved wall of glass tiles.
   archive.js builds and moves the tiles; this file styles them.
   ============================================================ */

:root {
  /* the thick-glass edge: a bright lip on top and a faint colour fringe on the sides */
  --rim:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
    inset 0 16px 26px -18px rgba(255, 255, 255, 0.75),
    inset 9px 0 14px -10px rgba(255, 70, 140, 0.55),
    inset -9px 0 14px -10px rgba(70, 190, 255, 0.55),
    inset 0 -12px 18px -12px rgba(255, 210, 120, 0.4);
  --rim-lg:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 26px 40px -30px rgba(255, 255, 255, 0.7),
    inset 14px 0 22px -18px rgba(255, 90, 150, 0.4),
    inset -14px 0 22px -18px rgba(90, 190, 255, 0.4);
  /* behind every picture: shown while it loads, or when Drive has no thumbnail for a video */
  --ph:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13l11-6.5z' fill='%23d8ccb2' fill-opacity='.55'/%3E%3C/svg%3E") 50% 40% / 26% no-repeat,
    radial-gradient(120% 70% at 30% 0%, rgba(216, 204, 178, 0.2), transparent 62%),
    linear-gradient(160deg, #262421, #0b0b0b);
}

html.archive, html.archive body { height: 100%; overflow: hidden; overscroll-behavior: none; }

/* ---- top bar ---- */
.a-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(14px, 1vw, 22px) 7vw 0;
  pointer-events: none;
}
.a-top > * { pointer-events: auto; }
.a-meta {
  font-family: var(--hero-font);
  color: var(--cream);
  text-align: right;
  transition: opacity 0.4s;
}
.a-meta h1 {
  margin: 0;
  font-size: clamp(13px, 1.05vw, 21px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.a-meta p {
  display: flex; justify-content: flex-end; gap: 1.2em;
  margin: 0.8em 0 0;
  font-size: clamp(11px, 0.78vw, 14px);
  color: #a39b8a;
}
.a-hint { display: inline-flex; align-items: center; gap: 0.55em; }
.a-hint::before { content: ""; width: 6px; height: 6px; background: var(--cream); }
html.is-detail .a-meta { opacity: 0; pointer-events: none; }

/* ---- the wall ---- */
.a-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
          user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.a-stage.dragging { cursor: grabbing; }
.a-stage.is-away { pointer-events: none; }
.a-wall {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  transition: opacity 0.7s var(--ease), transform 0.95s var(--ease);
}
.a-stage.is-away .a-wall { opacity: 0; transform: scale(1.14); }
.a-stage.no-anim .a-wall { transition: none; }

.a-tile {
  position: absolute;
  left: 0; top: 0;
  width: var(--tw); height: var(--th);
  margin: calc(var(--th) / -2) 0 0 calc(var(--tw) / -2);
  border-radius: var(--tr);
  overflow: hidden;
  background: var(--ph);
  backface-visibility: hidden;
  will-change: transform, opacity;
  transition: box-shadow 0.35s;
}
.a-tile img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  transform: scale(1.04);
  transition: transform 1s var(--ease), opacity 0.5s;
  pointer-events: none;
  -webkit-user-drag: none;
}
.a-tile img:not(.ok) { opacity: 0; }
/* glass: a soft sheen at the top, shade at the bottom for the caption */
.a-tile::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(130% 60% at 28% -8%, rgba(255, 255, 255, 0.2), transparent 58%),
    linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.26) 34%, transparent 58%);
}
.a-tile::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 4;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: var(--rim);
}
.a-tile:hover { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55), 0 0 44px rgba(255, 255, 255, 0.16); }
.a-tile:hover img { transform: scale(1.1); }
.a-tile.is-focus { box-shadow: 0 0 0 2px var(--cream), 0 0 44px rgba(216, 204, 178, 0.3); }
.a-tile.is-src { visibility: hidden; }

.a-num {
  position: absolute;
  z-index: 2;
  top: 7%; left: 8%;
  font: 600 max(9px, calc(var(--tw) * 0.04)) / 1 var(--hero-font);
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.8);
}
.a-cap, .a-refl {
  position: absolute;
  z-index: 2;
  left: 8%; right: 8%; bottom: 12%;
  display: flex; flex-direction: column; gap: 0.4em;
  pointer-events: none;
}
.a-cap b, .a-refl b {
  font-family: var(--hero-font);
  font-weight: 700;
  font-size: max(13px, calc(var(--tw) * 0.088));
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: #fff;
}
.a-cap b { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); }
.a-cap small, .a-refl small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: max(9.5px, calc(var(--tw) * 0.043));
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.82);
}
/* the caption seen again through the glass lip at the bottom, upside down */
.a-refl {
  transform: scaleY(-1);
  transform-origin: 50% 100%;
  opacity: 0.3;
  filter: blur(0.5px);
  -webkit-mask-image: linear-gradient(to top, #000, transparent 72%);
          mask-image: linear-gradient(to top, #000, transparent 72%);
}
.a-refl b, .a-refl small { color: rgba(255, 255, 255, 0.8); text-shadow: -1.5px 0 rgba(255, 40, 120, 0.8), 1.5px 0 rgba(40, 190, 255, 0.8); }

/* fades the far edges of the sphere into black, and keeps the top bar / dock readable */
.a-vignette {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 80% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.45) 80%, rgba(0, 0, 0, 0.9) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 15%, transparent 84%, rgba(0, 0, 0, 0.6));
}

/* keyboard / screen-reader list (the wall glides to and outlines the focused piece) */
.a-list {
  position: absolute;
  left: 0; bottom: 0;
  width: 1px; height: 1px;
  margin: 0; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  list-style: none;
}

/* ---- the open piece ---- */
.a-detail {
  position: fixed; inset: 0;
  z-index: 40;
  display: flex;
  padding: 92px clamp(16px, 5vw, 80px) 64px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
  visibility: hidden;
}
.a-detail.on { visibility: visible; }
.d-wrap {
  display: flex; align-items: stretch;
  gap: clamp(24px, 3vw, 48px);
  margin: auto;
}
.d-main { position: relative; flex: none; }
.d-close {
  position: absolute;
  left: 0; bottom: calc(100% + 14px);
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 999px;
  background: #0f0f0f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #eee;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, opacity 0.45s, transform 0.8s var(--ease);
}
.d-close svg { width: 14px; height: 14px; }
.d-close:hover { background: #1b1b1b; color: #fff; }

.d-frame {
  position: relative;
  width: var(--fw, 340px); height: var(--fh, 600px);
  overflow: hidden;
  border-radius: var(--fr, 26px);
  background: var(--ph);
  opacity: 0;
}
.a-detail.in .d-frame { opacity: 1; }
.d-poster, .d-player > * {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.d-poster { object-fit: cover; object-position: 50% 28%; transition: opacity 0.3s; }
.d-player > * { background: #000; opacity: 0; transition: opacity 0.6s; }
.d-player > .on { opacity: 1; }
.d-rim { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; box-shadow: var(--rim-lg); }
.d-frame::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  z-index: 3;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--cream);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  animation: a-spin 0.9s linear infinite;
}
.d-frame.loading::after { opacity: 1; }
@keyframes a-spin { to { transform: rotate(360deg); } }

.d-side {
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 28px;
  width: var(--sw, 440px);
  min-width: 0;
}
.d-eyebrow {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin: 0 0 18px;
  font: 600 12px / 1 var(--hero-font);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream);
}
.d-tags { color: #8f877a; }
.d-title {
  margin: 0;
  font-family: var(--hero-font);
  font-weight: 600;
  font-size: clamp(30px, 3.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--cream);
}
.d-desc { max-width: 34ch; margin: 18px 0 0; font-size: 16px; line-height: 1.55; color: #a3a3a3; }
.d-by { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 13.5px; color: #8a8a8a; }
.d-by img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; object-position: 50% 8%; }
.d-by b { font-weight: 500; color: #e6e6e6; }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.d-cta, .d-open {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, transform 0.25s var(--ease);
}
.d-cta svg, .d-open svg { width: 14px; height: 14px; }
.d-cta { background: var(--cream); color: #121110; }
.d-cta:hover { background: #e9dfc8; transform: scale(1.03); }
.d-open { background: #0f0f0f; color: #eee; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.d-open:hover { background: #1b1b1b; }
.d-open[hidden] { display: none; }

.d-more-label {
  margin: 0 0 12px;
  font: 600 11.5px / 1 var(--hero-font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a8a8a;
}
.d-more-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.d-mini {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--ph);
  text-align: left;
  transition: opacity 0.5s, transform 0.9s var(--ease), box-shadow 0.3s;
}
.d-mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; transition: transform 0.8s var(--ease); }
.d-mini::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 60%); }
.d-mini::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; box-shadow: var(--rim); pointer-events: none; }
.d-mini span {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  z-index: 2;
  display: flex; flex-direction: column; gap: 4px;
  font: 700 13px / 1.1 var(--hero-font);
  color: #fff;
}
.d-mini small { font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; color: rgba(255, 255, 255, 0.7); }
.d-mini:hover { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5); }
.d-mini:hover img { transform: scale(1.08); }

/* entrance: the frame swaps in under the flying tile, then the details rise in */
.a-detail .d-close,
.a-detail .d-info > *,
.a-detail .d-more-label { opacity: 0; transform: translateY(14px); }
.a-detail .d-info > *,
.a-detail .d-more-label { transition: opacity 0.45s, transform 0.8s var(--ease); }
.a-detail .d-mini { opacity: 0; transform: translateX(36px); }
.a-detail.in .d-close,
.a-detail.in .d-info > *,
.a-detail.in .d-more-label,
.a-detail.in .d-mini { opacity: 1; transform: none; }
.a-detail.in .d-info > :nth-child(2) { transition-delay: 0.05s; }
.a-detail.in .d-info > :nth-child(3) { transition-delay: 0.1s; }
.a-detail.in .d-info > :nth-child(4) { transition-delay: 0.15s; }
.a-detail.in .d-info > :nth-child(5) { transition-delay: 0.2s; }
.a-detail.in .d-more-label { transition-delay: 0.18s; }
.a-detail.in .d-mini:nth-child(1) { transition-delay: 0.2s; }
.a-detail.in .d-mini:nth-child(2) { transition-delay: 0.28s; }
.a-detail.in .d-mini:nth-child(3) { transition-delay: 0.36s; }
/* switching to another piece from "You may also like" */
.a-detail.swap .d-poster,
.a-detail.swap .d-player > *,
.a-detail.swap .d-info > *,
.a-detail.swap .d-mini { opacity: 0; transition-delay: 0s; transition-duration: 0.3s; }

/* the tile that flies between the wall and the player */
.a-ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 45;
  overflow: hidden;
  background: var(--ph);
  pointer-events: none;
  visibility: hidden;
}
.a-ghost.on { visibility: visible; }
.a-ghost img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.a-ghost-rim { position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--rim-lg); }

/* the dock steps aside while a piece is open */
html.is-detail .dock.show { opacity: 0; pointer-events: none; transform: translate(-50%, 140%); }

/* cursor: "Drag" while moving the wall */
.cursor.drag { width: 58px; height: 58px; background: rgba(216, 204, 178, 0.1); box-shadow: inset 0 0 0 1px var(--cream); }
.cursor.drag .cursor-label { opacity: 1; color: var(--cream); }

@media (max-width: 759px) {
  .a-detail { padding: 76px 16px 40px; }
  .d-close { left: auto; right: 0; }
  .a-top { transition: opacity 0.4s; }
  html.is-detail .a-top { opacity: 0; pointer-events: none; } /* the open piece scrolls under it */
  .d-wrap { flex-direction: column; align-items: center; gap: 24px; width: 100%; }
  .d-side { width: 100%; max-width: 480px; }
  .d-title { font-size: 30px; }
  .d-desc { font-size: 15px; }
  .d-more-row { gap: 10px; }
  .d-mini { border-radius: 13px; }
  .d-mini span { left: 8px; right: 8px; bottom: 8px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .a-wall, .a-detail *, .a-tile img { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
