@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

:root {
  --bg: #0a0b12; /* deeper, richer dark */
  --bg-elev: #131522;
  --text: #ececf1; /* off-white for better contrast */
  --muted: #a8abb7;
  --primary: #7b25d7;
  --primary-600: #6a1fbe;
  --card: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.10);
  --shadow: 0 10px 30px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg: #eef1f7; /* stronger off-white */
  --bg-elev: #ffffff;
  --text: #0f1222;
  --muted: #5b5e6b;
  --primary: #7b25d7;
  --primary-600: #6a1fbe;
  --card: #ffffff;
  --border: rgba(0,0,0,0.10);
  --shadow: 0 10px 26px rgba(0,0,0,0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: background-color .45s ease, color .45s ease;
}

/* Base links */
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: none; }

/* Utilities */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.stack-2 > * + * { margin-top: 0.5rem; }
.stack-4 > * + * { margin-top: 1rem; }
.stack-6 > * + * { margin-top: 1.5rem; }
.stack-8 > * + * { margin-top: 2rem; }

/* Buttons */
.btn { appearance: none; border: 1px solid transparent; padding: 0.6rem 1rem; border-radius: 10px; cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; font-weight: 600; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--card); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  backdrop-filter: blur(10px);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background-color .45s ease, border-color .45s ease;
}
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { font-size: 1.3rem; font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav a { color: var(--text); text-decoration: none; position: relative; transition: color .15s ease; }
.site-nav a::after { content: ""; position: absolute; left: 0; bottom: -6px; width: 100%; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .2s ease; }
.site-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; transition: transform .15s ease, box-shadow .2s ease; }
.theme-toggle:hover { box-shadow: var(--shadow); }
.theme-toggle.fade { animation: toggle-fade .45s ease; }
@keyframes toggle-fade { from { opacity: .5; } to { opacity: 1; } }

.burger { display: none; appearance: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); }

/* Mobile menu */
.mobile-bar { display: none; align-items: center; gap: 10px; }
.mobile-menu { display: none; position: static; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.mobile-menu a { display: block; padding: 10px 6px; color: var(--text); text-decoration: none; border-radius: 8px; }
.mobile-menu a:hover { background: var(--card); }
.mobile-open .mobile-menu { display: block; }

/* Hero */
.hero { padding: 48px 0 8px; text-align: center; background: radial-gradient(1000px 400px at 50% -10%, color-mix(in oklab, var(--primary) 35%, transparent), transparent 60%); }
.avatar { width: 164px; height: 164px; border-radius: 999px; object-fit: cover; border: 2px solid var(--border); box-shadow: var(--shadow); }
.hero h1 { font-size: 2.4rem; margin: 16px 0 4px; }
.hero h3 { color: var(--muted); font-weight: 500; }

/* Sections */
section { padding: 40px 0; }
.section-head { text-align: center; margin-bottom: 18px; }
.section-head h2 { font-size: 1.6rem; }
.section-head p { color: var(--muted); }

/* Projects */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); }
.card .title { font-weight: 700; margin-bottom: 6px; }
.card .meta { display: flex; gap: 12px; color: var(--muted); font-size: 0.9rem; }

