/*
 * Quiet: near-monochrome greys and one ink-blue accent that always means the
 * same thing (yours, selected, or the main action). One typeface, thin
 * borders, small radii. The board carries the color.
 *
 * Instrument Sans: Copyright 2022 The Instrument Sans Project Authors
 * (https://github.com/Instrument/instrument-sans), licensed under the SIL Open
 * Font License, Version 1.1 (https://openfontlicense.org).
 *
 * Icons in assets/icon-*.svg: Lucide (https://lucide.dev).
 *
 * ISC License. Copyright (c) 2026 Lucide Icons and Contributors
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * The chevron-down and code icons are derived from Feather, under the MIT
 * License: Copyright (c) 2013-present Cole Bemis. Permission is hereby
 * granted, free of charge, to any person obtaining a copy of this software
 * and associated documentation files (the "Software"), to deal in the
 * Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions: The above
 * copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS",
 * WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

@font-face {
  font-family: "Instrument Sans";
  src: url("assets/InstrumentSans-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("assets/InstrumentSans-Italic-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Page & surfaces */
  --c-page: 245 246 247;
  --c-surface: 255 255 255;
  --c-surface-muted: 237 239 241;
  --c-surface-alt: 230 233 236;

  /* Text */
  --c-primary: 38 43 49;
  --c-heading: 17 20 24;
  --c-secondary: 77 85 96;
  --c-tertiary: 90 98 109;
  --c-muted: 100 109 120;
  --c-placeholder: 154 163 173;

  /* Borders */
  --c-edge: 217 221 226;
  --c-edge-light: 230 233 236;
  --c-edge-subtle: 237 239 241;

  /* Interactive */
  --c-primary-hover: 17 20 24;
  --c-secondary-hover: 226 230 234;
  --c-focus: 39 71 201;

  /* Buttons: the main action is the accent */
  --c-btn: 39 71 201;
  --c-btn-hover: 31 58 168;
  --c-btn-text: 255 255 255;

  --c-shadow: 17 20 24;
  --c-brand: 39 71 201;

  /* Status */
  --c-success: 30 122 76;
  --c-success-hover: 24 100 62;
  --c-info-bg: 229 243 236;
  --c-info-text: 30 122 76;
  --c-info-ring: 30 122 76;
  --c-danger-bg: 252 235 234;
  --c-danger-text: 179 38 30;
  --c-danger-ring: 179 38 30;

  /* The accent: yours, selected, the main action */
  --c-accent-bg: 233 237 251;
  --c-accent-text: 30 55 163;
  --c-accent: 39 71 201;
  --c-accent-hover: 31 58 168;

  --c-on-success: 255 255 255;
  --c-on-accent: 255 255 255;
  --c-on-brand: 255 255 255;

  /* Nav: a white bar, not a dark one */
  --c-nav-bg: 255 255 255;
  --c-nav-text: 77 85 96;
  --c-nav-accent: 17 20 24;

  /* Editor */
  --c-editor-bg: 255 255 255;
  --c-editor-text: 38 43 49;
  --c-editor-gutter-bg: 245 246 247;
  --c-editor-gutter-text: 100 109 120;
  --c-editor-line-active: 237 239 241;
  --c-editor-selection: 233 237 251;
  --c-editor-cursor: 17 20 24;

  /* Boards, for games that read them */
  --c-board-light: 228 231 234;
  --c-board-dark: 154 171 184;
  --c-board-mark: 39 71 201;

  /* Quiet's own: the strong neutral button, waiting badges */
  --q-ink: 17 20 24;
  --q-on-ink: 255 255 255;
  --q-warning: 138 90 0;
  --q-warning-bg: 252 241 220;
  --q-input-edge: 195 201 207;

  /* Type and shape */
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 4px;
  --radius: 5px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --radius-2xl: 8px;
}

