/* toska web — design tokens mirror ToskaDesign.swift / LateNightTheme */
:root {
    --ink: #14130f;
    --paper: #ffffff;
    --ground: #f2f2f4;
    --soft: #72757e;
    --faint: #91949c;
    --plum: #6d55c9;
    --plum-soft: #9387c0;
    --night: #0b0a10;
    --hairline: #e6e7ea;
    --card: #ffffff;
    --danger: #b3564f;
    --shadow: 0 1px 2px rgba(20, 19, 15, 0.04), 0 4px 16px rgba(20, 19, 15, 0.05);
    --shadow-lift: 0 2px 4px rgba(20, 19, 15, 0.05), 0 10px 28px rgba(20, 19, 15, 0.09);
}
[data-theme="night"] {
    --ink: #eeeff1;
    --paper: #14131a;
    --ground: #0b0a10;
    --soft: #91949c;
    --faint: #6e7078;
    --hairline: #232230;
    --card: #16151e;
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lift: 0 2px 4px rgba(0,0,0,0.45), 0 10px 28px rgba(0,0,0,0.5);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: "Newsreader", Georgia, "Times New Roman", serif;
    background: var(--ground);
    color: var(--ink);
    line-height: 1.65;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.sans { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif; }

/* layout */
.shell { max-width: 620px; margin: 0 auto; padding: 4px 16px 120px; }
#mount > * { animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

header.app { background: var(--ground); }
header.app .inner {
    max-width: 620px; margin: 0 auto; padding: 16px 16px 4px;
    display: flex; align-items: center; justify-content: space-between;
}
.wordmark {
    font-size: 24px; letter-spacing: 0.01em;
    color: var(--plum); text-decoration: none; font-weight: 500;
}
#signOutBtn {
    font-family: -apple-system, sans-serif; font-size: 13px;
    color: var(--faint); background: none; border: none; cursor: pointer;
    padding: 6px 0;
}
#signOutBtn:hover { color: var(--soft); }

/* main navigation — segmented pills on desktop, floating tab bar on mobile.
   NOTE: lives OUTSIDE header.app — backdrop-filter on an ancestor would
   hijack position:fixed and pin the mobile bar to the header. */
.mainnav {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--ground) 82%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--hairline);
    display: flex; gap: 4px;
    padding: 8px max(12px, calc(50% - 298px)) 8px;
}
.mainnav a {
    position: relative;
    display: flex; align-items: center; gap: 7px;
    font-size: 13.5px; color: var(--faint); text-decoration: none;
    padding: 8px 14px; white-space: nowrap; border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.mainnav[hidden] { display: none; }
.mainnav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.mainnav a:hover { color: var(--soft); }
.mainnav a.active {
    color: var(--ink); background: var(--card); box-shadow: var(--shadow);
}
.mainnav a.active svg { color: var(--plum); }
.mainnav a .dot {
    position: absolute; top: 7px; left: 24px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--plum);
    display: inline-block; border: 1.5px solid var(--ground);
    box-sizing: content-box;
}

@media (max-width: 640px) {
    .mainnav {
        position: fixed; top: auto; bottom: 14px; left: 50%; transform: translateX(-50%);
        z-index: 20; margin: 0; padding: 7px;
        background: color-mix(in srgb, var(--card) 86%, transparent);
        border: 1px solid var(--hairline);
        border-bottom: 1px solid var(--hairline);
        border-radius: 999px; box-shadow: var(--shadow-lift);
        width: auto; max-width: calc(100% - 24px);
    }
    .mainnav a {
        flex-direction: column; gap: 3px;
        font-size: 10px; letter-spacing: 0.02em;
        padding: 7px 13px 6px;
    }
    .mainnav a svg { width: 21px; height: 21px; }
    .mainnav a.active { background: color-mix(in srgb, var(--plum) 10%, transparent); box-shadow: none; color: var(--plum); }
    .mainnav a .dot { top: 5px; left: auto; right: 10px; }
    header.app { border-bottom: none; }
    header.app .inner { padding-bottom: 12px; }
}

/* buttons + tabs */
.btn {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px; border: none; cursor: pointer; border-radius: 12px;
    padding: 13px 22px; background: var(--plum); color: #fff;
    transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.985); }
