/* Shop — Tessera Exchange (blank-slate; no dew/dm/a69-tile patterns) */

body.tf-exchange.a69-body {
  --tf-void: #0b0d12;
  --tf-panel: #141821;
  --tf-ink: #f4f1ea;
  --tf-muted: rgba(244, 241, 234, 0.78);
  --tf-line: rgba(244, 241, 234, 0.14);
  --tf-sun: #ffe566;
  --tf-ice: #7eb8ff;
  --tf-hot: #ff5c7a;
  --tf-display: "Bebas Neue", "Impact", sans-serif;
  --tf-sans: "Source Sans 3", "Segoe UI", sans-serif;
  --tf-ease: cubic-bezier(0.18, 0.9, 0.22, 1);

  color: var(--tf-ink);
  font-family: var(--tf-sans);
  background:
    radial-gradient(700px 420px at 90% 0%, rgba(255, 229, 102, 0.12), transparent 55%),
    radial-gradient(600px 380px at 0% 80%, rgba(126, 184, 255, 0.1), transparent 50%),
    var(--tf-void) !important;
}

body.tf-exchange .a69-main {
  padding-bottom: 3.5rem;
  overflow-x: clip;
}

.tf-world {
  position: relative;
  width: min(1200px, calc(100% - 1.25rem));
  margin: 0.6rem auto 0;
}

.tf-noise {
  pointer-events: none;
  position: absolute;
  inset: -2rem;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* Grid area mapping */
.tf-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(0, 1fr);
  grid-template-areas:
    "banner banner"
    "dial   river";
  gap: 1rem 1.15rem;
  align-items: start;
}

.tf-banner { grid-area: banner; }
.tf-dial { grid-area: dial; }
.tf-river { grid-area: river; min-width: 0; }

.tf-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tf-sun);
}

.tf-banner {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  grid-template-areas:
    "kicker kicker"
    "title  lens"
    "lede   lens"
    "meters lens";
  gap: 0.55rem 1.25rem;
  padding: clamp(1.2rem, 3vw, 1.85rem);
  background: linear-gradient(135deg, rgba(20, 24, 33, 0.95), rgba(11, 13, 18, 0.8));
  border: 1px solid var(--tf-line);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 28px), calc(100% - 28px) 100%, 0 100%);
  animation: tf-rise 0.7s var(--tf-ease) both;
}
.tf-banner .tf-kicker { grid-area: kicker; }
.tf-banner h1 {
  grid-area: title;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 0.9;
}
.tf-title-main {
  font-family: var(--tf-display);
  font-size: clamp(2.8rem, 8vw, 5rem);
  letter-spacing: 0.02em;
  font-weight: 400;
}
.tf-title-sub {
  font-family: var(--tf-display);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: 0.08em;
  color: var(--tf-ice);
}
.tf-lede {
  grid-area: lede;
  margin: 0;
  max-width: 46ch;
  color: var(--tf-muted);
  font-size: 1rem;
}
.tf-lens {
  grid-area: lens;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  min-width: 0;
}
.tf-lens input {
  width: 100%;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--tf-ink);
  padding: 0.9rem 1rem;
  outline: none;
  font: inherit;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 92% 100%, 0 100%);
  border: 1px solid var(--tf-line);
}
.tf-lens input:focus {
  border-color: var(--tf-sun);
  box-shadow: 0 0 0 3px rgba(255, 229, 102, 0.18);
}
.tf-lens input::placeholder { color: var(--tf-muted); }
.tf-lens button {
  align-self: start;
  border: 0;
  cursor: pointer;
  background: var(--tf-sun);
  color: #111;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1.2rem;
  clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%, 0 30%);
  transition: transform 0.25s var(--tf-ease), background 0.2s;
}
.tf-lens button:hover {
  transform: translateY(-2px);
  background: #fff1a0;
}

.tf-meters {
  grid-area: meters;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.35rem 0 0;
}
.tf-meters div { display: grid; gap: 0.1rem; }
.tf-meters dt {
  margin: 0;
  font-family: var(--tf-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--tf-sun);
  line-height: 1;
}
.tf-meters dd {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tf-muted);
}

/* Vertical parallelogram dial */
.tf-dial {
  position: sticky;
  top: calc(var(--a69-dock-h) + 0.9rem);
  padding: 0.85rem 0.55rem;
  background: var(--tf-panel);
  border: 1px solid var(--tf-line);
  clip-path: polygon(0 18px, 18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}
.tf-dial-label {
  margin: 0 0.55rem 0.75rem;
  font-family: var(--tf-display);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: var(--tf-ice);
}
.tf-dial-stack {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tf-dial-seg {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  text-decoration: none;
  color: var(--tf-muted);
  background: rgba(255, 255, 255, 0.03);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: color 0.2s, background 0.25s, transform 0.3s var(--tf-ease);
}
.tf-dial-seg:hover {
  color: var(--tf-ink);
  background: rgba(126, 184, 255, 0.12);
  transform: translateX(4px);
}
.tf-dial-seg.is-on {
  color: #111;
  background: var(--tf-sun);
  box-shadow: 0 0 24px rgba(255, 229, 102, 0.25);
}
.tf-dial-ix {
  font-family: var(--tf-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
}
.tf-dial-name {
  font-size: 0.88rem;
  font-weight: 700;
}

/* Mosaic river with varied grid placement */
.tf-mosaic {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(160px, auto);
  gap: 0.85rem;
}

.tf-facet {
  position: relative;
  opacity: 0;
  transform: translateY(22px) rotate(-0.4deg);
  transition: opacity 0.55s var(--tf-ease), transform 0.55s var(--tf-ease);
  transition-delay: calc(min(var(--i), 10) * 0.04s);
}
.tf-facet.is-in {
  opacity: 1;
  transform: translateY(0) rotate(0deg);
}

/* Varied spans — challenges uniform product grids */
.tf-facet-0 { grid-column: span 5; }
.tf-facet-1 { grid-column: span 3; }
.tf-facet-2 { grid-column: span 4; }
.tf-facet-3 { grid-column: span 4; }
.tf-facet-4 { grid-column: span 5; }
.tf-facet-5 { grid-column: span 3; }

.tf-facet-hit {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  min-height: 240px;
  text-decoration: none;
  color: inherit;
  background: var(--tf-panel);
  border: 1px solid var(--tf-line);
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 92% 100%, 0 100%);
  transition: transform 0.4s var(--tf-ease), border-color 0.25s, box-shadow 0.4s;
}
.tf-facet:nth-child(even) .tf-facet-hit {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 14%, 8% 0);
}
.tf-facet-hit:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: rgba(255, 229, 102, 0.55);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 229, 102, 0.15);
}

