.modal { $base-border-color: gainsboro !default; $base-border-radius: 3px !default; $base-background-color: white !default; $base-font-size: 1em !default; $base-line-height: 1.5em !default; $action-color: #477DCA !default; $dark-gray: #333 !default; $light-gray: #DDD !default; $medium-screen: em(640) !default; $large-screen: em(860) !default; $base-font-color: $dark-gray !default; $modal-padding: 3em; $modal-background: transparent; $modal-close-color: $light-gray; $modal-image-height: 135px; $modal-image-width: $modal-image-height; $modal-trigger-image-width: 300px; label { cursor: pointer; margin-bottom: 0; } label img { border-radius: $modal-trigger-image-width / 2; display: block; max-width: $modal-trigger-image-width; } .modal-state { display: none; } .modal-trigger { @include button(flat, $action-color); padding: 0.8em 1em; } .modal-fade-screen { // overlay @include transition(opacity 0.25s ease); @include position(fixed, 0px 0px 0px 0px); background: rgba(0,0,0, 0.85); opacity: 0; padding-top: 0.6em; text-align: left; visibility: hidden; z-index: 99999; @include media($large-screen) { padding-top: 10em; } .modal-bg { @include position(absolute, 0px 0px 0px 0px); cursor: pointer; } } .modal-close { @include position(absolute, ($modal-padding /4) ($modal-padding /4) null null); @include size(1.5em); background: $modal-background; cursor: pointer; &:after, &:before { @include position(absolute, 3px 3px 0 50%); @include transform(rotate(45deg)); @include size(0.15em 1.5em); background: $modal-close-color; content: ''; display: block; margin: -3px 0 0 -1px; } &:hover:after, &:hover:before { background: darken($modal-close-color, 10%); } &:before { @include transform(rotate(-45deg)); } } .modal-inner { @include transition(opacity 0.25s ease); border-radius: $base-border-radius; padding: $modal-padding / 2; position: relative; a.cta { color: white; display: inline-block; margin-right: 0.5em; margin-top: 1em; &:last-child { padding: 0 2em; } } } .modal-state:checked + .modal-fade-screen, .modal-fade-screen.visible { opacity: 1; visibility: visible; } .modal-state:checked + .modal-fade-screen .modal-inner, .modal-fade-screen.visible .modal-inner { top: 0.5em; } } .modal-open { overflow: hidden; } // Based on code by Kasper Mikiewicz