/*
 Theme Name:   Bricks Child Theme
 Theme URI:    https://bricksbuilder.io/
 Description:  Use this child theme to extend Bricks.
 Author:       Bricks
 Author URI:   https://bricksbuilder.io/
 Template:     bricks
 Version:      1.1
 Text Domain:  bricks
*/

/* CSS Variables */
:root {
  --sidebar-toggle-offset: 31px;
  --sidebar-width: min(100vw, max(20%, calc(400px - (var(--sidebar-toggle-offset) * 2))));
}

/* HTML Elements */
* {
	word-break: break-word;
}

body {
    height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}

:is(dir, menu, ol, ul) ul
{
    list-style-type: square;
}

/* Layout */
.alignwide {
  margin-inline: auto;
  max-width: 100%;
}

.is-layout-constrained > .alignwide {
  max-width: min(var(--wp--style--global--wide-size), 100%);
}

/* Archive listing */
.archive, .category {
  .brxe-posts {
    li {
      margin-bottom: 2em;
      position: relative;
    }

    li::after {
      background: #000;
      content: '';
      height: 1px;
      position: absolute;
      top: calc(100% + 1em);
      width: calc(100% + 1px);
    }
  }
}

/* Grid */
.brx-grid > * {
	min-width: 0;
}

/* Block: Column with only Image block */
.wp-block-column:has(figure:only-child) {
	figure {
    	margin-block: 0 !important;
	}
}

/* Caption */
.wp-element-caption {
	color: inherit;
}

/* Drop caps */
.has-drop-cap::first-letter {
  initial-letter: 3; /* Spans exactly 3 lines of text */
  -webkit-initial-letter: 3; /* Safari prefix */
  font-weight: normal !important;
  margin-right: var(--spacing-medium);
  text-transform: uppercase;
}

/* Header */
@media (min-width: 992px) {
  #brx-header {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    position: sticky;
    top: var(--wp-admin--admin-bar--height);
    z-index: 999;
  }
}

#brx-header a:hover,
#brx-header a:focus-visible,
#brx-footer a:hover,
#brx-footer a:focus-visible,
.brxe-post-content a:hover,
.brxe-post-content a:focus-visible,
h3 a:hover,
h3 a:focus-visible {
  text-decoration: underline;
}

/* Sidebar */
.sidebar-wrapper {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100%;
  min-height: 100vh;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-wrapper a {
  text-decoration: underline;
}

.sidebar-wrapper .brxe-sidebar {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

/* Sidebar: Toggle buttons */
.sidebar-toggle {
  position: absolute;
  top: calc(142px + var(--wp-admin--admin-bar--height, 0px));
  right: -33px;
  width: 16px;
  height: 36px;
  cursor: pointer;
}

/* Sidebar: Desktop: always visible */
@media (min-width: 992px) {
  .sidebar-wrapper {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: none;
  }

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

.sidebar-wrapper.is-open .sidebar-toggle-show {
  display: none;
}
  
.sidebar-wrapper:not(.is-open) .sidebar-toggle-hide {
  display: none;
}

@media (max-width: 991px) {
  .sidebar-wrapper.is-open {
    transform: translateX(0);
  }

  body:not(:has(.sidebar-wrapper.is-open)) .align-with-sidebar {
    margin-left: 0;
  }

  .sidebar-wrapper {
    transform: translateX(-100%);
  }
}

/**
 * Contact Form 7
 */
.wpcf7 {
    form {
        display: flex;
        flex-direction: column;
        gap: 15px;
		max-width: min(450px, 90vw);
    }
	
	.wpcf7-list-item:has(input[type="checkbox"]) {
		margin-left: 0;
	}

    label {
        color: initial;
    }

    input[type="text"], input[type="email"], input[type="tel"], textarea {
        border-color: currentColor;
        border-style: solid;
        border-width: 1px;
        color: initial;
        outline-offset: 2px;
    }
	
	textarea {
		resize: vertical;
	}

    button[type="submit"] {
        margin-top: 15px;
    }

    button[type="submit"][disabled] {
        opacity: 0.5;
    }
}
