/* ==========================================================================
   RO-US — Marketplace startup (light) — v2
   Design read: overhaul white marketplace (Gumroad / Linear-clean)
   Dials: VARIANCE 5 · MOTION 3 · DENSITY 6
   Shape lock: cards 12px · inputs/buttons 8px
   Accent lock: blue #2563EB only
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-elev: #ffffff;
  --bg-muted: #f4f4f5;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #18181b;
  --muted: #71717a;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-hover: #1d4ed8;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px rgba(24, 24, 27, .06);
  --shadow-hover: 0 1px 2px rgba(24, 24, 27, .05), 0 12px 28px rgba(24, 24, 27, .1);
  --max: 1200px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--text);
}

.bg-glow { display: none; }

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.2) blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.04em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
}
.brand-text { letter-spacing: -0.04em; }

.site-nav {
  display: flex;
  align-items: center;
  gap: .15rem 1.1rem;
  flex-wrap: nowrap;
}
.site-nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: .925rem;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav .nav-user { color: var(--text); }

.btn-publish-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, transform .12s ease;
}
.btn-publish-plus:hover { background: var(--accent-hover); color: #fff; }
.btn-publish-plus:active { transform: scale(.96); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  margin: 6px 0;
  background: var(--text);
  border-radius: 1px;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .65rem 1.1rem;
  font-family: inherit;
  font-weight: 600;
  font-size: .925rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.btn:active { transform: scale(.98); }
.btn-sm { padding: .4rem .75rem; font-size: .85rem; }
.btn-primary {
  background: var(--accent);
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff !important;
}
.btn-secondary {
  background: var(--bg);
  color: var(--text) !important;
  border-color: var(--line-strong);
}
.btn-secondary:hover {
  background: var(--bg-muted);
  color: var(--text) !important;
}
.btn-ghost {
  background: transparent;
  color: var(--muted) !important;
  border-color: var(--line);
}
.btn-ghost:hover {
  color: var(--text) !important;
  background: var(--bg-muted);
}
.btn-danger {
  background: var(--danger);
  color: #fff !important;
}
.btn-danger:hover {
  background: #b91c1c;
  color: #fff !important;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.inline-form { display: inline; }

/* ——— Main ——— */
.site-main {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
  flex: 1 0 auto;
}
.section { margin: 2.25rem 0; }
.section.narrow { max-width: 640px; }
.section-title {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  margin: 0 0 .35rem;
  letter-spacing: -0.03em;
}
.section-lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 55ch;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.empty, .muted { color: var(--muted); }

