/* ===== Library wrapper ===== */
.library-wrap{ display:flex; flex-direction:column; gap:16px; }

/* Header row */
.page-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.page-head-controls {
  display: flex;
  align-items: center;
  gap: 12px;  /* space between count and Filters button */
}

.deck-count {
  color: #ccc;
  font-size: 15px;
  opacity: 0.85;
  white-space: nowrap;
  /* remove left margin now that it's in its own group */
  margin-left: 0;
}

.btn-outline.small{ padding:6px 10px; height:30px; border-radius:8px; }
.btn-outline.wide{ width:100%; }

/* ===== Grid ===== */
.grid{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px; }

.deck-count {
  color: #ccc;
  font-size: 15px;
  margin-left: 10px;
  opacity: 0.85;
  white-space: nowrap;
}


/* ===== Card styles (unchanged) ===== */
.card{ position:relative; background:var(--panel); border:1px solid var(--border); border-radius:14px; overflow:hidden; transition: transform .08s ease; }
.card:hover{ transform: translateY(-2px); }
.card:focus-visible{ outline:2px solid var(--accent-2); outline-offset:2px; }
.thumb{ aspect-ratio:1/1; background:#0b0e13; position:relative; overflow:hidden; }
.thumb>img{ width:100%; height:100%; object-fit:cover; display:block; transform:scale(1.0); transition:transform .2s ease; }
.card:hover .thumb>img{ transform:scale(1.03); }
.bar{ position:absolute; left:0; right:0; bottom:0; height:40px; background:rgba(0,0,0,.78); display:flex; align-items:center; justify-content:space-between; padding:0 10px; border-top:1px solid rgba(255,255,255,.06); transition:opacity .18s ease; }
.title{ font-weight:700; font-size:18px; color:#eaeaea; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-right:8px; }
.cols,.hover-cols{ display:inline-flex; align-items:center; gap:2px; }
.mana-icon{ width:18px; height:18px; flex:0 0 18px; object-fit:contain; display:inline-block; }
.hover-pane{ position:absolute; inset:0; background:rgba(0,0,0,.66); opacity:0; pointer-events:none; display:flex; align-items:center; justify-content:center; transition:opacity .18s ease; }
.card:hover .hover-pane, .card:focus-visible .hover-pane{ opacity:1; }
.card:hover .bar{ opacity:.15; }
.hover-card{ text-align:center; color:#eaeaea; display:flex; flex-direction:column; align-items:center; gap:8px; padding:12px; max-width:90%; }
.hover-format{ font-weight:800; font-size:14px; }
.hover-char{ font-weight:700; font-size:13.5px; color:#d8def7; }
.hover-div{ width:68%; height:1px; background:rgba(255,255,255,.28); margin:2px 0; }

/* Responsive grid */
@media (max-width:780px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ===== Color pills ===== */
.color-pills{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.pill{ display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:#0f1218; border:1px solid var(--border); }
.pill img{ width:16px; height:16px; pointer-events:none; }
.pill.active{ border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(120,150,255,.15) inset; background:#121826; }

/* ===== Off-canvas drawer ===== */
.filters-drawer{
  position:fixed; top:0; right:0; bottom:0;
  width:320px; max-width:85vw;
  background:var(--panel);
  border-left:1px solid var(--border);
  box-shadow: -20px 0 40px rgba(0,0,0,.35);
  transform: translateX(100%);
  transition: transform .18s ease;
  z-index: 60;
  display:flex; flex-direction:column;
}
.filters-drawer.open{ transform: translateX(0); }
.drawer-header{ display:flex; align-items:center; justify-content:space-between; padding:12px; border-bottom:1px solid var(--border); }

/* ✅ ONLY CHANGE: remove the dark overlay on the left */
.drawer-overlay{
  position:fixed;
  inset:0;
  background: transparent !important; /* was rgba(0,0,0,.5) */
  z-index: 50;
}

body.noscroll{ overflow:hidden; }

/* Vertical filters layout inside drawer */
.filters.vertical{
  display:flex; flex-direction:column; gap:10px;
  padding:12px; border:none; background:transparent;
}
.filters.vertical .ctl{ display:flex; gap:8px; }
.filters.vertical input[type="text"],
.filters.vertical select,
.filters.vertical button{
  height:34px; line-height:34px; font-size:14px; padding:0 10px; border-radius:10px;
}

/* Tighter widths inside drawer */
#q{ width:100%; }
#fmt{ width:100%; }
#arch{ width:100%; }
#banned{ width:100%; }
#colorMode{ width:100%; }
#sort{ width:100%; }
:root{ --header-h: 0px; }

/* =========================================================
   UPDATED: Make the drawer a "box" instead of full height
   (keeps everything else the same)
   ========================================================= */
.filters-drawer{
  top: calc(var(--header-h) + 12px);   /* a little breathing room under header */
  bottom: auto !important;                        /* stop stretching to the bottom */
  height: auto !important;                        /* size to content */
  max-height: calc(100dvh - var(--header-h) - 24px) !important; /* never exceed viewport */
  overflow-y: auto;                               /* scroll inside if needed */
  border-radius: 0;                   /* makes it feel like a panel */
}

/* Keep the (now invisible) overlay below the header too */
.drawer-overlay{
  inset: auto 0 0 0 !important;
  top: var(--header-h) !important;
  height: calc(100dvh - var(--header-h)) !important;
  background: transparent !important;             /* NO DARKENING */
}

/* === Drawer mana icons: bigger, borderless, centered === */
.filters-drawer{
  --mana-size: 36px;      /* button size */
  --mana-icon: 28px;      /* SVG size inside */
  --mana-gap: px;         /* space between symbols */
}

/* center the tray inside the drawer */
.filters-drawer .ctl-colors,
.filters-drawer .ctl-colors .color-pills{
  display:flex;
  justify-content:center;
  align-items:center;
}

/* spacing */
.filters-drawer #colorPills{
  gap: var(--mana-gap);
  flex-wrap:wrap;
}

/* buttons: no border, no background, larger hit area */
.filters-drawer #colorPills .pill{
  width: var(--mana-size);
  height: var(--mana-size);
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  display:grid;
  place-items:center;
}

/* icon size */
.filters-drawer #colorPills .pill img{
  width: var(--mana-icon);
  height: var(--mana-icon);
}

/* selected look (soft glow instead of border) */
.filters-drawer #colorPills .pill.active{
  background: rgba(120,150,255,.08);
  box-shadow: 0 0 0 3px rgba(120,150,255,.45) inset,
              0 0 6px rgba(120,150,255,.30);
  border: none;
}

/* keyboard focus */
.filters-drawer #colorPills .pill:focus-visible{
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* === LOCK PAGE BACKGROUND === */
body {
  background: #0f131a !important;
}

/* Filters button — purple theme (Deck Library only) */
.library-wrap .btn-outline {
  border: 1px solid var(--accent-2);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.15) inset,
    0 6px 16px rgba(0,0,0,.35),
    0 0 14px color-mix(in oklab, var(--accent) 45%, transparent);
}

.library-wrap .btn-outline:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.library-wrap .btn-outline:active {
  transform: translateY(0);
}

/* ===== Purple Filters buttons (open/close/clear) ===== */
#openFilters,
#closeFilters,
#clearFilters {
  border: 1px solid var(--accent-2);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.18) inset,
    0 6px 16px rgba(0,0,0,.35),
    0 0 14px color-mix(in oklab, var(--accent) 45%, transparent);
}

/* keep the sizing/shape already defined for .btn-outline.small/.wide */
#openFilters.btn-outline.small,
#closeFilters.btn-outline.small { border-radius: 8px; height: 30px; padding: 6px 10px; }
#clearFilters.btn-outline.wide  { border-radius: 10px; }

#openFilters:hover,
#closeFilters:hover,
#clearFilters:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

#openFilters:active,
#closeFilters:active,
#clearFilters:active {
  transform: translateY(0);
}

