/* MVA Portals */
:root {
  --bg: #f6f6fb; --surface: #fff; --surface-2: #f0f0f7; --border: #e3e3ee;
  --text: #13152b; --text-2: #4c5070; --text-3: #7d819e;
  --accent: #4b4ff0; --accent-2: #6d5ff5; --accent-soft: #e9e9fe; --accent-text: #3a3ed6;
  --shadow: 0 1px 2px rgba(19,21,43,.05), 0 10px 26px -14px rgba(19,21,43,.22);
  --shadow-hover: 0 2px 4px rgba(19,21,43,.06), 0 22px 40px -18px rgba(40,42,120,.38);
  --radius-tile: 24px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d1a; --surface: #161831; --surface-2: #1e2140; --border: #2a2d50;
    --text: #eceefe; --text-2: #b5b8d8; --text-3: #8387ad;
    --accent: #7c7ffb; --accent-2: #9a86ff; --accent-soft: #252859; --accent-text: #abadff;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 26px -14px rgba(0,0,0,.7);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 22px 40px -18px rgba(0,0,0,.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d1a; --surface: #161831; --surface-2: #1e2140; --border: #2a2d50;
  --text: #eceefe; --text-2: #b5b8d8; --text-3: #8387ad;
  --accent: #7c7ffb; --accent-2: #9a86ff; --accent-soft: #252859; --accent-text: #abadff;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 26px -14px rgba(0,0,0,.7);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 22px 40px -18px rgba(0,0,0,.85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.55 var(--font); color: var(--text); background: var(--bg);
  background-image: radial-gradient(900px 420px at 50% -120px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--display); letter-spacing: -.02em; margin: 0; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
main.wrap { flex: 1; }

/* Top bar */
.top-row { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 11px; font: 600 18px var(--display); letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; padding: 7px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px -6px var(--accent);
}
.brand-mark i { background: #fff; border-radius: 3px; }
.brand-mark i:last-child { opacity: .55; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.icon-btn:hover { color: var(--text); }

/* Intro + search */
.intro { text-align: center; padding: 40px 0 28px; }
.greet { margin: 0 0 6px; color: var(--accent-text); font-weight: 600; font-size: 15px; }
.intro h1 { font-size: clamp(28px, 4.6vw, 44px); font-weight: 800; margin-bottom: 26px; }
.search {
  position: relative; display: flex; align-items: center; gap: 10px;
  max-width: 560px; height: 56px; margin: 0 auto; padding: 0 14px 0 18px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text-3); cursor: text;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 500 16px var(--font); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd {
  font: 600 12px var(--font); color: var(--text-3); padding: 2px 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
}
@media (hover: none) { .search kbd { display: none; } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.chip {
  height: 36px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: 600 14px var(--font);
}
.chip:hover { color: var(--text); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip small { font-weight: 600; opacity: .6; margin-left: 4px; }

/* Recently opened */
.recent { margin: 8px 0 28px; text-align: center; }
/* auto margins centre the row but still let it scroll from the first item on narrow screens */
.recent-row > :first-child { margin-left: auto; }
.recent-row > :last-child { margin-right: auto; }
.recent h2, .group-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.recent-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.recent-row::-webkit-scrollbar { display: none; }
.recent-item {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 7px 14px 7px 7px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 14px;
}
.recent-item:hover { border-color: var(--accent); }
.recent-item .thumb { width: 34px; border-radius: 10px; font-size: 13px; }

/* Grid of portals */
/* Each group is a centred row of equal tiles, so short groups sit in the middle instead of hugging the left */
.grid { padding-bottom: 32px; }
.group + .group { margin-top: 36px; }
.group-title { text-align: center; margin-bottom: 16px; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.tiles .tile { width: 200px; }
@media (max-width: 600px) {
  .tiles { gap: 14px; }
  .tiles .tile { width: calc(50% - 7px); }
}

.tile {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 16px;
  border-radius: calc(var(--radius-tile) + 8px); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  outline: none;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.tile:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.tile:active { transform: translateY(-1px) scale(.99); }

.thumb {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--radius-tile); overflow: hidden; flex: none;
  background: var(--tile-bg, linear-gradient(135deg, var(--accent), var(--accent-2)));
  color: #fff; font: 800 clamp(28px, 4vw, 40px) var(--display); letter-spacing: -.02em;
  isolation: isolate;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb::after { /* soft light on the initials tiles */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,.28), transparent 60%);
}
.thumb.has-img::after { display: none; }

.t-body { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; min-width: 0; }
.t-title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.t-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-host { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--text-3); font-size: 12px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.t-open {
  position: absolute; top: 20px; right: 20px; width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(-4px); transition: opacity .18s, transform .18s;
}
.tile:hover .t-open, .tile:focus-visible .t-open { opacity: 1; transform: none; }
@media (hover: none) { .t-open { display: none; } }

/* Empty states */
.empty { text-align: center; padding: 48px 16px 72px; color: var(--text-2); }
.empty-art { display: inline-grid; grid-template-columns: repeat(2, 54px); gap: 10px; margin-bottom: 20px; }
.empty-art i { width: 54px; height: 54px; border-radius: 16px; border: 2px dashed var(--border); }
.empty-art i:first-child { border-style: solid; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); opacity: .9; }
.empty h3 { font: 800 20px var(--display); color: var(--text); margin: 0 0 6px; }

.foot { padding: 18px 24px 30px; text-align: center; color: var(--text-3); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { .tile, .t-open { transition: none; } .tile:hover { transform: none; } }
