/* public/css/style.css — Dark tech theme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --surface:   #13161e;
  --surface2:  #1a1e28;
  --border:    #252a38;
  --green:     #39d98a;
  --green-dim: #1f7a4e;
  --blue:      #4fa3f7;
  --amber:     #f5a623;
  --text:      #e8ecf0;
  --muted:     #7a8394;
  --radius:    8px;
  --font:      'DM Sans', -apple-system, sans-serif;
  --heading:   'DM Serif Display', Georgia, serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --max:       780px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13,15,20,.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: .85rem 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-name { font-family: var(--mono); font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--green); letter-spacing: -.01em; display: flex; align-items: center; gap: .6rem; }
.site-name:hover { opacity: .8; }
.site-logo-photo { height: 40px; width: auto; max-width: 110px; object-fit: cover; object-position: center 20%; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.site-header nav { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: .875rem; transition: color .15s; }
.site-header nav a:hover { color: var(--text); }

/* Nav search */
.nav-search { display: flex; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.nav-search input { background: transparent; border: none; padding: .3rem .75rem; font-size: .8rem; font-family: var(--mono); color: var(--text); width: 130px; outline: none; }
.nav-search input::placeholder { color: var(--muted); }
.nav-search button { background: transparent; border: none; padding: .3rem .65rem; color: var(--muted); cursor: pointer; font-size: .95rem; line-height: 1; }
.nav-search button:hover { color: var(--green); }

/* Login button */
.nav-login-btn { background: var(--green); color: #000 !important; padding: .3rem .85rem; border-radius: 20px; font-family: var(--mono); font-size: .75rem; font-weight: 600; text-decoration: none; transition: opacity .15s; white-space: nowrap; letter-spacing: .03em; }
.nav-login-btn:hover { opacity: .85; }

/* Flash */
.flash { padding: .75rem 1.25rem; margin: .5rem 0; border-radius: var(--radius); font-size: .9rem; }
.flash-success { background: #0e2a1e; color: var(--green); border: 1px solid var(--green-dim); }
.flash-error   { background: #2a0e0e; color: #f87171; border: 1px solid #7a1f1f; }

/* ── Admin edit bar (visible when logged in) ── */
.admin-edit-bar {
  background: #1a1200; border-bottom: 1px solid #3d2e00;
  padding: .5rem 1.25rem; display: flex; align-items: center;
  gap: .65rem; flex-wrap: wrap;
}
.admin-edit-label { font-family: var(--mono); font-size: .7rem; color: #a07840; margin-right: .25rem; }
.admin-edit-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  background: var(--amber); color: #000; text-decoration: none;
  padding: .28rem .8rem; border-radius: 5px; transition: opacity .15s;
}
.admin-edit-btn:hover { opacity: .85; }
.admin-edit-btn--ghost { background: transparent; color: var(--amber); border: 1px solid #3d2e00; }
.admin-edit-btn--ghost:hover { background: #1a1200; opacity: 1; }

/* ── Hero (index + archive) ── */
.blog-hero {
  position: relative; overflow: hidden;
  padding: 64px 24px 56px; text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #0e2a1e 0%, var(--bg) 65%);
  border-bottom: 1px solid var(--border);
}
.blog-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .2; pointer-events: none;
}
.blog-hero h1 { font-family: var(--heading); font-size: clamp(1.9rem, 4.5vw, 2.9rem); color: var(--text); line-height: 1.2; margin-bottom: .75rem; position: relative; }
.blog-hero p  { font-size: 1rem; color: var(--muted); max-width: 480px; margin: 0 auto; position: relative; }

/* ── Post Hero (single post) ── */
.post-hero {
  position: relative; overflow: hidden;
  padding: 64px 0 52px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #0e2a1e 0%, var(--bg) 65%);
  border-bottom: 1px solid var(--border);
}
.post-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .2; pointer-events: none;
}
.post-hero-inner { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; position: relative; }
.post-badge { display: inline-flex; align-items: center; gap: 6px; background: #0e2a1e; border: 1px solid var(--green-dim); color: var(--green); font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; padding: .3rem .9rem; border-radius: 999px; margin-bottom: 1.25rem; text-decoration: none; transition: background .15s; }
.post-badge:hover { background: #1a3d2a; }
.post-hero h1 { font-family: var(--heading); font-size: clamp(1.75rem, 4vw, 2.75rem); color: var(--text); line-height: 1.2; margin-bottom: 1rem; }
.post-meta { font-family: var(--mono); font-size: .75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; }
.post-meta a { color: var(--blue); text-decoration: none; }
.post-meta a:hover { text-decoration: underline; }
.reading-time { color: var(--muted); }

/* ── Main ── */
main { padding: 2.5rem 0; }

/* ── Post Grid ── */
.posts-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.posts-header h2 { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.post-grid { display: grid; gap: 1rem; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s, transform .2s; }
.post-card:hover { border-color: var(--green-dim); transform: translateY(-2px); }
.post-card img { width: 100%; height: 200px; object-fit: cover; display: block; border-bottom: 1px solid var(--border); }
.post-card-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.post-card-cats { display: flex; gap: .4rem; flex-wrap: wrap; }
.post-cat { font-family: var(--mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; color: var(--green); background: #0e2a1e; border: 1px solid var(--green-dim); padding: .18rem .6rem; border-radius: 999px; text-decoration: none; }
.post-card-body h2 { font-family: var(--heading); font-size: 1.2rem; line-height: 1.3; }
.post-card-body h2 a { color: var(--text); text-decoration: none; }
.post-card-body h2 a:hover { color: var(--green); }
.post-card-body p { color: var(--muted); font-size: .9rem; line-height: 1.55; flex: 1; }
.post-card-meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); display: flex; gap: .75rem; }

/* Pagination */
.pagination { display: flex; gap: .75rem; align-items: center; justify-content: center; margin-top: 2.5rem; }
.pagination a { font-family: var(--mono); font-size: .78rem; color: var(--green); text-decoration: none; padding: .4rem 1rem; border: 1px solid var(--border); border-radius: 20px; transition: background .15s, border-color .15s; }
.pagination a:hover { background: var(--surface); border-color: var(--green-dim); }
.pagination span { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

/* ── Post content ── */
.post-wrapper { padding: 2.5rem 0 4rem; }
.featured-img { width: 100%; border-radius: var(--radius); margin-bottom: 2rem; border: 1px solid var(--border); }

.post-content { color: #bcc4ce; font-size: 1.05rem; line-height: 1.85; }
.post-content h2 { font-family: var(--heading); font-size: 1.65rem; color: var(--text); margin: 2.5rem 0 .75rem; line-height: 1.2; }
.post-content h3 { font-size: 1.15rem; font-weight: 500; color: var(--text); margin: 2rem 0 .6rem; }
.post-content h4 { font-size: 1rem; font-weight: 500; color: var(--text); margin: 1.5rem 0 .5rem; }
.post-content p  { margin-bottom: 1.1rem; }
.post-content ul, .post-content ol { margin: 0 0 1.1rem 1.5rem; }
.post-content li { margin-bottom: .35rem; }
.post-content a  { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.post-content strong { color: var(--text); }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-content blockquote { border-left: 3px solid var(--green); padding: .6rem 0 .6rem 1.25rem; color: var(--muted); margin: 1.5rem 0; font-style: italic; }
.post-content pre { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; overflow-x: auto; font-family: var(--mono); font-size: .825rem; color: var(--green); line-height: 1.7; margin-bottom: 1.1rem; }
.post-content code { font-family: var(--mono); background: var(--surface2); color: var(--blue); padding: .15em .45em; border-radius: 4px; font-size: .875em; border: 1px solid var(--border); }
.post-content pre code { background: none; border: none; padding: 0; color: var(--green); font-size: inherit; }
.post-content img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.post-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.1rem; font-size: .9rem; }
.post-content th { background: var(--surface2); color: var(--text); padding: .6rem .85rem; text-align: left; border: 1px solid var(--border); font-weight: 500; }
.post-content td { padding: .6rem .85rem; border: 1px solid var(--border); color: #bcc4ce; }

/* Tags */
.post-tags { margin-top: 2rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); padding: .25rem .7rem; border-radius: 999px; text-decoration: none; transition: border-color .15s, color .15s; }
.tag:hover { border-color: var(--green-dim); color: var(--green); }

/* Related posts */
.related-posts { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-posts h2 { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 1rem; }

/* Post list (archive / search) */
.post-list { display: flex; flex-direction: column; gap: .75rem; }
.post-list-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; transition: border-color .2s; }
.post-list-item:hover { border-color: var(--green-dim); }
.post-list-item h2 { font-family: var(--heading); font-size: 1.1rem; margin-bottom: .3rem; }
.post-list-item h2 a { color: var(--text); text-decoration: none; }
.post-list-item h2 a:hover { color: var(--green); }
.post-list-item p { color: var(--muted); font-size: .875rem; margin-bottom: .4rem; line-height: 1.55; }
.post-list-item time { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

/* Search */
.search-query { color: var(--green); }
.search-count { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-bottom: 1.25rem; }
.muted-msg { color: var(--muted); }

/* Comments */
.comments-section { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 2rem; }
.comments-section h2 { font-family: var(--heading); font-size: 1.4rem; color: var(--text); margin-bottom: 1.25rem; }
.comment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .75rem; }
.comment strong { display: block; font-size: .9rem; color: var(--text); }
.comment time { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.comment p { margin-top: .4rem; color: #bcc4ce; font-size: .95rem; }
.comment-form { margin-top: 1.75rem; display: grid; gap: .75rem; }
.comment-form h3 { font-family: var(--heading); font-size: 1.2rem; color: var(--text); }
.comment-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; color: var(--muted); }
.comment-form input, .comment-form textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: .55rem .85rem; font-family: var(--font); font-size: .95rem; color: var(--text); }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--green-dim); }
.comment-form textarea { resize: vertical; }
.comment-form button { width: fit-content; background: var(--green); color: #000; border: none; border-radius: var(--radius); padding: .6rem 1.4rem; font-family: var(--mono); font-size: .78rem; font-weight: 600; letter-spacing: .04em; cursor: pointer; transition: opacity .15s; }
.comment-form button:hover { opacity: .85; }
.comment-form small { color: var(--muted); font-size: .8rem; }

/* Error pages */
.error-page { text-align: center; padding: 5rem 0; }
.error-page h1 { font-family: var(--heading); font-size: 2.5rem; color: var(--text); margin-bottom: 1rem; }
.error-page p { color: var(--muted); margin-bottom: 1.5rem; }
.error-page a { color: var(--green); text-decoration: none; font-family: var(--mono); font-size: .875rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 4rem; text-align: center; color: var(--muted); font-family: var(--mono); font-size: .72rem; letter-spacing: .05em; line-height: 1.8; }
.site-footer a { color: var(--blue); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (min-width: 620px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .nav-search input { width: 90px; } .site-header nav { gap: .5rem; } }

/* ── Hero profile (avatar + bio + social) ── */
.hero-avatar {
  width: 90px; height: 90px;
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--green-dim);
  margin-bottom: 1.1rem;
  position: relative;
}
.hero-bio {
  font-size: .9rem; color: var(--muted);
  max-width: 420px; margin: .5rem auto 0;
  line-height: 1.65; position: relative;
}
.hero-social {
  display: flex; justify-content: center; gap: .85rem;
  margin-top: 1rem; position: relative;
}
.hero-social a {
  color: var(--muted); text-decoration: none;
  display: flex; align-items: center;
  transition: color .15s;
}
.hero-social a:hover { color: var(--green); }

/* ── Light theme ── */
[data-theme="light"] {
  --bg:        #f5f5f0;
  --surface:   #ffffff;
  --surface2:  #ebebeb;
  --border:    #d8d8d0;
  --text:      #1a1a1a;
  --muted:     #6b7280;
  --green-dim: color-mix(in srgb, var(--green) 30%, #000);
}
[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}
[data-theme="light"] .site-header {
  background: rgba(245,245,240,.95);
  border-bottom-color: var(--border);
}
[data-theme="light"] .blog-hero,
[data-theme="light"] .post-hero {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in srgb, var(--green) 12%, var(--bg)) 0%, var(--bg) 65%);
}
[data-theme="light"] .blog-hero::before,
[data-theme="light"] .post-hero::before { opacity: .07; }
[data-theme="light"] .post-card { background: var(--surface); border-color: var(--border); }
[data-theme="light"] .post-list-item { border-bottom-color: var(--border); }
[data-theme="light"] .comment { background: var(--surface); border-color: var(--border); }
[data-theme="light"] .comment p { color: var(--muted); }
[data-theme="light"] .comment-form input,
[data-theme="light"] .comment-form textarea { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="light"] code,
[data-theme="light"] pre { background: var(--surface2); color: #1a1a1a; border-color: var(--border); }
[data-theme="light"] .site-footer { border-top-color: var(--border); }
[data-theme="light"] .nav-search { background: var(--surface2); border-color: var(--border); }
[data-theme="light"] .nav-search input { color: var(--text); }
[data-theme="light"] .post-content blockquote { background: var(--surface2); border-color: var(--border); }
