/* RoGamedevCompany — base, tokens, theme, layout */

:root,
[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #070b12;
  --color-surface: #101826;
  --color-surface-2: #151f2f;
  --color-surface-3: #1b293d;
  --color-text: #eef4ff;
  --color-muted: #93a4bb;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-primary: #10b981;
  --color-primary-strong: #34d399;
  --color-accent: #38bdf8;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #6366f1;
  --color-imported: #6b8aa8;
  --color-imported-bg: rgba(107, 138, 168, 0.18);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 22px 70px rgba(0, 0, 0, 0.42);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;
}

[data-theme='light'] {
  color-scheme: light;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-2: #f1f5fa;
  --color-surface-3: #eef3f8;
  --color-text: #0f172a;
  --color-muted: #526176;
  --color-border: rgba(15, 23, 42, 0.10);
  --color-border-strong: rgba(15, 23, 42, 0.18);
  --color-primary: #059669;
  --color-primary-strong: #10b981;
  --color-accent: #2563eb;
  --color-success: #059669;
  --color-warning: #b45309;
  --color-danger: #dc2626;
  --color-info: #4f46e5;
  --color-imported: #475569;
  --color-imported-bg: rgba(71, 85, 105, 0.10);
  --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 22px 70px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 32rem),
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-accent) 14%, transparent), transparent 30rem),
    var(--color-bg);
  color: var(--color-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Page gutter token — single source of truth for left/right breathing room.
   * 20px each side on phones, scaling up to 48px on >= 1100px. Cards, topbar
   * inner content, and any custom surfaces can read this for alignment. */
  --page-gutter-x: clamp(20px, 4.5vw, 48px);
  font-size: 16px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--color-primary-strong); }

/* ---------- Layout ---------- */

.app-shell {
  width: min(1200px, calc(100% - 2 * var(--page-gutter-x)));
  margin: 0 auto;
  padding: clamp(12px, 2vw, 24px) 0 clamp(48px, 8vw, 96px);
}

.eyebrow,
.card-label {
  margin: 0 0 8px;
  color: var(--color-primary-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow--muted { color: var(--color-muted); }

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 14px;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}
h2 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.6vw, 32px);
  letter-spacing: -0.02em;
}
h3 { margin-bottom: 6px; font-size: clamp(16px, 1.6vw, 18px); }
.lead {
  max-width: 760px;
  color: var(--color-muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.6;
}
/* Override the default 760px max-width when the intro text needs to span the
 * full container (e.g. the platforms picker, where the card is already
 * generously bounded by the page max-width). */
.lead--full { max-width: none; }
/* Inline links inside body copy: subtle underline that brightens on hover. */
.lead a,
.bio-prose a {
  color: var(--color-primary-strong);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  transition: border-color 160ms ease, color 160ms ease;
}
.lead a:hover,
.bio-prose a:hover {
  color: color-mix(in srgb, white 20%, var(--color-primary-strong));
  border-bottom-color: var(--color-primary-strong);
}
.bio-prose {
  color: var(--color-muted);
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.7;
}
.bio-prose p { margin: 0 0 12px; }
.bio-prose p:last-child { margin-bottom: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: 160ms ease;
  min-height: 44px;
}
.btn:hover { border-color: var(--color-border-strong); }
.btn--primary {
  border-color: transparent;
  background: var(--color-primary);
  color: white;
}
.btn--primary:hover { background: var(--color-primary-strong); }
.btn--ghost {
  background: transparent;
}
.btn--danger {
  border-color: color-mix(in srgb, var(--color-danger) 40%, transparent);
  color: var(--color-danger);
}
.btn--small {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ---------- Top bar ---------- */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
  padding: clamp(8px, 1.4vw, 12px) 0 clamp(20px, 3vw, 28px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 800;
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  font-size: 11px;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--color-muted); font-weight: 600; font-size: 11px; }

.nav-primary {
  grid-column: 2;
  justify-self: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-surface) 70%, transparent);
  border: 1px solid var(--color-border);
}
.nav-primary button,
.nav-primary .nav-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-muted);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  min-height: 36px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-primary button.active,
.nav-primary .nav-link.active {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  color: var(--color-primary-strong);
  border-color: color-mix(in srgb, var(--color-primary) 30%, transparent);
}
.nav-primary button:hover:not(.active),
.nav-primary .nav-link:hover:not(.active) {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ---------- Appearance pill (combined lang + theme dropdown) ---------- */

.appearance-wrap {
  position: relative;
  grid-column: 3;
  justify-self: end;
}
.appearance-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  height: 40px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  transition: border-color 160ms ease, background 160ms ease;
}
.appearance-pill:hover { border-color: var(--color-border-strong); background: var(--color-surface-3); }
.appearance-pill[aria-expanded='true'] {
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border-strong));
  background: var(--color-surface-3);
}
.appearance-pill__theme { letter-spacing: 0.01em; }
.appearance-pill .chevron {
  width: 8px; height: 8px;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  margin-bottom: 3px;
  transition: transform 160ms ease;
}
.appearance-pill[aria-expanded='true'] .chevron { transform: rotate(225deg); margin-bottom: -3px; }

