/* claude: redesign — minimal muted dark system for portfolion (top navbar + card feed).
   Previous neon/sidebar stylesheet preserved as main.css.bak.
   Class/tag names are kept identical to what the templates use. */

/* ========== Design tokens ========== */
:root {
    --bg: #0a0a0c;
    --bg-elev: #121214;
    --surface: rgba(255, 255, 255, 0.025);
    --surface-2: #141417;
    --surface-hover: rgba(255, 255, 255, 0.055);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text: #ededf0;
    --text-muted: #8b8b93;
    --text-dim: #5f5f68;

    --accent: #7b7bfb;
    --accent-2: #9a86ff;
    --accent-soft: rgba(123, 123, 251, 0.16);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;
    --like: #ff4d6d;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.8);

    --navbar-h: 64px;
    /* claude: wider feed so posts read larger (was 600px) */
    --content-max: 700px;
}

/* ========== Base ========== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.jp-Notebook { background: var(--bg); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover { color: var(--accent-2); }

img { max-width: 100%; height: auto; }

::selection { background: var(--accent-soft); color: var(--text); }

/* Custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ========== Top navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-h);
    /* claude: 3-column grid so the search is always centred in the viewport,
       with brand/nav pinned left and user controls pinned right (was flex, which
       let the search drift right on wide screens). */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: rgba(10, 10, 12, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

/* claude: solid-background fallback for the pinned navbar.
   In-app browsers (e.g. Telegram on iOS) often don't support backdrop-filter,
   so the translucent bar (0.82 alpha) let feed posts bleed through it while
   scrolling. Without blur, paint the bar fully opaque so the pinned menu
   always renders cleanly. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .navbar { background: #0b0b0e; }
    :root[data-theme="light"] .navbar { background: #ffffff; }
}

.nav-left {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 28px;
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}
.brand-name {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text);
}
.brand:hover .brand-name { color: var(--text); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { color: var(--text); background: var(--surface-hover); }

.message-link { position: relative; }
.message-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--like);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Centered search — redesigned as a pill */
.nav-search {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    max-width: 480px;
    padding: 0 18px;
    height: 42px;
    /* claude: search blends into the navbar colour (transparent fill, was --surface) */
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav-search:hover { border-color: var(--border-strong); }
.nav-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav-search i {
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}
.nav-search:focus-within i { color: var(--accent); }
.nav-search input {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.92rem;
}
.nav-search input:focus { outline: none; box-shadow: none; background: transparent; }
.nav-search input::placeholder { color: var(--text-dim); }

.nav-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Round theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
/* claude: center the glyph purely via the button's flexbox — no width/text-align
   box that shifted the crescent off-centre. */
.theme-toggle i {
    font-size: 15px;
    line-height: 1;
    margin: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }

/* claude: hamburger + mobile dropdown drawer.
   Both are hidden on desktop (display:none removes them from the navbar grid, so
   the desktop layout is untouched); the mobile media query below reveals them. */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.nav-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.nav-drawer { display: none; }

/* User chip in navbar */
.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
}
.nav-user:hover { color: var(--text); }
.nav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.nav-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5b8def, #7b7bfb);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}
.nav-username { font-size: 0.92rem; font-weight: 500; color: var(--text); }
.nav-username:hover { color: var(--accent-2); }

/* claude: navbar avatar is just the round icon — clicking it changes the avatar.
   No button chrome (transparent, no border/padding), only a subtle hover cue. */
.nav-avatar-form { display: inline-flex; margin: 0; }
.nav-avatar-btn {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    line-height: 0;
    border-radius: 50%;
    cursor: pointer;
}
.nav-avatar-btn .nav-avatar { transition: filter 0.18s ease, opacity 0.18s ease; }
.nav-avatar-btn:hover .nav-avatar { filter: brightness(0.8); opacity: 0.9; }

.nav-logout {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.18s ease;
}
.nav-logout:hover { color: var(--text); }

.nav-cta {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}
.nav-cta:hover { background: var(--accent-2); color: #fff; }

/* ========== Main content ========== */
main {
    padding: calc(var(--navbar-h) + 40px) 24px 80px;
    min-height: 100vh;
}

/* ========== Feed / card list ========== */
.feed,
.features,
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    text-align: left;
    color: var(--text);
}
/* claude: wider feed for larger posts (per request: 1500px) — same for the
   "Моё портфолио" page and the single-post detail page. */
.feed,
.features.portfolio-page,
.features.post-detail { max-width: 1500px; }

.feed-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 18px;
}

