/* ============================================================
   DAVE'S BLOG STUDIO - style.css
   This file holds ALL the looks: colors, layout, sizes, shapes.
   index.html loads it with:  <link rel="stylesheet" href="style.css">

   Colors are stored in :root as "CSS variables". Change a color
   ONCE here and it updates everywhere it's used. Try it!
   ============================================================ */

:root{
  --bg:#0f1220;        /* page background          */
  --panel:#171b2e;     /* card/panel background    */
  --panel2:#1f2440;    /* slightly lighter panels  */
  --ink:#e8eaf6;       /* main text color          */
  --muted:#9aa3c7;     /* secondary "grey" text    */
  --accent:#6c8cff;    /* blue - main highlight    */
  --accent2:#ff6c9c;   /* pink - second highlight  */
  --good:#3ddc97;      /* green - success/feeling  */
  --border:#2a3157;    /* subtle borders           */
}

/* Reset: make every box size predictably (width includes padding) */
*{box-sizing:border-box}

body{
  margin:0;
  font-family:"Segoe UI",system-ui,sans-serif;
  background:var(--bg);
  color:var(--ink);
  min-height:100vh;
}

/* ---------- header ---------- */
header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 22px;
  background:var(--panel);
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:10;
  flex-wrap:wrap;
  gap:8px;
}
header h1{margin:0; font-size:1.25rem; letter-spacing:.5px}
header h1 span{color:var(--accent2)}

main{max-width:960px; margin:0 auto; padding:22px}

/* ---------- buttons ---------- */
.btn{
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--ink);
  padding:8px 14px;
  border-radius:9px;
  cursor:pointer;
  font-size:.9rem;
  transition:.15s;
  font-family:inherit;
}
.btn:hover{border-color:var(--accent); transform:translateY(-1px)}
.btn.primary{background:var(--accent); border-color:transparent; color:#fff; font-weight:600}
.btn.danger:hover{border-color:var(--accent2); color:var(--accent2)}
/* the active header button lights up so you always know where you are */
.btn.active{background:var(--accent2); border-color:transparent; color:#fff; font-weight:600; box-shadow:0 2px 10px rgba(244,114,182,.4)}
.top-btn{display:flex; gap:8px}

/* ---------- VIEW: empty state (hero) ---------- */
.hero{text-align:center; padding:60px 20px}
.hero .big{font-size:2.6rem; margin:0 0 8px}
.hero .big span{color:var(--accent2)}
.hero p{color:var(--muted); max-width:480px; margin:0 auto 22px}
.hero .cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:14px;
  max-width:680px;
  margin:22px auto 0;
  text-align:left;
}
.hero .card{background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:16px}
.hero .card h3{margin:0 0 6px}
.hero .card p{margin:0; color:var(--muted); font-size:.9rem}

/* ---------- VIEW: list of posts ---------- */
.post-list{display:flex; flex-direction:column; gap:14px}
.post-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px 20px;
  cursor:pointer;
  transition:.15s;
}
.post-card:hover{border-color:var(--accent); transform:translateY(-2px)}
.post-card h3{margin:0 0 6px; color:var(--ink)}
.post-card .meta{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  font-size:.8rem;
  color:var(--muted);
}
.post-card .excerpt{color:var(--muted); margin:10px 0 0; font-size:.92rem}
.tag{
  background:var(--panel2);
  border:1px solid var(--border);
  padding:2px 9px;
  border-radius:20px;
  font-size:.75rem;
  color:var(--accent);
}
.view-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:18px;
  flex-wrap:wrap;
  gap:10px;
}
.view-head h2{margin:0}

/* ---------- VIEW: editor ---------- */
.editor-wrap{display:grid; grid-template-columns:1fr 1fr; gap:14px}
@media(max-width:760px){ .editor-wrap{grid-template-columns:1fr} }
.col h3{
  margin:0 0 8px;
  font-size:.85rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:1px;
}
textarea{
  width:100%;
  height:420px;
  resize:vertical;
  background:var(--panel);
  color:var(--ink);
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px;
  font-family:"Cascadia Code","Fira Code",monospace;
  font-size:.95rem;
  line-height:1.5;
}
textarea:focus{outline:none; border-color:var(--accent)}
.fields{display:flex; gap:10px; margin-bottom:12px; flex-wrap:wrap}
.fields input{
  flex:1;
  min-width:160px;
  background:var(--panel);
  border:1px solid var(--border);
  color:var(--ink);
  padding:10px 12px;
  border-radius:9px;
  font-size:.95rem;
  font-family:inherit;
}
.fields input:focus{outline:none; border-color:var(--accent)}
.editor-btns{display:flex; gap:8px; margin-top:12px; flex-wrap:wrap}

