:root {
    --sky-50: #f0f9ff;
    --sky-100: #e0f2fe;
    --sky-200: #bae6fd;
    --sky-300: #7dd3fc;
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;
    --sky-600: #0284c7;
    --sky-700: #0369a1;
    --sky-800: #075985;

    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --paper: #ffffff;
    --bg: #f7fafc;

    --accent: #fb923c;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 20px;

    --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
    --font-display: "Outfit", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;

    --maxw: 1160px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--sky-600);
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: var(--sky-800);
}

img {
    max-width: 100%;
    display: block;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.2;
    color: var(--ink);
    margin: 0 0 .5em;
}

p {
    margin: 0 0 1em;
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--sky-600);
    margin-bottom: 14px;
}

.section {
    padding: 84px 0;
}

.section--tint {
    background: var(--sky-50);
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: clamp(26px, 4vw, 40px);
    margin: 0;
}

.section-head p {
    color: var(--muted);
    margin: 6px 0 0;
    max-width: 560px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    background: var(--sky-500);
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform .12s ease, background .15s ease, border-color .15s ease;
}

.btn:hover {
    background: var(--sky-600);
    color: #fff;
    transform: translateY(-2px);
}

.btn--ghost {
    background: transparent;
    border-color: var(--ink);
    color: var(--ink);
}

.btn--ghost:hover {
    background: var(--ink);
    color: #fff;
}

.btn--light {
    background: #fff;
    color: var(--sky-700);
}

.btn--light:hover {
    background: var(--sky-100);
    color: var(--sky-800);
}

.btn--sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn--block {
    width: 100%;
    justify-content: center;
}

/* File inputs */
.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;
}

.file-error {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #b91c1c;
}

input[type="file"]:not(.sr-only) {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--muted);
    background: #fff;
    border: 2px dashed var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

input[type="file"]:not(.sr-only):hover {
    border-color: var(--sky-300);
    background: var(--sky-50);
}

input[type="file"]:not(.sr-only)::file-selector-button {
    margin-right: 14px;
    padding: 9px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--sky-500);
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s ease;
}

input[type="file"]:not(.sr-only)::file-selector-button:hover {
    background: var(--sky-600);
}

input[type="file"]:not(.sr-only)::-webkit-file-upload-button {
    margin-right: 14px;
    padding: 9px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--sky-500);
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* Top bar + nav */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 74px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    color: var(--ink);
}

.brand:hover {
    color: var(--ink);
}

.brand__mark {
    width: 40px;
    height: 40px;
    border-radius: 12px 12px 12px 4px;
    background: var(--sky-400);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 20px;
    position: relative;
}

.brand__mark::after {
    content: "";
    position: absolute;
    top: -7px;
    right: 6px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 9px solid var(--sky-500);
}

.brand__logo {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links > li {
    position: relative;
}

.nav-links a {
    display: block;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 15px;
    position: relative;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 4px;
    height: 2px;
    background: var(--sky-400);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .2s ease;
}

.nav-links a:hover {
    color: var(--sky-700);
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-sub {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all .18s ease;
}

.nav-links > li:hover .nav-sub {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-sub a::after {
    display: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
}

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

.site-footer {
    background: var(--ink);
    color: #cbd5e1;
    padding: 56px 0 28px;
    margin-top: 0;
}

.site-footer a {
    color: var(--sky-300);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
}

.footer-grid h4 {
    color: #fff;
    font-size: 15px;
    letter-spacing: .04em;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.site-footer .icp-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    transition: color .15s ease;
}

.site-footer .icp-link:hover {
    color: var(--sky-300);
}

.icp-link__icon {
    flex-shrink: 0;
    opacity: .9;
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--sky-50);
    border-bottom: 1px solid var(--line);
}

.hero__grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
    padding: 90px 0 96px;
}

.hero h1 {
    font-size: clamp(34px, 6vw, 62px);
    letter-spacing: -.02em;
}

.hero p {
    font-size: 18px;
    color: var(--ink-soft);
    max-width: 520px;
}

.hero__actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.hero__stats {
    display: flex;
    gap: 32px;
    margin-top: 44px;
    flex-wrap: wrap;
}

.hero__stat strong {
    display: block;
    font-family: var(--font-display);
    font-size: 30px;
    color: var(--sky-600);
}

.hero__stat span {
    color: var(--muted);
    font-size: 14px;
}

.hero__visual {
    position: relative;
}

.hero__visual img {
    border-radius: var(--radius-lg);
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 3px solid var(--sky-400);
}

.hero__blob {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--sky-200);
    top: -40px;
    right: -30px;
    z-index: -1;
}

