/* =========================================================
   Vopros.cc — Modern Light Theme (Mobile-first, Safe-area)
   ========================================================= */

/* ---- Color system ---- */
:root{
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e6e9f0;
  --brand: #2563eb;       /* blue */
  --brand-2: #14b8a6;     /* teal accent */
  --indigo: #4f46e5;
  --indigo-dark: #1e40af;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);

  /* iOS safe areas */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

/* ---- Base ---- */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 200px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Pastda footer bosilib ketmasligi uchun umumiy "nafas" */
  padding-bottom: calc(24px + var(--safe-bottom));
}

img{ max-width:100%; height:auto; display:block; }
.container{ max-width: 1120px; margin: 0 auto; padding: 0 18px; }

/* ---- Header ---- */
.site-header{
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(120%) blur(8px);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.86));
  border-bottom: 1px solid var(--border);

  /* iPhone notch uchun yuqori nafas */
  padding-top: max(6px, var(--safe-top));
}

.header-inner{
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 10px 0 12px;
}

.logo a{
  display:inline-block;
  font-weight: 900; letter-spacing: .2px; font-size: 24px;
  color: var(--brand); text-decoration: none;
  padding-top: 2px;
}

.search{ display:flex; gap:10px; flex:1; max-width:560px; }
.search input{
  flex:1; padding:12px 14px; border:1px solid var(--border); border-radius:14px;
  background:#fff; outline:none; font-size:15px;
}
.search input:focus{ border-color:#c7d2fe; box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.search button{
  padding:12px 16px; border:0; border-radius:14px; background:var(--brand); color:#fff; cursor:pointer;
  font-weight:600; transition:transform .06s ease, box-shadow .2s ease;
  box-shadow:0 6px 14px rgba(37,99,235,.25);
}
.search button:hover{ transform: translateY(-1px); }

.nav{ border-top:1px solid var(--border); background:transparent; }
.nav-links{ display:flex; gap:14px; align-items:center; padding: 8px 0 10px; flex-wrap:wrap; }
.nav a{
  color:var(--text); text-decoration:none; padding:8px 10px; border-radius:10px; transition:background .2s ease, color .2s ease;
}
.nav a:hover{ background:#eef2ff; }
.nav a.ask{
  color:#fff; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 18px rgba(20,184,166,.25);
}

/* ---- Links (visited fix) ---- */
a, a:visited{ color: var(--indigo); }
a:hover{ color: var(--indigo-dark); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Layout ---- */
.main-grid{
  display:grid; grid-template-columns: 1fr 320px; gap:22px;
  padding: 18px 0 10px;
}
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h1{ margin: 4px 0 14px; font-size: 28px; line-height: 1.25; }
.card h3{ margin: 0 0 10px; font-size: 20px; }
.badge{
  display:inline-block; padding:4px 10px; border-radius:999px; background:#eef2ff; color:#3743c7; font-size:12px; font-weight:600;
}

.q-item{ padding: 12px 0; border-bottom: 1px dashed #e9ecf5; }
.q-item:last-child{ border-bottom:0; }
.q-item a{ font-weight: 700; }
.q-meta{ color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---- Lists ---- */
.list{ list-style:none; margin:0; padding:0; }
.list li{ padding:7px 0; }
.list a{ color:#6b4be8; }
.list a:hover{ color:#1e40af; }

/* ---- Forms ---- */
.form-row{ display:flex; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
input[type=text], input[type=password], input[type=email], textarea, select{
  width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:14px; background:#fff; outline:none; font-size:15px;
}
textarea{ min-height: 160px; resize: vertical; }
input:focus, textarea:focus, select:focus{
  border-color:#c7d2fe; box-shadow:0 0 0 3px rgba(37,99,235,.15);
}
button.btn{
  padding:12px 16px; border:0; border-radius:14px; background:var(--brand); color:#fff; cursor:pointer; font-weight:700;
  transition:transform .06s ease, box-shadow .2s ease; box-shadow:0 8px 18px rgba(37,99,235,.25);
}
button.btn:hover{ transform: translateY(-1px); }
.actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.vote{
  display:inline-flex; gap:6px; align-items:center; padding:8px 12px; border:1px solid var(--border);
  border-radius:999px; background:#fff; cursor:pointer;
}
.vote:hover{ background:#f8fafc; }

/* ---- Footer (reworked) ---- */
.site-footer{
  margin-top: 36px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
  border-top: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(0,0,0,.03);
}
.site-footer .container{
  /* Safe-area va nafas */
  padding-top: 24px;
  padding-bottom: calc(28px + var(--safe-bottom));
}
.footer-grid{
  display:grid; grid-template-columns: repeat(3,1fr);
  gap: 22px;
}
.site-footer h4{
  margin: 0 0 10px;
  font-size: 16px; color: #111827;
}
.site-footer p, .site-footer li, .site-footer a{
  font-size: 15px; line-height: 1.55; color: #374151;
}
.site-footer a, .site-footer a:visited{
  color: #334155; text-decoration: underline; text-underline-offset: 3px;
}
.site-footer a:hover{ color: var(--indigo-dark); }
.copy{
  margin-top: 8px; color:#6b7280; font-size: 13px;
  padding: 14px 0 0;
  border-top: 1px dashed var(--border);
}

/* ---- Utilities ---- */
.m-0{ margin:0 }
.mt-2{ margin-top:8px }
.mt-3{ margin-top:12px }
.mt-4{ margin-top:16px }

/* ---- Responsive ---- */
@media (max-width: 960px){
  .main-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 560px){
  .site-header{
    position: sticky !important;
    top: env(safe-area-inset-top, 0px);
    z-index: 50;
    background: #fff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
    padding-top: 6px; /* safe-area bilan birga yetarli nafas */
  }

  /* Hech qanday sun’iy kompensatsiya kerak emas */
  body{
    padding-top: 0 !important;
  }

  /* Anchorlarga skroll qilganda to‘g‘ri joyda to‘xtashi uchun kichik offset */
  html{
    scroll-padding-top: 80px; /* headerning o‘rtacha balandligi */
  }

  /* Header ostidagi birinchi kontentga ozgina “nafas” */
  .main-grid{
    margin-top: 8px;
  }
}

  /* Content spacing */
  .main-grid{ padding: 14px 0 8px; }
  .card{ padding: 16px; border-radius: 18px; }
  .card h1{ font-size: 24px; }

  /* Footer columns stack + bigger tap targets */
  .footer-grid{ grid-template-columns: 1fr; }
  .site-footer h4{ font-size: 17px; }
  .site-footer a, .site-footer p, .site-footer li{ font-size: 16px; }
  .nav a, .btn, .vote{ min-height: 44px; } /* Apple HIG */
}
