/* ==========================================================================
   NIMZELIO — layout.css
   Nav, hero, sections, cards, footer, pixel logo animation
   ========================================================================== */

/* Shell ------------------------------------------------------------------ */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--s5);
}
@media (max-width: 640px) {
  .wrap { padding: 0 var(--s4); }
}

/* Nav -------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 248, 245, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--border);
  background: rgba(248, 248, 245, 0.95);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s5);
  height: var(--nav-h);
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--s5);
}
@media (max-width: 640px) {
  .nav { padding: 0 var(--s4); gap: var(--s3); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  padding: 6px;
  margin-left: -6px;
  border-radius: var(--r-sm);
  flex: 0 0 auto;
}
.brand:hover { background: #EFEFEA; }

.brand-word {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
  list-style: none;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color 140ms var(--ease), background 140ms var(--ease);
}
.nav-link:hover { color: var(--text); background: #EFEFEA; }
.nav-link.is-current { color: var(--text); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; }

  .nav-links.is-open {
    display: flex;
    position: absolute;
    left: var(--s4);
    right: var(--s4);
    top: calc(var(--nav-h) - 6px);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: var(--s2);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-2);
    margin-left: 0;
  }
  .nav-links.is-open .nav-link { min-height: 48px; padding: 12px 14px; font-size: 15px; }
}

/* Pixel logo ------------------------------------------------------------- */
.logo-mark { display: block; overflow: visible; }
.logo-mark .px {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 260ms var(--ease), opacity 260ms var(--ease);
}
.logo-mark .p1 { fill: #242722; }
.logo-mark .p2 { fill: #C8D5C2; }
.logo-mark .p3 { fill: #DCE8F1; }
.logo-mark .p4 { fill: #242722; }
.logo-mark .spark { fill: #F4D4C7; }

/* first-load reveal — staggered assembly */
.reveal .logo-mark .px {
  animation: px-in 420ms var(--ease) both;
}
.reveal .logo-mark .p1 { animation-delay: 0ms; }
.reveal .logo-mark .p2 { animation-delay: 60ms; }
.reveal .logo-mark .p3 { animation-delay: 120ms; }
.reveal .logo-mark .p4 { animation-delay: 180ms; }
.reveal .logo-mark .spark { animation-delay: 250ms; }

@keyframes px-in {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: none; }
}

/* hover — a couple of pixels shift by one grid unit */
.brand:hover .logo-mark .p2 { transform: translate(0, -2px); }
.brand:hover .logo-mark .p3 { transform: translate(2px, 0); }
.brand:hover .logo-mark .spark { transform: rotate(45deg) scale(1.15); }

@media (prefers-reduced-motion: reduce) {
  .brand:hover .logo-mark .px { transform: none; }
}

/* Sections --------------------------------------------------------------- */
.section { padding: var(--s9) 0; }
.section-sm { padding: var(--s8) 0; }
.section-head { max-width: 620px; margin-bottom: var(--s6); }
.section-head h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: var(--s3); }
.section-head p { color: var(--text-2); font-size: 16px; }

@media (max-width: 640px) {
  .section { padding: var(--s7) 0; }
  .section-sm { padding: var(--s6) 0; }
}

/* Hero ------------------------------------------------------------------- */
.hero { padding: var(--s8) 0 var(--s7); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--s8);
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s6); }
}

.hero h1 {
  font-size: clamp(32px, 5.2vw, 54px);
  letter-spacing: -0.035em;
  line-height: 1.06;
  margin: var(--s4) 0 var(--s4);
  font-weight: 600;
}
.hero-sub {
  font-size: clamp(16px, 1.5vw, 18px);
  color: var(--text-2);
  max-width: 520px;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin: var(--s5) 0 var(--s6);
}

.trust-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}
.trust-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-2);
}
.trust-list svg { flex: 0 0 auto; margin-top: 3px; color: var(--ok); }

