/* Self-hosted Zalando Sans (variable, 400–700) — no third-party requests. */
@font-face {
    font-family: "Zalando Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 100%;
    font-display: swap;
    src: url("/fonts/zalando-sans-vietnamese.woff2") format("woff2");
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169,
        U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323,
        U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: "Zalando Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 100%;
    font-display: swap;
    src: url("/fonts/zalando-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
        U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
        U+A720-A7FF;
}

@font-face {
    font-family: "Zalando Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 100%;
    font-display: swap;
    src: url("/fonts/zalando-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light;

    --accent: #7f649c;

    --bg: #eeeeee;
    --text: #222222;
    --link: #0645ad;
    --link-hover: #c00000;

    --surface: #ffffff;
    --surface-border: #aaaaaa;

    --header-bg: #e6e6e6;
    --header-border: #999999;
    --footer-bg: #e8e8e8;
    --footer-border: #bbbbbb;

    --muted: #666666;
    --muted-2: #777777;
    --subtle: #555555;

    --panel-bg: #fafafa;
    --panel-border: #cccccc;
    --divider: #cccccc;
    --item-border: #aaaaaa;

    --control-bg: #e5e5e5;
    --control-border: #888888;
    --control-hover: #d8d8d8;
    --control-text: #111111;

    --input-bg: #ffffff;
    --input-border: #999999;

    --table-border: #bbbbbb;
    --table-head: #e9e9e9;

    --avatar-bg: #eeeeee;
    --avatar-border: #aaaaaa;

    --error-bg: #fff0f0;
    --error-border: #cc6666;
    --error-text: #990000;

    --rating: #996600;
    --logo-filter: none;
}

[data-theme="dark"] {
    color-scheme: dark;

    --accent: #7f649c;

    --bg: #121212;
    --text: #e8e8e8;
    --link: #7fb3ff;
    --link-hover: #ff8a8a;

    --surface: #1b1b1b;
    --surface-border: #3a3a3a;

    --header-bg: #232323;
    --header-border: #3a3a3a;
    --footer-bg: #1e1e1e;
    --footer-border: #333333;

    --muted: #a3a3a3;
    --muted-2: #9a9a9a;
    --subtle: #b5b5b5;

    --panel-bg: #202020;
    --panel-border: #383838;
    --divider: #333333;
    --item-border: #383838;

    --control-bg: #2b2b2b;
    --control-border: #555555;
    --control-hover: #383838;
    --control-text: #e8e8e8;

    --input-bg: #171717;
    --input-border: #555555;

    --table-border: #3a3a3a;
    --table-head: #262626;

    --avatar-bg: #262626;
    --avatar-border: #444444;

    --error-bg: #3a1515;
    --error-border: #a34040;
    --error-text: #ffb4b4;

    --rating: #e6bd53;
    --logo-filter: invert(1) hue-rotate(180deg);
}

* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: "Zalando Sans", Arial, Helvetica, sans-serif;
}

a {
    color: var(--link);
    text-decoration: underline;
}

a:hover {
    color: var(--link-hover);
}

.site {
    width: 940px;
    max-width: calc(100% - 12px);
    margin: 10px auto 25px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 14px 11px;
    text-align: center;
}

.header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.logo img {
    display: block;
    width: 200px;
    height: auto;
    max-width: 100%;
    margin: 0 auto;
    filter: var(--logo-filter);
}

.member-count {
    color: var(--muted);
    font-size: 12px;
    margin-top: 7px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 11px;
    font-size: 13px;
    text-align: center;
}

nav a {
    display: inline-block;
    margin: 0 6px 5px;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0 0 6px;
    border: 0;
    background: none;
    line-height: 0;
    cursor: pointer;
}

.theme-toggle:hover {
    background: none;
}

.theme-toggle img {
    display: block;
    width: 22px;
    height: 22px;
}

.bare-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    line-height: 0;
    cursor: pointer;
    vertical-align: middle;
}

.bare-button:hover {
    background: none;
}

.bare-button img {
    display: block;
    width: 22px;
    height: 22px;
}

