:root {
  --bg: #0d0d0d;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --muted: #888;
  --accent: #00d4aa;
  --accent2: #0099ff;
  --code-bg: #111;
  --bg-nav: rgba(13,13,13,.92);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 6px;
  --max-w: 1100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

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

/* ── Layout ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.page { padding: 60px 0 100px; }

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.nav-logo {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: -.5px;
}
.nav-logo span { color: var(--muted); }
.nav-links { display: flex; gap: 8px; list-style: none; }
.nav-links a {
  color: var(--muted); font-size: 13px; padding: 6px 12px;
  border-radius: var(--radius); transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: var(--bg3);
}
.nav-links a.active { color: var(--accent); }

/* ── Hero / About ── */
.hero {
  padding: 100px 0 80px;
  border-bottom: 1px solid var(--border);
}
.hero-tag {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--accent); margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.hero-tag::before { content:''; width:32px; height:1px; background:var(--accent); }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700; line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: var(--muted); font-size: 16px; max-width: 500px; margin-bottom: 32px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { background: transparent; color: var(--accent); }
.btn-ghost { border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Section titles ── */
.section-title {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 2px; color: var(--muted); margin-bottom: 40px;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after { content:''; flex:1; height:1px; background:var(--border); }
h2.page-heading { font-size: 1.8rem; font-weight: 700; letter-spacing: -.5px; margin-bottom: 8px; }
.page-sub { color: var(--muted); margin-bottom: 48px; }

/* ── Cards ── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-label {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); margin-bottom: 10px;
}
.card h3 { font-size: 16px; margin-bottom: 8px; line-height: 1.3; }
.card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.card-footer { margin-top: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-date { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ── Tags ── */
.tag {
  display: inline-block; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 3px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.tag:hover, .tag.active { border-color: var(--accent); color: var(--accent); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 32px; }

/* ── Blog post ── */
.post-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.post-meta .tag { cursor: default; }
.post-date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.prose { max-width: 720px; }
.prose h2 { font-size: 1.3rem; margin: 40px 0 12px; }
.prose h3 { font-size: 1.1rem; margin: 28px 0 10px; color: var(--accent); }
.prose p { margin-bottom: 18px; color: var(--muted); }
.prose ul, .prose ol { padding-left: 24px; margin-bottom: 18px; color: var(--muted); }
.prose li { margin-bottom: 6px; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 12px 20px;
  margin: 24px 0; background: var(--bg3); border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}
.prose code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--code-bg); padding: 2px 6px;
  border-radius: 3px; color: var(--accent);
}
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 24px 0;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: var(--text); }

/* ── Code snippet card ── */
.snippet-card { position: relative; }
.snippet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.snippet-lang {
  font-family: var(--font-mono); font-size: 11px; padding: 2px 8px;
  border-radius: 3px; background: var(--bg3); color: var(--accent2);
  border: 1px solid var(--border);
}
.snippet-code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  overflow: hidden; max-height: 120px;
  position: relative; color: var(--text); line-height: 1.6;
  white-space: pre;
}
.snippet-code::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 40px; background: linear-gradient(transparent, var(--code-bg));
}
.copy-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--muted); font-family: var(--font-mono); font-size: 11px;
  padding: 3px 10px; border-radius: 3px; cursor: pointer; transition: all .15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Portfolio ── */
