/* logomaker — built on the shared rglw brand tokens.
 *
 * brand/tokens.base.css + brand/theme-nuclear-blue.css are mirrored byte-identical
 * from ../../brand (same approach as team-landing) because the container has no
 * access to that directory. To change tone, re-copy a different themes/*.css —
 * every token name is identical across tones, so nothing below changes.
 *
 * Tone: scarlet (stark vivid red over clean grayscale). electric-blue is
 * polywell's, default is plasmoid's, indigo is spheromak's, gunmetal is
 * team-landing's.
 *
 * No @import and no external fonts: the container is offline, and an @import
 * would serialise the CSS fetch behind this file. The HTML links all three.
 */

:root {
  --radius: 10px;
  --radius-lg: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute only works through the UA stylesheet's
   `[hidden] { display: none }`, which ANY class rule setting `display` beats on
   specificity — `.status { display: flex }` alone was enough to make the loader
   show on first paint. Stating it here, with !important, means no future
   display rule can silently un-hide an element again. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------------------------------------------------------------- top bar */

header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; }
/* The header mark routes home. It always looked clickable, so it should be —
   `a.brand` and not `.brand`, because the lockup composer reuses that class for
   the brand text it draws. */
a.brand {
  color: inherit; text-decoration: none;
  border-radius: var(--radius); padding: 2px 6px; margin-left: -6px;
}
a.brand:hover { background: var(--bg-alt); }
a.brand:hover h1 span { color: var(--ramp-1); }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand img { width: 28px; height: 28px; display: block; flex: none; }
.brand h1 {
  font-size: 15px; margin: 0; font-weight: 700; letter-spacing: .01em;
}
/* The second half of the wordmark carries the tone, the way fusor's does. */
.brand h1 span { color: var(--accent); }
.brand .sub {
  font-size: 10px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--fg-muted); margin-top: 2px;
}
header nav { display: flex; gap: 4px; margin-left: auto; align-items: center; position: relative; }
header .who { color: var(--fg-muted); font-size: 13px; margin-right: 8px; }

/* ------------------------------------------------------------ user menu ---
 *
 * One avatar button replaces the row of five controls the header used to
 * carry. Navigation lives inside it, which costs a click on Gallery — the
 * trade the header's clutter was not worth.
 */

/* No background and `contain`, so an avatar with alpha shows what is behind it
   rather than sitting on a plate — these are marks, and a mark's transparency is
   the point of it. `cover` would also crop the transparent margin away, which
   makes respecting alpha moot for anything that is not exactly square. */
.avatar {
  border-radius: 50%; object-fit: contain; background: transparent;
  display: block; flex: none;
}
.avatar.lg { border-radius: 12px; }

.avatar-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
}
.avatar-btn .avatar-name { font-size: 13px; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-btn .caret { color: var(--fg-muted); font-size: 10px; }
.avatar-btn[aria-expanded="true"] { border-color: var(--accent); }

.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  min-width: 232px; padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px rgb(0 0 0 / .45);
}
.menu-head { display: flex; gap: 11px; align-items: center; padding: 8px 9px 10px; }
.menu-id { min-width: 0; }
.menu-name { font-size: 14px; font-weight: 600; }
.menu-sub { font-size: 11.5px; color: var(--fg-muted); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; color: var(--fg);
  font: inherit; font-size: 13.5px; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--bg-alt); border-color: transparent; }
.menu-item.on { color: var(--accent); }
.menu-item.danger:hover { color: var(--danger); }
/* Icons inherit currentColor, so they follow the tone and the hover state
   without a second rule for each. */
.menu-item .mi { flex: none; opacity: .72; }
.menu-item:hover .mi, .menu-item.on .mi { opacity: 1; }

/* ---------------------------------------------------------------- controls */