/* Hero pixel composition */
.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s5);
}
.hero-art svg { width: 100%; max-width: 380px; height: auto; }
@media (max-width: 640px) {
  .hero-art { padding: var(--s3) 0; }
  .hero-art svg { max-width: 272px; }
}
.hero-art .tile { fill: #FFFFFF; stroke: #E8E9E2; stroke-width: 1; }
.hero-art .glyph { fill: #242722; }
.hero-art .wire { stroke: #D6D8CE; stroke-width: 1.5; stroke-dasharray: 4 5; fill: none; }
.hero-art .node-sage { fill: #C8D5C2; }
.hero-art .node-lav { fill: #E8E3F5; }
.hero-art .node-peach { fill: #F4D4C7; }
.hero-art .node-blue { fill: #DCE8F1; }
.hero-art .drift { animation: drift 6s ease-in-out infinite; }
.hero-art .drift-2 { animation: drift 7.5s ease-in-out infinite reverse; }
@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Search + filters ------------------------------------------------------- */
.search-row {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  margin-bottom: var(--s6);
}
.search-field { position: relative; max-width: 560px; width: 100%; }
.search-field svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  pointer-events: none;
}
.search-field .input { padding-left: 42px; min-height: 48px; font-size: 15px; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* Library controls: search + tabs ---------------------------------------- */
.library-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  margin-bottom: var(--s6);
}
@media (min-width: 900px) {
  .library-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--s5);
  }
  .library-controls .search-field { flex: 0 1 360px; }
}

.tabs-shell {
  position: relative;
  min-width: 0;
  max-width: 100%;
}
.tabs-shell[data-scrollable="true"]::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 44px;
  border-radius: 0 11px 11px 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--surface) 72%);
  pointer-events: none;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.tab:hover { color: var(--text); background: #F1F1EC; }
.tab[aria-selected="true"] { background: var(--text); color: #fff; }
.tab .count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}
.tab[aria-selected="true"] .count { opacity: 0.8; }

/* Tool grid -------------------------------------------------------------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4);
}
@media (max-width: 1040px) { .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .tool-grid { grid-template-columns: 1fr; } }

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
  position: relative;
  min-height: 168px;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}
.tool-card:active { transform: translateY(0); }

.tool-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s1);
  flex: 0 0 auto;
}
.tool-icon.cat-audio  { background: var(--sage-soft); }
.tool-icon.cat-video  { background: var(--lavender-soft); }
.tool-icon.cat-images { background: var(--peach-soft); }
.tool-icon.cat-files  { background: var(--blue-soft); }
.tool-icon.cat-utility { background: #F1F1EC; }
.tool-icon.cat-pdf { background: var(--rose-soft); }

/* Per-tool glyph accent, tinted by category */
.tool-icon.cat-audio   { --icon-accent: #A9BCA0; }
.tool-icon.cat-video   { --icon-accent: #B9AEDA; }
.tool-icon.cat-images  { --icon-accent: #E3AF9A; }
.tool-icon.cat-pdf     { --icon-accent: #D79E97; }
.tool-icon.cat-files   { --icon-accent: #A8BFD2; }
.tool-icon.cat-utility { --icon-accent: #BFC0B4; }

.tool-icon svg { display: block; color: var(--text); }

.tool-icon svg { overflow: visible; transition: transform 200ms var(--ease); }
.tool-card:hover .tool-icon svg { transform: scale(1.06); }

.tool-card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-card p {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
  flex: 1 1 auto;
}
.tool-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s2);
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.tool-card .arrow {
  color: var(--border-strong);
  transition: transform 180ms var(--ease), color 180ms var(--ease);
}
.tool-card:hover .arrow { transform: translateX(2px); color: var(--text-2); }

.group-label {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  margin: var(--s7) 0 var(--s4);
}
.group-label:first-of-type { margin-top: 0; }
.group-label h3 { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.group-label .count { font-size: 12px; color: var(--text-2); }

/* Steps ------------------------------------------------------------------ */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
  list-style: none;
  counter-reset: step;
}
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: var(--s4); } }

.step {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.step .step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: var(--s3);
}
.step h3 { font-size: 15.5px; margin-bottom: 6px; }
.step p { font-size: 14px; color: var(--text-2); line-height: 1.55; }

/* Privacy / prose sections ----------------------------------------------- */
.prose { max-width: 720px; }
.prose h2 { font-size: clamp(22px, 2.6vw, 30px); margin-bottom: var(--s4); }
.prose h3 { font-size: 17px; margin: var(--s6) 0 var(--s2); }
.prose p { color: var(--text-2); font-size: 15.5px; line-height: 1.7; margin-bottom: var(--s3); }
.prose ul { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: var(--s3) 0 var(--s5); }
.prose ul li {
  position: relative;
  padding-left: 22px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 6px; height: 6px;
  background: var(--sage);
  border-radius: 1px;
}
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border-strong); }
.prose a:hover { text-decoration-color: var(--text); }
.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #EFEFEA;
  padding: 1px 5px;
  border-radius: 4px;
}

.safeguards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  margin-top: var(--s5);
  list-style: none;
}
@media (max-width: 700px) { .safeguards { grid-template-columns: 1fr; } }
.safeguard {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}
.safeguard svg { flex: 0 0 auto; margin-top: 2px; color: var(--ok); }
.safeguard strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

/* Footer ----------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--s8);
  padding: var(--s7) 0 var(--s6);
  background: var(--bg);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--s6);
  align-items: start;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: var(--s5); } }

.footer-brand p {
  margin-top: var(--s3);
  font-size: 14px;
  color: var(--text-2);
  max-width: 380px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  list-style: none;
}
.footer-links a {
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
}
.footer-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.footer-bottom {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-2);
}

/* Empty state ------------------------------------------------------------ */
.empty-state {
  padding: var(--s8) var(--s5);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-card);
  background: var(--surface);
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-2); margin-bottom: var(--s4); }
