/* N4DU Studio — the ground floor.
   Colours, spacing, the reset, the window frame, and the controls that turn
   up everywhere. Everything else in css/ is loaded after this and leans on
   the custom properties declared here, so this file goes first and nothing
   works without it. */

/* N4DU Studio — desktop interface */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The `hidden` attribute has to actually hide.
   The browser's own rule for it is display:none, and ANY author rule that sets
   a display beats it — .btn-ghost sets inline-flex, so a button carrying
   `hidden` stayed on screen. This had been patched one selector at a time,
   nine times over, and the tenth was the "Window" button appearing in the
   DESKTOP version: the one place it must never be, because that window is
   already its own. One rule instead of a tenth patch. */
[hidden] { display: none !important; }

:root {
  --bg:       #0a0a0a;
  --chrome:   #141414;
  --surface:  #171717;
  --surface2: #202020;
  --border:   #262626;
  --border2:  #333;
  --text:     #ececec;
  --muted:    #7a7a7a;
  /* Was #4a4a4a: 2.0:1 against the background, below the 3:1 floor and in
     practice unreadable. It carries real information — the keyboard
     shortcuts line, the reason a format pill is unavailable, the "each" that
     says whether a limit is per file. #7a7a7a clears 4.6:1. */
  --faint:    #7a7a7a;
  --accent:   #e8ff47;
  --accent2:  #c4d930;
  --danger:   #ff5f5f;
  --success:  #5fffaa;
  --fh:       'Space Grotesk', 'Segoe UI', sans-serif;
  --fb:       'Inter', 'Segoe UI', system-ui, sans-serif;

  /* The "nothing here" pattern, in one place so the stage, the file tiles
     and the result preview cannot drift apart. Far enough apart to actually
     read as a checkerboard: at eight levels of difference it just looked
     like a black background, which is the opposite of what it means. */
  --check-a:  #1b1b1b;
  --check-b:  #333;

  /* Vertical rhythm. Tightened on short windows so the panels never scroll. */
  --gap:      18px;
  --pad:      14px;
  /* The gap between the rows of the actions block. It is named because the
     destination panel has to cancel exactly this much while it is shut — a
     flex parent keeps its row gap around a child of zero height — and
     window.css narrows it for the compact window. */
  --actions-gap: 11px;
  /* The icon plus the gap after it, in a button whose label is icon + word.
     Centring that content as one block puts the word off-centre by half of
     this; the green Convert button gives it back as padding on the right.
     window.css narrows it where the icon is smaller. */
  --label-lead: 21px;
}

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  line-height: 1.5;
}

/* The icon sprite must not take up space */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg use, .sprite symbol { fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }

/* ── LAYOUT ── */
.app {
  display: grid;
  grid-template-rows: 48px 1fr 24px;
  height: 100vh;
}

/* ── TITLE BAR ── */
.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--fh);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.02em;
  user-select: none;
  flex-shrink: 0;
}
.brand em { font-style: normal; color: var(--accent); }
.logo { width: 21px; height: 21px; flex-shrink: 0; }
.title-file {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}
.title-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.title-actions .sep {
  width: 1px; height: 20px; background: var(--border2); margin: 0 2px;
}

/* Buttons */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--fb);
  font-size: .8rem;
  padding: 6px 11px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn-ghost:disabled { opacity: .35; cursor: not-allowed; }
.btn-ghost.small { font-size: .75rem; padding: 5px 9px; justify-content: center; }
.btn-ghost.grow { flex: 1; justify-content: center; }

.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #000;
  font-family: var(--fh);
  font-size: .8rem;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-accent:hover:not(:disabled) { background: var(--accent2); border-color: var(--accent2); }
.btn-accent:active:not(:disabled) { transform: scale(.97); }
.btn-accent:disabled { opacity: .35; cursor: not-allowed; }

.bi { width: 15px; height: 15px; flex-shrink: 0; }

/* Replacing a file in place is the headline feature, so it carries its own
   emphasis instead of blending in with the secondary buttons. */
.btn-primary {
  background: rgba(232,255,71,.1);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--accent);
  font-family: var(--fh);
  font-size: .8rem;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover:not(:disabled) { background: rgba(232,255,71,.2); }
.btn-primary:active:not(:disabled) { transform: scale(.97); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }

/* Click-to-type readouts */
.editable { cursor: text; border-bottom: 1px dotted var(--faint); }
.editable:hover { border-bottom-color: var(--accent); }
.inline-number {
  width: 4.2em;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--fh);
  font-size: .72rem;
  padding: 0 4px;
  text-align: right;
}
.inline-number:focus { outline: none; }
.inline-number:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Weight limit: number plus its unit */
.unit-row { display: flex; gap: 5px; }
.unit-row input[type=number] {
  flex: 1; min-width: 0;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 7px; color: var(--text); font-family: var(--fb);
  font-size: .82rem; padding: 5px 8px;
}
/* A 1px border-colour change is not a focus indicator: every other
   control on the page keeps the browser default, so losing the ring
   here read as "focus went somewhere else". Mouse users still get the
   quiet version; :focus-visible is keyboard only. */
.unit-row input[type=number]:focus { outline: none; border-color: var(--accent); }
.unit-row input[type=number]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.unit-row select {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--fb);
  font-size: .78rem;
  padding: 5px 4px;
  cursor: pointer;
}
.unit-row select:focus { outline: none; border-color: var(--accent); }
.unit-row select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  width: 30px; height: 30px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--border2); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.icon-btn.wide { flex: 1; border-color: var(--border2); }

.link-btn {
  background: none; border: none;
  color: var(--muted);
  font-family: var(--fb);
  font-size: .74rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
}
.link-btn:hover { color: var(--danger); }

