/* ArtCraft Web AIO — the launcher's look, in CSS.
   Tokens, type and metrics come from craft-launcher v0.4.1:
   crates/ui-egui/src/theme.rs (Tokens::DARK / Tokens::LIGHT, HUD_SIZE, CONTROL_H)
   crates/ui-egui/src/views.rs (HEADER_H, FOOTER_H, CARD_H, STRIP_H, CARD_PAD)
   crates/ui-egui/src/widgets.rs (tag, badge, hud_link, wordmark, buttons)
   Hard edges, hairline rules, Archivo display, Inter body, Geist Mono labels. */

@font-face {
  font-family: Archivo; src: url("fonts/Archivo-Variable.ttf") format("truetype-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}
@font-face {
  font-family: Inter; src: url("fonts/Inter-Variable.ttf") format("truetype-variations");
  font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.ttf") format("truetype-variations");
  font-weight: 100 900; font-display: swap;
}

/* Tokens::LIGHT */
:root {
  --bg: #f2f1ee;
  --sunken: #e9e8e4;
  --ink: #101014;
  --ink-strong: #000000;
  --muted: rgba(16, 16, 20, 0.620);
  --faint: rgba(16, 16, 20, 0.420);
  --line: rgba(16, 16, 20, 0.161);
  --line-strong: rgba(16, 16, 20, 0.400);
  --accent: #2d81ff;
  --accent-ink: #1659c4;
  --invert-bg: #101014;
  --invert-fg: #f2f1ee;
  --good: #0a7563;
  --warn: #8a5800;
  --bad: #b3261e;
  --logo-light: inline;
  --logo-dark: none;

  --header-h: 48px;
  --footer-h: 34px;
  --card-h: 280px;
  --strip-h: 40px;
  --card-pad: 20px;
  --control-h: 34px;
}

/* Tokens::DARK */
:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #121316;
    --sunken: #060607;
    --ink: #f2f1ee;
    --ink-strong: #ffffff;
    --muted: rgba(242, 241, 238, 0.600);
    --faint: rgba(242, 241, 238, 0.380);
    --line: rgba(242, 241, 238, 0.149);
    --line-strong: rgba(242, 241, 238, 0.400);
    --accent-ink: #74aaff;
    --invert-bg: #ffffff;
    --invert-fg: #0b0b0c;
    --good: #3fd6b8;
    --warn: #ffc14d;
    --bad: #ff6259;
    --logo-light: none;
    --logo-dark: inline;
  }
}

