/* metadata.zlef.fr — uses da.zlef.fr/tokens.css for the palette/roles. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.zl-body {
  background: var(--zl-bg);
  color: var(--zl-text);
  font-family: var(--zl-font);
  font-size: var(--zl-text-base);
  line-height: var(--zl-leading);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--zl-accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ── topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--zl-space-4) var(--zl-space-5);
  max-width: 980px; margin: 0 auto;
  position: relative; z-index: 2;
}
.brand { display: flex; align-items: center; gap: var(--zl-space-3); color: var(--zl-text); }
.brand:hover { text-decoration: none; }
.brand .mark {
  font-size: 26px; line-height: 1; color: var(--zl-accent-soft);
  filter: drop-shadow(0 0 14px var(--zl-accent-glow));
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt strong { font-size: var(--zl-text-xl); letter-spacing: var(--zl-tracking-tight); }
.brand-txt small { color: var(--zl-text-muted); font-size: var(--zl-text-xs); letter-spacing: var(--zl-tracking-wide); text-transform: uppercase; }
.privacy-badge {
  font-size: var(--zl-text-xs); letter-spacing: var(--zl-tracking-wide); text-transform: uppercase;
  color: var(--zl-accent-soft); border: 1px solid var(--zl-line-strong);
  background: var(--zl-accent-wash);
  padding: 6px 12px; border-radius: var(--zl-radius-pill);
}

/* ── layout ─────────────────────────────────────────────── */
.wrap { max-width: 820px; margin: 0 auto; padding: var(--zl-space-5); position: relative; z-index: 2; }

/* ── intro / dropzone ───────────────────────────────────── */
.intro { text-align: center; padding: var(--zl-space-6) 0 var(--zl-space-5); animation: rise .5s ease both; }
.hero-title {
  font-size: var(--zl-text-3xl); line-height: var(--zl-leading-tight);
  letter-spacing: var(--zl-tracking-tight); font-weight: var(--zl-weight-bold);
  margin: 0 auto var(--zl-space-4); max-width: 18ch;
}
.lede { color: var(--zl-text-soft); max-width: 52ch; margin: 0 auto var(--zl-space-6); font-size: var(--zl-text-lg); }

.dropzone {
  border: 1.5px dashed var(--zl-line-strong);
  border-radius: var(--zl-radius-xl);
  background: linear-gradient(180deg, var(--zl-surface-1), rgba(14,14,19,.4));
  padding: var(--zl-space-8) var(--zl-space-5);
  cursor: pointer; transition: border-color .25s, background .25s, transform .25s, box-shadow .25s;
  display: flex; flex-direction: column; align-items: center; gap: var(--zl-space-3);
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--zl-line-focus); background: var(--zl-surface-2); }
.dropzone.over { border-color: var(--zl-accent-soft); background: var(--zl-accent-wash); transform: scale(1.01); box-shadow: var(--zl-shadow-md); }
.dz-ico { width: 46px; height: 46px; color: var(--zl-accent-soft); margin-bottom: var(--zl-space-2); }
.dz-title { font-size: var(--zl-text-xl); font-weight: var(--zl-weight-medium); }
.dz-sub { color: var(--zl-text-soft); }
.dz-hint { color: var(--zl-text-muted); font-size: var(--zl-text-sm); }
.linkbtn { background: none; border: none; color: var(--zl-accent-soft); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ── result head ────────────────────────────────────────── */
.result { animation: rise .4s ease both; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: var(--zl-space-4); margin-bottom: var(--zl-space-5); }
.file-id { display: flex; align-items: center; gap: var(--zl-space-4); min-width: 0; }
.thumb {
  width: 60px; height: 60px; flex: 0 0 60px; border-radius: var(--zl-radius-md);
  background: var(--zl-surface-2); border: 1px solid var(--zl-line);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--zl-accent-soft);
  background-size: cover; background-position: center;
}
.thumb.img { border-color: var(--zl-line-strong); }
.file-id-txt { min-width: 0; }
.file-name { font-size: var(--zl-text-lg); font-weight: var(--zl-weight-medium); word-break: break-all; }
.file-kind { color: var(--zl-text-muted); font-size: var(--zl-text-sm); font-family: var(--zl-font-mono); }

/* ── groups & fields ────────────────────────────────────── */
.groups { display: flex; flex-direction: column; gap: var(--zl-space-4); }
.group {
  background: var(--zl-surface-1); border: 1px solid var(--zl-line);
  border-radius: var(--zl-radius-lg); overflow: hidden;
  animation: rise .4s ease both;
}
.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--zl-space-3) var(--zl-space-4);
  border-bottom: 1px solid var(--zl-line); background: var(--zl-surface-2);
}
.group-head h3 { margin: 0; font-size: var(--zl-text-base); font-weight: var(--zl-weight-medium); letter-spacing: var(--zl-tracking-tight); }
.group-count { color: var(--zl-text-muted); font-size: var(--zl-text-xs); font-family: var(--zl-font-mono); }