/* ——— Community banner ——— */
.community-banner {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.community-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.community-kicker {
  margin: 0 0 .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.community-lead {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.45;
  font-size: .95rem;
}
.community-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.community-soon {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}
.home-assets { margin-top: 0; }
.home-assets .section-title { margin-bottom: .85rem; }

.reveal {
  animation: reveal .45s ease both;
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ——— Categories ——— */
.cat-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.cat-chip {
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  transition: border-color .15s, background .15s;
}
.cat-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* ——— Asset cards ——— */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.asset-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.asset-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.asset-card-media {
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--bg-muted);
  overflow: hidden;
}
.asset-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.asset-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  background: var(--accent-soft);
}
.asset-placeholder.large { min-height: 280px; font-size: 3.5rem; }
.asset-card-body { padding: .9rem 1rem 1.05rem; }
.asset-card h3 {
  margin: .35rem 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.asset-card h3 a { color: var(--text); }
.asset-card h3 a:hover { color: var(--accent); }
.asset-author,
.asset-stats {
  margin: .2rem 0 0;
  font-size: .85rem;
  color: var(--muted);
}
.asset-meta { display: flex; gap: .35rem; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 500;
  font-family: var(--mono);
  background: var(--bg-muted);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge-free {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #a7f3d0;
}
.badge-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: #fde68a;
}

/* ——— Forms ——— */
.form { display: grid; gap: .9rem; }
.form label {
  display: grid;
  gap: .35rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}
.form input,
.form select,
.form textarea {
  width: 100%;
  padding: .7rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.form input::placeholder,
.form textarea::placeholder { color: #a1a1aa; }
.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: 2px solid rgba(37, 99, 235, .25);
  border-color: var(--accent);
}
.form-card,
.auth-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.form-hint { font-size: .85rem; color: var(--muted); font-weight: 400; }
.form-sep { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; }
.checkbox {
  display: flex !important;
  align-items: center;
  gap: .5rem;
  grid-template-columns: none;
  color: var(--muted);
}
.checkbox input { width: auto; }

.auth-section {
  display: grid;
  place-items: center;
  padding: 2.5rem 0;
}
.auth-card { width: min(400px, 100%); }
.auth-card h1 { margin-top: 0; font-size: 1.5rem; }
.auth-links { margin-top: 1rem; font-size: .9rem; color: var(--muted); }

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: .55rem;
  margin-bottom: 1.35rem;
}
.filters input,
.filters select {
  padding: .65rem .8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.filters input:focus,
.filters select:focus {
  outline: 2px solid rgba(37, 99, 235, .25);
  border-color: var(--accent);
}

/* ——— Detail ——— */
.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
  margin-bottom: 2rem;
}
.detail-media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-muted);
}
.detail-info h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: .5rem 0;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.1rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  font-family: var(--mono);
  font-size: .72rem;
  padding: .2rem .45rem;
  border-radius: 6px;
  background: var(--bg-muted);
  border: 1px solid var(--line);
  color: var(--muted);
}
.prose h2 { margin-top: 1.5rem; font-size: 1.15rem; }
.report-box { margin: 1.5rem 0; color: var(--muted); }
.report-panel {
  margin: 2rem 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
}
.report-panel h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.report-form { max-width: 480px; margin-top: 1rem; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.admin-tabs a {
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: .925rem;
}
.admin-tabs a:hover { color: var(--text); background: var(--bg-muted); }
.admin-tabs a.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.admin-panel h2 { margin-top: 0; font-size: 1.15rem; }

/* Modal publication */
body.modal-open { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, .45);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90dvh, 820px);
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 1.25rem 1.25rem 1.35rem;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
}
.modal-lead {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg-muted);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}
.publish-form { gap: .8rem; }

.comment-list { list-style: none; padding: 0; }
.comment-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.comment-list time {
  color: var(--muted);
  font-size: .8rem;
  margin-left: .5rem;
}

/* ——— Dashboard / admin ——— */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin: 1.25rem 0 2rem;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: grid;
  gap: .15rem;
}
.stat-n {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.03em;
  color: var(--text);
}
.stat-l { color: var(--muted); font-size: .85rem; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.data-table th,
.data-table td {
  padding: .75rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  background: var(--bg-soft);
  color: var(--muted);
  font-weight: 500;
  font-size: .8rem;
}
.data-table tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.profile-head {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 2rem;
}
.profile-head-text { min-width: 0; }
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}
.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 700;
}

.pagination {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.pagination a {
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.pagination a:hover { color: var(--text); border-color: var(--line-strong); }
.pagination a.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ——— Flash / cookies / footer ——— */
.flash {
  width: min(var(--max), calc(100% - 2rem));
  margin: .75rem auto 0;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .925rem;
}
.flash-success {
  background: var(--ok-soft);
  border: 1px solid #a7f3d0;
  color: #047857;
}
.flash-error {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 100;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}
.cookie-banner p {
  margin: 0;
  font-size: .875rem;
  color: var(--muted);
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 2.25rem clamp(1rem, 4vw, 2rem) 2.75rem;
  background: var(--bg-soft);
}
.footer-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  display: grid;
  gap: .75rem;
}
.footer-brand {
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
}
.footer-tag {
  color: var(--muted);
  max-width: 44ch;
  margin: 0;
  font-size: .875rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem 1.15rem;
  margin-top: .35rem;
}
.footer-links a {
  color: var(--muted);
  font-size: .875rem;
}
.footer-links a:hover { color: var(--text); }

/* ——— Responsive ——— */
@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: .25rem;
    padding: 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a,
  .site-nav .btn,
  .site-nav .btn-publish-plus { width: 100%; justify-content: flex-start; }
  .site-nav .btn-publish-plus { width: 36px; }
}

@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr; }
  .community-banner-actions { width: 100%; }
  .community-banner-actions .btn { flex: 1; }
}