.hero__tag {
    position: absolute;
    bottom: -22px;
    left: -22px;
    background: #fff;
    border: 2px solid var(--sky-400);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
}

/* Cards grid */
.grid {
    display: grid;
    gap: 24px;
}

.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .16s ease, border-color .16s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--sky-300);
}

.card__media {
    aspect-ratio: 16 / 10;
    background: var(--sky-100);
    overflow: hidden;
}

.card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card__body {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card__body h3 {
    font-size: 19px;
    margin-bottom: 8px;
}

.card__body p {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 16px;
}

.card__link {
    margin-top: auto;
    font-weight: 700;
    color: var(--sky-600);
    font-size: 14px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--sky-100);
    color: var(--sky-700);
    font-size: 12px;
    font-weight: 700;
}

/* Partner / logo wall */
.logo-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

.logo-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .16s ease, border-color .16s ease;
}

.logo-card:hover {
    transform: translateY(-3px);
    border-color: var(--sky-300);
}

.logo-card__mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--sky-100);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    font-weight: 800;
    color: var(--sky-600);
    font-family: var(--font-display);
}

.logo-card__mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Member roster */
.member-card {
    text-align: center;
}

.member-card__avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--sky-100);
    color: var(--sky-600);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-weight: 800;
    font-size: 34px;
    font-family: var(--font-display);
    box-shadow: 0 0 0 6px var(--sky-50);
}

.member-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-card__links {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    word-break: break-all;
}

.logo-card h4 {
    margin: 0;
    font-size: 15px;
}

.logo-card span {
    color: var(--muted);
    font-size: 13px;
}

/* Friendly links */
.link-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-soft);
    transition: all .15s ease;
}

.link-chip:hover {
    border-color: var(--sky-400);
    color: var(--sky-700);
    transform: translateY(-2px);
}

.link-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

/* Page hero */
.page-head {
    background: var(--sky-500);
    color: #fff;
    padding: 64px 0;
}

.page-head h1 {
    color: #fff;
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
}

.page-head p {
    color: var(--sky-100);
    margin: 10px 0 0;
    max-width: 640px;
}

.breadcrumb {
    font-size: 14px;
    color: var(--sky-100);
    margin-bottom: 12px;
}

.breadcrumb a {
    color: #fff;
}

/* Prose (custom pages / product detail) */
.prose {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    font-size: 16px;
    color: var(--ink-soft);
}

.prose h1, .prose h2, .prose h3 {
    color: var(--ink);
    margin-top: 1.4em;
}

.prose h2 {
    font-size: 24px;
    border-left: 5px solid var(--sky-400);
    padding-left: 14px;
}

.prose img {
    border-radius: var(--radius);
    margin: 20px 0;
}

.prose ul, .prose ol {
    padding-left: 22px;
}

.prose blockquote {
    margin: 20px 0;
    padding: 14px 20px;
    background: var(--sky-50);
    border-left: 4px solid var(--sky-400);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--ink-soft);
}

.prose code {
    background: var(--sky-50);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .9em;
}

/* Detail layout */
.detail-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 36px;
    align-items: start;
}

.detail-cover {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    margin-bottom: 28px;
}

.side-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.gallery img {
    border-radius: var(--radius-sm);
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--line);
}

/* Empty state */
.empty {
    text-align: center;
    padding: 70px 24px;
    color: var(--muted);
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    background: #fff;
}

/* Auth card */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background: var(--sky-50);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 40px;
}

.auth-card h1 {
    font-size: 26px;
    margin-bottom: 6px;
}

.auth-card .sub {
    color: var(--muted);
    margin-bottom: 28px;
    font-size: 14px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 7px;
    color: var(--ink-soft);
}

.input, .textarea, .select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s ease;
}

.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--sky-400);
}

.textarea {
    resize: vertical;
    min-height: 120px;
}

.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 18px;
}

.alert--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert--info {
    background: var(--sky-50);
    color: var(--sky-700);
    border: 1px solid var(--sky-200);
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.center {
    text-align: center;
}

/* User chip (header) */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-soft);
    transition: border-color .15s ease, color .15s ease;
}

