/* Hyde-like theme for Pelican — sidebar, content, cards */

@import url("https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400&family=Palatino+Linotype&display=swap");

* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
html {
  font-family: "PT Sans", "Trebuchet MS", "Lucida Grande", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
@media (min-width: 48em) {
  html { font-size: 16px; }
}
@media (min-width: 58em) {
  html { font-size: 20px; }
}
body {
  color: #515151;
  background: #fff;
  -webkit-text-size-adjust: 100%;
}

a {
  color: #268bd2;
  text-decoration: none;
}
a:hover, a:focus {
  text-decoration: underline;
}

/* Sidebar */
.sidebar {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255,255,255,.5);
  background-color: #202020;
}
@media (min-width: 48em) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 18rem;
    text-align: left;
    /* Column flex rather than absolutely positioning the nav block against the
       bottom edge. The old approach let the nav grow upward into the portrait:
       below roughly 870px of viewport height the name overlapped the photo
       outright (at 1440x800, a stock 13" laptop, by ~38px). Here the nav is
       pushed to the bottom only when there is room to spare, and once there
       is not, everything stacks in flow and the sidebar scrolls instead. */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
}
.sidebar a {
  color: #fff;
}
.sidebar-about h1,
.sidebar-about .site-title {
  color: #fff;
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 3.25rem;
  font-weight: 600;
  /* The name wraps to two lines in an 18rem sidebar. At 3.25rem the default
     1.25 leading left the two lines drifting apart; display type wants tighter
     leading and slightly negative tracking than body copy. This also shortens
     .sidebar-sticky, which is bottom-anchored on desktop and therefore grows
     upward — so tightening here widens the gap to the portrait above. */
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-rendering: optimizeLegibility;
}
.sidebar-about .site-title a {
  color: inherit;
}
.sidebar .lead {
  margin-bottom: 1rem;
}
.sidebar-nav {
  margin-bottom: 1rem;
}
.sidebar-nav-item {
  display: block;
  line-height: 1.75;
}
.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  font-weight: bold;
  text-decoration: underline;
}
@media (min-width: 48em) {
  .sidebar-sticky {
    /* Consumes leftover vertical space so the nav sits at the bottom on tall
       screens, and collapses to nothing on short ones — where the portrait's
       own 2rem margin then sets the minimum gap. Replaces position:absolute,
       which could not yield and so overlapped the portrait. */
    margin-top: auto;
  }
}

.sidebar-portrait {
  position: relative;
  width: 250px;
  height: 250px;
  /* The sidebar is a flex column on desktop; without this the circle gets
     squashed into an ellipse when vertical space runs short. */
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  /* Portrait-to-name gap. Was 1rem, which read as crowded against the display
     name below it; this is a modest bump, not a wholesale change of the
     sidebar's proportions. */
  margin: 0 auto 2rem;
  display: block;
}
.sidebar-portrait img {
  width: 100%;
  height: auto;
}
@media (min-width: 48em) {
  .sidebar-portrait {
    margin-left: auto;
    margin-right: auto;
  }
}

.themed .sidebar {
  background-color: #202020;
}
.themed .content a {
  color: #268bd2;
}

/* Main content */
.container {
  padding-left: 1rem;
  padding-right: 1rem;
}
.content {
  padding-top: 4rem;
  padding-bottom: 4rem;
}
@media (min-width: 48em) {
  .content {
    max-width: 42rem;
    margin-left: 20rem;
    margin-right: 2rem;
  }
}
@media (min-width: 64em) {
  .content {
    margin-left: 22rem;
    margin-right: 4rem;
  }
}

/* Page / post */
.page, .post {
  margin-bottom: 1em;
}
.page li + li,
.post li + li {
  margin-top: 0.25rem;
}