.fields { display: flex; flex-direction: column; }
.field {
  display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: var(--zl-space-4);
  padding: 10px var(--zl-space-4); align-items: center;
  border-bottom: 1px solid var(--zl-line);
  transition: background .2s;
}
.field:last-child { border-bottom: none; }
.field:hover { background: var(--zl-surface-2); }
.field.removed { opacity: .45; }
.field.removed .field-input, .field.removed .field-val { text-decoration: line-through; }
.field-key { color: var(--zl-text-soft); font-size: var(--zl-text-sm); word-break: break-word; }
.field-body { display: flex; align-items: center; gap: var(--zl-space-2); min-width: 0; }
.field-val { color: var(--zl-text); word-break: break-word; min-width: 0; }
.field-val.mono, .field-val .mono { font-family: var(--zl-font-mono); font-size: var(--zl-text-sm); }
.field-val em { color: var(--zl-text-faint); }
.field-link { color: var(--zl-accent-soft); font-size: var(--zl-text-sm); white-space: nowrap; }

.field-input {
  flex: 1; min-width: 0; background: var(--zl-surface-2); color: var(--zl-text);
  border: 1px solid var(--zl-line); border-radius: var(--zl-radius-sm);
  padding: 7px 10px; font: inherit; font-size: var(--zl-text-sm);
  transition: border-color .2s, box-shadow .2s;
}
.field-input:focus { outline: none; border-color: var(--zl-line-focus); box-shadow: 0 0 0 3px var(--zl-accent-wash); }
.field-rm {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: var(--zl-radius-sm);
  border: 1px solid var(--zl-line); background: var(--zl-surface-2); color: var(--zl-text-muted);
  cursor: pointer; font-size: 16px; line-height: 1; transition: all .2s;
}
.field-rm:hover { border-color: var(--zl-danger); color: var(--zl-danger); background: var(--zl-danger-wash); }

.add-row {
  display: grid; grid-template-columns: minmax(120px,30%) 1fr auto; gap: var(--zl-space-2);
  padding: 10px var(--zl-space-4); background: var(--zl-surface-2); align-items: center;
}
.add-key, .add-val {
  background: var(--zl-surface-1); border: 1px solid var(--zl-line); border-radius: var(--zl-radius-sm);
  padding: 7px 10px; font: inherit; font-size: var(--zl-text-sm); color: var(--zl-text);
}
.add-key:focus, .add-val:focus { outline: none; border-color: var(--zl-line-focus); }

/* ── buttons ────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--zl-line-strong); background: var(--zl-surface-2); color: var(--zl-text);
  padding: 10px 18px; border-radius: var(--zl-radius-md); cursor: pointer; font: inherit;
  font-weight: var(--zl-weight-medium); transition: all .2s; position: relative;
}
.btn:hover:not(:disabled) { background: var(--zl-surface-3); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 7px 14px; font-size: var(--zl-text-sm); }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--zl-accent); border-color: var(--zl-accent-mid); color: var(--zl-on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--zl-accent-mid); box-shadow: 0 0 22px var(--zl-accent-glow); }
.btn.danger { background: transparent; border-color: var(--zl-danger); color: var(--zl-danger); }
.btn.danger:hover:not(:disabled) { background: var(--zl-danger-wash); box-shadow: 0 0 22px var(--zl-danger-wash); }
.btn.loading { color: transparent; }
.btn.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  color: var(--zl-on-accent); animation: spin .7s linear infinite;
}

/* ── actions / status ───────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: var(--zl-space-5); margin-top: var(--zl-space-6); }
.act { display: flex; flex-direction: column; gap: 6px; }
.act-hint { color: var(--zl-text-muted); font-size: var(--zl-text-xs); }
.ro-note { color: var(--zl-text-muted); font-size: var(--zl-text-sm); margin-top: var(--zl-space-5); }
.status { margin-top: var(--zl-space-4); min-height: 1.4em; font-size: var(--zl-text-sm); }
.status.ok { color: var(--zl-success); }
.status.err, .err { color: var(--zl-danger); }
.status.warn { color: var(--zl-warning); }

/* ── skeleton / empty ───────────────────────────────────── */
.skel-wrap { padding: var(--zl-space-5); background: var(--zl-surface-1); border: 1px solid var(--zl-line); border-radius: var(--zl-radius-lg); }
.skel-line { height: 14px; border-radius: var(--zl-radius-sm); margin-bottom: 14px;
  background: linear-gradient(90deg, var(--zl-surface-2) 25%, var(--zl-surface-3) 37%, var(--zl-surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skel-line:nth-child(even) { width: 70%; }
.reading { color: var(--zl-text-muted); text-align: center; font-size: var(--zl-text-sm); margin: var(--zl-space-2) 0 0; }
.empty { text-align: center; padding: var(--zl-space-7) var(--zl-space-4); background: var(--zl-surface-1); border: 1px solid var(--zl-line); border-radius: var(--zl-radius-lg); }
.empty-emoji { font-size: 40px; margin-bottom: var(--zl-space-3); }
.empty h3 { margin: 0 0 var(--zl-space-2); font-weight: var(--zl-weight-medium); }
.empty p { color: var(--zl-text-muted); margin: 0; }

/* ── footer ─────────────────────────────────────────────── */
.foot { text-align: center; color: var(--zl-text-muted); font-size: var(--zl-text-sm); padding: var(--zl-space-7) var(--zl-space-5) var(--zl-space-6); position: relative; z-index: 2; }
.foot p { margin: 4px 0; }

/* ── animations ─────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (max-width: 560px) {
  .field, .add-row { grid-template-columns: 1fr; gap: 6px; }
  .add-row { grid-template-columns: 1fr 1fr auto; }
  .hero-title { font-size: var(--zl-text-2xl); }
  .result-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
