@import "pico";

// Global Set
:root {
  --border-radius: .5rem;
}

body {
  cursor: auto;
  text-underline-offset: 0.2rem;
}

// Theme
[data-theme="light"],
:root:not([data-theme="dark"]) {
  --muted-border-color: #{$grey-200};
  --level-odd-color: #{$grey-50};
}

@media only screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background-color: #{$grey-900};
    --muted-border-color: #{$grey-700};
    --level-odd-color: #{$grey-800};
  }
}

[data-theme="dark"] {
  --background-color: #{$grey-900};
  --muted-border-color: #{$grey-700};
  --level-odd-color: #{$grey-800};
}

// Content
h1, h2, h3, h4, h5 { line-height: 1.25; }

// Icon Size
.is-sm {
  width: 1.25em;
  height: 1.25em;
}

// Utilities
.text-muted,
.text-muted a {
  color: var(--muted-color);
}

.text-muted a:hover {
  color: var(--secondary-hover);
}

.text-center {
  text-align: center;
}

.text-end {
  text-align: right;
}

.ms-2 {
  margin-left: calc(var(--spacing) / 2);
}

.me-2 {
  margin-right: calc(var(--spacing) / 2);
}

.mx-2 {
  margin-left: calc(var(--spacing) / 2);
  margin-right: calc(var(--spacing) / 2);
}

.list-inline {
  padding-left: 0;
  list-style: none;
  margin-bottom: 0;

  li {
    display: inline-block;
    margin-bottom: 0;

    &:not(:last-child) { margin-right: var(--spacing); }
  }

  svg { vertical-align: text-bottom; }
}

// Layout
.container-inner {
  @if map-get($breakpoints, "lg") {
    @media (min-width: map-get($breakpoints, "lg")) {
      padding-left: calc(var(--spacing) / 2);
      padding-right: calc(var(--spacing) / 2);
    }
  }
}

.container-thin {
  margin-left: auto;
  margin-right: auto;
  max-width: 40rem;
}

.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.justify-content-between {
  justify-content: space-between;
}

.justify-content-end {
  justify-content: end;
}

.align-self-center {
  align-self: center;
}

// Header & Navbar
.site-navbar {
  padding-top: .25rem;
  padding-bottom: .25rem;

  a {
    color: inherit;
  }

  .site-name {
    flex-grow: 1;
  }

  .brand {
    font-size: 1.25rem;
    font-weight: 700;
  
    img {
      max-height: 2rem;
    }
  }

  .desc {
    color: var(--muted-color);
    display: none;
    @if map-get($breakpoints, "sm") {
      @media (min-width: map-get($breakpoints, "sm")) {
        display: inline-block;
      }
    }
  }
}

.site-nav {
  display: block;
}

#nav-toggler {
  display: none;

  &:checked ~ .nav-menu {
    display: block;
  }
}

.nav-toggler-btn {
  cursor: pointer;
}

// Dropdown Menu
.nav-menu {
  display: none;

  li {
    display: block;
    padding: calc(var(--spacing) * .5);
  }

  form {
    margin-bottom: 0;

    input[type=search] {
      height: 50px;
      background-size: auto;

      &:not(:focus) {
        padding: 0;
        border: none;
        width: 30px;
        padding-inline-start: 0;
        background-position: center center;
        background-color: inherit;
        color: transparent;
        cursor: pointer;
      }
    }
  }
}

@if map-get($breakpoints, "lg") {
  @media (min-width: map-get($breakpoints, "lg")) {
    .site-navbar .container-inner,
    .site-nav { display: flex; }
    .site-navbar .container-inner nav:first-child { flex-grow: 1; }
    .nav-toggler-btn { display: none; }
    .nav-menu {
      display: flex !important;
      li:not(:last-child) { margin-right: calc(var(--spacing) / 2); }
    }
  }
}

// Posts
.post-separator {
  margin: var(--block-spacing-vertical) 0;
}