/* Lists (match Poole/Hyde typography) */
.page ul,
.page ol,
.page dl,
.post ul,
.post ol,
.post dl {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.post ul,
.page ul {
  list-style-type: disc;
}
.post ol,
.page ol {
  list-style-type: decimal;
}
.post dl,
.page dl {
  padding-left: 0;
}
.post dt,
.page dt {
  font-weight: bold;
}
.post dd,
.page dd {
  margin-bottom: 0.5rem;
  margin-left: 1.5rem;
}

.page-title, .post-title {
  color: #303030;
  margin-top: 0;
}
.landing-intro {
  margin-bottom: 1.5rem;
}
.landing-intro p {
  margin-top: 0;
  margin-bottom: 1rem;
}
.landing-intro p:last-child {
  margin-bottom: 0;
}
.post-date {
  display: block;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  color: #9a9a9a;
  font-size: 0.9rem;
}
.section-subheader {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: #303030;
}

/* Card grid (project cards) */
.card-grid {
  display: grid;
  grid-template-columns: 10em 1fr;
  grid-gap: 0.5em;
  background-color: #f9f9f9;
  align-items: center;
  border: 0.15em solid #e5e5e5;
  border-radius: 5px;
  padding: 0.5em;
  margin: 0.5em 0;
}
.card-element {
  padding: 0.2em;
}
.card-element.card-image img {
  margin: 0;
  max-width: 100%;
  border-radius: 3px;
}
.card-element.card-text {
  font-size: 85%;
}

/* Related posts */
.related {
  padding-top: 2em;
  border-top: 1px solid #eee;
}
.related h2 {
  margin-top: 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
}
.pagination-item.older.disabled,
.pagination-item.newer.disabled {
  color: #999;
  cursor: default;
}

/* Code */
pre, code {
  font-family: "Ubuntu Mono", Monaco, Consolas, monospace;
  font-size: 85%;
  background: #f4f4f4;
  border-radius: 3px;
}
pre {
  padding: 1em;
  overflow-x: auto;
}
code {
  padding: 0.2em 0.4em;
}
pre code {
  padding: 0;
  background: none;
}

/* Syntax highlighting (Pygments / codehilite – same as Poole/Hyde) */
.highlight {
  margin: 1em 0;
  background: #f8f8f8;
  border-radius: 3px;
  line-height: 1.4;
}
.highlight pre {
  margin: 0;
  padding: 1em;
  background: transparent;
  border: 0;
}
.highlight pre code {
  background: transparent;
}
.highlight .hll { background-color: #ffc; }
.highlight .c { color: #999; }   /* Comment */
.highlight .err { color: #a00; background-color: #faa; }
.highlight .k { color: #069; }   /* Keyword */
.highlight .o { color: #555; }   /* Operator */
.highlight .cm { color: #09f; font-style: italic; }  /* Comment.Multiline */
.highlight .cp { color: #099; }  /* Comment.Preproc */
.highlight .c1 { color: #999; }  /* Comment.Single */
.highlight .cs { color: #999; }  /* Comment.Special */
.highlight .gd { background-color: #fcc; border: 1px solid #c00; }
.highlight .ge { font-style: italic; }
.highlight .gr { color: #f00; }
.highlight .gh { color: #030; }
.highlight .gi { background-color: #cfc; border: 1px solid #0c0; }
.highlight .go { color: #aaa; }
.highlight .gp { color: #009; }
.highlight .gs { font-weight: bold; }
.highlight .gu { color: #030; }
.highlight .gt { color: #9c6; }
.highlight .kc { color: #069; }  /* Keyword.Constant */
.highlight .kd { color: #069; }  /* Keyword.Declaration */
.highlight .kn { color: #069; }  /* Keyword.Namespace */
.highlight .kp { color: #069; }
.highlight .kr { color: #069; }  /* Keyword.Reserved */
.highlight .kt { color: #078; }  /* Keyword.Type */
.highlight .m { color: #f60; }   /* Literal.Number */
.highlight .s { color: #d44950; } /* Literal.String */
.highlight .na { color: #4f9fcf; }
.highlight .nb { color: #366; }  /* Name.Builtin */
.highlight .nc { color: #0a8; }  /* Name.Class */
.highlight .no { color: #360; }
.highlight .nd { color: #99f; }
.highlight .ni { color: #999; }
.highlight .ne { color: #c00; }
.highlight .nf { color: #c0f; }  /* Name.Function */
.highlight .nl { color: #99f; }
.highlight .nn { color: #0cf; }
.highlight .nt { color: #2f6f9f; }
.highlight .nv { color: #033; }  /* Name.Variable */
.highlight .ow { color: #000; }
.highlight .w { color: #bbb; }
.highlight .mf { color: #f60; }
.highlight .mh { color: #f60; }
.highlight .mi { color: #f60; }  /* Literal.Number.Integer */
.highlight .mo { color: #f60; }
.highlight .sb { color: #c30; }
.highlight .sc { color: #c30; }
.highlight .sd { color: #c30; font-style: italic; }
.highlight .s2 { color: #c30; }  /* Literal.String.Double */
.highlight .se { color: #c30; }  /* String.Escape */
.highlight .sh { color: #c30; }
.highlight .si { color: #a00; }
.highlight .sx { color: #c30; }
.highlight .sr { color: #3aa; }
.highlight .s1 { color: #c30; }  /* Literal.String.Single */
.highlight .ss { color: #fc3; }
.highlight .bp { color: #366; }
.highlight .vc { color: #033; }
.highlight .vg { color: #033; }
.highlight .vi { color: #033; }
.highlight .il { color: #f60; }

/* Images in content */
article img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}
figure {
  margin: 1em 0;
}
figure img {
  margin: 0 0 0.5rem;
  display: block;
  margin-left: auto; /* Distribute available left space automatically */
  margin-right: auto; /* Distribute available right space automatically */
}
figcaption {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  font-style: italic;
}