.btn.quiet { background: transparent; color: var(--soft); border: 1px solid var(--hairline); }
.btn:disabled { opacity: 0.5; cursor: default; }
.tabs { display: flex; gap: 7px; padding: 16px 0 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab { white-space: nowrap; flex-shrink: 0; }
.tab {
    font-family: -apple-system, sans-serif; font-size: 13.5px;
    padding: 7px 15px; border-radius: 999px; border: 1px solid var(--hairline);
    background: var(--card); color: var(--soft); cursor: pointer;
    transition: all 0.15s ease;
}
.tab:hover { border-color: var(--faint); }
.tab.active { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* post rows */
.post-row {
    background: var(--card); border: none;
    border-radius: 18px; padding: 20px 22px 16px; margin: 14px 0;
    cursor: pointer; display: block; width: 100%; text-align: left; color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}
a.post-row:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.post-meta {
    font-family: -apple-system, sans-serif; font-size: 13px; color: var(--faint);
    display: flex; gap: 10px; align-items: baseline; margin-bottom: 9px;
}
.post-meta .handle { color: var(--soft); font-weight: 500; }
a.handle { text-decoration: none; }
a.handle:hover { color: var(--plum); }
.post-meta .tag {
    margin-left: auto; font-size: 12.5px;
    padding: 2px 10px; border-radius: 999px;
    background: color-mix(in srgb, currentColor 9%, transparent);
}
.post-text {
    font-size: 17.5px; line-height: 1.62;
    white-space: pre-wrap; word-break: break-word;
}
.post-stats {
    font-family: -apple-system, sans-serif; font-size: 12.5px; color: var(--faint);
    display: flex; gap: 7px; margin-top: 13px; align-items: baseline;
}
.post-stats span + span::before { content: "·"; margin-right: 7px; color: var(--hairline); }
.repost-strip {
    font-family: -apple-system, sans-serif; font-size: 12px; color: var(--faint);
    margin-bottom: 8px; letter-spacing: 0.01em;
}
.repost-strip::before { content: "↻ "; color: var(--plum-soft); }

/* hero card (most felt #1) */
.hero-card {
    background: linear-gradient(150deg, #211d33 0%, var(--night) 70%);
    color: #eeeff1; border-radius: 20px;
    padding: 30px 26px 24px; margin: 16px 0 20px;
    box-shadow: var(--shadow-lift);
}
.hero-card .eyebrow {
    font-family: -apple-system, sans-serif; font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase; color: var(--plum-soft);
    margin-bottom: 14px;
}
.hero-card .post-text { font-size: 21px; line-height: 1.55; color: #eeeff1; }
.hero-card .post-meta { color: #91949c; }
.hero-card .post-meta .handle { color: #a7aab2; }
.hero-card .post-stats { color: #91949c; }
.rank-num {
    font-family: "Newsreader", Georgia, serif; font-size: 15px; font-style: italic;
    color: var(--plum-soft); min-width: 26px; display: inline-block;
}

/* forms */
.auth-card {
    background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
    padding: 36px 30px; max-width: 400px; margin: 72px auto 0;
}
.auth-card h1 { font-size: 40px; font-weight: 500; letter-spacing: 0.01em; }
.auth-card .tagline { margin: 4px 0 26px; }
.field { margin: 15px 0; }
.field label {
    display: block; font-family: -apple-system, sans-serif;
    font-size: 12.5px; letter-spacing: 0.04em; color: var(--soft); margin-bottom: 7px;
}
.field input {
    width: 100%; padding: 13px 15px; font-size: 16px;
    font-family: -apple-system, sans-serif;
    border: 1px solid var(--hairline); border-radius: 12px;
    background: var(--ground); color: var(--ink);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus { outline: none; border-color: var(--plum-soft); background: var(--card); }
.error {
    font-family: -apple-system, sans-serif; font-size: 14px;
    color: var(--danger); margin: 10px 0;
}
.note { font-family: -apple-system, sans-serif; font-size: 13.5px; color: var(--faint); line-height: 1.55; }
.note a { color: var(--plum); }

/* misc */
h2, h3 { font-weight: 500; }
.section-title {
    font-size: 22px; font-weight: 500; padding: 22px 4px 4px;
}
.spinner {
    width: 22px; height: 22px; margin: 48px auto; display: block;
    border: 2px solid var(--hairline); border-top-color: var(--plum);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.back {
    font-family: -apple-system, sans-serif; font-size: 13.5px;
    color: var(--faint); text-decoration: none; display: inline-block; margin: 16px 0 0;
}
.back:hover { color: var(--soft); }
a.plain { color: var(--plum); text-decoration: none; }
a.plain:hover { text-decoration: underline; }
.pending-banner {
    font-family: -apple-system, sans-serif; font-size: 12.5px;
    background: color-mix(in srgb, var(--plum) 7%, var(--card));
    color: var(--soft); border: 1px solid color-mix(in srgb, var(--plum) 18%, transparent);
    border-radius: 10px; padding: 9px 13px; margin: 4px 0 10px;
}
.profile-head {
    background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
    padding: 30px 26px 24px; margin: 18px 0 6px;
}
.profile-head h2 { font-size: 28px; letter-spacing: 0.01em; }
.profile-head .joined {
    font-style: italic; color: var(--faint); font-size: 15px; margin-top: 2px;
}
.stat-line {
    font-family: -apple-system, sans-serif; font-size: 13.5px; color: var(--faint);
    display: flex; gap: 8px; margin-top: 14px; align-items: baseline; flex-wrap: wrap;
}
.stat-line b { color: var(--ink); font-weight: 600; font-size: 15px; }
.stat-line span + span::before { content: "·"; margin-right: 8px; color: var(--hairline); }

/* empty states */
.empty {
    text-align: center; color: var(--faint); padding: 56px 24px 72px;
    font-style: italic; font-size: 16.5px;
}
.empty .glyph {
    display: block; font-size: 26px; font-style: normal;
    color: var(--plum-soft); margin-bottom: 12px; opacity: 0.75;
}

/* replies + notifications read lighter than posts */
.reply-row { padding: 15px 18px 12px; border-radius: 14px; margin: 10px 0; }
.reply-row .post-text { font-size: 16px; }
.thread-child { border-left: 2px solid var(--hairline); }
.notif-row { padding: 15px 18px 13px; border-radius: 14px; margin: 10px 0; }
.notif-row .post-text { font-size: 15px; }

/* modals (gates, report sheet) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(11, 10, 16, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: fadein 0.18s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lift);
    max-width: 420px; width: 100%; padding: 28px 26px 22px;
    animation: rise 0.22s ease both;
    max-height: 85vh; overflow-y: auto;
}
.modal-card h3 { font-size: 21px; margin-bottom: 10px; }
.modal-body { font-size: 16px; line-height: 1.6; }
.modal-hint {
    font-family: -apple-system, sans-serif; font-size: 13px;
    color: var(--faint); margin-top: 10px;
}
.modal-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.modal-actions .btn { width: 100%; }
.crisis-lines { margin-top: 16px; }
.crisis-line {
    font-family: -apple-system, sans-serif; font-size: 14px; color: var(--ink);
    background: color-mix(in srgb, var(--plum) 6%, var(--card));
    border: 1px solid var(--hairline); border-radius: 12px;
    padding: 12px 14px; margin: 8px 0;
}

/* compose */
.compose-card {
    background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
    padding: 22px; margin: 18px 0;
}
.compose-card textarea {
    width: 100%; min-height: 180px; border: none; resize: vertical;
    font-family: "Newsreader", Georgia, serif; font-size: 18px; line-height: 1.6;
    background: transparent; color: var(--ink); outline: none;
}
.compose-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px; gap: 10px; flex-wrap: wrap;
}
.char-count { font-family: -apple-system, sans-serif; font-size: 12.5px; color: var(--faint); }
.char-count.over { color: var(--danger); }
.tag-picker { display: flex; gap: 7px; flex-wrap: wrap; margin: 14px 0 4px; }
.write-top {
    padding: 9px 18px; font-size: 14px; border-radius: 999px;
    box-shadow: var(--shadow);
}
.write-top[hidden] { display: none; }

/* action row on post detail */
.action-row {
    display: flex; gap: 8px; margin: 14px 0 6px; align-items: center;
}
.action-btn {
    font-family: -apple-system, sans-serif; font-size: 13.5px;
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--hairline); background: var(--card);
    color: var(--soft); cursor: pointer; transition: all 0.15s ease;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { border-color: var(--faint); }
.action-btn.on-like { color: #b3564f; border-color: color-mix(in srgb, #b3564f 35%, transparent); }
.action-btn.on-save { color: var(--plum); border-color: color-mix(in srgb, var(--plum) 35%, transparent); }
.action-btn.on-repost { color: #6f9c8a; border-color: color-mix(in srgb, #6f9c8a 40%, transparent); }
.action-btn.overflow { margin-left: auto; padding: 8px 12px; }

/* reply composer */
.reply-composer {
    display: flex; gap: 9px; margin: 16px 0; align-items: flex-end;
    background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
    padding: 12px 12px 12px 16px;
}
.reply-composer textarea {
    flex: 1; border: none; resize: none; min-height: 24px; max-height: 140px;
    font-family: "Newsreader", Georgia, serif; font-size: 16px; line-height: 1.5;
    background: transparent; color: var(--ink); outline: none;
}
.reply-send {
    width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--plum); color: #fff; font-size: 17px; flex-shrink: 0;
}
.reply-send:disabled { opacity: 0.4; cursor: default; }
.replying-strip {
    font-family: -apple-system, sans-serif; font-size: 12.5px; color: var(--faint);
    margin: 8px 2px -6px; display: flex; gap: 8px; align-items: center;
}
.replying-strip button { background: none; border: none; color: var(--plum); cursor: pointer; font-size: 12.5px; }

/* toast */
.toast {
    position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
    z-index: 60; background: var(--night); color: #eeeff1;
    font-family: -apple-system, sans-serif; font-size: 14px;
    padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow-lift);
    animation: rise 0.25s ease both;
    max-width: calc(100% - 40px); text-align: center;
}

/* menus */
.menu-sheet { min-width: 240px; padding: 12px; }
.menu-sheet button {
    display: block; width: 100%; text-align: left;
    font-family: -apple-system, sans-serif; font-size: 15px;
    background: none; border: none; color: var(--ink); cursor: pointer;
    padding: 13px 14px; border-radius: 10px;
}
.menu-sheet button:hover { background: var(--ground); }
.menu-sheet button.danger { color: var(--danger); }

@media (max-width: 480px) {
    .post-row { padding: 17px 17px 13px; border-radius: 16px; }
    .auth-card { margin-top: 40px; padding: 30px 22px; box-shadow: none; background: transparent; }
}

/* ---- phase 2 parity (2026-07-09): search, prompt, ephemerals, edit, gifs, blocked ---- */

/* the `hidden` attribute loses to `display:block` on .post-row (see guide §2) */
.post-row[hidden] { display: none; }

.feed-search {
    width: 100%; margin: 14px 0 0; padding: 11px 16px;
    font-family: -apple-system, sans-serif; font-size: 14px;
    border: 1px solid var(--hairline); border-radius: 999px;
    background: var(--card); color: var(--ink);
}
.feed-search:focus { outline: none; border-color: var(--plum-soft); }

.prompt-card {
    background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
    padding: 18px 22px 16px; margin: 18px 0 0;
    border: 1px solid color-mix(in srgb, var(--plum) 14%, transparent);
}
.prompt-card .eyebrow {
    font-family: -apple-system, sans-serif; font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase; color: var(--plum-soft);
    margin-bottom: 8px;
}
.prompt-card .btn.quiet { padding: 7px 16px; font-size: 13px; margin-left: auto; }

.post-meta .tag.ephemeral { color: var(--plum-soft); margin-left: 0; }

.compose-toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mode-note { font-size: 12.5px; color: var(--plum-soft); margin-top: 8px; }

.gif-card { width: min(480px, calc(100vw - 48px)); }
.gif-card input[type="search"] {
    width: 100%; margin: 10px 0; padding: 10px 14px;
    font-family: -apple-system, sans-serif; font-size: 14px;
    border: 1px solid var(--hairline); border-radius: 10px;
    background: var(--ground); color: var(--ink);
}
.gif-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    max-height: 46vh; overflow-y: auto;
}
.gif-grid img {
    width: 100%; height: 90px; object-fit: cover; border-radius: 8px;
    cursor: pointer; transition: transform 0.12s ease;
}
.gif-grid img:hover { transform: scale(1.04); }
.gif-attach { position: relative; margin-top: 10px; }
.gif-attach img { max-width: 220px; border-radius: 12px; display: block; }
.gif-attach .tab { margin-top: 6px; font-size: 12px; padding: 4px 12px; }
.reply-gif {
    background: none; border: 1px solid var(--hairline); border-radius: 999px;
    font-family: -apple-system, sans-serif; font-size: 11.5px; color: var(--faint);
    padding: 6px 10px; cursor: pointer; flex-shrink: 0;
}
.reply-gif:hover { color: var(--plum); border-color: var(--plum-soft); }

.edit-card { width: min(560px, calc(100vw - 48px)); }
.edit-card textarea {
    width: 100%; min-height: 130px; margin: 10px 0 4px; padding: 12px 14px;
    font-family: inherit; font-size: 16px; line-height: 1.6;
    border: 1px solid var(--hairline); border-radius: 12px;
    background: var(--ground); color: var(--ink); resize: vertical;
}
.edit-card textarea:focus { outline: none; border-color: var(--plum-soft); }
.edit-card .modal-actions { align-items: center; }
.edit-card .char-count { margin-left: auto; }

.btn.danger { background: var(--danger); }

.blocked-row { display: flex; align-items: center; justify-content: space-between; }
.blocked-row .btn.quiet { padding: 8px 18px; font-size: 13px; }
