/* ===== Design Tokens ===== */
:root {
  --bg:          #0a0a0a;
  --bg-2:        #141414;
  --bg-3:        #1e1e1e;
  --border:      #252525;
  --text:        #ebebeb;
  --muted:       #888;
  --accent:      #7c3aed;
  --accent-h:    #6d28d9;
  --accent-10:   rgba(124,58,237,.10);
  --accent-30:   rgba(124,58,237,.30);
  --success:     #10b981;
  --error:       #ef4444;
  --r:           8px;
  --r-lg:        16px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
  --t:           .18s ease;
  --sans:        -apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif;
  --mono:        'SF Mono','Fira Code',Consolas,monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== Nav ===== */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; max-width: 1100px; margin: 0 auto; padding: 0 24px;
}
.nav-logo { font-weight: 700; font-size: 1.1rem; letter-spacing: -.03em; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a { color: var(--muted); font-size: .875rem; transition: color var(--t); }
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-admin { font-size: .8rem; color: var(--muted); border: 1px solid var(--border); padding: 4px 12px; border-radius: 100px; transition: all var(--t); }
.nav-admin:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r);
  font-size: .875rem; font-weight: 500; border: none;
  cursor: pointer; transition: all var(--t); text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ===== Hero ===== */
.hero {
  padding: 110px 0 80px;
  text-align: center;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, var(--accent-10) 0%, transparent 70%);
}
.hero-badge {
  display: inline-block;
  background: var(--accent-10); color: var(--accent);
  border: 1px solid var(--accent-30);
  padding: 4px 14px; border-radius: 100px;
  font-size: .75rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2.4rem,6vw,4.2rem);
  font-weight: 800; letter-spacing: -.05em;
  line-height: 1.1; margin-bottom: 18px;
}
.hero h1 .accent { color: var(--accent); }
.hero p {
  font-size: 1.1rem; color: var(--muted);
  max-width: 500px; margin: 0 auto 36px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Sections ===== */
.section { padding: 80px 0; }
.section-header { margin-bottom: 48px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.section-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: 6px; }
.section-title { font-size: clamp(1.6rem,3.5vw,2.2rem); font-weight: 700; letter-spacing: -.04em; }
.section-link { font-size: .85rem; color: var(--muted); border-bottom: 1px solid transparent; transition: all var(--t); white-space: nowrap; }
.section-link:hover { color: var(--text); border-color: var(--text); }

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

.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  transition: all var(--t); display: flex; flex-direction: column;
}
.card:hover { border-color: var(--accent-30); transform: translateY(-2px); box-shadow: 0 12px 40px var(--accent-10); }
.card-thumb {
  width: 100%; height: 190px; object-fit: cover;
  background: linear-gradient(135deg,var(--bg-3),var(--bg-2));
}
.card-thumb-placeholder {
  width: 100%; height: 190px;
  background: linear-gradient(135deg,var(--bg-3),var(--bg-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--border);
}
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-type { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.card-title { font-size: 1rem; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; line-height: 1.35; }
.card-excerpt { font-size: .85rem; color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-date { font-size: .75rem; color: var(--border); margin-top: 14px; }
a.card:hover .card-title { color: var(--accent); }

/* ===== Page Header ===== */
.page-header { padding: 72px 0 52px; border-bottom: 1px solid var(--border); margin-bottom: 60px; }
.page-header h1 { font-size: clamp(2rem,5vw,3rem); font-weight: 800; letter-spacing: -.05em; margin-bottom: 10px; }
.page-header p { color: var(--muted); font-size: 1rem; }

/* ===== Filter Tabs ===== */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 40px; flex-wrap: wrap; }
.filter-tab {
  padding: 7px 18px; border-radius: 100px;
  font-size: .8rem; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  transition: all var(--t);
}
.filter-tab:hover { border-color: var(--accent-30); color: var(--text); }
.filter-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 280px 1fr; gap: 64px; align-items: start; }
.about-photo {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--r-lg); border: 1px solid var(--border);
}
.about-photo-placeholder {
  width: 100%; aspect-ratio: 1;
  background: var(--bg-3); border-radius: var(--r-lg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem; color: var(--border);
}
.about-text h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.04em; margin-bottom: 16px; }
.about-text p { color: var(--muted); margin-bottom: 16px; line-height: 1.75; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.skill-chip {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--muted); padding: 4px 13px; border-radius: 100px; font-size: .78rem;
}

