/* ============================================================
   ATLAS — Icon & Logo Library
   ============================================================ */

:root{
  --font-display:'Bricolage Grotesque',serif;
  --font-ui:'Hanken Grotesk',sans-serif;
  --font-mono:'DM Mono',monospace;

  --bg:#121110;
  --bg-2:#181614;
  --surface:#1E1C19;
  --surface-2:#262320;
  --line:#322E29;
  --line-soft:#262320;
  --text:#ECE7DF;
  --text-dim:#9C968B;
  --text-mute:#6A655C;
  --accent:#FF5A36;
  --accent-soft:#FF8A6B;
  --good:#5BC07A;
  --preview-light:#F3F0E8;
  --shadow:0 24px 60px -18px rgba(0,0,0,.7);
  --hdr-h:64px;
  --tool-h:60px;
}
[data-theme="light"]{
  --bg:#EDEAE2;
  --bg-2:#E5E1D7;
  --surface:#FBFAF6;
  --surface-2:#FFFFFF;
  --line:#D8D2C5;
  --line-soft:#E4DFD3;
  --text:#1F1C17;
  --text-dim:#6B665C;
  --text-mute:#9A958A;
  --preview-light:#FBFAF6;
  --shadow:0 24px 60px -22px rgba(60,50,40,.32);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--font-ui);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  line-height:1.5;
  overflow-x:hidden;
}
/* faint grain */
body::before{
  content:"";position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.025;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a{color:var(--accent-soft)}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select{font-family:inherit}
.mono{font-family:var(--font-mono)}

/* ---------- Boot ---------- */
.boot{
  position:fixed;inset:0;z-index:200;background:var(--bg);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;
  transition:opacity .45s ease;
}
.boot.gone{opacity:0;pointer-events:none}
.boot-mark{
  width:64px;height:64px;border-radius:16px;background:var(--accent);color:#1a0d08;
  font-family:var(--font-display);font-weight:800;font-size:38px;
  display:grid;place-items:center;animation:pulse 1.6s ease-in-out infinite;
}
@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.92);opacity:.7}}
.boot-bar{width:200px;height:3px;background:var(--line);border-radius:3px;overflow:hidden}
.boot-bar span{display:block;height:100%;width:40%;background:var(--accent);border-radius:3px;animation:slide 1.2s ease-in-out infinite}
@keyframes slide{0%{transform:translateX(-110%)}100%{transform:translateX(310%)}}
.boot-text{color:var(--text-dim);font-size:14px;letter-spacing:.02em}

/* ---------- Header ---------- */
.hdr{
  position:sticky;top:0;z-index:60;height:var(--hdr-h);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 22px;background:var(--bg-2);
  border-bottom:1px solid var(--line);
}
.hdr-brand{display:flex;align-items:center;gap:13px}
.logo{
  width:38px;height:38px;border-radius:11px;background:var(--accent);color:#1a0d08;
  font-family:var(--font-display);font-weight:800;font-size:23px;
  display:grid;place-items:center;
  box-shadow:0 0 0 1px rgba(255,255,255,.06) inset;
}
.hdr-titles h1{
  font-family:var(--font-display);font-weight:800;font-size:21px;
  letter-spacing:.06em;line-height:1;
}
.hdr-titles span{font-size:11px;color:var(--text-mute);letter-spacing:.16em;text-transform:uppercase}
.hdr-meta{display:flex;align-items:center;gap:12px}
.pill{
  font-family:var(--font-mono);font-size:12px;color:var(--text-dim);
  padding:5px 11px;border:1px solid var(--line);border-radius:99px;
}
.icon-btn{
  width:38px;height:38px;border-radius:10px;border:1px solid var(--line);
  background:var(--surface);color:var(--text-dim);
  display:grid;place-items:center;transition:.16s;
}
.icon-btn:hover{color:var(--text);border-color:var(--text-mute)}
.ico-moon{display:none}
[data-theme="light"] .ico-sun{display:none}
[data-theme="light"] .ico-moon{display:block}

