/* ============================================================
   WERHINO 2.0 - Material Library
   materials.css · layers on platform.css (tokens, nav, footer)
   Material-Bank-style masonry. Favorites/collections gated.
   ============================================================ */

.mlib { padding: calc(var(--nav-h) + clamp(2.5rem,7vh,5rem)) 0 clamp(1.5rem,4vh,2.5rem); }
.mlib__title { font-size: clamp(2.8rem, 6vw, 5rem); margin: 1.3rem 0 1.1rem; max-width: 15ch; }
.mlib__title em { font-style: italic; color: var(--accent); }
.mlib__sub { color: var(--muted); font-weight: 300; max-width: 52ch; line-height: 1.7; font-size: 1.05rem; }

/* filter row */
.mfilters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 2rem; }
.mfilter {
  font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  padding: .58em 1.15em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  transition: border-color .3s, color .3s, background .3s;
}
.mfilter:hover { color: var(--text); border-color: var(--line-2); }
.mfilter.is-active { background: var(--accent); color: #1a1409; border-color: var(--accent); }
.mfilters__saved { margin-left: auto; font-size: .72rem; color: var(--muted); letter-spacing: .06em; display: inline-flex; align-items: center; gap: .4rem; }
.mfilters__saved b { color: var(--accent); }

/* masonry */
.mgrid { columns: 4 260px; column-gap: clamp(.7rem,1.2vw,1rem); padding-bottom: clamp(4rem,9vh,7rem); }
.mcard {
  break-inside: avoid; position: relative; margin-bottom: clamp(.7rem,1.2vw,1rem);
  border-radius: var(--r-card); overflow: hidden; cursor: pointer; isolation: isolate;
  border: 1px solid var(--line); background: var(--bg-card);
}
.mcard__img { width: 100%; display: block; transition: transform .9s var(--ease), filter .5s var(--ease); filter: brightness(.92); }
.mcard:hover .mcard__img { transform: scale(1.05); filter: brightness(1.02); }
.mcard::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to top, rgba(8,7,6,.86) 4%, rgba(8,7,6,.1) 44%, transparent 70%); }
.mcard__meta { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 1.1rem 1.1rem; }
.mcard__cat { font-size: .58rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.mcard__name { font-family: var(--font-d); font-weight: 500; font-size: 1.4rem; line-height: 1.05; color: var(--text); margin-top: .2rem; }
.mcard__fav {
  position: absolute; top: .8rem; right: .8rem; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(12,11,9,.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--text);
  transition: background .3s, color .3s, transform .3s var(--ease), border-color .3s;
}
.mcard__fav:hover { transform: scale(1.1); border-color: var(--line-2); }
.mcard__fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.mcard__fav.is-fav { background: var(--accent); color: #1a1409; border-color: var(--accent); }
.mcard__fav.is-fav svg { fill: currentColor; }

/* detail modal */
.mlb { position: fixed; inset: 0; z-index: 410; display: none; align-items: center; justify-content: center; padding: 1.2rem; }
.mlb.is-open { display: flex; }
.mlb__backdrop { position: absolute; inset: 0; background: rgba(6,5,4,.82); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.mlb__card { position: relative; width: min(960px, 100%); max-height: 92vh; overflow: hidden; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg-card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 50px 130px rgba(0,0,0,.6); }
.mlb.is-open .mlb__card { animation: authPop .5s var(--ease); }
.mlb__media { position: relative; background: #0a0908; }
.mlb__media img { width: 100%; height: 100%; object-fit: cover; min-height: 320px; }
.mlb__info { padding: clamp(1.6rem,2.4vw,2.4rem); overflow-y: auto; max-height: 92vh; display: flex; flex-direction: column; gap: 1.1rem; }
.mlb__cat { font-size: .62rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.mlb__name { font-family: var(--font-d); font-weight: 500; font-size: clamp(2rem,3.4vw,2.8rem); line-height: 1.02; }
.mlb__desc { color: var(--muted); font-size: .96rem; line-height: 1.65; }
.mlb__row { display: flex; flex-direction: column; gap: .22rem; }
.mlb__row h5 { font-size: .6rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.mlb__row p { font-size: .92rem; color: var(--text); line-height: 1.5; }
.mlb__seen { display: flex; gap: .5rem; }
.mlb__seen img { width: 33%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.mlb__spec { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.mlb__speccell { background: #14120d; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; }
.mlb__speccell b { font-family: var(--font-d); font-weight: 500; font-size: 1.05rem; color: var(--accent); line-height: 1.15; }
.mlb__speccell span { font-size: .58rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.mlb__finishes { display: flex; flex-wrap: wrap; gap: .4rem; }
.mlb__finish { font-size: .72rem; color: var(--text); border: 1px solid var(--line-2); border-radius: 999px; padding: .3em .8em; }
.mlb__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: auto; padding-top: .6rem; }
.mlb__actions .btn { flex: 1; min-width: 170px; }
.mlb__save { flex: 1; }
.mlb__close { position: absolute; top: 1rem; right: 1rem; z-index: 4; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: rgba(12,11,9,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid var(--line); transition: background .3s, color .3s, transform .3s var(--ease); }
.mlb__close:hover { background: var(--accent); color: #1a1409; transform: rotate(90deg); }
.mlb__close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

/* responsive */
@media (max-width: 900px) { .mgrid { columns: 2 180px; } }
@media (max-width: 760px) {
  .mlb__card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; max-height: 94vh; overflow-y: auto; }
  .mlb__media img { min-height: 220px; max-height: 38vh; }
  .mfilters__saved { margin-left: 0; width: 100%; }
}
@media (max-width: 480px) { .mgrid { columns: 1; } }
