:root{
  --white: #ffffff;
  --black: #111111;
  --grey-900: #1a1a1a;
  --grey-600: #6b6b6b;
  --grey-400: #a3a3a3;
  --grey-200: #e5e5e5;
  --grey-100: #f2f2f2;
  --max-width: 860px;
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; }

::selection{
  background: var(--grey-900);
  color: var(--white);
}

:focus-visible{
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

button{ font-family: inherit; }

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

/* ---------- Header ---------- */

header.site{
  padding: 2.75rem 0 2.25rem;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
}

.header-text{ min-width: 0; }

h1.name{
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

h1.name a{ text-decoration: none; }

p.tagline{
  color: var(--grey-600);
  font-size: 1rem;
  margin: 0;
  max-width: 42ch;
}

nav.site{
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  flex-shrink: 0;
  padding-top: 0.3rem;
}

nav.site a, nav.site button.icon-link{
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--grey-600);
  background: none;
  border: none;
  padding: 0 0 2px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

nav.site a:hover, nav.site a:focus-visible,
nav.site button.icon-link:hover, nav.site button.icon-link:focus-visible{
  color: var(--black);
  border-bottom-color: var(--black);
}

nav.site svg{
  width: 17px;
  height: 17px;
  fill: currentColor;
  display: block;
}

nav.site svg.icon-stroke{ fill: none; }

nav.site a.icon-only, nav.site button.icon-link{
  padding-bottom: 0;
  border-bottom: none;
}

/* ---------- Layout: sidebar + entries ---------- */

.layout{
  display: flex;
  align-items: flex-start;
  gap: 2.75rem;
  padding: 3rem 0 5rem;
}

.sidebar-nav{
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: sticky;
  top: 10rem;
  z-index: 10;
  width: 128px;
  flex-shrink: 0;
}

.sidebar-nav a{
  font-size: 0.85rem;
  color: var(--grey-600);
  text-decoration: none;
}

.sidebar-nav a:hover{ color: var(--black); }
.sidebar-nav a.active{ color: var(--black); font-weight: 600; }

.entries-col{
  flex: 1;
  min-width: 0;
  max-width: 620px;
}

@media (max-width: 760px){
  .layout{
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 2.25rem;
  }
  .sidebar-nav{
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    gap: 1.4rem;
    position: sticky;
    top: 10rem;
    z-index: 40;
    background: var(--white);
    padding: 0.6rem 0 0.7rem;
    border-bottom: 1px solid var(--grey-200);
  }
  .sidebar-nav a{ flex-shrink: 0; }
  .entries-col{ max-width: none; }
}

@media (max-width: 480px){
  .sidebar-nav{ top: 13.5rem; }
}

/* ---------- Entries ---------- */

.entry{
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--grey-200);
}

.entry:first-child{ padding-top: 0; }
.entry:last-child{ border-bottom: none; }

.entry-date{
  display: block;
  font-size: 0.85rem;
  color: var(--grey-400);
  margin-bottom: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.entry h2{
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}

.entry h2 a{ text-decoration: none; }
.entry h2 a:hover{ text-decoration: underline; }

.entry p{
  margin: 0 0 0.9rem;
  color: var(--grey-900);
  max-width: 58ch;
}

.entry p:last-of-type{ margin-bottom: 0; }

.empty{
  padding: 2.5rem 0;
  color: var(--grey-400);
  font-size: 0.95rem;
}

/* ---------- Share row ---------- */

.entry-share{
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.15rem;
}

.entry-share a{
  display: inline-flex;
  color: var(--grey-400);
  text-decoration: none;
  transition: color 0.15s ease;
}

.entry-share a:hover{ color: var(--black); }

.entry-share svg{
  width: 15px;
  height: 15px;
  display: block;
}

/* ---------- Pagination ---------- */

.pagination{
  display: flex;
  justify-content: space-between;
  padding-top: 0.5rem;
  font-size: 0.88rem;
}

.pagination a{
  text-decoration: none;
  color: var(--grey-600);
}

.pagination a:hover{ color: var(--black); }

.pagination .disabled{
  color: var(--grey-400);
  pointer-events: none;
}

/* ---------- Single post page ---------- */

.back-link{
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--grey-600);
  text-decoration: none;
  margin-bottom: 1.75rem;
}

.back-link:hover{ color: var(--black); }
.back-link svg{ width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Footer ---------- */

footer.site{
  border-top: 1px solid var(--grey-200);
  padding: 1.75rem 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--grey-400);
}

.powered-by{
  padding: 0 0 3rem;
  display: flex;
}

.powered-by img{ display: block; }

@media (max-width: 480px){
  header.site{
    flex-direction: column;
    align-items: flex-start;
    padding: 2.25rem 0 1.75rem;
  }
  nav.site{ padding-top: 0; margin-top: 1.25rem; }
  footer.site{
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

/* ---------- Contact modal ---------- */

.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.modal-overlay.is-open{
  opacity: 1;
  pointer-events: auto;
}

.modal-card{
  background: var(--white);
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 12px 40px rgba(17,17,17,0.18);
  transform: translateY(6px);
  transition: transform 0.15s ease;
}

.modal-overlay.is-open .modal-card{ transform: translateY(0); }

.modal-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.modal-head h3{
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-close{
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-400);
  padding: 0.2rem;
  line-height: 1;
}

.modal-close:hover{ color: var(--black); }

.modal-close svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.field{ margin-bottom: 1rem; }

.field label{
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--grey-600);
  margin-bottom: 0.35rem;
}

.field input, .field textarea{
  width: 100%;
  border: 1px solid var(--grey-200);
  border-radius: 5px;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--black);
  background: var(--white);
}

.field input:focus, .field textarea:focus{
  outline: none;
  border-color: var(--black);
}

.field textarea{ resize: vertical; min-height: 100px; }

.modal-submit{
  width: 100%;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.25rem;
  transition: background 0.15s ease;
}

.modal-submit:hover{ background: var(--grey-900); }
.modal-submit:disabled{ background: var(--grey-400); cursor: not-allowed; }

.modal-status{
  font-size: 0.85rem;
  margin-top: 0.9rem;
  display: none;
}

.modal-status.is-visible{ display: block; }
.modal-status.success{ color: #1a7a3c; }
.modal-status.error{ color: #b3261e; }
