/*
 * Hyde - Layout & Sidebar
 * Responsive sidebar layout with 4 breakpoints, color schemes, and CSS custom properties.
 * Inspired by https://github.com/spf13/hyde
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
  /* Sidebar */
  --stb-sidebar-width: 250px;
  --stb-logo-size: 150px;
  --stb-sidebar-bg: #202020;
  --stb-sidebar-text: rgba(255, 255, 255, 0.6);
  --stb-sidebar-link: #fff;
  --stb-sidebar-heading: #fff;

  /* Body */
  --stb-body-bg: #fff;
  --stb-text-color: #515151;
  --stb-heading-color: #313131;
  --stb-link-color: #268bd2;

  /* Code */
  --stb-code-color: #bf616a;
  --stb-code-bg: #f9f9f9;
  --stb-pre-bg: #f9f9f9;

  /* Misc */
  --stb-blockquote-color: #7a7a7a;
  --stb-blockquote-border: #e5e5e5;
  --stb-table-border: #e5e5e5;
  --stb-table-stripe: #f9f9f9;
  --stb-hr-color: #eee;
  --stb-input-bg: #fff;
  --stb-input-border: #ccc;
}

/* ==========================================================================
   Layout: Wrap & Content
   ========================================================================== */

.stb-wrap {
  position: relative;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.stb-content {
  padding: 2rem 1rem;
  max-width: 900px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .stb-content {
    padding: 2rem 3rem;
  }
}

@media (min-width: 1280px) {
  .stb-content {
    padding: 2rem 4rem;
    max-width: 1000px;
  }
}

/* ==========================================================================
   Mobile Header (< 768px)
   ========================================================================== */

.stb-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background-color: var(--stb-sidebar-bg);
  color: var(--stb-sidebar-link);
  position: sticky;
  top: 0;
  z-index: 100;
}

.stb-mobile-header__title {
  margin: 0;
  font-size: 1rem;
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
}

.stb-mobile-header__title a {
  color: var(--stb-sidebar-link);
  text-decoration: none;
}

.stb-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 110;
}

