/* ==========================================================
   AskNest main stylesheet
   Font: Roboto only. Breakpoints: 1100, 992, 768, 640, 480
   ========================================================== */

:root {
    --navy-950: #040d26;
    --navy-900: #061233;
    --navy-800: #0a1f4d;
    --blue-700: #0f55d6;
    --blue-600: #1a66f2;
    --blue-500: #2f7bff;
    --cyan: #22bfff;
    --ink: #0f1b33;
    --text: #27324b;
    --muted: #6b7a94;
    --line: #e3e9f3;
    --bg: #f5f8fd;
    --card: #ffffff;
    --radius: 14px;
    --font: 'Roboto', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }

.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;
}

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 20px; border-radius: 8px; border: 1px solid transparent;
    font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
    transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-outline { background: #fff; color: var(--blue-600); border-color: var(--blue-600); }
.btn-outline:hover { background: #eef4ff; }
.btn-block { width: 100%; height: 48px; font-size: 15px; }
.btn-pill {
    height: 40px; padding: 0 26px; border-radius: 999px; background: #fff;
    border-color: var(--blue-600); color: var(--blue-600);
}
.btn-pill:hover { background: #eef4ff; }

.icon-btn {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
    background: #fff; color: var(--ink); display: inline-flex; align-items: center;
    justify-content: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: #f1f5fc; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 60; background: #fff;
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 66px; }

.logo { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.logo-mark { display: block; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 24px; font-weight: 700; color: var(--navy-800); letter-spacing: -.2px; }
.logo-text small { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.logo-light .logo-text strong { color: #fff; }
.logo-light .logo-text small { color: #9db0d4; }

.main-nav { display: flex; align-items: stretch; gap: 30px; margin: 0 auto; align-self: stretch; }
.main-nav > a {
    display: inline-flex; align-items: center; font-size: 14px; font-weight: 500;
    color: var(--ink); position: relative; padding: 0 2px;
}
.main-nav > a:hover { color: var(--blue-600); }
.main-nav > a.active { color: var(--blue-600); }
.main-nav > a.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
    background: var(--blue-600); border-radius: 3px 3px 0 0;
}
.nav-auth { display: none; }

.header-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.nav-toggle { display: none; }

.search-panel { background: #fff; border-top: 1px solid var(--line); padding: 14px 0; }
.search-panel[hidden] { display: none; }

/* ---------- Search form (shared) ---------- */
.search-form {
    position: relative; display: flex; align-items: stretch; background: #fff;
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 52px;
}
.search-form .search-ico {
    position: absolute; left: 16px; top: 0; bottom: 0; display: flex; align-items: center;
    color: #8493ad; pointer-events: none;
}
.search-form input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
    padding: 0 14px 0 46px; font-size: 15px; color: var(--ink);
}
.search-form input::placeholder { color: #8d9ab2; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-form button {
    flex: none; width: 58px; border: 0; background: var(--blue-500); color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.search-form button:hover { background: var(--blue-600); }
.search-form:focus-within { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(47, 123, 255, .18); }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; color: #fff;
    background:
        radial-gradient(900px 420px at 78% 55%, rgba(47, 123, 255, .45), rgba(47, 123, 255, 0) 70%),
        linear-gradient(100deg, var(--navy-950) 0%, var(--navy-900) 38%, #0b2d78 78%, #0e3f9d 100%);
}
.hero-grid {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    align-items: center; gap: 24px; padding-top: 58px; padding-bottom: 54px;
}
.hero h1 {
    font-size: clamp(34px, 5.2vw, 56px); line-height: 1.1; font-weight: 700;
    letter-spacing: -.5px; color: #fff;
}
.hero-accent { color: var(--cyan); }
.hero-sub { margin-top: 18px; font-size: 17px; line-height: 1.55; color: rgba(255, 255, 255, .9); max-width: 560px; }
.hero-search { margin-top: 26px; max-width: 610px; border: 0; height: 54px; }
.hero-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.hero-chips span { font-size: 14px; color: rgba(255, 255, 255, .9); margin-right: 2px; }
.hero-chips a {
    padding: 6px 15px; border-radius: 999px; font-size: 13px; color: #fff;
    border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .06);
}
.hero-chips a:hover { background: rgba(255, 255, 255, .16); }

.hero-visual { min-width: 0; display: flex; justify-content: center; }
.hero-art { width: 100%; max-width: 560px; height: auto; display: block; }
.hero-art text { font-family: var(--font); }
.ha-note text { fill: #fff; font-size: 17px; font-style: italic; font-weight: 300; }

/* ---------- Page body & sections ---------- */
.page-body { padding-top: 34px; padding-bottom: 56px; }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--blue-600); white-space: nowrap; }
.link-more:hover, .link-small:hover { text-decoration: underline; }
.link-small { font-size: 13px; font-weight: 500; color: var(--blue-600); white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 36, 80, .03); }

/* tones */
.tone-blue    { --tone-bg: #eaf2ff; --tone-fg: #2563eb; }
.tone-pink    { --tone-bg: #ffeef2; --tone-fg: #e11d48; }
.tone-purple  { --tone-bg: #f2ecff; --tone-fg: #7c3aed; }
.tone-amber   { --tone-bg: #fff5df; --tone-fg: #e69100; }
.tone-green   { --tone-bg: #e8f8ef; --tone-fg: #16a34a; }
.tone-orange  { --tone-bg: #fff0e6; --tone-fg: #ea6a12; }
.tone-sky     { --tone-bg: #e8f3ff; --tone-fg: #1d7be6; }
.tone-red     { --tone-bg: #ffeeee; --tone-fg: #e5383b; }
.tone-violet  { --tone-bg: #f0ecff; --tone-fg: #6d4be0; }

/* ---------- Category carousel ---------- */
.cat-carousel { position: relative; --per-view: 8; --gap: 12px; }
.cat-track {
    display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory;
    scrollbar-width: none; -ms-overflow-style: none; padding: 2px; scroll-behavior: smooth;
}
.cat-track::-webkit-scrollbar { display: none; }
.cat-tile {
    flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
    min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px; text-align: center;
    padding: 18px 8px 16px; border-radius: 12px; background: var(--tone-bg); color: var(--tone-fg);
    border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(15, 27, 51, .04);
    transition: transform .15s;
}
.cat-tile:hover { transform: translateY(-2px); }
.cat-tile strong { font-size: 14px; font-weight: 500; color: var(--ink); margin-top: 6px; }
.cat-tile span { font-size: 12px; color: var(--muted); }

.car-btn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
    background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 6px rgba(16, 36, 80, .12);
}
.car-btn:hover { background: #f1f5fc; }
.car-prev { left: -17px; }
.car-next { right: -17px; }

/* ---------- Stats strip ---------- */
.stats-card {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(280px, 1.35fr);
    align-items: center; gap: 18px 24px; padding: 20px 26px; margin-bottom: 26px;
    background: #f9fbff;
}
.stat { display: flex; align-items: center; gap: 14px; min-width: 0; }
.stat-ico {
    width: 50px; height: 50px; border-radius: 13px; background: var(--tone-bg); color: var(--tone-fg);
    display: flex; align-items: center; justify-content: center; flex: none;
}
.stat strong { display: block; font-size: 25px; line-height: 1.1; font-weight: 700; color: var(--ink); }
.stat span { font-size: 13px; color: var(--muted); }
.stat-cta p { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Main grid ---------- */
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; margin-bottom: 22px; }
.main-grid > * { min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 22px; }

/* tabs */
.tabs { display: flex; gap: 30px; padding: 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 18px 2px 16px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }

/* question rows */
.q-row {
    display: grid; grid-template-columns: 158px minmax(0, 1fr) 168px; gap: 18px;
    padding: 20px 24px; border-bottom: 1px solid var(--line); align-items: start;
}
.q-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.q-stat { display: flex; flex-direction: column; align-items: center; padding: 5px 2px; border-radius: 7px; min-width: 0; }
.q-stat strong { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.2; }
.q-stat span { font-size: 11px; color: var(--muted); }
.q-stat-answered { background: #e6f7ee; }
.q-stat-answered strong { color: #15803d; }
.q-stat-answered span { color: #3f8a5c; }
.q-title { font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.q-title a:hover { color: var(--blue-600); }
.q-excerpt {
    margin-top: 5px; font-size: 13px; color: var(--muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag { display: inline-block; padding: 3px 11px; border-radius: 5px; background: #eaf2ff; color: var(--blue-600); font-size: 12px; }
.tag:hover { background: #d9e8ff; }
.q-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.q-author strong { display: block; font-size: 13px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.q-author span { display: block; font-size: 11px; color: var(--muted); }
.more-row { display: flex; justify-content: center; padding: 22px 16px 24px; }
.empty-state { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }

/* avatars */
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 500; line-height: 1; }

/* widgets */
.widget { padding: 20px 22px 14px; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.widget-head h2 { font-size: 18px; font-weight: 700; color: var(--ink); }

.people li { display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.people li + li { border-top: 1px solid #f0f3f9; }
.person { flex: 1; min-width: 0; }
.person strong { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.person span { display: block; font-size: 12px; color: var(--muted); }

.rank {
    flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-size: 12px; font-weight: 500;
    background: #eef2f9; color: #4a5875;
}
.rank-1 { background: #f6b81c; color: #fff; }
.rank-2 { background: #aab4c4; color: #fff; }
.rank-3 { background: #d9822b; color: #fff; }

.chip {
    flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
    border-radius: 6px; font-size: 11.5px; font-weight: 500;
}
.chip-orange { background: #fff1de; color: #d97706; }
.chip-blue { background: #e6efff; color: #1d5fe0; }

/* popular categories */
.pop-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 22px; padding-bottom: 8px; }
.pop-cats a { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-width: 0; }
.pop-cats a:hover strong { color: var(--blue-600); }
.pop-ico {
    flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--tone-bg);
    color: var(--tone-fg); display: flex; align-items: center; justify-content: center;
}
.pop-text { min-width: 0; }
.pop-text strong { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pop-text small { display: block; font-size: 12px; color: var(--muted); }

/* badges */
.badge-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.badge-ico { flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.badge-gold   { background: #fff4d6; color: #d99a00; }
.badge-orange { background: #fff0dd; color: #ea7a12; }
.badge-red    { background: #ffe9e9; color: #e0393e; }
.badge-blue   { background: #e6efff; color: #1d5fe0; }
.badge-list strong { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.badge-list small { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: #b7c3dc; }
.footer-grid {
    display: grid; grid-template-columns: 1.5fr .8fr .9fr .9fr 1.4fr; gap: 34px;
    padding-top: 44px; padding-bottom: 34px;
}
.footer-grid > * { min-width: 0; }
.footer-brand p { margin: 14px 0 16px; font-size: 13px; line-height: 1.6; color: #a9b8d6; max-width: 300px; }
.social { display: flex; gap: 10px; }
.social a {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .08);
    color: #fff; display: flex; align-items: center; justify-content: center;
}
.social a:hover { background: var(--blue-600); }
.footer-col h3 { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 14px; }
.footer-col li + li { margin-top: 9px; }
.footer-col a { font-size: 13px; color: #b7c3dc; }
.footer-col a:hover { color: #fff; }
.footer-news p { font-size: 13px; line-height: 1.55; color: #a9b8d6; margin-bottom: 14px; }
.news-form { display: flex; gap: 0; }
.news-form input {
    flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 0; outline: 0;
    border-radius: 6px 0 0 6px; background: #fff; color: var(--ink); font-size: 13px;
}
.news-form .btn { height: 40px; border-radius: 0 6px 6px 0; padding: 0 16px; }
.news-msg { margin-top: 10px; font-size: 12.5px !important; }
.news-success { color: #6ee7a3 !important; }
.news-error { color: #ff9a9a !important; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .09); }
.footer-bottom-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding-top: 16px; padding-bottom: 16px; font-size: 12.5px; flex-wrap: wrap; }
.footer-bottom nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-bottom a:hover { color: #fff; }

/* ---------- Stub / inner pages ---------- */
.inner-wrap { padding: 56px 0 72px; }
.notice-card { max-width: 620px; margin: 0 auto; padding: 44px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.notice-card .stat-ico { width: 60px; height: 60px; }
.notice-card h1 { font-size: 26px; color: var(--ink); }
.notice-card p { color: var(--muted); max-width: 440px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--ink); margin-bottom: 18px; overflow-wrap: anywhere; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--blue-600); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1100px) {
    .cat-carousel { --per-view: 6; }
    .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .footer-brand { grid-column: 1 / -1; }
    .footer-brand p { max-width: 520px; }
    .footer-news { grid-column: auto; }
    .main-grid { grid-template-columns: minmax(0, 1fr) 310px; }
    .q-row { grid-template-columns: 150px minmax(0, 1fr); }
    .q-author { grid-column: 2; }
    .header-inner { gap: 18px; }
    .main-nav { gap: 20px; }
}

@media (max-width: 992px) {
    .container { padding: 0 20px; }
    .nav-toggle { display: inline-flex; }
    .btn-sm-hide { display: none; }
    .header-actions { margin-left: auto; }
    .main-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        background: #fff; flex-direction: column; align-items: stretch; gap: 0;
        padding: 8px 20px 18px; border-bottom: 1px solid var(--line);
        box-shadow: 0 12px 24px rgba(16, 36, 80, .1); margin: 0;
    }
    .site-header.nav-open .main-nav { display: flex; }
    .main-nav > a { padding: 14px 2px; border-bottom: 1px solid #f0f3f9; }
    .main-nav > a.active::after { display: none; }
    .nav-auth { display: flex; gap: 10px; padding-top: 16px; }
    .nav-auth .btn { flex: 1; }

    .hero-grid { grid-template-columns: 1fr; padding-top: 44px; padding-bottom: 40px; }
    .hero-visual { order: 2; }
    .hero-art { max-width: 460px; }

    .cat-carousel { --per-view: 5; }
    .car-prev { left: -10px; }
    .car-next { right: -10px; }

    .stats-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-cta { grid-column: 1 / -1; }

    .main-grid, .main-grid-lower { grid-template-columns: minmax(0, 1fr); }
    .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .pop-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .cat-carousel { --per-view: 4; }
    .q-row { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px 18px; }
    .q-stats { order: 1; max-width: 270px; }
    .q-main { order: 2; }
    .q-author { order: 3; grid-column: auto; }
    .tabs { padding: 0 18px; gap: 22px; }
    .pop-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
    .footer-news { grid-column: 1 / -1; }
    .news-form { max-width: 420px; }
}

@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .container { padding: 0 16px; }
    .logo-text strong { font-size: 21px; }
    .logo-mark { width: 38px; height: 38px; }
    .hero-visual { display: none; }
    .hero-sub { font-size: 15.5px; }
    .hero-search { height: 50px; }
    .hero-chips a { padding: 5px 12px; }
    .section-head h2 { font-size: 19px; }
    .cat-carousel { --per-view: 3; }
    .car-btn { display: none; }
    .cat-tile { padding: 14px 6px 12px; }
    .cat-tile strong { font-size: 13px; }
    .stats-card { padding: 16px; gap: 16px 12px; }
    .stat { gap: 10px; }
    .stat-ico { width: 42px; height: 42px; border-radius: 11px; }
    .stat strong { font-size: 21px; }
    .sidebar { grid-template-columns: minmax(0, 1fr); }
    .widget { padding: 18px 16px 10px; }
    .pop-cats { gap: 4px 14px; }
}

@media (max-width: 480px) {
    .cat-carousel { --per-view: 2.4; }
    .logo-text small { display: none; }
    .stat span { font-size: 12px; }
    .pop-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pop-ico { width: 36px; height: 36px; }
    .footer-grid { grid-template-columns: minmax(0, 1fr); }
    .footer-bottom-inner { flex-direction: column; align-items: flex-start; }
    .news-form { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cat-track { scroll-behavior: auto; }
    .cat-tile { transition: none; }
}
