/* ============================================================================
   Lepidus Blank State Illustration Library — UI styles
   Premium enterprise SaaS · light-first, dark-aware · lavender / periwinkle
   ========================================================================== */
:root {
  --bg:        #FAFBFE;
  --bg-tint:   #F1F3FB;
  --surface:   #FFFFFF;
  --surface-2: #F5F6FC;
  --tile:      #F4F5FB;   /* illustration canvas tile */
  --line:      #E7E9F3;
  --line-2:    #DBDFEE;
  --ink:       #232A44;
  --ink-2:     #5B6488;
  --muted:     #8A92AE;
  --brand:     #6E77C4;
  --brand-ink: #4B54A6;
  --brand-soft:#EEEFFB;
  --brand-soft-2:#E4E6F8;
  --green:     #7FA778;
  --green-soft:#E7F0E3;
  --amber:     #C99B5A;
  --amber-soft:#F5ECDD;
  --radius:    18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(40,46,84,.05), 0 2px 8px rgba(40,46,84,.05);
  --shadow-md: 0 6px 20px rgba(45,52,96,.09), 0 2px 6px rgba(45,52,96,.05);
  --shadow-lg: 0 24px 60px rgba(38,44,86,.18), 0 6px 18px rgba(38,44,86,.10);
  --ring:      0 0 0 3px rgba(110,119,196,.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1240px;
}
[data-theme="dark"] {
  --bg:        #111325;
  --bg-tint:   #171A31;
  --surface:   #191C33;
  --surface-2: #1F2340;
  --tile:      #EDEFF7;   /* keep illustration tile light so pale art reads */
  --line:      #2A2F52;
  --line-2:    #333963;
  --ink:       #EDEFFa;
  --ink-2:     #AEB5D6;
  --muted:     #8087AC;
  --brand:     #8E96E4;
  --brand-ink: #B4BAF0;
  --brand-soft:#232748;
  --brand-soft-2:#2B3059;
  --green:     #98BE90;
  --green-soft:#22352A;
  --shadow-md: 0 8px 26px rgba(0,0,0,.42);
  --shadow-lg: 0 28px 70px rgba(0,0,0,.55);
  --ring:      0 0 0 3px rgba(142,150,228,.42);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  line-height: 1.5;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
h1,h2,h3 { margin: 0; letter-spacing: -.02em; font-weight: 700; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color:#fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 12px; }

/* ---------- buttons ---------- */
.btn { border: 1px solid transparent; border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: transform .12s ease, background .15s ease, box-shadow .15s ease, border-color .15s; color: var(--ink); background: transparent; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(110,119,196,.35); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-ink); }
.btn-secondary:hover { background: var(--brand-soft-2); }
.btn-soft { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-soft:hover { border-color: var(--line-2); background: var(--surface); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 12px; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-size: 15px; }
.btn-icon:hover { border-color: var(--line-2); }
.btn-icon:focus-visible { outline: none; box-shadow: var(--ring); }
.count-pill { background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; font-size: 12px; padding: 1px 8px; font-weight: 700; }
.ico { font-size: 14px; line-height: 1; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { color: var(--brand); display: inline-grid; place-items: center; filter: drop-shadow(0 4px 8px rgba(110,119,196,.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 16px; letter-spacing: -.02em; }
.brand-text em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-ico::before { content: "☾"; font-size: 16px; }
[data-theme="dark"] .theme-ico::before { content: "☀"; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 30px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 700; color: var(--brand); margin: 0 0 16px; }
.hero h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.08; max-width: 15ch; }
.lede { color: var(--ink-2); font-size: 17px; max-width: 52ch; margin: 20px 0 26px; }
.hero-search { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 4px 4px 4px 46px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s; max-width: 560px; }
.hero-search:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.search-ico { position: absolute; left: 15px; color: var(--muted); display: inline-grid; place-items: center; }
.hero-search input { flex: 1; border: none; background: transparent; font-size: 16px; color: var(--ink); padding: 12px 8px; outline: none; }
.hero-search input::placeholder { color: var(--muted); }
.kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 7px; padding: 3px 9px; font-size: 12px; color: var(--muted); background: var(--surface-2); margin-right: 6px; }
.hero-stats { list-style: none; display: flex; gap: 34px; padding: 0; margin: 30px 0 0; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats b { font-size: 24px; letter-spacing: -.02em; }
.hero-stats span { font-size: 13px; color: var(--muted); font-weight: 600; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 340px; }
.hero-card { width: 100%; max-width: 420px; aspect-ratio: 1/.92; background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: grid; place-items: center; overflow: hidden; position: relative; z-index: 2; }
.hero-card svg, .hero-card img { width: 100%; height: 100%; }
.hero-glow { position: absolute; inset: -10% 6% 20% -6%; background: radial-gradient(closest-side, rgba(126,135,214,.28), transparent 72%); z-index: 1; filter: blur(6px); }

/* ---------- toolbar / filters ---------- */
.toolbar { position: sticky; top: 68px; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
.filter-row { display: flex; align-items: center; gap: 14px; }
.filter-row-2 { margin-top: 12px; justify-content: space-between; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.chips::-webkit-scrollbar { height: 6px; }
.chips::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
.chip-btn { white-space: nowrap; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 8px 15px; font-size: 13.5px; font-weight: 600; transition: all .14s; }
.chip-btn:hover { border-color: var(--brand); color: var(--ink); }
.chip-btn[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
[data-theme="dark"] .chip-btn[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; color: var(--ink-2); padding: 7px 13px; font-size: 13px; font-weight: 600; border-radius: 9px; transition: all .14s; text-transform: capitalize; }
.seg button:hover { color: var(--ink); }
.seg button.is-active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }
.seg.small button { padding: 6px 12px; font-size: 12.5px; }
.toolbar-right { display: flex; align-items: center; gap: 18px; }
.switch-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.switch-mini input { accent-color: var(--brand); width: 16px; height: 16px; }
.result-count { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---------- gallery ---------- */
.gallery-wrap { padding: 30px 24px 60px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease, border-color .16s; display: flex; flex-direction: column; text-align: left; padding: 0; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.card:focus-visible { outline: none; box-shadow: var(--ring); }
.card-tile { position: relative; background: var(--tile); aspect-ratio: 1/.82; display: grid; place-items: center; overflow: hidden; }
.card-tile img { width: 100%; height: 100%; display: block; }
.card-fav { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 9px; border: none; background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--muted); backdrop-filter: blur(4px); display: grid; place-items: center; font-size: 15px; opacity: 0; transition: opacity .15s, color .15s, transform .1s; }
.card:hover .card-fav, .card-fav.on { opacity: 1; }
.card-fav.on { color: var(--brand); }
.card-fav:hover { color: var(--brand-ink); }
.card-quick { position: absolute; inset: auto 0 0 0; display: flex; gap: 6px; padding: 10px; background: linear-gradient(to top, color-mix(in srgb, var(--tile) 96%, transparent), transparent); transform: translateY(6px); opacity: 0; transition: opacity .16s, transform .16s; }
.card:hover .card-quick { opacity: 1; transform: none; }
.qbtn { flex: 1; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 700; padding: 7px 4px; border-radius: 9px; transition: all .13s; }
.qbtn:hover { color: var(--brand-ink); border-color: var(--brand); }
.qbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-meta { display: flex; align-items: center; gap: 7px; }
.chip { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .01em; }
.chip-cat { background: var(--brand-soft); color: var(--brand-ink); }
.chip-type { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); text-transform: capitalize; }
[data-type="error"] .chip-type, .chip-type.type-error { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
[data-type="security"] .chip-type, .chip-type.type-security { background: var(--green-soft); color: var(--green); border-color: transparent; }

.empty-results { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-results p { font-size: 17px; margin-bottom: 16px; }

/* ---------- recently viewed rail ---------- */
.recent-wrap { padding: 8px 24px 70px; }
.section-h { font-size: 18px; margin-bottom: 16px; }
.rail { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.rail .card { min-width: 200px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-tint); padding: 44px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; align-items: center; flex-wrap: wrap; }
.footer-inner .brand-mark { color: var(--brand); vertical-align: middle; margin-right: 8px; }
.footer-inner strong { font-size: 15px; }
.footer-inner p { color: var(--muted); font-size: 13.5px; max-width: 46ch; margin: 8px 0 0; }
.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal-root[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(23,26,49,.5); backdrop-filter: blur(4px); animation: fade .18s ease; }
.modal-panel { position: relative; z-index: 2; width: min(1020px, 94vw); max-height: 92vh; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s cubic-bezier(.2,.8,.3,1); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 6; }
.modal-nav { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.nav-arrow { pointer-events: auto; position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 22px; line-height: 1; display: grid; place-items: center; box-shadow: var(--shadow-md); }
#prevBtn { left: -14px; } #nextBtn { right: -14px; }
.nav-arrow:hover { color: var(--brand-ink); border-color: var(--brand); }
.nav-arrow:focus-visible { outline: none; box-shadow: var(--ring); }
.modal-grid { display: grid; grid-template-columns: 1.05fr .95fr; max-height: 92vh; }
.preview-col { padding: 26px; display: flex; flex-direction: column; gap: 16px; background: var(--bg-tint); border-right: 1px solid var(--line); }
.stage { flex: 1; min-height: 300px; border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.stage[data-bg="light"] { background: #F4F5FB; }
.stage[data-bg="transparent"] { background: repeating-conic-gradient(#e9ebf3 0% 25%, #f7f8fc 0% 50%) 50% / 22px 22px; }
[data-theme="dark"] .stage[data-bg="transparent"] { background: repeating-conic-gradient(#2a2f52 0% 25%, #333963 0% 50%) 50% / 22px 22px; }
.stage[data-bg="dark"] { background: #1a1d33; }
.stage-art { width: 84%; max-width: 400px; }
.stage-art svg { width: 100%; height: auto; display: block; }
.stage-controls { display: flex; justify-content: center; }

.detail-col { padding: 30px 30px 26px; overflow-y: auto; }
.detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fav-toggle { margin-left: auto; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 17px; }
.fav-toggle[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.fav-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
#mTitle { font-size: 26px; margin-bottom: 8px; }
.detail-desc { color: var(--ink-2); font-size: 15px; margin: 0 0 22px; }
.detail-block { margin-bottom: 22px; }
.detail-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px; }
.use-list { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 5px; }
.use-list li::marker { color: var(--brand); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.tag:hover { border-color: var(--brand); color: var(--brand-ink); cursor: pointer; }

.export-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.presets { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.presets button { flex: 1; min-width: 52px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: 8px 4px; border-radius: 10px; font-size: 13px; font-weight: 700; transition: all .13s; }
.presets button.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.presets button:focus-visible { outline: none; box-shadow: var(--ring); }
.size-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field input { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 11px; font-size: 14px; font-weight: 600; width: 100%; }
.field input:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
.lock-btn { width: 40px; height: 39px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; display: grid; place-items: center; margin-bottom: 1px; opacity: .5; }
.lock-btn.is-locked { opacity: 1; border-color: var(--brand); background: var(--brand-soft); }
.lock-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.px-hint { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.switch-row input { accent-color: var(--brand); width: 17px; height: 17px; }
.export-actions { display: flex; gap: 10px; margin: 16px 0 10px; }
.export-actions .btn { flex: 1; justify-content: center; }
.copy-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.filename-hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.filename-hint code { background: var(--surface); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; font-size: 12px; }

/* ---------- drawer ---------- */
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(460px, 92vw); background: var(--surface); box-shadow: var(--shadow-lg); padding: 30px; overflow-y: auto; z-index: 2; animation: slide .24s cubic-bezier(.2,.8,.3,1); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer h2 { font-size: 22px; margin-bottom: 6px; }
.drawer-lede { color: var(--ink-2); font-size: 14px; margin: 0 0 24px; }
.drawer-block { margin-bottom: 26px; }
.drawer-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 12px; }
.drawer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pack-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; text-align: left; transition: all .14s; }
.pack-btn:hover { border-color: var(--brand); background: var(--surface); }
.pack-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.pack-btn b { display: block; font-size: 13.5px; font-weight: 700; }
.pack-btn span { font-size: 12px; color: var(--muted); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 80; opacity: 0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="dark"] .toast { background: var(--brand); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-art { order: -1; min-height: 240px; }
  .hero-card { max-width: 320px; }
  .modal-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .preview-col { border-right: none; border-bottom: 1px solid var(--line); }
  #prevBtn { left: 6px; } #nextBtn { right: 6px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 34px 0 20px; }
  .hero-stats { gap: 22px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .header-actions .btn-ghost span:not(.count-pill):not(.ico) { display: none; }
  .detail-col, .preview-col { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