button, .btn {
  font: inherit;
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, .btn:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary {
  background: var(--btn-bg); border-color: var(--btn-bg);
  color: var(--btn-fg); box-shadow: var(--btn-shadow);
}
button.primary:hover:not(:disabled) {
  background: var(--btn-bg-hover); border-color: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}
button.primary:active:not(:disabled) { background: var(--btn-bg-active); }
button.ghost { background: transparent; }
button.small, .btn.small { padding: 4px 9px; font-size: 13px; }

input, textarea, select {
  font: inherit;
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
}
textarea { resize: vertical; min-height: 84px; }
/* Without this a range slider paints itself in the browser's own accent — it
   was still blue on a scarlet app. */
input[type="range"] { accent-color: var(--accent); padding: 0; }
label { display: block; margin: 14px 0 5px; font-size: 13px; color: var(--fg-muted); }

/* ---------------------------------------------------------------- layout */

.wrap { max-width: 1400px; margin: 0 auto; padding: 20px; }
.cols { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
/* A grid item defaults to `min-width: auto`, so its widest content can force
   the whole column open however narrow the track is nominally sized. On a
   390px phone the lockup preview did exactly that: both panels in the column
   came out 432px and the page scrolled sideways. */
.cols > * { min-width: 0; }
@media (max-width: 950px) { .cols { grid-template-columns: 1fr; } }

/* --------------------------------------------------------- components --
 *
 * Panels and grids are used by every page, so they belong in the stylesheet
 * every page loads. They spent one commit inside studio.css, where only the
 * session screen could see them, and the preferences page lost its panels.
 */

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 4px; font-size: 15px; }
.panel .hint { color: var(--fg-muted); font-size: 13px; margin: 0 0 8px; }

details.adv summary { cursor: pointer; color: var(--fg-muted); font-size: 13px; margin-top: 16px; }
details.adv .row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
details.adv output { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }

/* auto-FIT, not auto-fill: a batch of four in a wide column left an empty
   fifth track and a band of dead space down the right. auto-fit collapses the
   empty tracks, and the per-card cap stops four marks stretching into posters. */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  justify-items: center;
}
.grid > .card { width: 100%; max-width: 340px; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.card.picked {
  border-color: var(--accent);
  box-shadow: var(--btn-shadow-soft);
}
/* The DIRECT child only. As `.card img` this also caught the byline's avatar,
   stretching a 16px circle to the full card width — the white ellipse across
   the footer of every gallery card. */
.card > img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; display: block; }
.card .bar { display: flex; align-items: center; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.card .bar .sp { margin-left: auto; }

/* The glyph and its count are one label. Without this they wrap onto two
   lines the moment the card narrows, and the bar reads as four rows of noise. */
.vote {
  background: transparent; border: 1px solid transparent;
  padding: 3px 7px; border-radius: 8px; white-space: nowrap;
}
.vote:hover { border-color: var(--border); }
.vote.on-star { color: var(--ok); border-color: var(--ok); }
.vote.on-reject { color: var(--danger); border-color: var(--danger); }

.batch { margin-bottom: 26px; }
.batch > h3 {
  font-size: 13px; color: var(--fg-muted); font-weight: 500;
  margin: 0 0 10px; display: flex; align-items: center; gap: 10px;
}
.batch > h3 .tag {
  font-family: var(--mono); font-size: 11px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 20px;
}
/* Which engine produced this batch. Shown because the failure this replaced was
   a refinement that ran the one path incapable of doing what was asked and
   still reported success. */
.batch > h3 .tag.mode { border-color: var(--accent); color: var(--accent); }

.chat { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.msg { padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.msg.user { background: var(--bg-alt); }
.msg.assistant {
  background: var(--bg-code); color: var(--fg-muted);
  font-family: var(--mono); font-size: 12px;
}

/* Style-reference picker: small enough that a dozen marks fit without
   scrolling, big enough to tell them apart. */
.refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; margin-bottom: 9px; }
.refs label { margin: 0; cursor: pointer; position: relative; }
.refs input { position: absolute; opacity: 0; width: 0; height: 0; }
.refs img {
  width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff;
  border: 2px solid var(--border); border-radius: 8px; display: block;
}
.refs input:checked + img { border-color: var(--accent); box-shadow: var(--btn-shadow-soft); }
.refs input:focus-visible + img { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- loading */

/* The status block owns the whole results column while a batch runs, instead of
   floating in the corner beside the empty-state text. */
.status {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 64px 20px; text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
}
.status .label { font-size: 14px; color: var(--fg); }
.status .sub { font-size: 12.5px; color: var(--fg-muted); }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Placeholder tiles so the wait shows the shape of what is coming. */
.ghosts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 560px; }
@media (max-width: 700px) { .ghosts { grid-template-columns: repeat(2, 1fr); } }
.ghosts div {
  aspect-ratio: 1; border-radius: 10px;
  background: var(--bg-alt); border: 1px solid var(--border);
  animation: pulse 1.6s ease-in-out infinite;
}
.ghosts div:nth-child(2) { animation-delay: .2s; }
.ghosts div:nth-child(3) { animation-delay: .4s; }
.ghosts div:nth-child(4) { animation-delay: .6s; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .ghosts div { animation: none; opacity: .6; }
}

/* Refine modes. Radios rather than a slider because the three are not points on
   one scale: Reframe runs a different graph, and a number gave no way to say
   "change what this shows" as opposed to "redraw it harder". */
.modes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.modes label {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; align-items: baseline;
  margin: 0; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 400;
}
.modes label:hover { border-color: var(--fg-muted); }
.modes .name { font-weight: 600; font-size: 14px; color: var(--fg); }
.modes .why { grid-column: 2; font-size: 12px; color: var(--fg-muted); line-height: 1.4; }
.modes input:checked ~ .name { color: var(--accent); }
.modes label:has(input:checked) { border-color: var(--accent); background: var(--bg-alt); }
.modes label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A statement of fact about how the engine behaves, not an error. */
.warn {
  font-size: 12.5px; line-height: 1.45; color: var(--fg-muted);
  border-left: 2px solid var(--warning, var(--accent));
  padding: 2px 0 2px 10px; margin: 0 0 9px;
}

.err { color: var(--danger); font-size: 13px; margin-top: 10px; white-space: pre-wrap; }
.empty { color: var(--fg-muted); padding: 40px; text-align: center; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters .sp { margin-left: auto; }
.filter { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; }
.filter > span {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--fg-muted);
}
.filter select { width: auto; min-width: 150px; margin: 0; }
/* Who made it and when. Its own row rather than squeezed into the button bar,
   where it truncated to "jon..." and told you nothing. */
.card .byline {
  display: flex; gap: 6px; align-items: baseline;
  padding: 7px 9px 0; font-size: 11px; color: var(--fg-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .byline b { color: var(--fg); font-weight: 600; }
.card .byline .avatar { width: 16px; height: 16px; flex: none; }

/* ---------------------------------------------------------------- login */

.login { max-width: 340px; margin: 12vh auto; }
.login .brand { justify-content: center; margin-bottom: 6px; }
.login .brand img { width: 40px; height: 40px; }

/* ---------------------------------------------------------------- lockup */

/* Each stage pins its own text colour. Inheriting the page's --fg put
   near-white type on the white stage, which was invisible. */
/* The preview is the one thing here with an irreducible width — a lockup is as
   wide as its wordmark. It scrolls inside its own box rather than widening the
   page around it. */
.lockup-stage { background: #fff; border-radius: 12px; padding: 30px; display: grid; place-items: center; min-height: 260px; color: #111; overflow-x: auto; }
.lockup-stage.dark { background: #14171f; color: #fff; }

/* Generated marks are opaque PNGs with a solid background, so overlapping them
   with type pastes a visible square over the letters. Blending knocks the
   background out: multiply drops white on the light stage, and screen drops
   black on the dark stage (where the mark is already inverted). */
.lockup-stage.knockout #img-light { mix-blend-mode: multiply; }
.lockup-stage.dark.knockout #img-dark { mix-blend-mode: screen; }
.lockup { display: flex; align-items: center; gap: var(--lk-gap, 18px); }
.lockup.above, .lockup.below { flex-direction: column; }
.lockup.below { flex-direction: column-reverse; }
.lockup.right { flex-direction: row-reverse; }
.lockup img { display: block; }
.lockup .words { display: flex; flex-direction: column; line-height: 1.1; }
.lockup .brand { font-weight: var(--lk-weight, 600); letter-spacing: var(--lk-track, 0em); }
.lockup .slogan { opacity: .62; font-size: .34em; letter-spacing: .04em; margin-top: .5em; }
.sizes { display: flex; gap: 22px; align-items: flex-end; margin-top: 16px; }
.sizes figure { margin: 0; text-align: center; color: var(--fg-muted); font-size: 11px; }
.sizes img { background: #fff; display: block; margin-bottom: 5px; }

