/* ============================================================
   aymaneelouafi.me — minimal dark theme
   Change the colors here once and they apply everywhere.
   ============================================================ */
:root {
  --bg:        #0c0d10;
  --surface:   #14161a;
  --surface-2: #191c21;
  --border:    #23262d;
  --text:      #e7e9ec;
  --muted:     #8b929b;
  --faint:     #5f666f;
  --accent:    #5bc490;   /* the one accent — a calm terminal green */
  --accent-dim: rgba(91, 196, 144, 0.12);

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --maxw: 720px;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* ===== TOP BAR ===== */
.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 24px 0;
}
.topbar-home {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}
.topbar-home:hover { color: var(--accent); text-decoration: none; }
.menu-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
}
.menu-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ===== LAYOUT ===== */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 24px 90px;
}

/* ===== HOME: INTRO ===== */
.prompt {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--faint);
  margin: 0 0 18px;
}
.prompt .accent, .accent { color: var(--accent); }

.intro h1 {
  font-size: 2.6rem;
  margin: 0 0 6px;
}
.role {
  font-family: var(--mono);
  color: var(--accent);
  margin: 0 0 24px;
  font-size: 1rem;
}
.bio {
  color: var(--muted);
  max-width: 42rem;
  margin: 0 0 24px;
}
.bio a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.bio a:hover { text-decoration-color: var(--accent); }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 24px;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
}

.links {
  display: flex;
  gap: 20px;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* divider before the notes list */
.blog {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  padding-top: 36px;
}
.blog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.blog-head h2 { font-size: 1.1rem; margin: 0; color: var(--text); }

/* ===== SEARCH ===== */
.search {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 8px;
  outline: none;
  width: 240px;
  max-width: 100%;
}
.search::placeholder { color: var(--faint); }
.search:focus { border-color: var(--accent); }
.no-results { color: var(--muted); font-family: var(--mono); font-size: 0.9rem; }

/* ===== POST LIST ===== */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { border-top: 1px solid var(--border); }
.post-list li:first-child { border-top: none; }
.post-list a {
  display: block;
  padding: 20px 4px;
  color: var(--text);
}
.post-list a:hover { text-decoration: none; }
.post-list a:hover .post-title { color: var(--accent); }

.series-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.post-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  transition: color 0.15s;
}
.post-desc { color: var(--muted); font-size: 0.95rem; margin: 4px 0; }
.post-meta { color: var(--faint); font-family: var(--mono); font-size: 0.78rem; margin-top: 6px; }
.post-match {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 6px 0 2px;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}
mark { background: var(--accent-dim); color: var(--accent); padding: 0 2px; border-radius: 2px; }

