/* ═══════════════════════════════════════════════════════
   PROFILE.CSS  —  MineMev Profile Page (single-surface layout)
   ═══════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #0f0f13;
  --surface:     #16161d;
  --surface-2:   #1e1e28;
  --border:      #2a2a38;
  --border-hover:#3d3d52;

  --text:        #e8e8f0;
  --text-muted:  #8888a8;
  --text-dim:    #555570;

  --accent:      #7c3aed;
  --accent-2:    #a855f7;
  --gold:        #f59e0b;

  --green:       #22c55e;
  --red:         #ef4444;
  --orange:      #f97316;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;

  --shadow:      0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.6);

  --pad:         28px;
  --transition:  .2s ease;
}

/* ── Reset / Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body * {
  font-family: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans TC", "Noto Sans KR", sans-serif;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Icons: every svg.i is a stroked 16px icon from the sprite */
.i {
  width: 16px; height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i--lg { width: 18px; height: 18px; }
.i--crown    { width: 20px; height: 20px; stroke: #ffbf00; fill: #ffec00; stroke-width: 1.5; }
.i--verified { width: 22px; height: 22px; fill: var(--accent); stroke: none; }

/* ── Page ────────────────────────────────────────────── */
.page-wrapper {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
}

/* One continuous surface: hero on top, posts directly below */
.profile {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* no overflow:hidden here so the controls menu can escape the banner */
}

/* ════════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════════ */
.hero { position: relative; }

.hero__banner {
  position: relative;
  height: 150px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px var(--pad);
}

.hero__banner.has-bg {
  background: var(--bg-url) center/cover no-repeat;
}

/* fade the banner into the surface so there is no hard seam */
.hero__banner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(22,22,29,0) 30%, var(--surface) 100%);
  pointer-events: none;
}
.hero__banner > * { position: relative; z-index: 1; }

/* MEV score */
.mev-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: auto;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  backdrop-filter: blur(6px);
}
.mev-score__label { font-size: 11px; font-weight: 700; color: var(--gold); letter-spacing: .04em; }
.mev-score__value { font-size: 18px; font-weight: 700; color: #fff; }

/* ── Controls menu (admin / owner tools) ─────────────── */
.controls { position: relative; }

.controls__toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: border-color var(--transition);
}
.controls__toggle::-webkit-details-marker { display: none; }
.controls__toggle:hover, .controls[open] .controls__toggle { border-color: var(--accent); }

.controls__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.controls__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.controls__item:hover { background: #252535; }
.controls__form { margin: 0; }
button.controls__item {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.controls__item.is-danger  { color: #fca5a5; }
.controls__item.is-success { color: #86efac; }

.controls__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding: 10px 10px 6px;
  border-top: 1px solid var(--border);
}
.controls__field label { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }
#perm-status { color: var(--green); }

.permission-select {
  width: 100%;
  padding: 8px 32px 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.permission-select:hover, .permission-select:focus { border-color: var(--accent); outline: none; }

/* ── Identity row ────────────────────────────────────── */
.hero__main {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 var(--pad);
  margin-top: -56px;           /* avatar overlaps the banner */
  position: relative;
}

.hero__avatar { position: relative; flex-shrink: 0; }
.hero__avatar img {
  display: block;
  width: 112px; height: 112px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
}
.crown-badge {
  position: absolute;
  top: -8px; left: -8px;
  display: flex;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}

.hero__identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.hero__name-row { display: flex; align-items: center; gap: 8px; }
.hero__username {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.certified-badge { display: flex; align-items: center; }

/* Stats as a plain sentence line, not boxes */
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.hero__stats strong { color: var(--text); font-weight: 700; font-size: 15px; margin-right: 2px; }
.hero__stats a:hover { color: var(--accent-2); }

/* Minecraft chip: one inline strip instead of a separate card */
.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 6px 4px 6px;
  background: rgba(124,58,237,.1);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius);
}
.mc-chip__head, .mc-chip__fallback {
  width: 28px; height: 34px;
  object-fit: contain;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.35));
}
.mc-chip__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-chip__ok { width: 14px; height: 14px; color: var(--green); stroke-width: 2.5; }

.mc-chip__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.mc-chip__btn .i { width: 13px; height: 13px; }
.mc-chip__btn:hover { color: var(--text); background: rgba(124,58,237,.2); border-color: rgba(124,58,237,.6); }

/* Actions sit on the right of the identity row */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 6px;
  max-width: 360px;
}