[data-mode="dark"] {
  --c-page: 14 16 19;
  --c-surface: 22 25 29;
  --c-surface-muted: 30 34 39;
  --c-surface-alt: 34 38 43;

  --c-primary: 221 225 230;
  --c-heading: 243 245 247;
  --c-secondary: 165 174 184;
  --c-tertiary: 150 159 169;
  --c-muted: 140 149 160;
  --c-placeholder: 107 116 128;

  --c-edge: 42 47 53;
  --c-edge-light: 34 38 43;
  --c-edge-subtle: 30 34 39;

  --c-primary-hover: 243 245 247;
  --c-secondary-hover: 40 45 51;
  --c-focus: 142 166 255;

  --c-btn: 142 166 255;
  --c-btn-hover: 169 187 255;
  --c-btn-text: 14 16 19;

  --c-shadow: 0 0 0;
  --c-brand: 142 166 255;

  --c-success: 92 197 141;
  --c-success-hover: 120 210 160;
  --c-info-bg: 18 48 31;
  --c-info-text: 92 197 141;
  --c-info-ring: 92 197 141;
  --c-danger-bg: 58 23 20;
  --c-danger-text: 255 123 114;
  --c-danger-ring: 255 123 114;

  --c-accent-bg: 26 36 69;
  --c-accent-text: 180 196 255;
  --c-accent: 142 166 255;
  --c-accent-hover: 169 187 255;

  --c-on-success: 14 16 19;
  --c-on-accent: 14 16 19;
  --c-on-brand: 14 16 19;

  --c-nav-bg: 22 25 29;
  --c-nav-text: 165 174 184;
  --c-nav-accent: 243 245 247;

  --c-editor-bg: 22 25 29;
  --c-editor-text: 221 225 230;
  --c-editor-gutter-bg: 14 16 19;
  --c-editor-gutter-text: 140 149 160;
  --c-editor-line-active: 30 34 39;
  --c-editor-selection: 26 36 69;
  --c-editor-cursor: 243 245 247;

  --c-board-light: 185 195 203;
  --c-board-dark: 111 130 147;
  --c-board-mark: 142 166 255;

  --q-ink: 243 245 247;
  --q-on-ink: 14 16 19;
  --q-warning: 226 176 74;
  --q-warning-bg: 51 39 15;
  --q-input-edge: 74 82 92;
}

/* Type: one family; hierarchy from size and weight. */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  letter-spacing: -0.03em;
}

:focus-visible {
  outline: 2px solid rgb(var(--c-focus));
  outline-offset: 2px;
}

/* Badges: one shape, sentence case, a word always. */
[data-part="badge"] {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  background: rgb(var(--c-surface-muted));
  color: rgb(var(--c-secondary));
  box-shadow: none;
}

[data-part="badge"][data-variant="official"],
[data-part="badge"][data-variant="approved"] {
  background: rgb(var(--c-info-bg));
  color: rgb(var(--c-success));
}

[data-part="badge"][data-variant="pending"] {
  background: rgb(var(--q-warning-bg));
  color: rgb(var(--q-warning));
}

[data-part="badge"][data-variant="active"] {
  background: rgb(var(--c-info-bg));
  color: rgb(var(--c-success));
}

[data-part="badge"][data-variant="waiting"] {
  background: rgb(var(--q-warning-bg));
  color: rgb(var(--q-warning));
}

[data-part="badge"][data-variant="rejected"] {
  background: rgb(var(--c-danger-bg));
  color: rgb(var(--c-danger-text));
}

/* The theme control: a half-filled circle, light and dark. */
[data-part="icon"][data-icon="theme"] {
  -webkit-mask-image: url("assets/icon-contrast.svg");
  mask-image: url("assets/icon-contrast.svg");
}

/* Cards: a thin outline, never a shadow. The cards in a grid (the catalog,
   the landing page), the match cards, and the rows of a list of items with a
   byline (the projects, the submissions: an `ul` card-list whose cards carry
   a card-meta). The other lists' rows (the forum, the blog, the guides) keep
   their own look, and the dashboard's layout draws its own. :where keeps the
   specificity of [data-part="card"], so these still win over the platform's
   classes. */