/* ---------- RENDERED blog article ---------- */
.article{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:26px 30px;
  line-height:1.7;
}
.article .post-title{font-size:1.9rem; margin:0 0 6px}
.article .post-meta{color:var(--muted); font-size:.85rem; margin-bottom:18px}
.article h2{font-size:1.35rem; margin:26px 0 8px; color:var(--accent2)}
.article h3{font-size:1.1rem; margin:20px 0 6px}
.article p{margin:10px 0}
.article a{color:var(--accent)}
.article code{background:var(--panel2); padding:2px 6px; border-radius:5px; font-size:.9em}
.article pre{background:#0b0e1c; border:1px solid var(--border); border-radius:10px; padding:14px; overflow-x:auto}
.article pre code{background:none; padding:0}
.article blockquote{border-left:3px solid var(--accent); margin:12px 0; padding:4px 16px; color:var(--muted)}
.article ul,.article ol{padding-left:22px}
.article li{margin:4px 0}
.article img{max-width:100%; border-radius:10px}
.article hr{border:none; border-top:1px solid var(--border); margin:20px 0}
.article table{border-collapse:collapse; margin:14px 0}
.article th,.article td{border:1px solid var(--border); padding:6px 12px}
.article th{background:var(--panel2)}
.back-btn{display:inline-flex; align-items:center; gap:6px; margin-bottom:16px}

/* ---------- toast (pop-up message) ---------- */
.toast{
  position:fixed;
  bottom:22px;
  left:50%;
  transform:translateX(-50%);
  background:var(--good);
  color:#0b1b12;
  font-weight:600;
  padding:11px 20px;
  border-radius:10px;
  opacity:0;
  transition:.3s;
  pointer-events:none;
  box-shadow:0 6px 20px rgba(0,0,0,.4);
}
.toast.show{opacity:1; bottom:30px}

/* ---------- Cheat sheet panel (in the editor) ---------- */
.cheatsheet{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px 18px;
  margin-bottom:14px;
}
.cheatsheet h3{margin:0 0 12px; color:var(--accent2)}
.cs-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(230px,1fr));
  gap:10px;
}
.cs-card{
  background:var(--panel2);
  border:1px solid var(--border);
  border-radius:9px;
  padding:10px 12px;
}
.cs-card b{color:var(--accent); font-family:monospace; font-size:.85rem}
.cs-card p{margin:4px 0 0; color:var(--muted); font-size:.85rem}
.cs-card a{color:var(--accent)}
.cs-card s{color:var(--muted)}
.cs-card mark{background:rgba(108,140,255,.25); color:var(--ink); padding:0 3px; border-radius:3px}
.cs-sub{font-size:.75rem; color:var(--muted); font-weight:400}
.cs-card.cs-heading{grid-column:1 / -1}
.cs-card.cs-wide{grid-column:span 2}
.cs-code{background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:8px 10px; margin:8px 0 0; font-family:monospace; font-size:.75rem; line-height:1.5; overflow-x:auto}

/* ---------- New markdown element styles in the article ---------- */
.article mark{background:rgba(108,140,255,.25); color:var(--ink); padding:0 4px; border-radius:4px}
.article sub,.article sup{font-size:.72em}
.article li.task{list-style:none; margin-left:-18px}
.article li.task input{accent-color:var(--accent); margin-right:8px}
.article dl{margin:12px 0}
.article dl dt{font-weight:600; color:var(--accent2)}
.article dl dd{margin:2px 0 8px; padding-left:16px; color:var(--muted)}
/* footnotes */
.article .fn a{color:var(--accent2); text-decoration:none}
.article .footnotes{margin-top:26px; font-size:.9rem; color:var(--muted)}
.article .footnotes ol{padding-left:22px}
.article .footnotes li{margin:4px 0}
.article .fn-back{text-decoration:none; margin-left:4px}