/* ===== FOOTER ===== */
footer {
  margin-top: 70px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.foot-links { display: flex; gap: 16px; }

/* ============================================================
   SIDE MENU
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  z-index: 25;
  width: var(--sidebar-w);
  height: 100vh;
  background: #0e0f13;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.sidebar-inner { padding: 26px 20px 60px; }
.sidebar-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 16px;
}

.nav-phase { border-top: 1px solid var(--border); padding: 6px 0; }
.nav-phase > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
}
.nav-phase > summary::-webkit-details-marker { display: none; }
.nav-phase > summary:hover { color: var(--accent); }
.nav-num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  min-width: 14px;
}
.nav-walk > summary { color: var(--accent); }
.nav-walk .nav-num { color: var(--accent); }
.nav-projects > summary { color: var(--text); }
.nav-projects .nav-num { color: var(--accent); }

.nav-section { margin: 4px 0 10px 8px; }
.nav-sec-title {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 10px 0 4px;
}
.nav-section.empty .nav-sec-title { opacity: 0.6; }
.nav-section ul { list-style: none; margin: 0; padding-left: 10px; }
.nav-section li { margin: 2px 0; }
.nav-section li.empty { color: var(--faint); font-family: var(--mono); font-size: 0.82rem; }
.nav-section a {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--border);
}
.nav-section a:hover { color: var(--text); text-decoration: none; border-left-color: var(--faint); }
.nav-section a.current {
  color: var(--accent);
  border-left-color: var(--accent);
}

.backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 24;
  background: rgba(0, 0, 0, 0.55);
}

/* wide screens: sidebar pinned, content shifts right */
@media (min-width: 1080px) {
  body { padding-left: var(--sidebar-w); }
  .menu-toggle { display: none; }
}
/* narrow screens: sidebar becomes a drawer */
@media (max-width: 1079px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .backdrop { display: block; }
  .sidebar-inner { padding-top: 72px; }
}

/* ============================================================
   POST PAGE
   ============================================================ */
.back {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.back:hover { color: var(--accent); text-decoration: none; }

.post > .series-label { margin-top: 26px; }

.post h1 {
  font-size: 2rem;
  margin: 14px 0 8px;
}
.post > .post-meta { margin-bottom: 26px; }

/* in-post search */
.post-search { width: 100%; margin: 20px 0 6px; }
.search-count { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); margin: 0 0 10px; }
.post mark.hl { background: var(--accent-dim); color: var(--accent); }
.post mark.hl.active {
  background: var(--accent);
  color: #0c0d10;
  scroll-margin-top: 24px;
}

/* cheat sheet */
.cheatsheet {
  margin: 10px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.cheatsheet summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cheatsheet summary::-webkit-details-marker { display: none; }
.cheatsheet summary:hover { color: var(--accent); }
.cheatsheet .arrow { color: var(--accent); transition: transform 0.2s; display: inline-block; }
.cheatsheet[open] .arrow { transform: rotate(90deg); }
.cheat-body { padding: 4px 16px 14px; border-top: 1px solid var(--border); }
.cheat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.cheat-row:last-child { border-bottom: none; }
.cheat-row code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  background: none;
  padding: 0;
  cursor: pointer;
}
.cheat-row code:hover { text-decoration: underline; }
.cheat-row span { color: var(--muted); font-size: 0.88rem; }
.copied { color: var(--accent); font-size: 0.8rem; font-family: var(--mono); }

/* table of contents */
.toc {
  margin: 26px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  background: var(--surface);
}
.toc .prompt { margin: 0 0 8px; color: var(--faint); }
.toc ul { margin: 0; padding-left: 18px; }
.toc li { margin: 4px 0; }
.toc a { color: var(--muted); font-family: var(--mono); font-size: 0.9rem; }
.toc a:hover { color: var(--accent); }

/* series box */
.series {
  margin-top: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  background: var(--surface);
}
.series .prompt { margin: 0 0 8px; }
.series ul { margin: 0; padding-left: 18px; }
.series li { margin: 4px 0; }
.series a { font-family: var(--mono); font-size: 0.9rem; }
.series .current { color: var(--accent); font-family: var(--mono); font-size: 0.9rem; }

/* ===== ARTICLE TYPOGRAPHY ===== */
.post article { font-size: 1rem; }
.post article h2 {
  font-size: 1.45rem;
  margin: 56px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.post article h3 {
  font-size: 1.12rem;
  color: var(--text);
  margin: 34px 0 10px;
}
.post article h3::before { content: "# "; color: var(--accent); }
.post article h4 { font-size: 1rem; color: var(--muted); margin: 24px 0 8px; }

.post article p { color: #d4d7db; }
.post article ul, .post article ol { color: #d4d7db; padding-left: 22px; }
.post article li { margin: 5px 0; }
.post article a { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.post article a:hover { text-decoration-color: var(--accent); }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  color: #cfe8d8;
  padding: 2px 6px;
  border-radius: 4px;
}

pre {
  background: #0a0b0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
pre::-webkit-scrollbar { height: 8px; }
pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
pre code { background: none; color: #c9cdd2; padding: 0; font-size: inherit; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  display: block;
  overflow-x: auto;
  font-size: 0.9rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
th, td { padding: 9px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface); color: var(--text); font-weight: 600; }
td:last-child { min-width: 230px; }
td code { white-space: nowrap; }

blockquote {
  margin: 20px 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
}
blockquote p { color: var(--muted) !important; }

hr { border: none; border-top: 1px solid var(--border); margin: 48px 0; }

.post article img {
  display: block;
  max-width: 100%;
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: zoom-in;
}
.post a:hover img { border-color: var(--accent); }

/* ===== PDF / PROJECT DOWNLOADS ===== */
.pdf-actions { margin: 22px 0; }
.pdf-button {
  display: inline-block;
  background: var(--accent);
  color: #0c0d10;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 8px;
}
.pdf-button:hover { text-decoration: none; filter: brightness(1.08); }

.pdf-view {
  width: 100%;
  height: 80vh;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  margin-top: 12px;
}

/* long words never force a horizontal scrollbar on the page */
p, li { overflow-wrap: anywhere; }

/* ===== PHONES ===== */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .container { padding: 36px 18px 70px; }
  .intro h1 { font-size: 2rem; }
  .post h1 { font-size: 1.6rem; }
  .post article h2 { font-size: 1.25rem; margin-top: 40px; }
  .post article h3 { font-size: 1.05rem; }
  pre { font-size: 0.78rem; padding: 12px; }
  table { font-size: 0.82rem; }
  th, td { padding: 6px 9px; }
  .cheat-row { flex-direction: column; gap: 2px; }
  .blog-head { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
}
