/* ================================
   ELVAR WIKI — COPPER NOIR (FULL)
   FIXED: no waves/banding, straight grid, clean header
   ================================ */

/* ---------- THEME TOKENS ---------- */
:root{
  /* COPPER NOIR */
  --bg:#070608;        /* almost black */
  --bg2:#0b0a0d;       /* slightly lighter */
  --panel:#0f0c0f;     /* panels */
  --panel2:#120f13;    /* cards */

  --stroke: rgba(255,255,255,.075);
  --stroke2: rgba(255,255,255,.12);

  --text:#f3f0ee;
  --muted:#b2a8a2;

  --copper:#d39a61;
  --copper2:#b8743a;

  --shadow: 0 26px 70px rgba(0,0,0,.62);
  --shadow2: 0 12px 30px rgba(0,0,0,.42);

  --r:18px;
  --r2:14px;
  --max:1320px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Light theme (optional) */
html[data-theme="light"]{
  --bg:#fbf6f1;
  --bg2:#f6efe8;
  --panel:#ffffff;
  --panel2:#fffaf5;

  --stroke: rgba(30,16,10,.10);
  --stroke2: rgba(30,16,10,.16);

  --text:#1a1210;
  --muted:#6e5b52;

  --copper:#b8743a;
  --copper2:#8f4e22;

  --shadow: 0 18px 44px rgba(20,10,5,.14);
  --shadow2: 0 10px 24px rgba(20,10,5,.10);
}

/* ---------- BASE ---------- */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);

  /* ✅ clean flat background (NO WAVES / NO BAND) */
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

a{color:inherit}
code{font-family:var(--mono); font-size:12px}
.muted{color:var(--muted)}

.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- TOPBAR ---------- */
.topbar{
  position:sticky; top:0; z-index:20;
  border-bottom:1px solid var(--stroke);
  background: rgba(7,6,8,.86);
  backdrop-filter: blur(14px);
}
html[data-theme="light"] .topbar{
  background: rgba(255,255,255,.86);
}

.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 0;
}

.topbar__left{
  display:flex;
  align-items:center;
  gap:18px;
  min-width:0;
}

.topbar__right{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:flex-end;
}

/* BRAND — ровный блок (фикс “кривого левого хедера”) */
.brand{
  display:grid;
  grid-template-columns: 44px 1fr;
  align-items:center;
  gap:12px;
  min-width: 240px;
}
.brand__logo{
  width:44px;height:44px;
  border-radius: 16px;
  display:grid; place-items:center;
  font-weight:950;

  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid rgba(211,154,97,.35);
  box-shadow: var(--shadow2);
}
.brand__text{min-width:0}
.brand__title{
  font-weight:950;
  letter-spacing:.35px;
  line-height:1.05;
}
.brand__sub{
  font-size:12px;
  color:var(--muted);
  margin-top:3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 520px;
}

/* TOP NAV */
.topnav{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}
.topnav__link{
  text-decoration:none;
  color: var(--muted);
  padding:8px 10px;
  border-radius: 14px;
  border:1px solid transparent;
  transition: background .12s ease, border-color .12s ease, transform .12s ease, color .12s ease;
}
.topnav__link:hover{
  color: var(--text);
  border-color: var(--stroke);
  background: rgba(255,255,255,.03);
  transform: translateY(-1px);
}
html[data-theme="light"] .topnav__link:hover{
  background: rgba(0,0,0,.03);
}

/* SEARCH */
.search{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px;
  border:1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  min-width: 320px;
}
html[data-theme="light"] .search{ background: rgba(0,0,0,.03); }

.search__ico{color:var(--muted)}
.search__input{
  border:0; outline:0; background:transparent;
  color:var(--text); width:100%;
}
.search__input::placeholder{ color: rgba(178,168,162,.85); }
html[data-theme="light"] .search__input::placeholder{ color: rgba(110,91,82,.70); }

.search__clear{
  border:0; background:transparent;
  color:var(--muted);
  cursor:pointer;
  font-size:14px;
}

/* ICON BUTTONS */
.iconbtn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color:var(--text);
  padding:8px 10px;
  border-radius: 16px;
  cursor:pointer;
  text-decoration:none;
  display:inline-grid; place-items:center;
  min-width: 44px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
html[data-theme="light"] .iconbtn{ background: rgba(0,0,0,.03); }

.iconbtn:hover{
  transform: translateY(-1px);
  border-color: rgba(211,154,97,.22);
  background: rgba(255,255,255,.04);
}

/* ---------- LAYOUT ---------- */
.layout{
  display:flex;
  max-width: var(--max);
  margin: 0 auto;
  width:100%;
  min-height: calc(100vh - 64px);
}

/* SIDEBAR */
.sidebar{
  width: 310px;
  flex: 0 0 310px;
  padding: 24px 18px;
  border-right:1px solid var(--stroke);
}
.sidebar__group{margin-bottom:22px;}
.sidebar__title{
  font-size:11px;
  color: rgba(178,168,162,.75);
  letter-spacing:1.1px;
  margin-bottom:10px;
  text-transform: uppercase;
}
html[data-theme="light"] .sidebar__title{ color: rgba(110,91,82,.65); }

