/* ============================================================================
   Public blog theme — Medium-inspired, reading-first, code-forward.
   (Admin uses Bootstrap via _Layout; this file styles only the public site.)
   ========================================================================== */

:root {
  --bg: #ffffff;
  --text: #242424;
  --muted: #6b6b6b;
  --faint: #99999e;
  --border: #ececec;
  --accent: #1a8917;            /* links/tags accent */
  --accent-weak: #e8f3e8;
  --code-bg: #0d1117;           /* GitHub-dark, matches highlight.js github-dark */
  --code-text: #e6edf3;
  --inline-code-bg: #f2f3f5;
  --maxw: 720px;
  --headerw: 1100px;

  --serif: "Source Serif Pro", Georgia, Cambria, "Times New Roman", Times, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); }

/* ---- Header ---------------------------------------------------------------*/
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  position: relative;
  max-width: var(--headerw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
}
.brand {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }

.search { display: flex; align-items: center; margin-left: auto; }
.search input {
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f7f7f7;
  width: 220px;
  max-width: 46vw;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.search input:focus { background: #fff; border-color: #cfcfcf; }
.search button { display: none; }   /* submit on Enter; keeps the bar clean */

/* ---- Layout ---------------------------------------------------------------*/
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }
/* Listing pages (e.g. home) widen to the header width so content fills the page
   instead of sitting in a narrow reading column. */
.container--wide { max-width: var(--headerw); }
main { padding: 3.5rem 0 5rem; }

/* ---- Cookie consent banner ------------------------------------------------*/
.cookie-banner {
  position: fixed;
  left: 1rem; right: 1rem; bottom: 1rem;
  z-index: 40;
  max-width: var(--headerw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  background: #242424;
  color: #f3f3f3;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  font-family: var(--sans);
}
.cookie-banner__text { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.cookie-banner__text a { color: #9ad79a; text-decoration: underline; }
.cookie-banner__accept {
  flex: 0 0 auto;
  font-family: var(--sans); font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
  padding: 0.55rem 1.4rem;
  border: none; border-radius: 999px;
  background: #fff; color: #242424;
}
.cookie-banner__accept:hover { background: #e9e9e9; }
@media (max-width: 640px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #111;
}

.page-title { font-size: 2rem; margin: 0 0 0.4rem; }
.page-subtitle { font-family: var(--sans); color: var(--muted); font-size: 1rem; margin: 0 0 2.5rem; }
.empty { color: var(--muted); font-family: var(--sans); }

/* ---- Post list ------------------------------------------------------------*/
.post-card { padding-bottom: 2.25rem; margin-bottom: 2.25rem; border-bottom: 1px solid var(--border); }
.post-card:last-of-type { border-bottom: none; }
.post-card__title { font-size: 1.65rem; margin: 0 0 0.4rem; }
.post-card__title a { color: inherit; text-decoration: none; }
.post-card__title a:hover { color: inherit; text-decoration: underline; }
.post-card__meta { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin: 0 0 0.7rem; }
.post-card__excerpt { margin: 0 0 1rem; color: #333; font-size: 1.05rem; line-height: 1.6; }

/* ---- Single post ----------------------------------------------------------*/
.post__header { margin-bottom: 2.5rem; }
.post__title { font-size: 2.7rem; line-height: 1.12; margin: 0 0 1.1rem; letter-spacing: -0.03em; }
.post__meta { font-family: var(--sans); color: var(--muted); font-size: 0.95rem; }

/* Rendered markdown */
.prose { font-size: 1.25rem; line-height: 1.8; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.7rem; }
.prose h2 { font-size: 1.9rem; margin: 3rem 0 1rem; }
.prose h3 { font-size: 1.45rem; margin: 2.4rem 0 0.8rem; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: #c2c2c2; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 1.7rem; padding-left: 1.4rem; }
.prose li { margin: 0.45rem 0; }
.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.3rem;
  border-left: 3px solid var(--text);
  color: #4a4a4a;
  font-style: italic;
}
.prose img { max-width: 100%; height: auto; display: block; margin: 2.2rem auto; border-radius: 6px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 3rem auto; width: 40%; }
.prose table { width: 100%; border-collapse: collapse; font-size: 1rem; font-family: var(--sans); margin: 0 0 1.8rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.prose th { background: #fafafa; }

/* ---- Code (the technical focus) ------------------------------------------*/
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--inline-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  color: #b3261e;
}
.prose pre {
  font-family: var(--mono);
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 1.15rem 1.3rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 0 0 1.9rem;
  -webkit-font-smoothing: auto;
}
.prose pre code { font-family: inherit; background: none; padding: 0; font-size: 1em; color: inherit; }
/* highlight.js sets .hljs background; keep it consistent with the fallback */
.prose pre code.hljs { background: transparent; padding: 0; }

/* ---- Tags / footer of a post ---------------------------------------------*/
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; font-family: var(--sans); }
.tag {
  font-size: 0.8rem;
  color: #444;
  background: #f2f3f5;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tag:hover { background: var(--accent-weak); color: var(--accent); }
.tag--cat { background: #eef1f6; }
.post__footer { margin-top: 3rem; padding-top: 1.75rem; border-top: 1px solid var(--border); }

/* ---- Pager ----------------------------------------------------------------*/
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 2.5rem; font-family: var(--sans); font-size: 0.9rem; }
.pager a, .pager span { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager span.disabled { color: var(--faint); border-color: transparent; }
.pager .pager__status { border: none; color: var(--muted); }

/* ---- Footer ---------------------------------------------------------------*/
.site-footer { border-top: 1px solid var(--border); font-family: var(--sans); }
.site-footer__inner {
  max-width: var(--headerw);
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---- Primary nav (Home / Categories ▾ / Tags ▾) --------------------------*/
.nav { display: flex; align-items: center; flex: 1; gap: 1.25rem; margin-left: 2rem; font-family: var(--sans); font-size: 0.95rem; }
.nav__link { color: var(--text); text-decoration: none; font-weight: 500; cursor: pointer; white-space: nowrap; }
.nav__link:hover { color: var(--accent); }
.nav__item { position: relative; outline: none; }
.nav__menu {
  position: absolute; top: 100%; left: 0; margin-top: 0.4rem;
  min-width: 210px; max-height: 360px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1); padding: 0.4rem; display: none; z-index: 30;
}
.nav__item:hover .nav__menu, .nav__item:focus-within .nav__menu { display: block; }
.nav__menu a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.4rem 0.6rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 0.9rem; }
.nav__menu a:hover { background: #f5f7f5; color: var(--accent); }
.nav__count { color: var(--faint); font-size: 0.78rem; }
.nav__empty { display: block; padding: 0.4rem 0.6rem; color: var(--faint); font-size: 0.85rem; }

/* Hamburger toggle — hidden on desktop, shown below the nav breakpoint. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 38px;
  padding: 9px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle__bar { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.dot { color: var(--faint); margin: 0 0.35rem; }

/* ---- Post page: article + sidebar grid -----------------------------------*/
.post-shell { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 3.5rem; align-items: start; }
.post-main { min-width: 0; }

.sidebar { font-family: var(--sans); }
.sidebar__sticky { position: sticky; top: 5rem; }
.sidebar__section + .sidebar__section { margin-top: 2.25rem; padding-top: 2.25rem; border-top: 1px solid var(--border); }
.sidebar__title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 1.1rem; }
.sidebar__tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.sidebar__tags .tag { font-size: 0.78rem; }
.tag__count { color: var(--faint); font-size: 0.72rem; margin-left: 0.15rem; }
.sidebar__list { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.sidebar__list li { position: relative; margin: 0 0 1.1rem; padding-left: 1.7rem; counter-increment: top; }
.sidebar__list li::before { content: counter(top); position: absolute; left: 0; top: 0; color: var(--faint); font-weight: 700; font-size: 0.85rem; }
.sidebar__list a { display: block; color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.95rem; line-height: 1.35; }
.sidebar__list a:hover { color: var(--accent); }
.sidebar__date { display: block; color: var(--faint); font-size: 0.78rem; margin-top: 0.15rem; }
.sidebar__list li.is-current a { color: var(--accent); }

/* ---- Prev / next ----------------------------------------------------------*/
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.75rem; border-top: 1px solid var(--border); font-family: var(--sans); }
.post-nav__cell--right { text-align: right; }
.post-nav__link { display: inline-flex; flex-direction: column; gap: 0.25rem; text-decoration: none; color: var(--text); max-width: 100%; }
.post-nav__link--right { align-items: flex-end; }
.post-nav__link:hover .post-nav__title { color: var(--accent); }
.post-nav__dir { font-size: 0.78rem; color: var(--muted); }
.post-nav__title { font-weight: 600; line-height: 1.3; }

/* ---- Code copy button -----------------------------------------------------*/
.prose pre { position: relative; }
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  font-family: var(--sans); font-size: 0.72rem; color: #c9d1d9;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px; padding: 0.2rem 0.55rem; cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.prose pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.18); }

.site-footer__links a { margin: 0 0.15rem; }

/* ---- Work page: intro, experience timeline, project cards -----------------*/
.work-intro { font-family: var(--serif); font-size: 1.2rem; color: #444; line-height: 1.6; margin: 0.5rem 0 0; }
.work-section { margin-top: 3.5rem; }
.work-section__title { font-size: 1.5rem; margin: 0 0 1.5rem; }

.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 0.4rem; bottom: 0.4rem; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -1.75rem; top: 0.45rem;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 0 3px #fff;
}
.role__title { font-size: 1.2rem; margin: 0 0 0.2rem; }
.role__meta { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); margin: 0 0 0.6rem; }
.role__summary { font-family: var(--sans); font-size: 0.98rem; color: #333; margin: 0 0 0.6rem; line-height: 1.6; }
.role__highlights { font-family: var(--sans); font-size: 0.95rem; color: #444; margin: 0; padding-left: 1.2rem; }
.role__highlights li { margin: 0.3rem 0; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.project-card { border: 1px solid var(--border); border-radius: 12px; padding: 1.15rem 1.2rem; transition: box-shadow 0.15s, transform 0.15s; background: #fff; }
.project-card:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07); transform: translateY(-2px); }
.project-card__name { font-size: 1.1rem; margin: 0 0 0.4rem; }
.project-card__name a { color: var(--text); text-decoration: none; }
.project-card__name a:hover { color: var(--accent); }
.project-card__desc { font-family: var(--sans); font-size: 0.92rem; color: #444; line-height: 1.55; margin: 0 0 0.8rem; }
.project-card__tech { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { font-family: var(--sans); font-size: 0.72rem; color: #555; background: #f2f3f5; border-radius: 999px; padding: 0.2rem 0.55rem; }

/* ---- Responsive -----------------------------------------------------------*/
@media (max-width: 900px) {
  .post-shell { grid-template-columns: 1fr; gap: 0; }
  .sidebar { display: none; }
}

/* Collapse the primary nav into a hamburger-toggled panel. */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0.5rem 1rem 1rem;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
  }
  .nav.is-open { display: flex; }

  .nav > .nav__link,
  .nav__item > .nav__link { display: block; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--border); }

  /* Categories: expand the list inline instead of relying on a hover dropdown. */
  .nav__item { position: static; width: 100%; }
  .nav__menu {
    position: static; display: block; margin: 0 0 0.25rem;
    min-width: 0; max-height: none; overflow: visible;
    border: none; border-radius: 0; box-shadow: none; padding: 0.25rem 0 0.5rem 0.75rem;
  }

  .search { display: flex; width: 100%; margin: 0.75rem 0 0; }
  .search input { width: 100%; max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  .post__title { font-size: 2rem; }
  .prose { font-size: 1.15rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__cell--right, .post-nav__link--right { text-align: left; align-items: flex-start; }
}