.copyright {
    text-align: center;
}

main {
    padding: 13px;
    min-height: 520px;
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--footer-border);
    background: var(--footer-bg);
    color: var(--muted);
    padding: 10px 11px;
    font-size: 11px;
    text-align: center;
}

h1 {
    font-size: 22px;
    margin: 0 0 7px;
}

h2 {
    font-size: 17px;
    margin: 17px 0 7px;
}

h3 {
    font-size: 15px;
    margin: 0 0 4px;
}

hr {
    border: 0;
    border-top: 1px solid var(--divider);
    margin: 13px 0;
}

.intro,
.box {
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    padding: 9px;
}

.item {
    border-bottom: 1px dotted var(--item-border);
    padding: 10px 3px;
}

.item:last-child {
    border-bottom: 0;
}

.meta {
    font-size: 12px;
    color: var(--muted-2);
}

.excerpt {
    margin: 7px 0;
}

.post-body {
    line-height: 1.45;
}

/*
 * Text is rendered from Markdown, which already emits block elements.
 * Drop the outer margins so blocks do not add extra spacing around text.
 */
.markdown > :first-child {
    margin-top: 0;
}

.markdown > :last-child {
    margin-bottom: 0;
}

.markdown p {
    margin: 0 0 8px;
}

.rating {
    color: var(--rating);
    white-space: nowrap;
}

.big-rating {
    font-size: 16px;
}

/* Clickable star rating */

.star-rating-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 7px 0;
}

.star-rating-label {
    color: var(--muted);
    font-size: 13px;
}

.star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 2px;
}

.star-rating input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.star-rating label {
    color: var(--muted-2);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.1s ease;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: var(--rating);
}

/* Home: see more */

.see-more {
    margin: 16px 0 4px;
    text-align: center;
}

.two-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.project-list {
    padding-left: 20px;
}

.project-list li {
    margin: 5px 0;
}

label {
    display: block;
    font-weight: bold;
    margin: 9px 0 3px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="search"],
textarea,
select {
    width: 100%;
    max-width: 650px;
    padding: 5px;
    border: 1px solid var(--input-border);
    border-radius: 0;
    font: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 560px;
    margin: 10px 0 16px;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    max-width: none;
}

.search-form select {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

textarea {
    min-height: 180px;
    resize: vertical;
}

/*
 * Button kit (from the shared design).
 * `.yf-button` is the canonical class; plain `button` and `.button`
 * (used on links) share the same default look.
 */
button,
.button,
.yf-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 8px 14px;
    border: none;
    border-radius: 3px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover,
.button:hover,
.yf-button:hover {
    background: color-mix(in oklab, var(--accent), white 15%);
    color: #ffffff;
}

button:active,
.button:active,
.yf-button:active {
    background: color-mix(in oklab, var(--accent), black 10%);
}

button.text-button,
.button.text-button,
.yf-button.text-button {
    background: transparent;
    color: var(--accent);
}

button.text-button:hover,
.button.text-button:hover,
.yf-button.text-button:hover {
    background: color-mix(in oklab, var(--accent), transparent 85%);
    color: var(--accent);
}

button.text-button:active,
.button.text-button:active,
.yf-button.text-button:active {
    background: color-mix(in oklab, var(--accent), transparent 75%);
}

.yf-button.icon-button {
    width: 34px;
    height: 34px;
    padding: 0;
}

/* Icon + text button */
.yf-button.icon-text-button {
    gap: 8px;
}

.yf-button svg,
.yf-button img,
.button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

button:disabled,
.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.small-button {
    height: auto;
    padding: 4px 9px;
    font-size: 12px;
}

.error {
    border: 1px solid var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
    padding: 7px;
    margin-bottom: 10px;
}

/* Text-only action (used in the admin panel) */

.link-button {
    display: inline;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--link);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    background: none;
    color: var(--link-hover);
}

.link-button:active {
    background: none;
}

/* Auth pages */

.auth {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.auth input[type="text"],
.auth input[type="password"],
.auth input[type="email"] {
    display: block;
    margin: 0 auto;
}

/* Reports */

.report summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--link);
    list-style: none;
    cursor: pointer;
}

