@import '../../public/css/faq_style.scss'; // @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700'); :root { // colors @include defineColorHSL(--cd-color-1, 213, 7%, 33%); // Blue Dark @include defineColorHSL(--cd-color-2, 73, 46%, 55%); // Green @include defineColorHSL(--cd-color-3, 210, 14%, 49%); // Blue Light @include defineColorHSL(--cd-color-4, 0, 0%, 100%); // White // font --font-primary: 'Open Sans', sans-serif; } .cd-faq { box-shadow: var(--shadow-sm); &::before { // never visible - this is used in JavaScript to check the current MQ content: 'mobile'; display: none; } a { text-decoration: none; } @include breakpoint(md) { position: relative; box-shadow: none; display: flex; &::before { content: 'desktop'; } } } .cd-faq__categories { @include breakpoint(md) { position: sticky; // fix element on scrolling align-self: flex-start; flex-shrink: 0; top: 20px; width: 20%; box-shadow: var(--shadow-sm); margin-top: var(--space-md); } @include breakpoint(lg) { width: 200px; } } .cd-faq__category { position: relative; display: block; height: 50px; line-height: 50px; padding: 0 var(--space-lg) 0 calc(var(--space-sm)*1.4); color: var(--cd-color-4); background-color: var(--cd-color-1); @include fontSmooth; --border-color: hsl(var(--cd-color-1-h), var(--cd-color-1-s), calc(var(--cd-color-1-l)*1.1)); border-bottom: 1px solid var(--border-color); &::before, &::after { // plus icon on the right content: ''; position: absolute; top: 50%; right: 16px; display: inline-block; height: 1px; width: 10px; background-color: lightness(var(--cd-color-1), 1.6); } &::after { transform: rotate(90deg); } li:last-child & { border-bottom: none; } @include breakpoint(md) { font-size: var(--text-xs); font-weight: 600; padding: 0 var(--space-md); transition: background .2s; &::before, &::after { display: none; } &:hover { background: lightness(var(--cd-color-1), 1.1); } } @include breakpoint(lg) { &::before { // decorative rectangle on the left visible for the selected item display: block; top: 0; right: auto; left: 0; height: 100%; width: 3px; background-color: var(--cd-color-2); opacity: 0; transition: opacity .2s; } } } @include breakpoint(lg) { .cd-faq__category-selected { background: lightness(var(--cd-color-1), 0.8); &:hover { background: lightness(var(--cd-color-1), 0.8); } &::before { opacity: 1; } } } .cd-faq__items { // on mibile, faq contents slides in from the right position: fixed; z-index: 1; height: 100%; width: 90%; top: 0; right: 0; background: var(--cd-color-4); padding: 0 var(--component-padding) var(--space-md); overflow: auto; -webkit-overflow-scrolling: touch; backface-visibility: hidden; transform: translateZ(0) translateX(100%); transition: transform .3s; @include breakpoint(md) { position: static; height: auto; width: auto; flex-grow: 1; overflow: visible; transform: translateX(0); padding: 0 0 0 var(--space-sm); background: transparent; } } .cd-faq__items--slide-in { transform: translateX(0); } html:not(.js) .cd-faq__items { position: static; height: auto; width: 100%; transform: translateX(0); } .cd-faq__group { display: none; // hide group not selected @include breakpoint(md) { // all groups visible display: block; padding-top: 1px; // fix issue with collapsing margin } } html:not(.js) .cd-faq__group, .cd-faq__group--selected { display: block; } .cd-faq__title { margin: var(--space-md) 0; h2 { text-transform: uppercase; font-size: var(--text-sm); font-weight: 700; color: lightness(var(--color-contrast-low), 0.9); } @include breakpoint(md) { margin-bottom: var(--space-sm); h2 { font-size: var(--text-xs); } } } .cd-faq__item { @include breakpoint(md) { background: var(--cd-color-4); margin-bottom: var(--space-xxxs); box-shadow: 0 1px 2px rgba(#000, .08); transition: box-shadow .2s; &:hover { --box-shadow: hsla(var(--cd-color-3-h), var(--cd-color-3-s), var(--cd-color-3-l), 0.3); box-shadow: 0 1px 10px var(--box-shadow); } &:last-of-type { margin-bottom: 0; } } } .cd-faq__trigger { display: block; position: relative; margin: var(--space-md) 0 var(--space-xs); color: var(--cd-color-2); @include breakpoint(md) { font-weight: 300; margin: 0; padding: var(--space-sm) var(--space-lg) var(--space-sm) var(--space-sm); span { font-size: var(--text-md); } &::before, &::after { // arrow icon on the right content: ''; position: absolute; right: 24px; top: 50%; height: 2px; width: 13px; background: lightness(var(--cd-color-2), 1.3); backface-visibility: hidden; transition: transform .2s; } &::before { transform: rotate(45deg); right: 32px; } &::after { transform: rotate(-45deg); } .cd-faq__item-visible &::before { transform: rotate(-45deg); } .cd-faq__item-visible &::after { transform: rotate(45deg); } } } .cd-faq__content { .text-component { font-size: 0.95em; } p { color: var(--cd-color-3); } @include breakpoint(md) { display: none; padding: 0 var(--space-sm); overflow: hidden; .text-component { font-size: 0.75em; padding-bottom: var(--space-md); } } } .cd-faq__content--visible { display: block; } html:not(.js) .cd-faq__content { @include breakpoint(md) { display: block; // always display faq content } } .cd-faq__close-panel { // on small device -> x icon to close faqs panel position: fixed; z-index: 2; display: block; top: 5px; right: -40px; height: 40px; width: 40px; // Force Hardware Acceleration in WebKit transform: translateZ(0); backface-visibility: hidden; transition: right .3s; &::before, &::after { // close icon in CSS content: ''; position: absolute; top: 16px; left: 12px; display: inline-block; height: 3px; width: 18px; background: var(--cd-color-3); } &::before { transform: rotate(45deg); } &::after { transform: rotate(-45deg); } @include breakpoint(md) { display: none; } } .cd-faq__close-panel--move-left { right: var(--component-padding); transition-delay: 0.3s; } .cd-faq__overlay { // overlay visible on small devices when the right panel slides in position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: alpha(var(--cd-color-1), 0.8); visibility: hidden; opacity: 0; transition: opacity .3s, visibility .3s; @include breakpoint(md) { display: none; } } .cd-faq__overlay--is-visible { visibility: visible; opacity: 1; } // demo style body { background-color: var(--color-contrast-lower); } .cd-header { --header-height: 180px; height: var(--header-height); background-color: var(--cd-color-2); h1 { font-size: var(--text-xl); font-weight: 300; color: var(--cd-color-4); @include fontSmooth; } @include breakpoint(lg) { --header-height: 240px; } } .cd-article-link { color: lightness(var(--cd-color-2), 0.5); font-size: var(--text-sm); }