.stb-hamburger__line {
  width: 100%;
  height: 3px;
  background-color: var(--stb-sidebar-link);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.stb-hamburger[aria-expanded="true"] .stb-hamburger__line:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.stb-hamburger[aria-expanded="true"] .stb-hamburger__line:nth-child(2) {
  opacity: 0;
}

.stb-hamburger[aria-expanded="true"] .stb-hamburger__line:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

@media (min-width: 768px) {
  .stb-mobile-header {
    display: none;
  }
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.stb-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

.stb-overlay--active {
  display: block;
}

@media (min-width: 768px) {
  .stb-overlay {
    display: none !important;
  }
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.stb-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--stb-sidebar-width);
  background-color: var(--stb-sidebar-bg);
  color: var(--stb-sidebar-text);
  overflow-y: auto;
  z-index: 200;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

/* --- Mobile: hidden off-screen --- */
@media (max-width: 767px) {
  .stb-sidebar {
    width: 280px;
    transform: translateX(-100%);
  }

  .stb-sidebar--open {
    transform: translateX(0);
  }

  /* Reverse layout: sidebar on right */
  .sidebar-right .stb-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }

  .sidebar-right .stb-sidebar--open {
    transform: translateX(0);
  }
}

/* --- Tablet & Medium desktop (768px - 1279px): normal sidebar --- */
@media (min-width: 768px) and (max-width: 1279px) {
  .stb-sidebar {
    width: var(--stb-sidebar-width);
  }

  .stb-wrap {
    margin-left: var(--stb-sidebar-width);
    width: calc(100% - var(--stb-sidebar-width));
  }

  .sidebar-right .stb-sidebar {
    left: auto;
    right: 0;
  }

  .sidebar-right .stb-wrap {
    margin-left: 0;
    margin-right: var(--stb-sidebar-width);
    width: calc(100% - var(--stb-sidebar-width));
  }
}

/* --- Full desktop (>= 1280px) --- */
@media (min-width: 1280px) {
  .stb-sidebar {
    width: var(--stb-sidebar-width);
  }

  .stb-wrap {
    margin-left: var(--stb-sidebar-width);
    width: calc(100% - var(--stb-sidebar-width));
  }

  .sidebar-right .stb-sidebar {
    left: auto;
    right: 0;
  }

  .sidebar-right .stb-wrap {
    margin-left: 0;
    margin-right: var(--stb-sidebar-width);
    width: calc(100% - var(--stb-sidebar-width));
  }
}

/* ==========================================================================
   Sidebar Elements
   ========================================================================== */

.stb-sidebar__profile {
  text-align: center;
  margin-bottom: 1.5rem;
}

.stb-sidebar__profile-image {
  max-width: var(--stb-logo-size);
  max-height: var(--stb-logo-size);
  width: auto;
  height: auto;
  border-radius: 0;
  margin: 0 auto 1rem;
  object-fit: contain;
}

.stb-sidebar__title {
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 .5rem;
}

.stb-sidebar__title a {
  color: var(--stb-sidebar-heading);
  text-decoration: none;
}

.stb-sidebar__bio {
  font-size: .875rem;
  color: var(--stb-sidebar-text);
  margin-bottom: 1.5rem;
}

/* Navigation */
.stb-sidebar__nav {
  margin-bottom: 1.5rem;
}

.stb-sidebar__nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.stb-sidebar__nav-item {
  margin-bottom: .25rem;
}

.stb-sidebar__nav-link {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  color: var(--stb-sidebar-text);
  border-radius: 4px;
  transition: color .15s ease, background-color .15s ease;
}

.stb-sidebar__nav-link:hover,
.stb-sidebar__nav-link:focus {
  color: var(--stb-sidebar-link);
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.stb-sidebar__nav-link.current-menu-item > a,
.stb-sidebar__nav-item.current-menu-item > .stb-sidebar__nav-link {
  color: var(--stb-sidebar-link);
}

.stb-sidebar__nav-icon {
  width: 20px;
  height: 20px;
  margin-right: .75rem;
  fill: currentColor;
  flex-shrink: 0;
}

/* Widgets */
.stb-sidebar__widgets {
  margin-bottom: 1.5rem;
}

.stb-sidebar__widgets .widget {
  margin-bottom: 1.5rem;
}

.stb-sidebar__widgets .widget-title {
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--stb-sidebar-link);
  margin-bottom: .75rem;
}

.stb-sidebar__widgets ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.stb-sidebar__widgets li {
  margin-bottom: .25rem;
}

.stb-sidebar__widgets a {
  color: var(--stb-sidebar-text);
}

.stb-sidebar__widgets a:hover {
  color: var(--stb-sidebar-link);
}

.stb-sidebar__widgets .widget {
  text-align: center;
}

.stb-sidebar__widgets img {
  margin-left: auto;
  margin-right: auto;
}

.stb-sidebar__widgets .wp-block-image {
  text-align: center;
}

.stb-sidebar__widgets .wp-block-image img {
  display: inline-block;
}

/* Copyright */
.stb-sidebar__copyright {
  margin-top: auto;
  font-size: .75rem;
  color: var(--stb-sidebar-text);
  opacity: .6;
}

/* ==========================================================================
   Posts & Pages
   ========================================================================== */

.stb-post {
  margin-bottom: 3rem;
}

.stb-post__title {
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
  color: var(--stb-heading-color);
}

.stb-post__title a {
  color: var(--stb-heading-color);
}

.stb-post__title a:hover {
  color: var(--stb-link-color);
  text-decoration: none;
}

.stb-post__date {
  display: block;
  margin-top: -.5rem;
  margin-bottom: 1rem;
  color: var(--stb-blockquote-color);
  font-size: .875rem;
}

.stb-post__content {
  font-family: 'PT Serif', Georgia, 'Times New Roman', serif;
  line-height: 1.8;
}

.stb-post__meta {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--stb-hr-color);
  font-size: .875rem;
  color: var(--stb-blockquote-color);
}