.tf-facet-media {
  display: block;
  position: relative;
  min-height: 150px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 229, 102, 0.15), transparent 50%),
    #0f131c;
  overflow: hidden;
}
.tf-facet-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s var(--tf-ease), filter 0.4s;
  filter: saturate(1.05) contrast(1.04);
}
.tf-facet-hit:hover .tf-facet-media img {
  transform: scale(1.08) rotate(1deg);
  filter: saturate(1.15) contrast(1.08);
}

.tf-facet-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 2;
  padding: 0.3rem 0.65rem;
  background: var(--tf-hot);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 88% 100%, 0 100%);
}

.tf-facet-copy {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem 1.05rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}
.tf-facet-aisle {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tf-ice);
}
.tf-facet-title {
  font-family: var(--tf-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
}
.tf-facet-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.tf-facet-meta em {
  font-style: normal;
  font-weight: 800;
  color: var(--tf-sun);
  font-size: 1rem;
}
.tf-facet-meta small {
  font-size: 0.72rem;
  color: var(--tf-muted);
  letter-spacing: 0.04em;
}

.tf-facet-shard {
  position: absolute;
  right: -10%;
  bottom: -20%;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 229, 102, 0.18));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  pointer-events: none;
  transition: transform 0.5s var(--tf-ease), opacity 0.3s;
  opacity: 0.5;
}
.tf-facet-hit:hover .tf-facet-shard {
  transform: translate(-12px, -12px) rotate(20deg);
  opacity: 1;
}

.tf-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--tf-line);
  clip-path: polygon(0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  background: var(--tf-panel);
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}
.tf-empty h2 {
  margin: 0;
  font-family: var(--tf-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
}
.tf-empty p { margin: 0; color: var(--tf-muted); }
.tf-empty-btn {
  margin-top: 0.5rem;
  text-decoration: none;
  color: #111;
  background: var(--tf-sun);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 1.2rem;
  clip-path: polygon(8% 0, 100% 0, 100% 100%, 0 100%, 0 28%);
  transition: transform 0.25s;
}
.tf-empty-btn:hover { transform: translateY(-2px); }

/* Pagination restyle (classes from render_pagination) */
.tf-exchange .catalog-pagination {
  margin-top: 1.75rem;
}
.tf-exchange .pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.tf-exchange .pagination-btn,
.tf-exchange .pagination-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem;
  text-decoration: none;
  color: var(--tf-ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--tf-line);
  font-weight: 700;
  font-size: 0.85rem;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.tf-exchange .pagination-btn:hover,
.tf-exchange .pagination-num:hover {
  border-color: var(--tf-sun);
  color: var(--tf-sun);
  transform: translateY(-2px);
}
.tf-exchange .pagination-num.is-active {
  background: var(--tf-sun);
  color: #111;
  border-color: var(--tf-sun);
}
.tf-exchange .pagination-btn.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}
.tf-exchange .pagination-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tf-exchange .pagination-ellipsis {
  color: var(--tf-muted);
  padding: 0 0.25rem;
}

@keyframes tf-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .tf-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "banner"
      "dial"
      "river";
  }
  .tf-dial {
    position: static;
    clip-path: none;
    border-radius: 0;
  }
  .tf-dial-stack {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 0.45rem;
    padding-bottom: 0.25rem;
    scroll-snap-type: x mandatory;
  }
  .tf-dial-seg {
    scroll-snap-align: start;
    white-space: nowrap;
  }
  .tf-banner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kicker"
      "title"
      "lede"
      "meters"
      "lens";
    clip-path: none;
  }
  .tf-facet-0,
  .tf-facet-1,
  .tf-facet-2,
  .tf-facet-3,
  .tf-facet-4,
  .tf-facet-5 { grid-column: span 6; }
}

@media (max-width: 560px) {
  .tf-mosaic { grid-template-columns: 1fr; }
  .tf-facet-0,
  .tf-facet-1,
  .tf-facet-2,
  .tf-facet-3,
  .tf-facet-4,
  .tf-facet-5 { grid-column: auto; }
  .tf-facet-hit,
  .tf-facet:nth-child(even) .tf-facet-hit {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}