.portfolio-card { overflow: hidden; padding: 0; }
.portfolio-img {
  height: 180px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  overflow: hidden;
}
.portfolio-img img { width: 100%; height: 100%; object-fit: cover; }
.portfolio-body { padding: 20px; }
.portfolio-tech { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.portfolio-links { display: flex; gap: 8px; margin-top: 16px; }

/* ── Filter bar ── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.filter-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.search-input {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px; border-radius: var(--radius);
  font-size: 13px; font-family: var(--font-sans); outline: none;
  transition: border-color .15s; min-width: 220px;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

/* ── About page extras ── */
.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.skill-pill {
  padding: 4px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  transition: all .15s;
}
.skill-pill:hover { border-color: var(--accent); color: var(--accent); }

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position:absolute; left:0; top:0; bottom:0; width:1px; background:var(--border); }
.timeline-item { position: relative; margin-bottom: 36px; }
.timeline-item::before {
  content:''; position:absolute; left:-28px; top:6px;
  width:8px; height:8px; border-radius:50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.timeline-period { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.timeline-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.timeline-sub { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.timeline-desc { font-size: 13px; color: var(--muted); }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; margin-top: 48px; justify-content: center; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 12px;
  border: 1px solid var(--border); color: var(--muted);
  transition: all .15s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { border-color: var(--accent); color: var(--accent); background: rgba(0,212,170,.08); }

/* ── Snippet full page ── */
.snippet-full pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
}

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; }
.alert-success { background: rgba(0,212,170,.1); border: 1px solid rgba(0,212,170,.3); color: var(--accent); }
.alert-error { background: rgba(255,80,80,.1); border: 1px solid rgba(255,80,80,.3); color: #ff6b6b; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: 80px;
}
.footer-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-copy { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 12px; color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ── Admin ── */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-logo { padding: 0 20px 24px; font-family: var(--font-mono); font-size: 13px; color: var(--accent); border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.admin-nav { list-style: none; }
.admin-nav a { display: block; padding: 9px 20px; color: var(--muted); font-size: 13px; transition: all .15s; }
.admin-nav a:hover, .admin-nav a.active { color: var(--text); background: var(--bg3); border-left: 2px solid var(--accent); }
.admin-content { flex: 1; padding: 40px; max-width: 900px; }
.admin-content h1 { font-size: 1.4rem; margin-bottom: 32px; letter-spacing: -.3px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-family: var(--font-mono); }
.form-control {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: var(--radius);
  font-size: 13px; font-family: var(--font-sans); outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--accent); }
textarea.form-control { min-height: 200px; resize: vertical; font-family: var(--font-mono); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.admin-table th { color: var(--muted); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }
.admin-table tr:hover td { background: var(--bg2); }
.admin-table .actions { display: flex; gap: 8px; }

.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.published { background: var(--accent); }
.status-dot.draft { background: var(--muted); }

/* ── Tag input widget ── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
  cursor: text; transition: border-color .15s; min-height: 40px;
  position: relative;
}
.tag-input-wrap:focus-within { border-color: var(--accent); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 3px; padding: 2px 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text);
}
.tag-chip-remove {
  cursor: pointer; color: var(--muted); line-height: 1;
  background: none; border: none; padding: 0; font-size: 13px;
}
.tag-chip-remove:hover { color: #ff6b6b; }
.tag-input-field {
  border: none; background: transparent; color: var(--text);
  font-size: 13px; font-family: var(--font-sans); outline: none;
  min-width: 120px; flex: 1;
}
.tag-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg2); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  max-height: 180px; overflow-y: auto; display: none;
}
.tag-suggestions.open { display: block; }
.tag-suggestion {
  padding: 7px 12px; font-size: 13px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.tag-suggestion:hover, .tag-suggestion.focused { background: var(--bg3); }
.tag-suggestion-count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ── CKEditor overrides ── */
.ck-editor__editable {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  min-height: 320px;
}
.ck-editor__editable:focus { border-color: var(--accent) !important; }
.ck.ck-toolbar { background: var(--bg3) !important; border-color: var(--border) !important; }
.ck.ck-toolbar .ck-button { color: var(--muted) !important; }
.ck.ck-toolbar .ck-button:hover { background: var(--bg2) !important; color: var(--text) !important; }
.ck.ck-button.ck-on { background: var(--bg) !important; color: var(--accent) !important; }
.ck.ck-dropdown__panel, .ck.ck-list { background: var(--bg2) !important; border-color: var(--border) !important; }
.ck.ck-list__item .ck-button:hover { background: var(--bg3) !important; }
.ck.ck-editor { border-radius: var(--radius) !important; }
.ck.ck-editor__top .ck-sticky-panel .ck-toolbar { border-radius: var(--radius) var(--radius) 0 0 !important; }
.ck.ck-editor__editable_inline { border-radius: 0 0 var(--radius) var(--radius) !important; }

/* ── Screenshot gallery (masonry) ── */
.gallery-grid {
  columns: 3;
  column-gap: 8px;
}
.gallery-item {
  break-inside: avoid;
  display: block;
  width: 100%;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: border-color .2s, opacity .2s;
  text-decoration: none;
}
.gallery-item:hover { border-color: var(--accent); opacity: .85; }
.gallery-item img { width: 100%; height: auto; display: block; }


/* ── Admin: screens upload list ── */
.screens-list {
  display: flex; flex-wrap: wrap; gap: 10px;
  min-height: 44px; padding: 4px 0;
}
.screen-item {
  position: relative; width: 200px; height: 200px;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: grab; flex-shrink: 0;
  transition: border-color .15s;
}
.screen-item:hover { border-color: var(--accent); }
.screen-item.dragging { opacity: .4; cursor: grabbing; }
.screen-item.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,212,170,.3); }
.screen-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.screen-remove {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.75); border: none; color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.screen-remove:hover { background: #e53e3e; }
.screen-order {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,.7); color: var(--muted);
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px; border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .gallery-grid { columns: 2; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero { padding: 60px 0 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .admin-wrap { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-content { padding: 24px 16px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .gallery-grid { columns: 1; }
}