[data-part="card"]:where(
    [data-part="card-grid"] > *,
    [data-part="match-list"] *,
    ul[data-part="card-list"] > li:has([data-part="card-meta"])
  ) {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-edge-light));
  border-radius: 8px;
  box-shadow: none;
}

/* A game's picture, at the top of its card. Games have none yet (#914):
   its place says so, quietly. */
[data-part="cover"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgb(var(--c-surface-muted));
  color: rgb(var(--c-muted));
  font-size: 13px;
}

[data-part="card"] > [data-part="cover"] {
  height: 240px;
  margin: -16px -16px 14px;
  border-bottom: 1px solid rgb(var(--c-edge-light));
  border-radius: 7px 7px 0 0;
}

/* A card's name with its status right after it. */
[data-part="card-title-row"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px 8px;
}

[data-part="card-title-row"] [data-part="badge"] {
  padding: 1px 8px;
  font-size: 12px;
}

/* A game's tags, on its card and its page: the badge's shape, each a link
   to the catalog filtered by it. Scoped to those lists, so the forum's topic
   tags keep their look; position and z-index stay the platform's, which keep
   a card's tags above the link stretched over it. */
:is([data-part="card-tags"], [data-part="page-tags"]) {
  gap: 6px;
}

:is([data-part="card-tags"], [data-part="page-tags"]) [data-part="tag"] {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  background: rgb(var(--c-surface-alt));
  color: rgb(var(--c-secondary));
  text-decoration: none;
}

:is([data-part="card-tags"], [data-part="page-tags"]) [data-part="tag"]:hover {
  background: rgb(var(--c-edge));
  color: rgb(var(--c-primary));
}

[data-part="card"]:where(
    [data-part="card-grid"] > *,
    [data-part="match-list"] *,
    ul[data-part="card-list"] > li:has([data-part="card-meta"])
  ):hover {
  border-color: rgb(var(--c-edge));
  box-shadow: none;
}

/* A pinned thread keeps the accent edge, hovered or not. */
[data-part="card"][data-pinned],
[data-part="card"][data-pinned]:hover {
  border-color: rgb(var(--c-accent));
}

/* Fields. */
[data-part="label"] {
  color: rgb(var(--c-heading));
  font-weight: 600;
}

/* An invalid field (aria-invalid) keeps the platform's red border. */
[data-part="input"] {
  background-color: rgb(var(--c-surface));
  color: rgb(var(--c-primary));
}

[data-part="input"]:not([type="checkbox"]):not([type="radio"]) {
  min-height: 44px;
  border-radius: 6px;
}

[data-part="input"]:not([type="checkbox"]):not([type="radio"]):not([aria-invalid="true"]),
.bard-textarea {
  border-color: rgb(var(--q-input-edge));
}