.report summary::-webkit-details-marker {
    display: none;
}

.report summary img {
    width: 16px;
    height: 16px;
}

.report summary:hover {
    color: var(--link-hover);
}

.post-report-wrap {
    display: flex;
    justify-content: flex-end;
}

.report-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 320px;
    max-width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    text-align: left;
}

.report-form textarea {
    width: 100%;
    max-width: 100%;
    min-height: 90px;
}

.report-notice {
    margin: 10px 0;
}

.report-reason {
    margin: 7px 0;
    white-space: pre-wrap;
}

.report-target,
.report-actions {
    margin: 4px 0;
}

.profile-head {
    border-bottom: 1px solid var(--divider);
    padding-bottom: 9px;
}

.avatar {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border: 1px solid var(--avatar-border);
    float: left;
    margin-right: 10px;
    background: var(--avatar-bg);
}

.clear {
    clear: both;
}

.stats {
    color: var(--subtle);
    margin: 6px 0;
}

/* Profile */

.profile-layout {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: start;
}

.profile-info {
    min-width: 0;
}

.profile-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    min-width: 180px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.profile-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-email {
    margin: 4px 0;
    font-size: 13px;
}

.profile-email a {
    color: var(--text);
}

.profile-email a:hover {
    color: var(--accent);
}

.profile-bio {
    margin: 7px 0;
}

.admin-badge {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    vertical-align: middle;
    object-fit: contain;
}

.profile-name .admin-badge {
    width: 20px;
    height: 20px;
    margin-left: 0;
}

/* Socials */

.socials {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
}

.social {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--link);
    text-decoration: none;
    white-space: nowrap;
}

.social:hover {
    color: var(--link-hover);
}

.social svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: currentColor;
}

.social-globe {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Post author */

.post-author {
    display: flex;
    align-items: center;
    min-height: 40px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    margin-right: 8px;
    float: none;
    flex-shrink: 0;
}

.post-info {
    min-width: 0;
}

/* Comments */

.comment {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-top: 1px dotted var(--item-border);
    padding: 8px 2px;
    min-height: 50px;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.comment-user {
    display: flex;
    align-items: center;
    font-weight: bold;
}

.comment .avatar {
    width: 40px;
    height: 40px;
    margin-right: 8px;
    float: none;
    flex-shrink: 0;
}

.comment-info {
    min-width: 0;
}

.comment-body {
    margin-top: 3px;
}

/* Comment votes (right rail: report on top, then up / score / down) */

.comment-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.vote-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.vote-img {
    display: block;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.vote-img:hover {
    opacity: 0.75;
}

.vote-img.voted {
    filter: saturate(1.4);
}

.score {
    min-width: 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--subtle);
}

.comment-report {
    line-height: 0;
}

/* Compact comment composer at the top of the comments section */

.comment-form form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 480px;
    margin: 10px 0 14px;
}

.comment-form textarea {
    flex: 1;
    width: auto;
    max-width: none;
    height: 44px;
    min-height: 44px;
    padding: 6px 8px;
}

.comment-form button {
    flex-shrink: 0;
}

.rating-form {
    margin: 7px 0;
}

.rating-form select {
    width: auto;
}

.inline-form {
    display: inline;
}

.inline-form button {
    margin-left: 0;
}

.follow-form {
    margin-top: 10px;
}

.pagination {
    border-top: 1px solid var(--divider);
    margin-top: 15px;
    padding-top: 10px;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border: 1px solid var(--table-border);
    padding: 6px;
    text-align: left;
}

th {
    background: var(--table-head);
}

@media (max-width: 700px) {
    .site {
        max-width: calc(100% - 6px);
        margin: 3px auto 15px;
    }

    .logo img {
        width: 150px;
    }

    nav a {
        display: inline-block;
        margin-bottom: 5px;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-side {
        min-width: 0;
        align-items: flex-start;
    }

    .profile-actions {
        align-items: flex-start;
    }
}