.sidebar__link{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  padding:10px 12px;
  border-radius: 16px;
  border:1px solid transparent;
  color: rgba(243,240,238,.92);
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
html[data-theme="light"] .sidebar__link{ color: rgba(26,18,16,.90); }

.sidebar__link:hover{
  border-color: var(--stroke);
  background: rgba(255,255,255,.03);
  transform: translateX(1px);
}
html[data-theme="light"] .sidebar__link:hover{ background: rgba(0,0,0,.03); }

.sidebar__link.is-active{
  border-color: rgba(211,154,97,.30);
  background: linear-gradient(90deg, rgba(211,154,97,.14), rgba(255,255,255,.02));
  color: var(--text);
}
html[data-theme="light"] .sidebar__link.is-active{
  background: linear-gradient(90deg, rgba(184,116,58,.14), rgba(0,0,0,.02));
}

.sidebar__footer{
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  font-size: 13px;
}

/* CONTENT */
.content{
  flex: 1 1 auto;
  min-width: 0;
  padding: 34px 26px 56px;
}
.content__inner{
  max-width: 980px;
}

/* TITLE */
.view-title{
  font-size: 46px;
  font-weight: 960;
  letter-spacing: .15px;
  margin: 18px 0 22px;
}

/* ---------- HOME CARDS ---------- */
.cards{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  max-width: 980px;
}

.card{
  position:relative;
  border-radius: 22px;
  padding: 26px 18px;
  text-align:center;
  cursor:pointer;

  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border:1px solid var(--stroke);
  box-shadow: var(--shadow2);

  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

/* Copper edge (not copy of ref) */
.card::after{
  content:"";
  position:absolute; inset:0;
  border-radius: 22px;
  pointer-events:none;
  border:1px solid transparent;
  background:
    linear-gradient(135deg,
      rgba(211,154,97,.34),
      rgba(184,116,58,.18),
      rgba(0,0,0,0)
    ) border-box;
  -webkit-mask:
    linear-gradient(#000 0 0) padding-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity:0;
  transition: opacity .14s ease;
}

.card:hover{
  transform: translateY(-4px);
  border-color: rgba(211,154,97,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
.card:hover::after{opacity:1;}

.card h2{margin:0 0 8px; font-size:18px; font-weight:900;}
.card p{margin:0; color:var(--muted);}

/* ---------- PANEL / SECTION ---------- */
.panel{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.02);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow2);
}
html[data-theme="light"] .panel{ background: rgba(0,0,0,.02); }

.panel-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom: 12px;
}

/* CHIPS */
.chips{display:flex; gap:10px; flex-wrap:wrap}
.chip{
  font-size:12px;
  color: var(--muted);
  border:1px solid var(--stroke);
  padding:7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.02);
  cursor:pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
html[data-theme="light"] .chip{ background: rgba(0,0,0,.02); }

.chip.is-on{
  color: var(--text);
  border-color: rgba(211,154,97,.28);
  background: rgba(211,154,97,.12);
}
html[data-theme="light"] .chip.is-on{
  border-color: rgba(184,116,58,.28);
  background: rgba(184,116,58,.10);
}

/* GRID LIST */
.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.item{
  border:1px solid var(--stroke);
  border-radius: var(--r2);
  background: rgba(255,255,255,.02);
  padding: 12px;
  cursor:pointer;
  transition: border-color .12s ease, transform .12s ease, background .12s ease;
}
html[data-theme="light"] .item{ background: rgba(0,0,0,.02); }

.item:hover{
  border-color: rgba(211,154,97,.22);
  background: rgba(255,255,255,.03);
  transform: translateY(-1px);
}
html[data-theme="light"] .item:hover{
  border-color: rgba(184,116,58,.22);
  background: rgba(0,0,0,.03);
}

.item__top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px;}
.item__name{font-weight:900; font-size:15px;}
.item__desc{margin-top:6px; color:var(--muted); font-size:13px; line-height:1.45}

/* BADGE */
.badge{
  font-family: var(--mono);
  font-size:12px;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid rgba(211,154,97,.20);
  background: rgba(255,255,255,.03);
  white-space:nowrap;
}
html[data-theme="light"] .badge{
  border-color: rgba(184,116,58,.22);
  background: rgba(0,0,0,.03);
}

/* TAGS */
.tags{margin-top:10px; display:flex; gap:8px; flex-wrap:wrap;}
.tag{
  font-size:12px;
  color: var(--muted);
  border:1px solid var(--stroke);
  padding:5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.02);
}
html[data-theme="light"] .tag{ background: rgba(0,0,0,.02); }

/* ---------- MODAL ---------- */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,.68);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 16px;
  z-index: 50;
}
.modal.is-open{display:flex}

.modal__box{
  width: min(860px, 100%);
  border:1px solid var(--stroke2);
  background: rgba(15,12,15,.96);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}
html[data-theme="light"] .modal__box{
  background: rgba(255,255,255,.96);
}

.modal__head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}
.modal__title{font-weight:900; font-size:18px;}
.modal__close{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  color:var(--text);
  border-radius: 16px;
  padding:8px 10px;
  cursor:pointer;
}
html[data-theme="light"] .modal__close{ background: rgba(0,0,0,.03); }

.modal__body{
  margin-top:10px;
  color:var(--muted);
  line-height:1.55;
}
.kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:8px 12px;
  margin-top:12px;
}
.k{color:var(--muted)}
.v{color:var(--text); font-family:var(--mono); word-break:break-word;}

/* ---------- FOOTER ---------- */
.footer{
  border-top:1px solid var(--stroke);
  padding:14px 18px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  max-width: var(--max);
  margin: 0 auto;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px){
  .sidebar{display:none;}
  .content{padding:26px 18px 54px;}
  .content__inner{max-width:100%;}
  .cards{grid-template-columns: repeat(2, 1fr); max-width:100%;}
  .grid{grid-template-columns: repeat(2, 1fr);}
}

@media (max-width: 900px){
  .topnav{display:none;}
  .search{min-width:180px;}
}

@media (max-width: 560px){
  .brand{min-width: 170px;}
  .brand__sub{display:none;}
  .search{min-width: 150px;}
  .cards{grid-template-columns: 1fr;}
  .grid{grid-template-columns: 1fr;}
  .view-title{font-size: 32px;}
}