/* ===== Post Content ===== */
.post-container { max-width: 740px; margin: 0 auto; padding: 60px 24px 100px; }
.post-meta { color: var(--muted); font-size: .85rem; margin-bottom: 32px; }
.post-cover { width: 100%; border-radius: var(--r-lg); margin-bottom: 40px; border: 1px solid var(--border); }
.post-content h2 { font-size: 1.45rem; font-weight: 700; margin: 2em 0 .7em; letter-spacing: -.03em; }
.post-content h3 { font-size: 1.15rem; font-weight: 600; margin: 1.6em 0 .5em; }
.post-content p { margin-bottom: 1.15em; color: var(--text); line-height: 1.8; }
.post-content a { color: var(--accent); border-bottom: 1px solid var(--accent-30); }
.post-content a:hover { border-color: var(--accent); }
.post-content code {
  background: var(--bg-3); padding: 2px 7px; border-radius: 4px;
  font-family: var(--mono); font-size: .875em;
}
.post-content pre {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; overflow-x: auto; margin-bottom: 1.3em;
}
.post-content pre code { background: none; padding: 0; }
.post-content img { border-radius: var(--r); margin: 1.5em 0; }
.post-content ul, .post-content ol { padding-left: 1.5em; margin-bottom: 1.2em; }
.post-content li { margin-bottom: .3em; color: var(--text); }
.post-content blockquote {
  border-left: 3px solid var(--accent); padding-left: 1em;
  color: var(--muted); margin: 1.5em 0; font-style: italic;
}
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ===== Blog list ===== */
.blog-item {
  display: flex; gap: 20px; padding: 28px 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--t);
}
.blog-item:hover .blog-title { color: var(--accent); }
.blog-thumb { width: 120px; height: 80px; object-fit: cover; border-radius: var(--r); flex-shrink: 0; background: var(--bg-3); }
.blog-info { flex: 1; }
.blog-title { font-size: 1rem; font-weight: 600; letter-spacing: -.02em; margin-bottom: 6px; transition: color var(--t); }
.blog-excerpt { font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-date { font-size: .75rem; color: var(--border); margin-top: 8px; }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: .85rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; padding: 0 24px; flex-wrap: wrap; gap: 16px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); transition: color var(--t); }
.footer-links a:hover { color: var(--text); }

/* ===== States ===== */
.loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; color: var(--muted); gap: 12px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 80px 24px; color: var(--muted); }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }

/* ===== Toast ===== */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: var(--r); font-size: .85rem;
  box-shadow: var(--shadow); animation: slideIn .25s ease; max-width: 320px;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Admin ===== */
.admin-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px; font-weight: 700; font-size: 1rem; border-bottom: 1px solid var(--border); }
.sidebar-logo span { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.sidebar-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: var(--r); background: transparent;
  border: none; color: var(--muted); font-size: .875rem; text-align: left;
  cursor: pointer; transition: all var(--t);
}
.sidebar-btn:hover { background: var(--bg-3); color: var(--text); }
.sidebar-btn.active { background: var(--accent-10); color: var(--accent); }
.sidebar-btn svg { flex-shrink: 0; }
.sidebar-footer { padding: 16px 8px; border-top: 1px solid var(--border); }
.admin-main { flex: 1; padding: 40px 48px; overflow-y: auto; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.admin-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.04em; }

/* Admin login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 40px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.04em; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: .875rem; margin-bottom: 28px; }

/* Form elements */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--r); padding: 10px 14px; font-size: .9rem; font-family: inherit;
  transition: border-color var(--t);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 300px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; }
.form-select option { background: var(--bg-3); }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 10px 16px; text-align: left; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-3); }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: .72rem; font-weight: 600; }
.status-published { background: rgba(16,185,129,.12); color: var(--success); }
.status-draft { background: var(--bg-3); color: var(--muted); }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); gap: 12px; }
.media-item { position: relative; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--bg-3); cursor: pointer; transition: all var(--t); }
.media-item:hover { border-color: var(--accent-30); }
.media-item img { width: 100%; height: 110px; object-fit: cover; }
.media-item .media-name { padding: 6px 8px; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item .media-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); border: none; color: #fff; border-radius: 4px; padding: 2px 6px; font-size: .7rem; cursor: pointer; opacity: 0; transition: opacity var(--t); }
.media-item:hover .media-del { opacity: 1; }

/* Upload drop zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--r-lg);
  padding: 48px 24px; text-align: center; color: var(--muted);
  transition: all var(--t); cursor: pointer; margin-bottom: 24px;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); color: var(--text); background: var(--accent-10); }
.drop-zone p { font-size: .9rem; margin-top: 8px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 500; display: flex; align-items: flex-start; justify-content: flex-end; }
.modal { background: var(--bg-2); border-left: 1px solid var(--border); width: min(600px,100vw); height: 100vh; overflow-y: auto; padding: 36px 40px; animation: slideRight .25s ease; }
@keyframes slideRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.modal-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -.03em; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 100px; cursor: pointer; transition: background var(--t); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--t); }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Cover image picker */
.cover-picker { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 8px; max-height: 240px; overflow-y: auto; padding: 4px; }
.cover-option { border: 2px solid transparent; border-radius: var(--r); overflow: hidden; cursor: pointer; transition: border-color var(--t); }
.cover-option img { width: 100%; height: 70px; object-fit: cover; }
.cover-option.selected { border-color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 72px 0 56px; }
  .hero h1 { font-size: 2.2rem; }
  .section { padding: 56px 0; }
  .footer-inner { flex-direction: column; text-align: center; }
  .nav-links { gap: 16px; }
  .sidebar { width: 180px; }
  .admin-main { padding: 24px 20px; }
  .blog-item { flex-direction: column; }
  .blog-thumb { width: 100%; height: 160px; }
  .modal { width: 100vw; }
}
@media (max-width: 540px) {
  .sidebar { display: none; }
  .admin-main { padding: 20px 16px; }
}
