/* ============================================================
   PeerUp — inner app pages (feed / question / ask / buddies)
   Loaded AFTER styles.css: reuses tokens + header, overrides shell
   ============================================================ */

html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  background: #000;
  background-image: radial-gradient(
      1100px 620px at 50% -12%,
      rgba(255, 255, 255, 0.09),
      transparent 60%
    ),
    radial-gradient(760px 460px at 88% 8%, rgba(255, 255, 255, 0.05), transparent 62%);
  background-attachment: fixed;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: clamp(16px, 2.4vh, 28px) clamp(14px, 3vw, 32px) 64px;
}

.app .header {
  max-width: 980px;
  margin-bottom: clamp(26px, 5vh, 48px);
}

.app-main {
  width: 100%;
  max-width: 900px;
}

/* ============ page head ============ */
.page-head {
  margin-bottom: clamp(18px, 3vh, 28px);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #fff;
}

.page-sub {
  max-width: 560px;
  margin-top: 10px;
  color: #d0d0d0;
  opacity: 0.75;
  font-size: clamp(13.5px, 1.5vw, 15px);
  line-height: 1.55;
}

/* ============ toolbar ============ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}

.search i {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: #8e8e8e;
  font-size: 13px;
  pointer-events: none;
}

.field,
.select {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search .field {
  padding-left: 40px;
}

.field::placeholder {
  color: #7d7d7d;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.08);
}

.select {
  flex: 0 0 auto;
  width: auto;
  min-width: 150px;
  padding-right: 38px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8e8e8e 50%),
    linear-gradient(135deg, #8e8e8e 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.select option {
  background: #18181a;
  color: #fff;
}

.textarea {
  width: 100%;
  min-height: 170px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.textarea::placeholder {
  color: #7d7d7d;
}

/* ============ buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease,
    box-shadow 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.btn-primary {
  background: #fff;
  color: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15),
    0 0 22px rgba(255, 255, 255, 0.28);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25),
    0 0 30px rgba(255, 255, 255, 0.42);
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #e6e6e6;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ============ cards ============ */
.card {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 0.25s ease, background 0.25s ease,
    transform 0.25s ease;
}

.card + .card {
  margin-top: 12px;
}

a.card:hover,
.card.is-link:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-2px);
}

/* ---- question row ---- */
.q-row {
  display: flex;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.votes {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 44px;
  padding-top: 2px;
}

.vote-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #7d7d7d;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.vote-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.vote-btn.is-on {
  color: #fff;
}

.vote-count {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.q-body {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.q-title {
  font-size: clamp(15px, 1.8vw, 17.5px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: #fff;
}

.q-excerpt {
  margin-top: 6px;
  color: #a8a8a8;
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  border: 1px solid var(--trust-border);
  border-radius: 999px;
  background: var(--trust-bg);
  color: var(--trust-text);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-solved {
  border-color: rgba(120, 230, 160, 0.45);
  background: rgba(60, 190, 120, 0.16);
  color: #86e6ad;
}

.meta-dot::before {
  content: "·";
  margin-right: 8px;
}

/* ============ question detail ============ */
.q-detail {
  padding: clamp(20px, 3vw, 28px);
}

.q-detail .q-title {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.q-text {
  margin-top: 14px;
  color: #d2d2d2;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 34px 0 14px;
}

.section-head h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.answer.is-accepted {
  border-color: rgba(120, 230, 160, 0.4);
  background: rgba(60, 190, 120, 0.07);
}

.a-text {
  color: #d2d2d2;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.a-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: #8fbcff;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.link-btn:hover {
  color: #fff;
  text-decoration: underline;
}

/* ============ buddies ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.grid .card {
  display: flex;
  flex-direction: column;
}

.grid .card + .card {
  margin-top: 0;
}

.buddy-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.buddy-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid var(--trust-border);
  border-radius: 50%;
  background: var(--trust-bg);
  padding: 4px;
}

.buddy-avatar span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.buddy-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #fff;
}

.buddy-grade {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.buddy-goal {
  margin-top: 14px;
  color: #b9b9b9;
  font-size: 13.5px;
  line-height: 1.55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.buddy-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.buddy-when {
  color: var(--muted);
  font-size: 12px;
}

.btn-sm {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
}

.btn-req.is-on {
  border-color: rgba(120, 230, 160, 0.45);
  background: rgba(60, 190, 120, 0.16);
  color: #86e6ad;
}

/* ============ forms ============ */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row label {
  display: block;
  margin-bottom: 8px;
  color: #cfcfcf;
  font-size: 13px;
  font-weight: 500;
}

.form-row .select {
  width: 100%;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============ misc ============ */
.empty {
  padding: 44px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 40;
  transform: translate(-50%, 16px);
  padding: 13px 22px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ sign-in modal ============ */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: overlayIn 0.24s ease both;
}

.modal-back[hidden] {
  display: none;
}

.modal {
  width: min(400px, 100%);
  padding: 26px 24px 22px;
  border-radius: 28px;
  background: #fff;
  color: #111;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: linkIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal p {
  margin-top: 8px;
  color: #5c5c5c;
  font-size: 13.5px;
  line-height: 1.55;
}

.modal input {
  width: 100%;
  height: 48px;
  margin-top: 18px;
  padding: 0 18px;
  border: 1px solid #dcdcdc;
  border-radius: 999px;
  background: #f6f6f6;
  color: #111;
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
}

.modal input:focus {
  border-color: #111;
  background: #fff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn {
  flex: 1;
}

.modal .btn-primary {
  background: #111;
  color: #fff;
  box-shadow: none;
}

.modal .btn-primary:hover {
  background: #000;
  box-shadow: none;
}

.modal .btn-ghost {
  border-color: #dcdcdc;
  background: #fff;
  color: #444;
}

.modal .btn-ghost:hover {
  border-color: #111;
  background: #f2f2f2;
  color: #111;
}

/* ============ responsive ============ */
@media (max-width: 720px) {
  .app .header {
    margin-bottom: 26px;
  }

  .toolbar .select,
  .toolbar .btn {
    flex: 1 1 auto;
  }

  .votes {
    width: 38px;
  }
}