/* Sort pills */
.sorting-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
}
.sort-option {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.18s ease;
}
.sort-option:hover { color: var(--text); background: var(--surface-hover); }
.sort-option.active {
    background: #ffffff;
    color: #0a0a0c;
    font-weight: 600;
}

/* Post card */
.post-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 22px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease;
}
.post-card:hover { border-color: var(--border-strong); }

.post-card-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 18px;
}
.post-author { color: var(--accent); font-weight: 600; }
.post-author:hover { color: var(--accent-2); }
.post-title { color: var(--text); font-weight: 500; }

/* claude: letterbox covers so any aspect ratio looks clean in the wide card —
   image centred over a blurred backdrop derived from the cover itself (--cover is
   set inline per post), so it looks good in both light and dark themes. */
.post-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--surface-2);
}
.post-media::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--cover, none);
    background-size: cover;
    background-position: center;
    filter: blur(50px) saturate(1.25);
    transform: scale(1.2);
    opacity: 0.5;
}
.post-media img,
.post-media video {
    position: relative;
    z-index: 1;
    display: block;
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
}

.post-card-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
}

/* Like button */
.like-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.18s ease;
}
.like-button:hover { border-color: var(--like); color: var(--like); }
.like-button.red,
.like-button.red:hover {
    color: var(--like);
    border-color: var(--like);
    background: rgba(255, 77, 109, 0.1);
}
.red { color: var(--like); }

.feed-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
}

/* Found users (search) */
.found-users { margin-bottom: 24px; }
.found-users h3 { font-size: 1rem; margin-bottom: 12px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: border-color 0.18s ease;
}
.user-chip:hover { border-color: var(--border-strong); color: var(--text); }
.user-chip-name { color: var(--accent); font-weight: 600; }
.user-chip-full { color: var(--text-muted); font-size: 0.9rem; }

/* ========== Typography ========== */
h1, h2, h3, h4 { color: var(--text); font-weight: 700; line-height: 1.25; }

.features > h1:first-of-type,
main .features h1 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    color: var(--text);
}

h2 { font-size: 1.3em; margin: 18px 0 10px; }
h3 {
    color: var(--text);
    font-size: 1.1em;
    font-weight: 600;
    width: auto;
    margin: 0 0 10px;
    padding: 0;
}

/* Custom tags used as styling hooks in templates */
p1 {
    display: block;
    color: var(--text);
    font-size: 1.02rem;
    width: auto;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
    margin: 10px 0;
}
p2 { display: block; margin-top: 12px; font-size: 0.9em; color: var(--text-muted); }
ft {
    display: block;
    color: var(--text-muted);
    margin: 4px 0;
    overflow-wrap: break-word;
}
caption { color: var(--accent); font-size: 1.3em; font-weight: 700; padding: 10px; }

main .features p,
main .features ft { display: block; width: auto; text-align: left; }

/* ========== Cards / alerts (used across templates) ========== */
.alert-warning,
.alert-light,
.alert {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 20px;
    margin: 18px 0;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease;
}
.alert-warning:hover { border-color: var(--border-strong); }
.alert-warning img,
.alert img {
    width: 100%;
    border-radius: 12px;
    margin-top: 8px;
    display: block;
}
.alert-warning h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 1.05em;
    margin-bottom: 4px;
}
.alert-warning h3 a { color: var(--accent); font-weight: 600; }
.alert-warning h3 .post-title { color: var(--text); }
.alert-light a { color: var(--accent); font-weight: 600; }

.card-body { margin: 0; padding: 18px; text-align: left; }

/* ========== Buttons ========== */
button,
.btn,
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    width: auto;
}
button:hover,
.btn:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