/* About + servers: part of the hero, not a separate card */
.hero__about {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 32px;
  margin: 20px var(--pad) 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.description {
  flex: 1 1 320px;
  max-width: 70ch;
  max-height: 200px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
  white-space: pre-wrap;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.server-memberships {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.server-memberships__label { font-size: 12px; color: var(--text-dim); margin-right: 2px; }
.server-badge-link { display: inline-flex; }
.server-badge {
  width: 34px; height: 34px;
  object-fit: contain;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.server-badge:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Social */
.social-links { display: flex; gap: 6px; }
.social-link {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: all var(--transition);
}
.social-link--yt     { color: #ff4444; }
.social-link--twitch { color: #9b59b6; }
.social-link:hover   { border-color: currentColor; background: #252535; }

/* Tooltip */
.tooltip-wrap { position: relative; }
.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn--ghost   { background: var(--surface-2); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--border-hover); background: #252535; }

.btn--danger  { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.35);  color: #fca5a5; }
.btn--danger:hover  { background: rgba(239,68,68,.22);  border-color: var(--red); }
.btn--success { background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.35);  color: #86efac; }
.btn--success:hover { background: rgba(34,197,94,.22);  border-color: var(--green); }
.btn--warning { background: rgba(249,115,22,.12); border-color: rgba(249,115,22,.35); color: #fdba74; }
.btn--warning:hover { background: rgba(249,115,22,.22); border-color: var(--orange); }
.btn--accent  { background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.4);  color: #c4b5fd; }
.btn--accent:hover  { background: rgba(124,58,237,.25); border-color: var(--accent); }

.btn--follow {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 20px;
}
.btn--follow:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 4px 12px rgba(124,58,237,.4); }

.btn--xs { padding: 4px 8px; font-size: 11px; }

/* ════════════════════════════════════════════════════════
   POSTS (continues the same surface)
   ════════════════════════════════════════════════════════ */
.content {
  margin-top: 24px;
  padding: 20px var(--pad) var(--pad);
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 16px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.post-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow); }

.post-card--hidden { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.05); }

.post-card__img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg);
}
.post-card__img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.post-card:hover .post-card__img { transform: scale(1.04); }

/* Favorite lives on the image */
.icon-btn {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--text-muted);
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all var(--transition);
}
.icon-btn:hover     { color: var(--gold); border-color: var(--gold); }
.icon-btn.is-active { color: var(--gold); border-color: var(--gold); background: rgba(245,158,11,.15); }
.icon-btn.is-active .i { fill: currentColor; }

.post-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 8px;
}

.post-card__title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.post-card__title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}
.post-card__title:hover { color: var(--accent-2); }

/* Tags: versions and tags share one row */
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all var(--transition);
}
.tag:hover { color: var(--accent-2); border-color: var(--accent); background: rgba(124,58,237,.1); }
.tag--version { color: var(--gold); background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.3); }
.tag--version:hover { color: var(--gold); border-color: var(--gold); background: rgba(245,158,11,.16); }

/* Votes: compact footer of the card */
.post-card__votes {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.vote-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.vote-btn .i { width: 16px; height: 16px; }
.vote-btn:hover { color: var(--text); border-color: var(--border-hover); }
.vote-btn--up.is-active   { color: var(--green); background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.5); }
.vote-btn--down.is-active { color: var(--red);   background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.5); }
.vote-count { min-width: 28px; text-align: center; font-size: 13px; font-weight: 600; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 800px) {
  :root { --pad: 18px; }
  .page-wrapper { padding: 12px; }

  .hero__banner { height: 120px; }
  .hero__main {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: -48px;
  }
  .hero__avatar img { width: 96px; height: 96px; }
  .hero__identity { width: 100%; }
  .hero__actions { justify-content: flex-start; max-width: none; padding-bottom: 0; }
  .server-memberships { margin-left: 0; }
}

@media (max-width: 480px) {
  .hero__username { font-size: 24px; }
  .posts-grid { grid-template-columns: 1fr; }
  .mc-chip__btn span { display: none; }   /* icon-only buttons on small phones */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .post-card:hover .post-card__img { transform: none; }
}