/* Carousel */
.carousel { position: relative; }
.carousel-viewport { overflow: hidden; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elev); }
.carousel-track { --gap: 14px; --per-view: 3; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--gap) * (var(--per-view) - 1))) / var(--per-view)); gap: var(--gap); padding: var(--gap); transition: transform .4s ease; }
.carousel-item { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #000; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.carousel-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); }
.carousel-item img { width: 100%; height: 260px; object-fit: cover; display: block; transition: transform .3s ease; }
.carousel-item:hover img { transform: scale(1.03); }
.carousel-ctrl { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); border: none; color: #fff; width: 42px; height: 42px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

@media (max-width: 1024px) { .carousel-track { --per-view: 2; } }
@media (max-width: 640px) { .carousel-track { --per-view: 1; } .carousel-item img { height: 220px; } }

/* Hover details card for carousel */
.hover-card { position: fixed; pointer-events: auto; z-index: 2000; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; max-width: 360px; box-shadow: var(--shadow); display: none; }
.hover-card .title { font-weight: 700; margin-bottom: 6px; }
.hover-card .meta { color: var(--muted); font-size: .85rem; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.hover-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-sm { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: .75rem; color: var(--text); }
.hover-card .desc { color: var(--text); font-size: .9rem; line-height: 1.4; }

/* Blog & Post */
.post-list { max-width: 900px; margin: 0 auto; }
.post-list > h3 { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-top: 20px; }
.post-item { padding: 12px 10px; border-radius: 10px; transition: .2s ease; }
.post-item:hover { background: var(--card); }
.post-meta { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: .8rem; color: var(--text); }

.post { max-width: 900px; margin: 0 auto; padding: 0 6px; }
.post h1 { font-size: 2rem; margin-bottom: 12px; }
.post .content { line-height: 1.8; max-width: 900px; margin: 0 auto; padding: 0 6px; }
.post .content img { max-width: 100%; height: auto; }
.post .content pre { background: var(--bg-elev); border: 1px solid var(--border); padding: 12px; border-radius: 10px; overflow: auto; }
.post .content code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.post .content blockquote { border-left: 3px solid var(--primary); padding-left: 12px; color: var(--muted); }

/* Quill content helpers (ensure formatting reflects on public pages) */
.ql-align-center { text-align: center; }
.filters { position: relative; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px auto 18px; justify-content: flex-start; max-width: 900px; padding-left: 5px;}
.filters .search { flex: 0 0 260px; }
.filters input[type="search"] { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); }
.filters .selected-tags { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 4px; padding-right: 4px; }
.filters .tag { cursor: pointer; }
.filters .tag.active { border-color: var(--primary); color: #fff; background: color-mix(in oklab, var(--primary) 25%, var(--card)); }
.filters .tags-toggle { flex: 0 0 auto; }
.tags-dropdown { position: absolute; top: calc(100% + 8px); left: 0; z-index: 100; display: none; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow); width: min(520px, 90vw); }
.tags-dropdown .tag { margin: 4px; display: inline-flex; }
.tags-dropdown .actions { margin-top: 8px; display: flex; gap: 8px; }

/* Focus styles */
:where(a, button, input, select, textarea):focus-visible { outline: 2px solid color-mix(in oklab, var(--primary) 70%, transparent); outline-offset: 2px; border-radius: 8px; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
.ql-indent-1 { margin-left: 2em; }
.ql-indent-2 { margin-left: 4em; }
.ql-indent-3 { margin-left: 6em; }
.ql-indent-4 { margin-left: 8em; }
.ql-size-small { font-size: 0.9em; }
.ql-size-large { font-size: 1.3em; }
.ql-size-huge { font-size: 1.6em; }

/* Footer */
footer { margin-top: auto; padding: 32px 0; text-align: center; color: var(--muted); border-top: 1px solid var(--border); }

/* Forms */
.form { max-width: 900px; margin: 0 auto; }
.field { display: grid; gap: 8px; margin-bottom: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 10px; outline: none;
}
textarea { min-height: 160px; }

/* Admin list edit/delete */
.row-actions { display: inline-flex; gap: 8px; margin-left: 8px; }
.link { color: var(--text); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* Responsive header */
@media (max-width: 840px) {
  .site-nav { display: none; }
  .nav-actions { display: flex; }
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-bar { display: none; }
}

/* Tight mobile padding for content areas */
@media (max-width: 640px) {
  .container { padding-left: 18px; padding-right: 18px; }
  .post-list, .post, .form { padding-left: 6px; padding-right: 6px; }
  .filters .search { flex-basis: calc(100% - 110px); }
  .tags-dropdown { left: 0; right: 0; width: auto; }
}

/* Narrow wrapper to align headings with forms */
.narrow { max-width: 900px; margin: 0 auto; padding: 0 6px; }

/* Admin icon buttons */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.btn-icon:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: color-mix(in oklab, var(--primary) 10%, var(--card)); }
.btn-icon:active { transform: translateY(0); }