.lang-circle {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  flex-shrink: 0;
}
.lang-circle > * {
  position: absolute;
  inset: 0;
  display: block;
}
.lang-circle svg {
  width: 100%;
  height: 100%;
  display: block;
}
.lang-circle--small { width: 22px; height: 22px; }

.appearance-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-strong);
  z-index: 70;
  display: grid;
  gap: 4px;
}
.appearance-section { display: grid; gap: 2px; padding: 6px 4px 4px; }
.appearance-section__label {
  padding: 4px 8px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.appearance-option {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.appearance-option:hover { background: var(--color-surface-2); }
.appearance-option.active {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--color-primary) 28%, transparent);
}
.appearance-option .check {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--color-primary-strong);
  font-weight: 800;
  visibility: hidden;
}
.appearance-option.active .check { visibility: visible; }
.appearance-option .glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
  overflow: hidden;
}
.appearance-option .glyph svg { width: 14px; height: 14px; }
.appearance-option .glyph--flag { background: transparent; padding: 0; }
.appearance-option .glyph--flag svg { width: 100%; height: 100%; }

.appearance-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 8px;
}
.appearance-link {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
.appearance-link:hover { background: var(--color-surface-2); }
.appearance-link .glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
}
.appearance-link .glyph svg { width: 14px; height: 14px; }
.appearance-link .chev-right {
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1;
}

.menu-button {
  grid-column: 3;
  justify-self: end;
  display: none;
}

/* Reusable inline-flex row, also used inside settings/drawer */
.utility-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 880px) {
  .topbar { gap: 8px; }
  .brand { grid-column: 2; justify-self: center; }
  .brand-text small { display: none; }
  .nav-primary { display: none; }
  .appearance-wrap { display: none; }
  .menu-button { display: inline-grid; }
}

/* ---------- Drawer ---------- */

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(8px);
  z-index: 80;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(360px, 92vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  z-index: 81;
  display: flex; flex-direction: column;
  padding: 16px;
  gap: 8px;
  box-shadow: var(--shadow-strong);
  transform: translateX(0);
  animation: drawer-slide-in 220ms ease both;
  overflow-y: auto;
}
@keyframes drawer-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--color-border);
}
.drawer-list {
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}
.drawer-list button,
.drawer-list .nav-link {
  display: flex;
  align-items: center;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  min-height: 48px;
  text-decoration: none;
}
.drawer-list button.active,
.drawer-list .nav-link.active {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  color: var(--color-primary-strong);
}
.drawer-list button:hover:not(.active),
.drawer-list .nav-link:hover:not(.active) { background: var(--color-surface-2); }

.drawer-section {
  padding: 10px 0 6px;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: 4px;
}
.drawer-section__label {
  padding: 0 4px 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.drawer-radio {
  display: grid;
  gap: 4px;
}
.drawer-radio button {
  display: grid;
  grid-template-columns: 26px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  min-height: 40px;
}
.drawer-radio button.active {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--color-primary) 35%, transparent);
  color: var(--color-text);
}
.drawer-radio .glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
  overflow: hidden;
}
.drawer-radio .glyph svg { width: 13px; height: 13px; }
.drawer-radio .glyph--flag { background: transparent; padding: 0; }
.drawer-radio .glyph--flag svg { width: 100%; height: 100%; }
.drawer-radio .check {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--color-primary-strong);
  font-weight: 800;
  visibility: hidden;
}
.drawer-radio button.active .check { visibility: visible; }

.drawer-footer {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.drawer-footer__link {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  min-height: 48px;
}
.drawer-footer__link:hover { border-color: var(--color-border-strong); background: var(--color-surface-3); }
.drawer-footer__link .glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  color: var(--color-muted);
}
.drawer-footer__link .glyph svg { width: 14px; height: 14px; }
.drawer-footer__link .chev-right { color: var(--color-muted); font-size: 16px; line-height: 1; }

/* ---------- Popover (legacy; superseded by .appearance-pop) ---------- */

.popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 160px;
  box-shadow: var(--shadow-strong);
  z-index: 70;
  display: flex; flex-direction: column;
  gap: 2px;
}
.popover button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
.popover button:hover { background: var(--color-surface-2); }
.popover button.active {
  background: color-mix(in srgb, var(--color-primary) 16%, transparent);
  color: var(--color-primary-strong);
}

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--shadow-soft);
}
.card-soft {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  padding: clamp(16px, 2.4vw, 22px);
}
.stack { display: grid; gap: 16px; }
.stack-tight { display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */

.toast-host {
  position: fixed; bottom: clamp(16px, 4vw, 32px); left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  pointer-events: none;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  pointer-events: auto;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  box-shadow: var(--shadow-strong);
  font-weight: 700;
  font-size: 13px;
  animation: toast-pop 200ms ease;
}
@keyframes toast-pop {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