/* focus ring for accessibility */
#openFilters:focus-visible,
#closeFilters:focus-visible,
#clearFilters:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ===== Matte purple for Filters buttons (no glow) ===== */
#openFilters,
#closeFilters,
#clearFilters {
  background: var(--accent-2);   /* flat purple */
  border: 1px solid var(--accent-2);
  color: #fff;
  box-shadow: none;              /* remove outer/inner glow */
  text-shadow: none;             /* ensure crisp text */
}

/* keep sizing already defined elsewhere */
#openFilters.btn-outline.small,
#closeFilters.btn-outline.small { border-radius: 8px; height: 30px; padding: 6px 10px; }
#clearFilters.btn-outline.wide  { border-radius: 10px; }

/* subtle, matte interactions (no glow) */
#openFilters:hover,
#closeFilters:hover,
#clearFilters:hover {
  background: color-mix(in oklab, var(--accent-2) 88%, black);
  border-color: color-mix(in oklab, var(--accent-2) 88%, black);
  transform: none;
  filter: none;
}

#openFilters:active,
#closeFilters:active,
#clearFilters:active {
  background: color-mix(in oklab, var(--accent-2) 78%, black);
  border-color: color-mix(in oklab, var(--accent-2) 78%, black);
}

/* accessible focus without glow */
#openFilters:focus-visible,
#closeFilters:focus-visible,
#clearFilters:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ===== Filters drawer — match Submit form styling ===== */
.filters-drawer{
  background: linear-gradient(180deg, var(--panel) 0%, #1b1830 100%);
  color: var(--text);
  border-left: 1px solid rgba(255,255,255,.06);
}

/* Header bar */
.drawer-header{
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Inputs + selects inside the drawer (purple fields) */
.filters.vertical input[type="text"],
.filters.vertical select{
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  height: 34px;
  line-height: 34px;
  padding: 0 12px;
  outline: none;
}

/* Focus ring like the Submit page */
.filters.vertical input[type="text"]:focus,
.filters.vertical select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,93,211,.25);  /* soft purple */
}

/* Placeholder color in the search box */
.filters.vertical input::placeholder{ color: var(--muted); }

