/* ---------------------------------------------------------------------------
   Index button + panel. Lifted verbatim from /myth-collection, with the
   Webflow-specific bits pulled out into the variables at the top.

   Rename for another project:  sed -i 's/myth-index/your-name/g' *.css *.js
   --------------------------------------------------------------------------- */

:root {
  /* The panel's hover preview sits on this. On the myth page it is driven by a
     scroll-lerp; anywhere else a flat colour is fine. */
  --myth-card-bg: #D3E1E9;
  --myth-index-font: Instrumentsans, Arial, sans-serif;
  /* Horizontal inset. The live page overrides 48px -> 28px; both are below. */
  --myth-index-gutter: 28px;
  --myth-index-gutter-sm: 12px;
}

.myth-index {
  font-family: var(--myth-index-font);
  max-width: none;
  margin: 0 auto;
  padding: 0 var(--myth-index-gutter);
  color: #000;
  position: relative;
  z-index: 40;
}

/* ---------------------------------------------------------------- the button */

.myth-index__bar {
  display: flex;
  justify-content: flex-start;
  padding: 40px 0 12px;
}

.myth-index__toggle {
  appearance: none;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  backdrop-filter: blur(8px) saturate(1.2);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font: 500 12px/1 var(--myth-index-font);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: #000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 200ms ease;
}
.myth-index__toggle:hover { background: rgba(255, 255, 255, 0.9); }

.myth-index__chev {
  font-size: 10px;
  transform: rotate(0deg);
  transition: transform 220ms ease;
}
.myth-index__toggle[aria-expanded="true"] .myth-index__chev { transform: rotate(180deg); }

/* ----------------------------------------------------------------- the panel */

.myth-index__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: var(--myth-index-gutter);
  width: 721px;
  max-width: calc(100% - (var(--myth-index-gutter) * 2));
  height: 472px;
  z-index: 40;
  background: rgba(250, 250, 250, 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* The open/closed state is the `hidden` attribute, not a class. */
.myth-index__panel[hidden] { display: none; }

.myth-index__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
  padding: 4px 12px 12px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.myth-index__col-head {
  display: grid;
  grid-template-columns: 28px 1fr 60px;
  padding: 6px 8px 4px;
  font: 500 9px/1.2 var(--myth-index-font);
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  position: sticky;
  top: 0;
  background: rgba(250, 250, 250, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.myth-index__col-head span:last-child { text-align: right; }

/* ------------------------------------------------------------------ the rows */

.myth-index__row {
  display: grid;
  grid-template-columns: 28px 1fr 60px;
  align-items: center;
  padding: 5px 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: #000;
  transition: background 160ms ease;
}
.myth-index__col > .myth-index__row:first-of-type { border-top: 0; }
.myth-index__row:hover { background: rgba(255, 255, 255, 0.5); }

.myth-index__num   { color: #666; font: 400 10px/1 var(--myth-index-font); }
.myth-index__title {
  font: 400 11.5px/1.3 var(--myth-index-font);
  text-transform: lowercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.myth-index__price { text-align: right; font: 400 11px/1 var(--myth-index-font); color: #333; }

/* --------------------------------------------------------- the hover preview */

.myth-index__hover-preview {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  width: 180px;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease;
  background: var(--myth-card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.myth-index__hover-preview.is-visible { opacity: 1; transform: scale(1); }
.myth-index__hover-preview img {
  max-width: 68%;
  max-height: 76%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ---------------------------------------------------------------- one column */

@media (max-width: 767px) {
  .myth-index { padding: 0 var(--myth-index-gutter-sm); }
  .myth-index__bar { padding-top: 24px; }
  .myth-index__panel {
    left: var(--myth-index-gutter-sm);
    right: var(--myth-index-gutter-sm);
    width: auto;
    max-width: none;
    height: auto;
    max-height: 70vh;
  }
  .myth-index__cols { grid-template-columns: 1fr; padding: 4px 10px 10px; }
  /* second column's header would repeat "# Title Price" mid-list */
  .myth-index__cols .myth-index__col:nth-child(2) .myth-index__col-head { display: none !important; }
}
