:root{
  --bg:#ffffff;
  --panel:#f6f7f8;
  --text:#0f1216;
  --muted:#5b6573;
  --border:#e6e8ee;
  --link:#0b57d0;

  --radius:14px;
  --max:980px;

  --shadow: 0 1px 2px rgba(0,0,0,.05);
  --shadow2: 0 10px 30px rgba(0,0,0,.08);
  --ring: 0 0 0 3px rgba(11,87,208,.18);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:#0b0c0f;
    --panel:#12151b;
    --text:#f2f4f8;
    --muted:#a6b0be;
    --border:#252b38;
    --link:#8ab4f8;

    --shadow: 0 1px 2px rgba(0,0,0,.35);
    --shadow2: 0 12px 34px rgba(0,0,0,.45);
    --ring: 0 0 0 3px rgba(138,180,248,.18);
  }
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection{ background: rgba(11,87,208,.18); }

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

:focus-visible{
  outline:none;
  box-shadow: var(--ring);
  border-radius: 10px;
}

img{ max-width:100%; height:auto; border-radius: var(--radius); }

/* Layout */
.wrap{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

.content{ padding: 18px 0 40px; }

/* Skip link */
.skip-link{
  position:absolute;
  left:-999px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}
.skip-link:focus{
  left:16px;
  top:16px;
  width:auto;
  height:auto;
  padding:8px 12px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  z-index:9999;
}

/* Header */
.site-header{
  border-bottom:1px solid var(--border);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
}
@media (prefers-color-scheme: dark){
  .site-header{ background: rgba(11,12,15,.72); }
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:56px;
}

.site-title{
  font-weight:650;
  letter-spacing:.2px;
  color:var(--text);
}

.site-nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.site-nav a{
  color:var(--muted);
  padding:8px 10px;
  border-radius: 12px;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}

.site-nav a:hover{
  color:var(--text);
  background:var(--panel);
  text-decoration:none;
}

.site-nav a[aria-current="page"]{
  color:var(--text);
  background:var(--panel);
  border:1px solid var(--border);
}

/* Typography */
h1{
  font-size: clamp(24px, 3vw, 34px);
  margin: 10px 0 14px;
  letter-spacing: -.2px;
}
h2{
  font-size: 18px;
  margin: 0 0 6px;
}
h3{
  font-size: 16px;
  margin: 0 0 6px;
}
p{ margin: 0 0 12px; color: var(--text); }
.muted{ color: var(--muted); }

/* Cards */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.post-list{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:12px;
  margin: 14px 0 0;
  padding:0;
  list-style:none;
}

/* =========================
   Post Card (NEW)
   Use class="post-card"
========================= */
.post-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;

  display:flex;
  flex-direction:column;
  gap:10px;

  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.post-card:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow2);
  border-color: rgba(11,87,208,.25);
}

.post-card a{
  color: inherit;
  text-decoration: none;
}
.post-card a:hover{ text-decoration: underline; }

.post-card :where(h2,h3){
  margin:0;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: .1px;
}

.post-card :where(p){
  margin:0;
  font-size:14px;
  color: var(--muted);
}

.post-card .meta{
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.post-card :where(img){
  border-radius: 12px;
}

/* Article page */
.article{ max-width: 760px; }

.article .meta{
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.article :where(ul,ol){
  padding-left: 18px;
  margin: 0 0 12px;
}

.article :where(li){ margin: 6px 0; }

.article :where(blockquote){
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid rgba(11,87,208,.35);
  background: rgba(0,0,0,.02);
  border-radius: 12px;
}
@media (prefers-color-scheme: dark){
  .article :where(blockquote){ background: rgba(255,255,255,.03); }
}

/* Forms */
input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
}

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

input::placeholder,
textarea::placeholder{ color: color-mix(in srgb, var(--muted) 80%, transparent); }

/* Buttons (default) */
button{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  cursor:pointer;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease, border-color .12s ease;
}

button:hover{ filter: brightness(1.03); }
button:active{ transform: translateY(1px); }
button:disabled{ opacity:.6; cursor:not-allowed; }

/* Theme-specific button class names (kept) */
.primary-button{
  background: var(--link);
  border-color: rgba(0,0,0,.0);
  color: #fff;
}
.primary-button:hover{ filter: brightness(1.04); }

.secondary-button{
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-danger{
  border-color: rgba(180, 0, 32, .35);
}
.btn-danger:hover{ filter: brightness(1.05); }

/* Footer */
.site-footer{
  border-top:1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}

/* =========================
   Profile (kept + polished)
========================= */
.profile-header{
  display:flex;
  gap:16px;
  align-items:center;
}

.profile-avatar img{
  border-radius:999px;
  object-fit:cover;
}

.avatar-placeholder{
  width:100px;
  height:100px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:44px;
  font-weight:700;
  background: var(--border);
  color: var(--text);
}

.profile-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}

.profile-edit textarea,
.profile-edit input[type="email"],
.profile-edit input[type="text"]{
  width:100%;
}

.profile-edit-status{
  margin-top:8px;
  font-size:13px;
  color: var(--muted);
}
.profile-edit-status.ok{ color: var(--muted); }
.profile-edit-status.error{ color: #b00020; }

/* =========================
   Modals (if used elsewhere)
========================= */
.modal{
  display:none;
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.5);
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.modal-box{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  width: min(420px, calc(100% - 32px));
  box-shadow: var(--shadow2);
}

/* Menu items (if used) */
.menu-item{
  width:100%;
  padding:10px 14px;
  background:none;
  border:none;
  color:var(--text);
  text-align:left;
  cursor:pointer;
  font-size:14px;
}
.menu-item:hover{ background: rgba(0,0,0,.04); }
@media (prefers-color-scheme: dark){
  .menu-item:hover{ background: rgba(255,255,255,.04); }
}
.menu-item.danger{ color:#ff5c5c; }

/* =========================
   Loaded posts animations + loader
   (keeps your class names)
========================= */
.archive-posts-container{
  display:grid;
  gap:12px;
}

.post.scale-in{
  opacity: 0;
  transform: translateY(6px) scale(.985);
}
.post.scale-in.loaded{
  opacity: 1;
  transform: none;
  transition: opacity .18s ease, transform .18s ease;
}
.post.scale-out{
  opacity: 0;
  transform: translateY(4px) scale(.985);
  transition: opacity .16s ease, transform .16s ease;
}

.loading-sentinel{
  height: 1px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: var(--radius);
  background: rgba(0,0,0,.03);
  backdrop-filter: blur(2px);
}
@media (prefers-color-scheme: dark){
  .loading-overlay{ background: rgba(0,0,0,.25); }
}

.loading-icon{
  width:18px;
  height:18px;
  border:2px solid var(--border);
  border-top-color: var(--link);
  border-radius:999px;
  animation: spin .8s linear infinite;
}
@keyframes spin{ to { transform: rotate(360deg); } }

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior:auto !important; }
  .post.scale-in.loaded,
  .post.scale-out,
  .post-item,
  .post-card,
  button,
  .site-nav a{
    transition: none !important;
  }
  .loading-icon{ animation:none !important; }
}