.stb-post__tags {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.stb-post__tag {
  display: inline-block;
  padding: .15rem .5rem;
  background-color: var(--stb-code-bg);
  border-radius: 3px;
  font-size: .8rem;
}

.stb-post__tag a {
  color: var(--stb-text-color);
}

/* Read More */
.stb-read-more {
  display: inline-block;
  margin-top: .5rem;
  font-size: .875rem;
  font-weight: bold;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.stb-pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  font-size: .875rem;
}

.stb-pagination a,
.stb-pagination span {
  padding: .5rem 1rem;
  border-radius: 4px;
}

.stb-pagination a {
  color: var(--stb-link-color);
  border: 1px solid var(--stb-link-color);
}

.stb-pagination a:hover {
  background-color: var(--stb-link-color);
  color: #fff;
  text-decoration: none;
}

.stb-pagination .current {
  background-color: var(--stb-link-color);
  color: #fff;
  border: 1px solid var(--stb-link-color);
}

/* ==========================================================================
   Archive
   ========================================================================== */

.stb-archive__header {
  margin-bottom: 2rem;
}

.stb-archive__description {
  color: var(--stb-blockquote-color);
  font-size: .875rem;
}

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

.stb-search-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 2rem;
}

.stb-search-form__input {
  flex: 1;
  margin-bottom: 0 !important;
}

.stb-search-form__submit {
  flex-shrink: 0;
}

/* ==========================================================================
   404
   ========================================================================== */

.stb-404 {
  text-align: center;
  padding: 3rem 0;
}

.stb-404__title {
  font-size: 4rem;
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
  color: var(--stb-link-color);
}

/* ==========================================================================
   Comments
   ========================================================================== */

.stb-comments {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--stb-hr-color);
}

.stb-comments__title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.stb-comment {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--stb-hr-color);
}

.stb-comment__meta {
  font-size: .875rem;
  margin-bottom: .5rem;
  color: var(--stb-blockquote-color);
}

.stb-comment__author {
  font-weight: bold;
  color: var(--stb-heading-color);
}

.stb-comment__body p:last-child {
  margin-bottom: 0;
}

.stb-comment .children {
  list-style: none;
  padding-left: 1.5rem;
  margin-top: 1rem;
}

.comment-respond {
  margin-top: 2rem;
}

/* ==========================================================================
   Color Schemes
   ========================================================================== */

/* Default: Dark sidebar, light content (already in :root) */

/* Theme: Red */
.theme-base-08 {
  --stb-sidebar-bg: #ac4142;
  --stb-link-color: #ac4142;
}

/* Theme: Orange */
.theme-base-09 {
  --stb-sidebar-bg: #d28445;
  --stb-link-color: #d28445;
}

/* Theme: Yellow */
.theme-base-0a {
  --stb-sidebar-bg: #f4bf75;
  --stb-sidebar-text: rgba(0, 0, 0, 0.6);
  --stb-sidebar-link: #000;
  --stb-sidebar-heading: #000;
  --stb-link-color: #bd9a3f;
}

/* Theme: Green */
.theme-base-0b {
  --stb-sidebar-bg: #90a959;
  --stb-link-color: #90a959;
}

/* Theme: Cyan */
.theme-base-0c {
  --stb-sidebar-bg: #75b5aa;
  --stb-link-color: #75b5aa;
}

/* Theme: Blue */
.theme-base-0d {
  --stb-sidebar-bg: #6a9fb5;
  --stb-link-color: #6a9fb5;
}

/* Theme: Magenta */
.theme-base-0e {
  --stb-sidebar-bg: #aa759f;
  --stb-link-color: #aa759f;
}

/* Theme: Brown */
.theme-base-0f {
  --stb-sidebar-bg: #8f5536;
  --stb-link-color: #8f5536;
}