[data-part="dialog-title"] {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

[data-part="error"] {
  color: rgb(var(--c-danger-text));
}

/* Flashes and dialogs: the one place with a shadow is a dialog. */
[data-part="flash"] {
  border-radius: 6px;
  box-shadow: 0 6px 20px rgb(var(--c-shadow) / 0.12);
}

[data-part="dialog-panel"] {
  border: 1px solid rgb(var(--c-edge-light));
  border-radius: 8px;
  box-shadow: 0 12px 32px rgb(var(--c-shadow) / 0.16);
}

[data-part="dialog-backdrop"] {
  background: rgb(14 16 19 / 0.45);
}

/* The navbar: a white bar with a rule below. */
[data-part="nav"] {
  border-bottom: 1px solid rgb(var(--c-edge-light));
}

[data-part="nav-logo"] {
  color: rgb(var(--c-heading));
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Full strength on the white bar (the platform's is 70%, for a dark one). */
[data-part="nav-link"] {
  font-weight: 500;
  color: rgb(var(--c-nav-text));
}

[data-part="nav-link"][data-state="active"] {
  background: transparent;
  color: rgb(var(--c-heading));
}

[data-part="nav-link"]:hover {
  background: rgb(var(--c-surface-muted));
  color: rgb(var(--c-heading));
}

[data-part="nav-menu"] {
  border-color: rgb(var(--c-edge-light));
  border-radius: 8px;
  box-shadow: 0 12px 32px rgb(var(--c-shadow) / 0.12);
}

/* Play: the accent outline marks whoever moves now. */
[data-part="player-bar"] {
  border-radius: 6px;
}

/* The seat to move: an accent border. */
[data-part="player-bar"][data-turn] {
  border-color: rgb(var(--c-accent));
}

[data-part="move-record"] {
  font-variant-numeric: tabular-nums;
}

[data-part="move"][data-state="current"] {
  background: rgb(var(--c-accent-bg));
  color: rgb(var(--c-accent-text));
  font-weight: 600;
}

/* Buttons: one primary, the accent; the rest outlined. */
[data-part="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
}

/* Leave, with its hint under it. */
[data-part="button"].play-leave-btn {
  flex-direction: column;
  gap: 0;
  padding: 6px 16px;
}

[data-part="button"][data-variant="primary"] {
  border: 1px solid transparent;
  background: rgb(var(--c-accent));
  color: rgb(var(--c-on-accent));
}

[data-part="button"][data-variant="primary"]:hover {
  background: rgb(var(--c-accent-hover));
}

[data-part="button"][data-variant="secondary"] {
  border: 1px solid rgb(var(--c-edge));
  background: rgb(var(--c-surface));
  color: rgb(var(--c-primary));
}

[data-part="button"][data-variant="secondary"]:hover {
  background: rgb(var(--c-surface-muted));
}

[data-part="button"][data-variant="danger"] {
  border: 1px solid rgb(var(--c-edge));
  background: rgb(var(--c-surface));
  color: rgb(var(--c-danger-text));
}

[data-part="button"][data-variant="danger"]:hover {
  background: rgb(var(--c-danger-bg));
}

[data-part="button"]:disabled {
  border-color: transparent;
  background: rgb(var(--c-surface-muted));
  color: rgb(var(--c-placeholder));
}

[data-part="tab"][data-state="active"] {
  border-color: rgb(var(--c-accent));
  color: rgb(var(--c-heading));
}

/* Bard's post boxes (comments, forum, blog), by Bard's own class names:
   the buttons as Quiet's, the text area white, its border the inputs'. */
.bard-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
}

.bard-button-primary {
  background: rgb(var(--c-accent));
  color: rgb(var(--c-on-accent));
}

.bard-button-primary:hover {
  background: rgb(var(--c-accent-hover));
}

.bard-textarea {
  background: rgb(var(--c-surface));
  border-radius: 0 0 6px 6px;
}

/* The theme control's panel: the three choices alike, the picked one in
   the accent. */
[data-part="theme-panel-label"] {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgb(var(--c-muted));
}

[data-part="theme-choice"] {
  border: 1px solid rgb(var(--c-edge));
  border-radius: 6px;
  background: rgb(var(--c-surface));
  color: rgb(var(--c-secondary));
  font-weight: 500;
}

[data-part="theme-choice"]:hover:not(:disabled) {
  background: rgb(var(--c-surface-muted));
}

[data-part="theme-choice"][aria-pressed="true"] {
  border-color: rgb(var(--c-accent));
  background: rgb(var(--c-accent) / 0.08);
  color: rgb(var(--c-accent));
}

/* Links say where they go; no arrows after them. */
[data-part="link-arrow"] {
  display: none;
}

/* Comments: a section title as the others, the empty line plain. */
[data-part="comments-title"] {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

[data-part="comments"] [data-part="empty"] {
  padding: 0;
  text-align: left;
  font-size: 15px;
  color: rgb(var(--c-muted));
}