/* Primary / action */
button[type="submit"],
.btn-primary {
    background: var(--accent);
    border: none;
    color: #fff;
}
button[type="submit"]:hover,
.btn-primary:hover {
    background: var(--accent-2);
    color: #fff;
}
.btn-success { background: #16a34a; border: none; color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-info { background: #2563eb; border: none; color: #fff; }
.btn-info:hover { background: #1d4ed8; color: #fff; }
.btn-warning { background: #d97706; border: none; color: #fff; }
.btn-warning:hover { color: #fff; background: #b45309; }
.btn-danger { background: #dc2626; border: none; color: #fff; }
.btn-danger:hover { color: #fff; background: #b91c1c; }
.btn-secondary { background: var(--surface); color: var(--text); }

.button-container { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; }
.button-container .btn { margin: 0; }

/* ========== Forms ========== */
input, textarea, select {
    width: 100%;
    max-width: 420px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-hover);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 120px; resize: vertical; }

form { width: auto; }

.form-input {
    width: 100%;
    max-width: 420px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
}
.form-label {
    display: block;
    width: auto;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: left;
}
.form-error { color: #fca5a5; text-align: left; font-size: 0.9em; }
.form-error h1 { color: #fca5a5; font-size: 1em; }
.custom-input-style { max-width: 100%; }
.custom-input-style::placeholder { color: var(--text-dim); }

/* ========== Profile / avatar ========== */
.avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
    max-height: 200px;
    aspect-ratio: 1;
    margin: 20px auto;
    overflow: hidden;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
}
.avatar > img:not(.overlay-image) { width: 100%; height: 100%; object-fit: cover; }
.avatar::after { content: none; }
.avatar .overlay-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    border: none;
    background: none;
    border-radius: 0;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.35));
    pointer-events: none;
}
.avatar-upload-container { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#avatar-label {
    display: inline-block;
    padding: 10px 18px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
#avatar-submit { display: none; }
.user-container { display: flex; flex-direction: column; align-items: center; text-align: center; }
.username { color: var(--text); font-weight: 700; }

/* ========== Messages ========== */
.messages-title {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 24px;
    text-align: center;
}
.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card .bg-primary { background: var(--accent) !important; border-radius: 14px !important; }
.card .bg-light { background: var(--surface-hover) !important; color: var(--text) !important; border-color: var(--border) !important; border-radius: 14px !important; }
.card .text-muted { color: var(--text-dim) !important; }

/* ========== Notebook / code ========== */
.jp-Notebook { text-align: left; background: var(--bg-elev); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.jp-Notebook pre, .jp-Notebook code { display: block; text-align: left; }
.post-video { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--radius); margin: 12px 0; }

/* ========== Tables ========== */
table {
    width: 100%;
    max-width: 640px;
    margin: 20px auto;
    border-collapse: collapse;
    background: var(--surface-2);
    color: var(--text);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
th { background: var(--surface-hover); font-weight: 600; }

/* ========== Tinkoff pay widget ========== */
.tinkoffPayWidget { width: 100%; max-width: 40rem; margin: 0 auto; }
.tinkoffPayForm { padding: 1rem 0.5rem; background: var(--bg-elev); border-radius: var(--radius); display: flex; flex-direction: column; }
.tinkoffPayRow { width: 100%; box-sizing: border-box; transition: 0.3s; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 5px 0; outline: none; background: var(--surface); color: var(--text); font-size: 15px; }
.tinkoffPayRow:focus { background: var(--surface-hover); border-color: var(--accent); }
.payBtn, .payform-tinkoff-btn { width: 100%; border-radius: var(--radius-sm); transition: 0.3s; border: 0; text-transform: uppercase; background: #ffdd2d; color: #1a1204; padding: 15px; cursor: pointer; font-weight: 700; }
.payBtn:hover, .payform-tinkoff-btn:hover { background: #fcc521; }

/* ========== Auth card (login / register) ========== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    max-width: 100%;
}
.auth-page form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 36px 32px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: left;
}
/* the first <p1> in these forms is the title */
.auth-page form p1:first-of-type {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 22px;
    color: var(--text);
}
.auth-page .form-input,
.auth-page input:not([type="checkbox"]):not([type="radio"]) { width: 100%; max-width: 100%; }
.auth-page .form-label { margin-top: 14px; }
.auth-page button[type="submit"] { width: 100%; margin-top: 20px; }
.auth-page p2 { text-align: center; }
.auth-page .form-error { margin-top: 8px; }
main .features h1.form-error,
.auth-page h1.form-error {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    color: #fca5a5;
    background: none;
}

/* ========== Light theme ========== */
:root[data-theme="light"] {
    --bg: #f6f7fb;
    --bg-elev: #ffffff;
    --surface: rgba(15, 23, 42, 0.03);
    --surface-2: #ffffff;
    --surface-hover: rgba(15, 23, 42, 0.06);
    --border: rgba(15, 23, 42, 0.10);
    --border-strong: rgba(15, 23, 42, 0.18);

    --text: #1b2130;
    --text-muted: #55607a;
    --text-dim: #94a0b8;

    --accent: #5b5bf0;
    --accent-2: #7c3aed;
    --accent-soft: rgba(91, 91, 240, 0.14);

    --shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.3);
}
:root[data-theme="light"] .navbar { background: rgba(255, 255, 255, 0.85); }
:root[data-theme="light"] .brand-name { color: var(--text); }
:root[data-theme="light"] .sort-option.active { background: #1b2130; color: #ffffff; }
:root[data-theme="light"] .theme-toggle { background: var(--surface); }
:root[data-theme="light"] th { background: rgba(15, 23, 42, 0.04); }
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .form-input { background: #ffffff; }
:root[data-theme="light"] .nav-cta { color: #fff; }

/* ========== Responsive ========== */
/* claude: mobile navbar — single row [brand · search · theme · hamburger]; the nav
   links + user actions collapse into a dropdown drawer behind the hamburger. */
@media (max-width: 860px) {
    .navbar {
        display: flex;
        align-items: center;
        height: var(--navbar-h);
        gap: 10px;
        padding: 0 14px;
        /* claude: keep the bar pinned to the top on mobile. Drop backdrop-filter here —
           position:fixed + backdrop-filter is buggy in iOS in-app browsers (Telegram etc.)
           and can un-pin the bar on scroll; a solid opaque background pins it reliably. */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    /* claude: solid opaque bar in light theme too (base light override is translucent) */
    :root[data-theme="light"] .navbar { background: var(--bg); }
    .nav-left { flex: 0 0 auto; min-width: 0; }
    /* nav links live in the drawer on mobile (was inline on the left) */
    .nav-left .nav-links { display: none; }

    /* claude: basis 0 so the search only takes leftover space — keeps the theme
       toggle + hamburger on screen (its inherited width:100% otherwise fills the row) */
    .nav-search { flex: 1 1 0; width: auto; min-width: 0; max-width: none; margin: 0; }

    .nav-right { flex: 0 0 auto; gap: 8px; }
    /* keep only the theme toggle + hamburger in the bar; everything else → drawer */
    .nav-right .nav-avatar-form,
    .nav-right .nav-username,
    .nav-right .nav-logout,
    .nav-right > .nav-link,
    .nav-right .nav-cta { display: none; }
    .nav-toggle { display: inline-flex; }

    /* dropdown drawer, anchored under the hamburger (top-right) */
    .nav-drawer {
        position: absolute;
        top: calc(100% - 6px);
        right: 12px;
        min-width: 190px;
        max-width: calc(100vw - 24px);
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px;
        background: var(--bg-elev);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        z-index: 200;
    }
    .navbar.nav-open .nav-drawer { display: flex; }
    .nav-drawer .nav-link,
    .nav-drawer .nav-logout {
        padding: 10px 12px;
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        font-size: 0.95rem;
    }
    .nav-drawer .nav-link:hover,
    .nav-drawer .nav-logout:hover { color: var(--text); background: var(--surface-hover); }
    .nav-drawer .nav-cta { text-align: center; margin-top: 4px; }

    /* drawer header: avatar (tap = change photo) + name (tap = profile) */
    .nav-drawer-user {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 6px 8px;
        margin-bottom: 2px;
        border-bottom: 1px solid var(--border);
    }
    .nav-drawer-avatar {
        display: inline-flex;
        flex-shrink: 0;
        padding: 0;
        border: 0;
        background: none;
        line-height: 0;
        border-radius: 50%;
        cursor: pointer;
    }
    .nav-drawer-avatar .nav-avatar { width: 36px; height: 36px; transition: filter 0.18s ease; }
    .nav-drawer-avatar:hover .nav-avatar { filter: brightness(0.8); }
    .nav-drawer-name {
        flex: 1;
        min-width: 0;
        padding: 6px 6px;
        color: var(--text);
        font-size: 0.98rem;
        font-weight: 600;
        border-radius: var(--radius-sm);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-drawer-name:hover { color: var(--accent-2); background: var(--surface-hover); }

    main { padding-top: calc(var(--navbar-h) + 24px); }
}

@media (max-width: 560px) {
    .brand-name { display: none; }
    main { padding: calc(var(--navbar-h) + 20px) 14px 60px; }
    .feed, .features, .container { max-width: 100%; }
}