/* ---------- Toolbar ---------- */
.toolbar{
  position:sticky;top:var(--hdr-h);z-index:55;min-height:var(--tool-h);
  display:flex;align-items:center;gap:16px;flex-wrap:wrap;
  padding:11px 22px;background:var(--bg-2);border-bottom:1px solid var(--line);
}
.search{
  position:relative;flex:1;min-width:240px;display:flex;align-items:center;
}
.search>svg{position:absolute;left:14px;color:var(--text-mute);pointer-events:none}
.search input{
  width:100%;padding:11px 38px 11px 42px;
  background:var(--surface);border:1px solid var(--line);border-radius:11px;
  color:var(--text);font-size:14.5px;transition:.16s;
}
.search input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(255,90,54,.13)}
.search input::placeholder{color:var(--text-mute)}
.clear-btn{
  position:absolute;right:8px;width:26px;height:26px;border-radius:7px;
  font-size:18px;color:var(--text-mute);line-height:1;
}
.clear-btn:hover{color:var(--text);background:var(--surface-2)}
.tabs{display:flex;gap:4px;background:var(--surface);padding:4px;border-radius:11px;border:1px solid var(--line)}
.tab{
  padding:7px 12px;border-radius:8px;font-size:13px;font-weight:600;
  color:var(--text-dim);white-space:nowrap;transition:.14s;
}
.tab:hover{color:var(--text)}
.tab.is-active{background:var(--accent);color:#1a0d08}
.toolbar-end{margin-left:auto}
.count{font-family:var(--font-mono);font-size:12.5px;color:var(--text-mute)}

/* ---------- Stage / grid ---------- */
.stage{position:relative;z-index:1;padding:24px 22px 90px;min-height:60vh}
.grid{
  display:grid;gap:12px;
  grid-template-columns:repeat(auto-fill,minmax(118px,1fr));
}
.card{
  position:relative;aspect-ratio:1;border-radius:14px;
  background:var(--surface);border:1px solid var(--line-soft);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;
  padding:14px 8px;transition:transform .15s,border-color .15s,background .15s;
  animation:rise .4s ease backwards;
}
@keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.card:hover{transform:translateY(-3px);border-color:var(--accent);background:var(--surface-2)}
.card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.card-ico{
  width:38px;height:38px;display:grid;place-items:center;color:var(--text);
}
.card-ico svg{width:100%;height:100%;display:block}
.card-ico.skeleton{border-radius:9px;background:var(--surface-2);animation:sk 1.1s ease-in-out infinite}
@keyframes sk{0%,100%{opacity:.5}50%{opacity:1}}
.card-name{
  font-size:11px;color:var(--text-dim);text-align:center;line-height:1.3;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.card:hover .card-name{color:var(--text)}
.card-kind{
  position:absolute;top:7px;right:8px;width:6px;height:6px;border-radius:99px;
  background:var(--text-mute);opacity:.5;
}
.card-kind.brand{background:var(--accent)}
.card-kind.tabler{background:#3B82F6;opacity:.7}
.card-kind.phosphor{background:#16A34A;opacity:.7}
.card-kind.material{background:#7C3AED;opacity:.7}
.card-check{
  position:absolute;top:6px;left:6px;width:21px;height:21px;border-radius:7px;
  border:1.5px solid var(--line);background:var(--bg-2);
  display:grid;place-items:center;opacity:0;transition:.14s;color:transparent;
}
.card:hover .card-check,.card.picked .card-check{opacity:1}
.card-check svg{width:13px;height:13px}
.card.picked{border-color:var(--accent)}
.card.picked .card-check{background:var(--accent);border-color:var(--accent);color:#1a0d08}
.card.fav .card-name::after{content:" ★";color:var(--accent)}

.empty{text-align:center;padding:80px 20px;color:var(--text-mute)}
.empty-mark{font-family:var(--font-display);font-size:60px;color:var(--line);margin-bottom:8px}
.empty p{font-size:15px}
.sentinel{height:1px}

/* ---------- Drawer ---------- */
.scrim{position:fixed;inset:0;z-index:70;background:rgba(0,0,0,.5);backdrop-filter:blur(2px)}
.drawer{
  position:fixed;top:0;right:0;z-index:80;height:100%;width:392px;max-width:100vw;
  background:var(--surface);border-left:1px solid var(--line);
  display:flex;flex-direction:column;
  transform:translateX(105%);transition:transform .32s cubic-bezier(.4,0,.2,1);
  box-shadow:var(--shadow);
}
.drawer.open{transform:none}
.drawer-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
  padding:18px 18px 14px;border-bottom:1px solid var(--line);
}
.kind-tag{
  font-size:10px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;
  color:var(--accent);
}
.drawer-id h2{
  font-family:var(--font-display);font-weight:700;font-size:22px;line-height:1.15;
  word-break:break-word;
}
.drawer-head-actions{display:flex;gap:8px;flex-shrink:0}
#favBtn.on{color:var(--accent);border-color:var(--accent)}
#favBtn.on svg{fill:var(--accent)}

.drawer-body{flex:1;overflow-y:auto;padding:18px}
.drawer-body::-webkit-scrollbar{width:8px}
.drawer-body::-webkit-scrollbar-thumb{background:var(--line);border-radius:8px}

/* preview */
.preview{
  border-radius:14px;background:var(--preview-light);
  border:1px solid var(--line);padding:26px;margin-bottom:20px;
  display:grid;place-items:center;min-height:200px;
}
.preview-canvas{
  width:140px;height:140px;display:grid;place-items:center;
  background-image:
    linear-gradient(45deg,rgba(140,140,140,.18) 25%,transparent 25%),
    linear-gradient(-45deg,rgba(140,140,140,.18) 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,rgba(140,140,140,.18) 75%),
    linear-gradient(-45deg,transparent 75%,rgba(140,140,140,.18) 75%);
  background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0;
  border-radius:8px;transition:background .2s;
}
.preview-canvas.solid{background-image:none}
.preview-canvas svg{max-width:100%;max-height:100%;display:block}

/* controls */
.ctrl{padding:15px 0;border-top:1px solid var(--line-soft)}
.ctrl:first-of-type{border-top:none;padding-top:4px}
.ctrl-split{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.ctrl-label{
  display:flex;align-items:center;justify-content:space-between;
  font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;
  color:var(--text-dim);margin-bottom:11px;
}
.ctrl-val{color:var(--text);font-size:13px;text-transform:none;letter-spacing:0;display:flex;align-items:center;gap:3px}
.ctrl-val input{
  width:54px;background:var(--surface-2);border:1px solid var(--line);
  border-radius:6px;color:var(--text);padding:3px 6px;font-size:12.5px;text-align:right;
}

/* range */
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:4px;border-radius:4px;
  background:var(--line);outline:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:17px;height:17px;border-radius:50%;
  background:var(--accent);cursor:pointer;border:3px solid var(--surface);
  box-shadow:0 0 0 1px var(--accent);
}
input[type=range]::-moz-range-thumb{
  width:14px;height:14px;border-radius:50%;background:var(--accent);
  cursor:pointer;border:3px solid var(--surface);
}

/* swatches */
.swatches{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:11px}
.swatch{
  width:26px;height:26px;border-radius:7px;border:1px solid var(--line);
  transition:.13s;position:relative;
}
.swatch:hover{transform:scale(1.12)}
.swatch.on{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--accent)}
.swatch.cc{
  background:repeating-conic-gradient(var(--text-mute) 0 25%,transparent 0 50%) 50%/10px 10px;
  font-size:9px;color:var(--text);display:grid;place-items:center;font-weight:700;
}
.color-row{display:flex;gap:8px;align-items:center}
.color-pick{position:relative;width:38px;height:38px;flex-shrink:0}
.color-pick input{position:absolute;inset:0;opacity:0;cursor:pointer}
.color-chip{
  display:block;width:100%;height:100%;border-radius:9px;
  border:1px solid var(--line);background:var(--accent);
}
.hex-input{
  flex:1;background:var(--surface-2);border:1px solid var(--line);border-radius:9px;
  color:var(--text);padding:9px 11px;font-size:13px;letter-spacing:.04em;
}
.hex-input:focus{outline:none;border-color:var(--accent)}
.mini-btn{
  padding:8px 12px;border-radius:8px;border:1px solid var(--line);
  background:var(--surface-2);color:var(--text-dim);font-size:12.5px;font-weight:600;
  transition:.14s;white-space:nowrap;
}
.mini-btn:hover{color:var(--text);border-color:var(--text-mute)}
.mini-btn.on{background:var(--accent);color:#1a0d08;border-color:var(--accent)}
.mini-btn.ghost{background:transparent}

/* background opts */
.bg-opts{display:flex;gap:8px}
.bg-opt{
  width:42px;height:42px;border-radius:10px;border:1px solid var(--line);
  padding:4px;transition:.13s;position:relative;overflow:hidden;
}
.bg-opt:hover{border-color:var(--text-mute)}
.bg-opt.is-active{border-color:var(--accent);box-shadow:0 0 0 2px rgba(255,90,54,.2)}
.bg-opt>span{display:block;width:100%;height:100%;border-radius:6px}
.bg-opt .checker{
  background:repeating-conic-gradient(#bbb 0 25%,#fff 0 50%) 50%/12px 12px;
}
.bg-custom{padding:4px}
.bg-custom input{position:absolute;inset:0;opacity:0;cursor:pointer}

/* transform row */
.tf-row{display:flex;flex-wrap:wrap;gap:6px;margin-top:11px}

/* copy */
.copy-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.copy-btn{
  padding:11px;border-radius:9px;border:1px solid var(--line);
  background:var(--surface-2);color:var(--text-dim);font-size:12.5px;font-weight:600;
  transition:.14s;
}
.copy-btn:hover{color:var(--text);border-color:var(--accent);background:var(--surface)}

/* drawer footer */
.drawer-foot{
  display:flex;gap:9px;padding:14px 18px;
  border-top:1px solid var(--line);background:var(--surface);
}
.dl-btn{
  display:flex;align-items:center;justify-content:center;gap:7px;
  padding:12px 16px;border-radius:10px;font-size:14px;font-weight:700;
  background:var(--surface-2);border:1px solid var(--line);color:var(--text);
  transition:.14s;
}
.dl-btn:hover{border-color:var(--text-mute)}
.dl-svg{flex:1}
.dl-png{flex:1.4;display:flex;gap:7px}
.dl-png #dlPng{flex:1}
.dl-png #dlPng,.dl-svg{background:var(--accent);color:#1a0d08;border-color:var(--accent)}
.dl-png #dlPng:hover,.dl-svg:hover{background:var(--accent-soft)}
#pngScale{
  background:var(--surface-2);border:1px solid var(--line);border-radius:10px;
  color:var(--text);padding:0 8px;font-size:13px;
}
#pngCustom{
  width:70px;background:var(--surface-2);border:1px solid var(--line);
  border-radius:10px;color:var(--text);padding:0 9px;font-size:13px;
}

/* ---------- Bulk bar ---------- */
.bulkbar{
  position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:65;
  display:flex;align-items:center;gap:18px;flex-wrap:wrap;
  padding:13px 18px;background:var(--surface-2);
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);
  max-width:calc(100vw - 32px);
}
.bulk-count{font-size:13.5px;color:var(--text-dim)}
.bulk-count strong{color:var(--accent);font-family:var(--font-mono)}
.bulk-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.bulk-size{font-size:12.5px;color:var(--text-dim);display:flex;align-items:center;gap:6px}
.bulk-size input{
  width:62px;background:var(--surface);border:1px solid var(--line);
  border-radius:7px;color:var(--text);padding:5px 7px;font-size:12.5px;
}
.bulk-progress{position:absolute;left:0;bottom:0;height:3px;width:100%;background:var(--line);border-radius:0 0 14px 14px;overflow:hidden}
.bulk-progress span{display:block;height:100%;width:0;background:var(--accent);transition:width .2s}

/* ---------- Toasts ---------- */
.toasts{position:fixed;bottom:18px;right:18px;z-index:120;display:flex;flex-direction:column;gap:9px}
.toast{
  padding:11px 16px;border-radius:10px;background:var(--surface-2);
  border:1px solid var(--line);color:var(--text);font-size:13.5px;
  box-shadow:var(--shadow);animation:toastIn .25s ease;
  display:flex;align-items:center;gap:9px;
}
.toast::before{content:"";width:7px;height:7px;border-radius:99px;background:var(--good)}
.toast.err::before{background:var(--accent)}
@keyframes toastIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:none}}

/* ---------- Footer ---------- */
.ftr{
  position:relative;z-index:1;padding:20px 22px 28px;
  border-top:1px solid var(--line);text-align:center;
  font-size:12px;color:var(--text-mute);
}

/* ---------- Responsive ---------- */
@media(max-width:560px){
  .drawer{width:100%}
  .toolbar{gap:10px}
  .tabs{order:3;width:100%;justify-content:space-between;flex-wrap:wrap}
  .tab{flex:1 0 auto;text-align:center;padding:7px 8px;font-size:12.5px}
  .toolbar-end{order:2}
  .grid{grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}
  .bulkbar{flex-direction:column;align-items:stretch;gap:10px}
}