.user-chip:hover {
    border-color: var(--sky-400);
    color: var(--sky-700);
}

.user-chip__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sky-400);
    color: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-weight: 800;
    font-size: 14px;
    font-family: var(--font-display);
}

.user-chip__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Panels & forms (shared with profile) */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel__head {
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
}

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

.panel__body {
    padding: 28px;
}

.form-grid {
    display: grid;
    gap: 22px;
}

.form-grid--2 {
    grid-template-columns: 1fr 1fr;
}

.field .hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--sky-100);
    color: var(--sky-700);
}

.badge--admin {
    background: #fef3c7;
    color: #92400e;
}

/* PJAX progress bar */
[hidden] {
    display: none !important;
}

.pjax-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    background: transparent;
}

.pjax-progress__bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--sky-500);
}

/* Checkbox */
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--sky-500);
}

.remember-row {
    margin-bottom: 18px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 6px;
    padding: 5px;
    background: var(--sky-50);
    border-radius: var(--radius-sm);
    margin-bottom: 26px;
}

.tab {
    flex: 1;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.tab:hover {
    color: var(--sky-700);
}

.tab.is-active {
    background: #fff;
    color: var(--sky-700);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

/* Verification code */
.code-row {
    display: flex;
    gap: 10px;
}

.code-row .input {
    flex: 1;
    min-width: 0;
}

.code-send {
    flex-shrink: 0;
    white-space: nowrap;
}

.code-status {
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
    color: var(--muted);
}

.code-status.is-ok {
    color: #15803d;
}

.code-status.is-error {
    color: #b91c1c;
}

.email-code-wrap {
    margin-top: 22px;
    padding: 18px 20px;
    background: var(--sky-50);
    border: 1px solid var(--sky-200);
    border-radius: var(--radius);
}

.email-code-wrap .field {
    margin-bottom: 0;
}

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
}

.profile-side {
    overflow: hidden;
    margin-bottom: 0;
}

.profile-side__cover {
    height: 96px;
    background: var(--sky-400);
    position: relative;
}

.profile-side__cover::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -40px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--sky-300);
    opacity: .55;
}

.profile-side__body {
    padding: 0 28px 30px;
    margin-top: -52px;
    position: relative;
    text-align: center;
}

.profile-side__name {
    margin: 16px 0 8px;
    font-size: 19px;
}

.profile-side__role {
    margin-bottom: 8px;
}

.profile-side__meta {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.profile-side__action {
    margin-top: 14px;
}

.profile-main .panel:last-child {
    margin-bottom: 0;
}

/* Avatar uploader */
.avatar-uploader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.avatar-preview {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px var(--sky-200);
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
    color: var(--sky-400);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: var(--sky-100);
}

.avatar-spinner {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .7);
    border-radius: 50%;
}

.avatar-spinner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border: 3px solid var(--sky-200);
    border-top-color: var(--sky-500);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.avatar-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--sky-500);
    color: #fff;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background .15s ease;
}

.avatar-edit:hover {
    background: var(--sky-600);
    color: #fff;
    text-decoration: none;
}

.avatar-progress {
    width: 100%;
    max-width: 180px;
    height: 6px;
    border-radius: 999px;
    background: var(--sky-100);
    overflow: hidden;
}

.avatar-progress__bar {
    display: block;
    height: 100%;
    background: var(--sky-500);
    border-radius: 999px;
    transition: width .2s ease;
}

.avatar-status {
    font-size: 12px;
    min-height: 16px;
    color: var(--muted);
}

.avatar-status.is-ok {
    color: #15803d;
}

.avatar-status.is-error {
    color: #b91c1c;
}

/* Reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    animation: revealUp .6s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes revealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 980px) {
    .hero__grid {
        grid-template-columns: 1fr;
        gap: 36px;
        padding: 60px 0;
    }

    .grid--3, .grid--4, .grid--2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

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

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .section {
        padding: 60px 0;
    }

    .grid--3, .grid--4, .grid--2 {
        grid-template-columns: 1fr;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 74px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        border-bottom: 1px solid var(--line);
        padding: 12px;
        display: none;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-sub {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        padding-left: 16px;
        box-shadow: none;
    }

    .nav-actions .btn {
        display: none;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .prose {
        padding: 24px;
    }

    .hero__tag {
        display: none;
    }
}

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink-soft);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.theme-toggle:hover {
    border-color: var(--sky-400);
    color: var(--sky-600);
}

.theme-toggle svg {
    display: block;
}

.theme-toggle__moon {
    display: none;
}

html[data-theme="dark"] .theme-toggle__sun {
    display: none;
}

html[data-theme="dark"] .theme-toggle__moon {
    display: block;
}

/* ===== Dark theme ===== */
html[data-theme="dark"] {
    --ink: #e6edf6;
    --ink-soft: #c3cedd;
    --muted: #93a4ba;
    --line: #26364d;
    --paper: #101a2b;
    --bg: #0a1322;
    --sky-50: #0f2135;
    --sky-100: #16324d;
    --sky-200: #1e4568;
}

html[data-theme="dark"] body {
    background: var(--bg);
    color: var(--ink);
}

:where(html[data-theme="dark"]) a {
    color: var(--sky-400);
}

:where(html[data-theme="dark"]) a:hover {
    color: var(--sky-300);
}

html[data-theme="dark"] .site-header {
    background: rgba(10, 19, 34, .85);
}

html[data-theme="dark"] .nav-links a:hover {
    color: var(--sky-300);
}

html[data-theme="dark"] .nav-sub {
    background: var(--paper);
}

html[data-theme="dark"] .btn--ghost {
    border-color: var(--line);
    color: var(--ink);
}

html[data-theme="dark"] .btn--ghost:hover {
    background: var(--ink);
    color: var(--bg);
}

html[data-theme="dark"] .btn--light {
    background: var(--paper);
    color: var(--sky-400);
}

html[data-theme="dark"] .btn--light:hover {
    background: var(--sky-100);
    color: var(--sky-300);
}

html[data-theme="dark"] input[type="file"]:not(.sr-only) {
    background: var(--paper);
}

html[data-theme="dark"] .input,
html[data-theme="dark"] .textarea,
html[data-theme="dark"] .select {
    background: var(--paper);
    color: var(--ink);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .logo-card,
html[data-theme="dark"] .prose,
html[data-theme="dark"] .side-card,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .link-chip,
html[data-theme="dark"] .tab.is-active {
    background: var(--paper);
}

html[data-theme="dark"] .hero {
    background: var(--sky-50);
}

html[data-theme="dark"] .hero__tag {
    background: var(--paper);
}

html[data-theme="dark"] .auth-wrap {
    background: var(--bg);
}

html[data-theme="dark"] .avatar-preview {
    background: var(--paper);
    border-color: var(--paper);
}

html[data-theme="dark"] .avatar-spinner {
    background: rgba(16, 26, 43, .7);
}

html[data-theme="dark"] .site-footer {
    background: #0b1524;
    color: #94a3b8;
}

html[data-theme="dark"] .footer-grid h4 {
    color: #e2e8f0;
}

html[data-theme="dark"] .page-head p,
html[data-theme="dark"] .breadcrumb {
    color: #cbd5e1;
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .card__link,
html[data-theme="dark"] .hero__stat strong,
html[data-theme="dark"] .tab:hover,
html[data-theme="dark"] .tab.is-active,
html[data-theme="dark"] .link-chip:hover,
html[data-theme="dark"] .user-chip:hover,
html[data-theme="dark"] .tag,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .logo-card__mark,
html[data-theme="dark"] .member-card__avatar {
    color: var(--sky-300);
}

html[data-theme="dark"] .alert--error {
    background: rgba(239, 68, 68, .14);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, .35);
}

html[data-theme="dark"] .alert--success {
    background: rgba(34, 197, 94, .14);
    color: #86efac;
    border-color: rgba(34, 197, 94, .35);
}

html[data-theme="dark"] .badge--admin {
    background: rgba(245, 158, 11, .18);
    color: #fcd34d;
}

html[data-theme="dark"] .file-error,
html[data-theme="dark"] .code-status.is-error,
html[data-theme="dark"] .avatar-status.is-error {
    color: #fca5a5;
}

html[data-theme="dark"] .code-status.is-ok,
html[data-theme="dark"] .avatar-status.is-ok {
    color: #86efac;
}

@media (max-width: 680px) {
    html[data-theme="dark"] .nav-links {
        background: var(--paper);
    }
}