.entry-header {
  margin-bottom: calc(var(--spacing) * 2);
}

.entry-title {
  margin-bottom: var(--spacing);

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

.entry-meta {
  font-size: .875rem;
}

.feather-calendar::before,
.feather-folder::before,
.feather-message::before {
  content: "";
  display: inline-block;
  margin-right: .25rem;
  background: url("../img/calendar.svg") no-repeat center center / contain;
  width: 1rem;
  height: 1rem;
  vertical-align: text-top;
  fill: #396;
}
.feather-folder::before {
  background-image: url("../img/folder.svg");
}
.feather-message::before {
  background-image: url("../img/message-circle.svg");
}



.entry-content .more {
  text-align: center;
  a {
    display: inline-block;
    font-size: .875rem;
    padding: 6px 16px;
    border: 1px solid var(--muted-border-color);
    color: var(--muted-color);
    border-radius: 100px;
    text-decoration: none;
  }
}

.post-nav {
  border-top: 1px solid var(--muted-border-color);
  padding-top: var(--spacing);
  margin: var(--block-spacing-vertical) 0;
  
  a {
    color: inherit;
  }
}

// Format
.fmt {
  line-height: 1.6;

  pre, hr {
    margin-bottom: var(--typography-spacing-vertical);
  }
}

// Footer
.site-footer {
  padding-bottom: calc(var(--block-spacing-vertical) / 2);
}

// Comments
.comment-list {
  list-style: none;
  padding: 0;
}

.comment-level-odd {
  background-color: var(--level-odd-color);
}
.comment-level-even {
  background-color: var(--background-color);
}

.comment-body {
  margin: calc(var(--spacing) * 1.5) 0;
  padding: var(--spacing);
  border: 1px solid var(--muted-border-color);
  border-radius: var(--border-radius);
}

.comment-by-author > .comment-author::after {
  content: "OP";
  margin-left: .25rem;
  color: var(--muted-color);
  padding: 0 .375rem;
  border: 1px solid var(--muted-color);
  font-size: .75rem;
  border-radius: var(--border-radius);
}

.comment-author {
  display: inline-block;

  .avatar {
    margin-right: .25rem;
    width: calc(var(--spacing) * 2);
    border-radius: 48px;
  }

  cite {
    font-style: normal;
    font-weight: 700;
  }
}

.comment-meta a,
.comment-reply a {
  font-size: .875em;
  color: var(--muted-color);

  &:hover { color: var(--secondary-hover); }
}

.comment-meta {
  display: inline-block;
  color: var(--muted-color);
  margin-left: calc(var(--spacing) / 4);
  &::before {
    content: "·";
    margin-right: calc(var(--spacing) / 4);
  }
}

.comment-content {
  margin-top: var(--spacing);
}

.comment-reply:blank {
  margin-top: 0;
}

.comment-awaiting-moderation {
  margin-left: calc(var(--spacing) / 2);
  font-size: .875em;
  color: var(--del-color);
}

.comment-children {
  margin-bottom: calc(var(--spacing) * -1);
}

// .comment-by-author {
//   background-color: var(--mark-background-color);
// }

#response {
  margin-bottom: var(--spacing);
}

#cancel-comment-reply-link {
  font-size: .875em;
}

.respond {
  margin-top: calc(var(--spacing) * 1.5);

  .comment-body & {
    margin-top: var(--spacing);
  }
}

#comment-form textarea {
  resize: vertical;
}

// page nav
.page-navigator {
  margin: 0;
  flex: 1;

  .current a {
    text-decoration: underline;
    color: inherit;
    pointer-events: none;
  }

  .prev {
    margin-right: auto;
    & a::before {
      content: "‹";
      margin-right: .25rem;
    }
  }
  .next {
    margin-left: auto;
    & a::after {
      content: "›";
      margin-left: .25rem;
    }
  }
}