/* Make selects look native-purple with a custom arrow */
.filters.vertical select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;              /* room for arrow */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='white'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

/* Edge/IE legacy */
.filters.vertical select::-ms-expand{ display:none; }

/* Buttons already set to matte purple earlier; keep it consistent */
#openFilters, #closeFilters, #clearFilters{
  background: var(--accent-2);
  border: 1px solid var(--accent-2);
  color: #fff;
  box-shadow: none;
}

/* Float behavior only when we add the class from JS */
#openFilters.floating {
  position: fixed;
  top: calc(var(--header-h, 64px) + 12px); /* just below sticky header */
  left: var(--filters-float-left, auto);   /* JS sets this to align with page column */
  right: auto;
  z-index: 70;
}

/* Phone: dock bottom-right */
@media (max-width: 780px){
  #openFilters.floating {
    top: auto;
    left: auto;
    right: 16px;
    bottom: 16px;
  }
}

/* Filters button — square corners */
#openFilters{
  border-radius: 0 !important;
}
#openFilters,
#closeFilters,
#clearFilters{
  border-radius: 0 !important;
}

/* Center the Clear Filters button */
#clearFilters {
  display: block;
  width: 100px;             /* adjust width as you like */
  margin: 0 auto;           /* centers it horizontally */
  border-radius: 0;         /* keep square if you prefer */
}

/* In case the element keeps the .wide class somewhere */
#clearFilters.wide{ width: 100px !important; }

/* Mobile: allow deck titles to wrap so they don't get cut off */
@media (max-width: 600px) {
  .deck-card .deck-title {
    white-space: normal;   /* let it wrap to 2 lines */
    font-size: 0.95rem;    /* subtle reduction, not tiny */
    line-height: 1.25;
  }
}

/* =========================
   MOBILE: deck titles wrap
   ========================= */
@media (max-width: 768px) {
  /* Handle both possible class names just in case */
  .deck-card .deck-title,
  .deck-card-title {
    white-space: normal;       /* allow wrapping */
    overflow: visible;         /* don't clip */
    text-overflow: unset;      /* no ellipsis */

    font-size: 0.95rem;        /* very small reduction to keep cards tidy */
    line-height: 1.25;
  }

  /* Optional: give a bit more vertical room for wrapped titles */
  .deck-card {
    padding-bottom: 0.9rem;
  }
/* ===== Align Filters panel with first deck card (desktop) ===== */
.filters-drawer{
  top: 225px !important;  /* desktop alignment */
}

/* ===== Mobile: different alignment ===== */
@media (max-width: 600px){
  .filters-drawer{
    top: 167px !important;   /* mobile alignment - tweak this number */
    right: 12px;             /* optional: tiny inset so it doesn't kiss the edge */
    max-width: calc(100vw - 24px);
  }
}
}
/* =========================================================
   DECK LIBRARY — Purple outline glow on hover (WORKING)
   Your tiles are .card (not .deck-card), and overflow:hidden clips outer glows.
   So we apply glow directly to the card via box-shadow.
   ========================================================= */

.card{
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

/* Stronger purple hover glow */
.card:hover,
.card:focus-within{
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);

  box-shadow:
    /* existing depth */
    0 16px 38px rgba(0,0,0,.45),

    /* crisp purple frame */
    0 0 0 2px color-mix(in oklab, var(--accent) 75%, black),

    /* inner glow (does help even with overflow hidden) */
    inset 0 0 0 1px color-mix(in oklab, var(--accent) 35%, transparent),
    inset 0 0 18px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* Optional: slightly brighten the bottom title bar on hover */
.card:hover .bar,
.card:focus-within .bar{
  opacity: 0.22; /* you currently drop it to 0.15; this keeps it readable */
}
/* ===== iOS Safari fallback for aspect-ratio ===== */
@supports not (aspect-ratio: 1 / 1) {
  .thumb {
    height: auto;            /* ensure it can grow */
    position: relative;      /* required for absolute children */
  }

  .thumb::before {
    content: "";
    display: block;
    padding-top: 100%;       /* 1:1 square */
  }

  .thumb > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}
/* ===== Fix iOS Safari "Filters" label overflow ===== */
.filters-btn,
#filters-btn,
button.filters,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 8px;
  padding: 10px 14px;

  /* Prevent text from reflowing / spilling */
  white-space: nowrap;
  line-height: 1;
  overflow: hidden;

  /* Give the button a stable height across browsers */
  min-height: 40px;
  box-sizing: border-box;
}

/* If your label is a span/div inside the button */
.filters-btn .label,
#filters-btn .label,
button.filters .label,
.filter-button .label {
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* If you’re using an icon element inside the button */
.filters-btn svg,
#filters-btn svg,
button.filters svg,
.filter-button svg,
.filters-btn img,
#filters-btn img,
button.filters img,
.filter-button img {
  flex: 0 0 auto;
}

/* iOS Safari sometimes “helpfully” resizes text */
.filters-btn,
#filters-btn,
button.filters,
.filter-button {
  -webkit-text-size-adjust: 100%;
}
