/* ==========================================================
   Layout
   ========================================================== */

body {
  font-family: Georgia, serif;
  background: #faf9f5;
  color: #111;
  line-height: 1.8;
  margin: 0;
}

.page {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 80px;

  max-width: 1400px;
  margin: 0 auto;
  padding: 40px;
}

.sidebar {
  position: sticky;
  top: 40px;
  align-self: start;
}

main {
  max-width: 800px;
}


/* ==========================================================
   Typography
   ========================================================== */

.site-title {
  margin-bottom: 50px;
  padding-bottom: 18px;

  border-bottom: 1px solid #d7d2c6;
}

.site-title a {
  text-decoration: none;
  color: #7A8A57;

  font-size: 1.25rem;
  font-weight: normal;

  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.site-title a:hover {
  color: #7A8A57;
}

h1 {
  font-size: 4rem;
  font-weight: normal;
  line-height: 1.1;
}

h2 {
  margin-top: 3rem;
}

p {
  max-width: 700px;
}


/* ==========================================================
   Navigation
   ========================================================== */

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar nav a {
  text-decoration: none;
  color: #666;
  transition: color 0.2s ease;
}

.sidebar nav a:hover {
  color: #111;
}


/* Section containing submenu */

.menu-section {
  display: flex;
  flex-direction: column;
}

/* Permanent submenu */

.submenu {
  display: flex;
  flex-direction: column;

  margin-top: 8px;
  margin-left: 20px;
  gap: 6px;
}

.submenu a {
  font-size: 0.9rem;
  color: #888;
  letter-spacing: 0.02em;
}

.submenu a:hover {
  color: #111;
}

.submenu a::before {
  content: "— ";
}

/* Links in page content */

main a {
  color: #73805D;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

main a:hover {
  color: #3E4638;
  border-bottom-color: #3E4638;
}


/* ==========================================================
   Code
   ========================================================== */

pre.highlight {
  position: relative;

  background: #f4f2eb;
  border: 1px solid #d7d2c6;
  border-left: 4px solid #7A8A57;

  border-radius: 2px;

  padding: 1.25rem 1.5rem;
  margin: 2rem 0;

  overflow-x: auto;

  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.65;
}

pre.highlight code {
  background: transparent;
  border: none;
  padding: 0;

  font-family: inherit;
  font-size: inherit;
}

code {
  font-family: "Courier New", monospace;
}

/* Inline code */

p code,
li code {
  background: #f2f0ea;
  border: 1px solid #ddd8cc;

  padding: 2px 5px;

  border-radius: 2px;

  font-size: 0.9em;
}

/* ==========================================================
   Figures
   ========================================================== */

img {
  display: block;
  max-width: 100%;
  height: auto;

  margin: 2.5rem auto;
}

figure {
  margin: 3rem 0;
}

figcaption {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  font-style: italic;
}


/* ==========================================================
   Rouge syntax highlighting
   Werner × RStudio
   ========================================================== */

/* Comments ------------------------------------------------ */

.highlight .c,
.highlight .c1,
.highlight .cm {
    color: #8A8479;
    font-style: italic;
}

/* Keywords ------------------------------------------------ */

.highlight .k,
.highlight .kr,
.highlight .kd,
.highlight .kn {
    color: #6F8452;
    font-weight: bold;
}

/* Function names ------------------------------------------ */

.highlight .nf {
    color: #4C6F7A;
}

/* Package / namespace ------------------------------------- */

.highlight .nn {
    color: #7A5A73;
}

/* Strings ------------------------------------------------- */

.highlight .s,
.highlight .s1,
.highlight .s2 {
    color: #A55C34;
}

/* Numbers ------------------------------------------------- */

.highlight .m,
.highlight .mi,
.highlight .mf {
    color: #B28A2E;
}

/* Constants ----------------------------------------------- */

.highlight .kc,
.highlight .bp {
    color: #8B6A43;
}

/* Operators ----------------------------------------------- */

.highlight .o {
    color: #555555;
}

/* Variables ------------------------------------------------ */

.highlight .n {
    color: #222222;
}

/* Assignment operator (<-) -------------------------------- */

.highlight .assign {
    color: #6F8452;
    font-weight: bold;
}

/* Built-in R constants */

.highlight .nb {
    color: #4C6F7A;
}

/* Punctuation */

.highlight .p {
    color: #555555;
}

/* Generic names */

.highlight .na {
    color: #7A5A73;
}

/* ==========================================================
   Copy icon
   ========================================================== */

.copy-button {
  position: absolute;

  top: 10px;
  right: 10px;

  border: none;
  background: transparent;

  padding: 4px;

  color: #999;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: color .2s ease;
}

.copy-button:hover {
  color: #7A8A57;
}

.copy-button svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================
   Search
   ========================================================== */

.search-box {

  margin-top: 40px;

  padding-top: 25px;

  border-top: 1px solid #d7d2c6;
}

#search-input {

  width: 100%;

  box-sizing: border-box;

  padding: 8px 0;

  border: none;

  border-bottom: 1px solid #d7d2c6;

  background: transparent;

  font-family: Georgia, serif;

  font-size: 0.95rem;

  color: #111;
}

#search-input:focus {

  outline: none;

  border-bottom-color: #7A8A57;

}

#search-input::placeholder {

  color: #999;

}

#results-container {

  list-style: none;

  padding: 0;

  margin-top: 15px;

}

#results-container li {

  margin: 8px 0;

}

#results-container a {

  text-decoration: none;

  color: #666;

  font-size: 0.9rem;

}

#results-container a:hover {

  color: #7A8A57;

}


/* ==========================================================
   Footer
   ========================================================== */

.site-footer {

  max-width: 1400px;
  margin: 4rem auto 2rem auto;

  padding-top: 1.5rem;

  border-top: 1px solid #d7d2c6;

  text-align: center;

  font-size: 0.9rem;
  color: #7A6652;

  line-height: 1.6;
}

.site-footer p {
  margin: 0;
}