:root[data-theme="dark"] {
  --bg: #121316;
  --sunken: #060607;
  --ink: #f2f1ee;
  --ink-strong: #ffffff;
  --muted: rgba(242, 241, 238, 0.600);
  --faint: rgba(242, 241, 238, 0.380);
  --line: rgba(242, 241, 238, 0.149);
  --line-strong: rgba(242, 241, 238, 0.400);
  --accent-ink: #74aaff;
  --invert-bg: #ffffff;
  --invert-fg: #0b0b0c;
  --good: #3fd6b8;
  --warn: #ffc14d;
  --bad: #ff6259;
  --logo-light: none;
  --logo-dark: inline;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- shared primitives -------------------------------------------------- */

/* theme.rs: HUD_SIZE 11 px Geist Mono 500, upper case, 0.15 em apart. */
.hud, .hud-link, .nav-link, .tag, .badge, .btn {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* widgets.rs::rule — a vertical hairline dividing header cells. */
.rule { width: 1px; align-self: stretch; background: var(--line); flex: none; }

/* widgets.rs::tag — galley + (16, 8) padding, square, filled. */
.tag {
  display: inline-flex; align-items: center;
  padding: 4px 8px;
  font-weight: 700; letter-spacing: 0.15em;
  background: var(--fill, var(--accent)); color: var(--tag-ink, #000);
  flex: none;
}
.tag-invert { background: var(--invert-bg); color: var(--invert-fg); }

/* widgets.rs::badge — 10 px mono on the sunken surface, hairline, 20 px tall. */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 20px; padding: 0 6px;
  font-size: 10px; letter-spacing: 1px;
  background: var(--sunken); border: 1px solid var(--line);
  color: var(--badge-ink, var(--muted));
}

/* widgets.rs::hud_link — mono label, muted, brightening on hover. */
.hud-link { color: var(--muted); text-decoration: none; }
.hud-link:hover { color: var(--ink-strong); }

/* widgets.rs::nav_link — the span inverts on hover. */
.nav-link {
  display: inline-flex; align-items: center;
  height: var(--header-h); padding: 0 10px;
  color: var(--muted); text-decoration: none;
}
.nav-link:hover { color: var(--invert-fg); background: var(--invert-bg); }

.nav-icon {
  width: 34px; height: var(--header-h);
  border: 0; background: none; color: var(--muted);
  font-size: 15px; cursor: pointer;
}
.nav-icon:hover { color: var(--invert-fg); background: var(--invert-bg); }

/* widgets.rs::Kind — CONTROL_H 34, button padding (12, 6), mono 700, 0.12 em. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--control-h); padding: 0 12px;
  font-weight: 700; letter-spacing: 0.12em;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.btn.primary { background: var(--invert-bg); color: var(--invert-fg); }
.btn.primary:hover { opacity: 0.86; }
.btn.secondary { background: none; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }

/* ---- header (views.rs::header, HEADER_H 48) ----------------------------- */

.header {
  display: flex; align-items: center;
  height: var(--header-h);
  border-bottom: 1px solid var(--line);
}
.logo-cell { display: flex; align-items: center; padding: 0 20px; }
.logo { height: 14px; width: auto; }
.logo-light { display: var(--logo-light); }
.logo-dark { display: var(--logo-dark); }
.header > .tag { margin-left: 16px; }
.header-right { display: flex; align-items: center; margin-left: auto; height: 100%; }

/* ---- toolbar (views.rs::toolbar) ---------------------------------------- */

.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px; height: 48px;
  border-bottom: 1px solid var(--line);
}
.field {
  height: var(--control-h); width: 220px; padding: 0 10px;
  background: var(--sunken); color: var(--ink);
  border: 1px solid var(--line); border-radius: 0;
  font: 400 13.5px Inter, system-ui, sans-serif;
}
.field:focus { outline: none; border-color: var(--line-strong); }
.toolbar-note { margin-left: auto; }

/* ---- group sections ----------------------------------------------------- */

.group-head {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
}
.group-name { color: var(--ink-strong); }
.group-count { margin-left: auto; }

/* ---- grid (views.rs::grid — CARD_MIN_W 320, CARD_H 280, shared hairlines) */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.empty { padding: 40px 20px; }

/* ---- card (views.rs::card) ---------------------------------------------- */

.card[hidden], .group[hidden] { display: none; }

.card {
  position: relative;
  display: flex; flex-direction: column;
  height: var(--card-h);
  background: var(--bg);
  transition: background 120ms linear;
}
/* A faint wash in the app's colour fades in under the pointer (lerp 0.05). */
.card:hover { background: color-mix(in srgb, var(--app) 5%, var(--bg)); }

/* A 2 px rule in the app's colour wipes in from the left along the top. */
.card::before {
  content: ""; position: absolute; inset: 0 auto auto 0;
  height: 2px; width: 0; background: var(--app);
  transition: width 300ms ease-out;
}
.card:hover::before { width: 100%; }

.strip {
  display: flex; align-items: center;
  height: var(--strip-h); padding: 0 var(--card-pad);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.strip-links { display: flex; gap: 16px; margin-left: auto; }

.body {
  display: flex; flex-direction: column;
  padding: 18px var(--card-pad) var(--card-pad);
  flex: 1; min-height: 0;
}

.head { display: flex; align-items: center; gap: 6px; }

/* The icon rises a little on hover, over the card's only shadow. */
.icon {
  width: 56px; height: 56px; flex: none;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.278);
  transition: transform 300ms ease-out;
}
.card:hover .icon { transform: translateY(-4px); }

.names { min-width: 0; }
.wordmark-row { display: flex; align-items: center; gap: 8px; }

/* widgets.rs::wordmark — Archivo 620 at 118 % width, 22 px, -0.03 em. */
.wordmark {
  font-family: Archivo, system-ui, sans-serif;
  font-variation-settings: "wght" 620, "wdth" 118;
  font-size: 22px; line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink-strong);
  white-space: nowrap;
}
.wordmark .craft { color: var(--app-ink); }

.tagline {
  margin: 4px 0 0;
  font-size: 13.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.status { margin-top: 14px; }
.version { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.actions { display: flex; gap: 8px; margin-top: auto; }

/* ---- footer (views.rs::footer, FOOTER_H 34) ----------------------------- */

.footer {
  display: flex; align-items: center;
  height: var(--footer-h); padding: 0 20px;
  border-top: 1px solid var(--line);
}
.footer-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }

/* ---- narrow screens ------------------------------------------------------ */

@media (max-width: 720px) {
  .toolbar-note, .group-note { display: none; }
  .toolbar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .field { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .logo-cell { padding: 0 16px; }
  .footer { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .footer-right { margin-left: 0; }
}
