// Name:            Section
// Description:     Component to create horizontal layout section
//
// Component:       `ui-section`
//
// Modifiers:       `ui-section-xsmall`
//                  `ui-section-small`
//                  `ui-section-large`
//                  `ui-section-xlarge`
//                  `ui-section-default`
//                  `ui-section-muted`
//                  `ui-section-primary`
//                  `ui-section-secondary`
//                  `ui-section-overlap`
//
// States:          `ui-preserve-color`
//
// ========================================================================


// Variables
// ========================================================================

@section-padding-vertical:                        @global-medium-margin;
@section-padding-vertical-m:                      @global-large-margin;

@section-xsmall-padding-vertical:                 @global-margin;

@section-small-padding-vertical:                  @global-medium-margin;

@section-large-padding-vertical:                  @global-large-margin;
@section-large-padding-vertical-m:                @global-xlarge-margin;

@section-xlarge-padding-vertical:                 @global-xlarge-margin;
@section-xlarge-padding-vertical-m:               (@global-large-margin + @global-xlarge-margin);

@section-default-background:                      @global-background;

@section-muted-background:                        @global-muted-background;

@section-primary-background:                      @global-primary-background;
@section-primary-color-mode:                      light;

@section-secondary-background:                    @global-secondary-background;
@section-secondary-color-mode:                    light;


/* ========================================================================
   Component: Section
 ========================================================================== */

/*
 * 1. Make it work with `100vh` and height in general
 */

.ui-section {
    box-sizing: border-box; /* 1 */
    padding-top: @section-padding-vertical;
    padding-bottom: @section-padding-vertical;
    .hook-section;
}

/* Desktop and bigger */
@media (min-width: @breakpoint-medium) {

    .ui-section {
        padding-top: @section-padding-vertical-m;
        padding-bottom: @section-padding-vertical-m;
    }

}

/*
 * Micro clearfix
 */

.ui-section::before,
.ui-section::after {
    content: "";
    display: table;
}

.ui-section::after { clear: both; }

/*
 * Remove margin from the last-child
 */

.ui-section > :last-child { margin-bottom: 0; }


/* Size modifiers
 ========================================================================== */

/*
 * XSmall
 */

.ui-section-xsmall {
    padding-top: @section-xsmall-padding-vertical;
    padding-bottom: @section-xsmall-padding-vertical;
}

/*
 * Small
 */

.ui-section-small {
    padding-top: @section-small-padding-vertical;
    padding-bottom: @section-small-padding-vertical;
}

/*
 * Large
 */

.ui-section-large {
    padding-top: @section-large-padding-vertical;
    padding-bottom: @section-large-padding-vertical;
}

/* Tablet landscape and bigger */
@media (min-width: @breakpoint-medium) {

    .ui-section-large {
        padding-top: @section-large-padding-vertical-m;
        padding-bottom: @section-large-padding-vertical-m;
    }

}


/*
 * XLarge
 */

.ui-section-xlarge {
    padding-top: @section-xlarge-padding-vertical;
    padding-bottom: @section-xlarge-padding-vertical;
}

/* Tablet landscape and bigger */
@media (min-width: @breakpoint-medium) {

    .ui-section-xlarge {
        padding-top: @section-xlarge-padding-vertical-m;
        padding-bottom: @section-xlarge-padding-vertical-m;
    }

}


/* Style modifiers
 ========================================================================== */

/*
 * Default
 */

.ui-section-default {
    background: @section-default-background;
    .hook-section-default;
}

/*
 * Muted
 */

.ui-section-muted {
    background: @section-muted-background;
    .hook-section-muted;
}

/*
 * Primary
 */

.ui-section-primary {
    background: @section-primary-background;
    .hook-section-primary;
}

.ui-section-primary:not(.ui-preserve-color):extend(.ui-light all) when (@section-primary-color-mode = light) {}
.ui-section-primary:not(.ui-preserve-color):extend(.ui-dark all) when (@section-primary-color-mode = dark) {}


/*
 * Secondary
 */

.ui-section-secondary {
    background: @section-secondary-background;
    .hook-section-secondary;
}

.ui-section-secondary:not(.ui-preserve-color):extend(.ui-light all) when (@section-secondary-color-mode = light) {}
.ui-section-secondary:not(.ui-preserve-color):extend(.ui-dark all) when (@section-secondary-color-mode = dark) {}


/* Overlap modifier
 ========================================================================== */

/*
 * Reserved modifier to make a section overlap another section with an border image
 * Implemented by the theme
 */

.ui-section-overlap {
    .hook-section-overlap;
}


// Hooks
// ========================================================================

.hook-section-misc;

.hook-section() {}
.hook-section-default() {}
.hook-section-muted() {}
.hook-section-secondary() {}
.hook-section-primary() {}
.hook-section-overlap() {}
.hook-section-misc() {}
