/* ============================================================
   Design tokens — Light (default)
   ============================================================ */
:root {
  --color-bg: #f6f8ff;
  --color-surface: #fefefe;
  --color-text-primary: #2b3442;
  --color-text-secondary: #4b6a9b;
  --color-text-muted: #697c9a;
  --color-accent: #0079ff;
  --color-accent-hover: #60abff;
  --color-error: #f74646;
  --color-stats-bg: #f6f8ff;
  --color-toggle-idle: #4b6a9b;
  --color-toggle-hover: #222731;
  --shadow-surface: 0px 16px 30px -10px rgba(70, 96, 187, 0.2);
}

/* ============================================================
   Dark mode overrides
   ============================================================ */
[data-theme="dark"] {
  --color-bg: #141d2f;
  --color-surface: #1e2a47;
  --color-text-primary: #ffffff;
  --color-text-secondary: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.75);
  --color-stats-bg: #141d2f;
  --color-toggle-idle: #90a4d4;
  --color-toggle-hover: #ffffff;
  --shadow-surface: none;
}

/* ============================================================
   Reset & base
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: "Space Mono", monospace;
  font-size: 1rem;
  line-height: 1.667; /* 25px / 15px */
  background-color: var(--color-bg);
  color: var(--color-text-secondary);
  min-height: 100vh;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  width: 100%;
  max-width: 730px;
  margin: 0 auto;
  padding: 31px 24px 80px;
}

@media (min-width: 576px) {
  .container {
    padding: 140px 40px 100px;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 144px 0 100px;
  }
}

/* ============================================================
   Header
   ============================================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.logo {
  font-size: 1.733rem; /* 26px */
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-primary);
  letter-spacing: -0.5px;
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-toggle-idle);
  padding: 0;
  transition: color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--color-toggle-hover);
}

.toggle-label {
  font-family: "Space Mono", monospace;
  font-size: 0.867rem; /* 13px */
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.toggle-icon {
  display: flex;
  align-items: center;
  width: 20px;
  height: 20px;
}

/* Show correct icon per theme */
[data-theme="light"] .icon-sun {
  display: none;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

/* ============================================================
   Search Bar
   ============================================================ */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  height: 69px;
  padding: 0 10px 0 32px;
  background-color: var(--color-surface);
  border-radius: 15px;
  box-shadow: var(--shadow-surface);
  margin-bottom: 24px;
  overflow: hidden;
}

.search-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.search-input {
  flex: 1;
  min-width: 0;
  font-family: "Space Mono", monospace;
  font-size: 1.2rem; /* 18px */
  font-weight: 400;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
  padding: 0 16px;
  caret-color: var(--color-accent);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

/* Error message — inline in search bar */
.error-msg {
  flex-shrink: 0;
  font-family: "Space Mono", monospace;
  font-size: 0.933rem; /* 14px / ~15px */
  font-weight: 700;
  color: var(--color-error);
  white-space: nowrap;
  padding-right: 24px;
}

/* Search button */
.search-btn {
  flex-shrink: 0;
  height: 50px;
  padding: 0 24px;
  min-width: 84px;
  font-family: "Space Mono", monospace;
  font-size: 1.067rem; /* 16px */
  font-weight: 700;
  color: #fff;
  background-color: var(--color-accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.search-btn:hover {
  background-color: var(--color-accent-hover);
}

/* ============================================================
   Profile Card
   ============================================================ */
.profile-card {
  background-color: var(--color-surface);
  border-radius: 15px;
  box-shadow: var(--shadow-surface);
  padding: 32px 24px;
}

@media (min-width: 576px) {
  .profile-card {
    padding: 40px 40px;
  }
}

/* ---- Card top row ---- */
.card-top {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

@media (min-width: 576px) {
  .card-top {
    gap: 41px;
    margin-bottom: 20px;
  }
}

.avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

@media (min-width: 576px) {
  .avatar {
    width: 117px;
    height: 117px;
  }
}

.card-top-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Name & join date — stacked on mobile, side-by-side on tablet+ */
.name-join-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (min-width: 768px) {
  .name-join-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.display-name {
  font-size: 1.067rem; /* 16px on mobile */
  font-weight: 700;
  line-height: 1.46;
  color: var(--color-text-primary);
}

@media (min-width: 576px) {
  .display-name {
    font-size: 1.733rem; /* 26px */
    line-height: 38px;
  }
}

.join-date {
  font-size: 0.867rem; /* 13px */
  color: var(--color-text-muted);
  white-space: nowrap;
}

@media (min-width: 576px) {
  .join-date {
    font-size: 0.933rem; /* 14px */
    padding-top: 8px;
  }
}

.username {
  font-size: 0.867rem; /* 13px */
  font-weight: 400;
  color: var(--color-accent);
  text-decoration: none;
  line-height: 24px;
}

.username:hover {
  text-decoration: underline;
}

@media (min-width: 576px) {
  .username {
    font-size: 1.067rem; /* 16px */
  }
}

/* On tablet+, avatar and right-content are laid out together */
@media (min-width: 768px) {
  .card-top-right {
    padding-top: 4px;
  }
}

/* ---- Bio ---- */
.bio {
  font-size: 0.867rem;
  line-height: 25px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

@media (min-width: 576px) {
  .bio {
    font-size: 1rem; /* 15px */
    margin-bottom: 32px;
  }
}

.bio.no-bio {
  opacity: 0.75;
}

/* ---- Stats block ---- */
.stats {
  display: flex;
  justify-content: space-around;
  background-color: var(--color-stats-bg);
  border-radius: 10px;
  padding: 18px 15px;
  margin-bottom: 24px;
  text-align: center;
}

@media (min-width: 576px) {
  .stats {
    text-align: left;
    padding: 15px 32px;
    margin-bottom: 37px;
    justify-content: space-between;
  }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 0.733rem; /* 11px */
  font-weight: 400;
  color: var(--color-text-secondary);
}

@media (min-width: 576px) {
  .stat-label {
    font-size: 0.867rem; /* 13px */
  }
}

.stat-value {
  font-size: 1.067rem; /* 16px */
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

@media (min-width: 576px) {
  .stat-value {
    font-size: 1.467rem; /* 22px */
  }
}

/* ---- Info list ---- */
.info-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 576px) {
  .info-list {
    grid-template-columns: 1fr 1fr;
    gap: 16px 16px;
  }
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}

.info-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.info-text {
  font-size: 0.867rem; /* 13px */
  line-height: 20px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 576px) {
  .info-text {
    font-size: 1rem; /* 15px */
  }
}

.info-link {
  text-decoration: none;
  color: var(--color-text-secondary);
}

.info-link:hover {
  text-decoration: underline;
}

/* Unavailable state */
.info-item.unavailable {
  opacity: 0.5;
  pointer-events: none;
}
