/*!
 * StaticPress theme "Blocksy" - layout.css
 *
 * Layer 2 of 4: the page frame and the structural components.
 *
 * Direct ports of the Blocksy partials listed next to each block; the class
 * names are the ones the original prints, so the rules can be read side by
 * side with the theme source:
 *
 *   6-layout/main.scss            #main-container, containers, v-spacing
 *   6-layout/sidebar/*            [data-sidebar]
 *   6-layout/entries/*            [data-layout], enhanced-grid
 *   5-modules/header/*            #header rows, columns, items, branding, menu
 *   5-modules/menu/*              .menu / .ct-menu-link / type-2 indicator
 *   5-modules/off-canvas/*        .ct-panel, the side drawer
 *   5-modules/footer/*            .ct-footer rows and columns
 *
 * The dark header/footer and the dark drawer header are the "深浅混搭" half of
 * the design (see static/css/tokens.css).
 */

/* ------------------------------------------------------- page containers */
#main-container {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: calc(100vh - var(--admin-bar) - var(--theme-frame-size) * 2);
    overflow: clip;
}

#main-container .site-main {
    flex-grow: 1;
}

[class*='ct-container'] {
    margin-inline: auto;
}

.ct-container,
.ct-container-full,
.ct-container-narrow {
    width: var(--theme-container-width);
}

.ct-container,
.ct-container-full {
    max-width: var(--theme-normal-container-max-width);
}

.ct-container-narrow {
    max-width: var(--theme-narrow-container-max-width);
}

/* `--theme-block-max-width` is only defined inside an article
   (8-integrations/editors-common.scss, see static/css/pages.css), so outside
   of one the hero of the archives stays full width - exactly like the theme,
   where the undefined variable makes the declaration fall back to `none`. */
.is-width-constrained {
    margin-inline: auto;
    width: var(--theme-container-width);
    max-width: var(--theme-block-max-width, none);
}

[data-vertical-spacing*='top'] {
    padding-top: var(--theme-content-vertical-spacing);
}

[data-vertical-spacing*='bottom'] {
    padding-bottom: var(--theme-content-vertical-spacing);
}

/* --------------------------------------------------------------- header */
#header {
    position: relative;
    z-index: 50;
    background-color: var(--theme-dark-surface);
}

@media (max-width: 999.98px) {
    #header [data-device='desktop'] {
        display: none;
    }
}

@media (min-width: 1000px) {
    #header [data-device='mobile'] {
        display: none;
    }
}

#header [data-row] {
    position: relative;
    border-bottom: 1px solid var(--theme-dark-border);
}

#header [data-row] > div {
    min-height: var(--header-height);
}

#header [data-column] {
    min-height: inherit;
}

#header [data-column='start'],
#header [data-column='end'] {
    min-width: 0;
}

#header [data-column-set='2'] > div {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: space-between;
}

#header [data-items] {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 100%;
}

#header [data-items] > * {
    margin: var(--margin, 0 10px);
}

#header [data-column='start'] [data-items='primary'] > *:first-child {
    --margin: 0 10px 0 0;
}

#header [data-column='end'] [data-items='primary'] > *:last-child {
    --margin: 0 0 0 10px;
}

#header [data-column='end'] [data-items='primary'] {
    justify-content: flex-end;
}

#header [data-placements] {
    display: grid;
}

/* branding */
.site-branding {
    display: flex;
    align-items: center;
}

.site-title {
    display: block;
    margin-bottom: 0;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.site-title a {
    color: var(--theme-dark-heading);
}

.site-title a:hover,
.site-title a:focus {
    color: var(--theme-dark-heading);
    opacity: 0.82;
}

.site-description {
    display: block;
    margin-top: 0.35em;
    margin-bottom: 0;
    color: var(--theme-dark-text);
    font-size: 12.5px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

@media (min-width: 1000px) {
    #header .site-description {
        white-space: nowrap;
    }
}

/* ----------------------------------------------------------------- menu */
.menu {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    gap: var(--menu-items-gap, 0px);
}

.menu li.menu-item {
    display: flex;
    align-items: center;
}

.menu > li > .ct-menu-link {
    height: var(--menu-item-height, 100%);
    justify-content: var(--menu-item-alignment, center);
    --menu-item-padding: 0 calc(var(--menu-items-spacing, 25px) / 2);
}

.ct-menu-link {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    border-radius: var(--menu-item-radius, inherit);
}

.ct-menu-link:not(:empty) {
    padding: var(--menu-item-padding, 0px);
}

/* Header menu colours on the dark row */
#header [data-menu] .ct-menu-link {
    color: var(--theme-dark-text-strong);
    font-size: 15px;
    font-weight: 500;
}

#header [data-menu] li:hover > .ct-menu-link,
#header [data-menu] li[class*='current-menu-'] > .ct-menu-link {
    color: #ffffff;
}

/* Menu type-2: the accent underline that marks hover / current
   (5-modules/menu/menu-type.scss) */
[data-menu*='type-2'] > ul > li > .ct-menu-link::after {
    content: '';
    position: absolute;
    left: var(--menu-indicator-left, 0);
    right: var(--menu-indicator-right, 0);
    bottom: 0;
    height: var(--menu-indicator-height, 2px);
    opacity: var(--menu-indicator-opacity, 0);
    background-color: var(--menu-indicator-hover-color, var(--theme-palette-color-1));
    transition: opacity 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955),
        height 0.12s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

[data-menu*='type-2'] > ul > li:hover > .ct-menu-link::after,
[data-menu*='type-2'] > ul > li[class*='current-menu-'] > .ct-menu-link::after {
    --menu-indicator-opacity: 1;
}

/* type-1 flush edges (5-modules/menu/menu-type.scss) */
[data-column='end'] [data-items='primary'] [data-menu*='type-1']:last-child > ul > li:last-child > .ct-menu-link {
    padding-inline-end: 0;
}

/* ------------------------------------------------------------ trigger */
.ct-header-trigger,
.ct-header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    color: var(--theme-dark-text-strong);
}

.ct-header-trigger:hover,
.ct-header-search:hover,
.ct-header-trigger:focus,
.ct-header-search:focus {
    color: #ffffff;
}

.ct-header-trigger .ct-label,
.ct-header-search .ct-label {
    font-size: 13px;
    font-weight: 500;
}

/* -------------------------------------------------- drawer / offcanvas */
.ct-panel {
    flex-direction: column;
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: none;
    opacity: 0;
    pointer-events: none;
    background-color: rgba(8, 15, 26, 0.62);
    transition: opacity 0.25s ease-in-out;
}

body[data-panel] .ct-panel.active {
    display: flex;
}

body[data-panel*='in'] .ct-panel.active {
    opacity: 1;
    pointer-events: auto;
}

.ct-panel .ct-panel-inner {
    display: flex;
    flex-direction: column;
    background-color: var(--theme-palette-color-8);
}

[data-behaviour*='side'] .ct-panel-inner {
    position: absolute;
    inset-block: 0;
    height: 100%;
    width: calc(100% - var(--side-panel-offset) * 2);
    max-width: var(--side-panel-width);
    margin: var(--side-panel-offset);
    box-shadow: var(--theme-box-shadow-strong);
    transition: transform 0.25s ease-in-out;
}

[data-behaviour*='right-side'] .ct-panel-inner {
    align-self: flex-end;
    transform: translate3d(100%, 0, 0);
}

[data-behaviour*='left-side'] .ct-panel-inner {
    align-self: flex-start;
    transform: translate3d(-100%, 0, 0);
}

body[data-panel*='in'] [data-behaviour*='side'].active .ct-panel-inner {
    transform: translate3d(0, 0, 0);
}

/* modal behaviour (the search dialog of partials/search.html): instead of a
   side panel the sheet is centered in the viewport and rises into place. The
   original styles the same variant in off-canvas/main.scss. */
[data-behaviour*='modal'] .ct-panel-inner {
    width: calc(100% - var(--modal-panel-offset) * 2);
    max-width: var(--modal-panel-width);
    max-height: calc(100% - var(--modal-panel-offset) * 2);
    margin: auto;
    border-radius: var(--theme-border-radius);
    box-shadow: var(--theme-box-shadow-strong);
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

body[data-panel*='in'] [data-behaviour*='modal'].active .ct-panel-inner {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.ct-panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px var(--panel-padding, 30px);
    border-bottom: 1px solid var(--theme-border-color);
}

.ct-panel-heading {
    color: var(--theme-palette-color-4);
    font-size: 15px;
    font-weight: 600;
}

.ct-toggle-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 100%;
    background-color: var(--theme-palette-color-6);
    color: var(--theme-palette-color-4);
    transition: var(--theme-transition);
}

.ct-toggle-close:hover {
    background-color: var(--theme-palette-color-1);
    color: #ffffff;
}

.ct-panel-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ct-panel-content-inner {
    display: flex;
    flex-direction: column;
    gap: 26px;
    height: 100%;
    overflow-y: auto;
    padding: 24px var(--panel-padding, 30px) 40px;
}

/* the drawer holds stacked menus, not the horizontal header menu */
.mobile-menu .menu {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.mobile-menu .menu > li {
    border-bottom: 1px solid var(--theme-border-color);
}

.mobile-menu .menu > li:last-child {
    border-bottom: 0;
}

.mobile-menu .menu > li > .ct-menu-link {
    height: auto;
    padding: 14px 0;
    color: var(--theme-palette-color-4);
    font-size: 16px;
    font-weight: 500;
}

.mobile-menu .menu > li:hover > .ct-menu-link,
.mobile-menu .menu > li[class*='current-menu-'] > .ct-menu-link {
    color: var(--theme-palette-color-1);
}

.mobile-menu .ct-menu-count {
    margin-inline-start: auto;
    color: var(--theme-text-color);
    font-size: 13px;
    font-style: normal;
}

.mobile-menu > .ct-panel-heading {
    margin-bottom: 4px;
}

.ct-panel-actions-block {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------- footer */
.ct-footer {
    background-color: var(--theme-dark-surface);
    color: var(--theme-dark-text);
}

.ct-footer [data-row] > div {
    display: grid;
    grid-template-columns: var(--grid-template-columns);
    grid-column-gap: var(--columns-gap, 50px);
    grid-row-gap: 34px;
    align-items: start;
    padding-block: var(--container-spacing);
}

.ct-footer [data-row='middle'] > .ct-container {
    --grid-template-columns: 1.3fr 1fr 1fr;
    --container-spacing: 70px;
}

.ct-footer [data-row='bottom'] > .ct-container {
    --grid-template-columns: 1fr;
    --container-spacing: 22px;
    border-top: 1px solid var(--theme-dark-border);
}

.ct-footer [data-row='bottom'] {
    background-color: var(--theme-dark-surface-2);
}

.ct-footer [data-column] {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ct-footer-heading {
    margin: 0 0 18px;
    color: var(--theme-dark-heading);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ct-footer-text {
    margin: 0 0 12px;
    color: var(--theme-dark-text);
    font-size: 14.5px;
}

.ct-footer-text--muted {
    margin-bottom: 0;
    font-size: 12.5px;
    line-height: 1.7;
    opacity: 0.75;
}

.ct-footer-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ct-footer-list li {
    margin-bottom: 10px;
}

.ct-footer-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--theme-dark-text-strong);
    font-size: 14.5px;
}

.ct-footer-list a:hover,
.ct-footer-list a:focus {
    color: #ffffff;
}

.ct-footer-list a span {
    color: var(--theme-dark-text);
    font-size: 12.5px;
}

.ct-footer-copyright {
    color: var(--theme-dark-text);
    font-size: 13px;
    text-align: center;
}

.ct-footer-copyright > *:not(:first-child) {
    margin-top: 0.5em;
}

.ct-footer-copyright a {
    color: var(--theme-dark-text-strong);
}

.ct-footer-copyright a:hover {
    color: #ffffff;
}

.ct-footer-credit {
    font-size: 12.5px;
    opacity: 0.8;
}

@media (max-width: 999.98px) {
    .ct-footer [data-row='middle'] > .ct-container {
        --grid-template-columns: 1fr 1fr;
        --container-spacing: 50px;
    }
}

@media (max-width: 689.98px) {
    .ct-footer [data-row='middle'] > .ct-container {
        --grid-template-columns: 1fr;
        --container-spacing: 40px;
    }
}

/* --------------------------------------------------------------- sidebar */
[data-sidebar] {
    display: grid;
    grid-template-columns: var(--grid-template-columns, 100%);
    grid-column-gap: var(--sidebar-gap);
    grid-row-gap: 50px;
}

[data-sidebar] > aside {
    order: var(--sidebar-order);
}

@media (min-width: 1000px) {
    [data-sidebar='right'] {
        --grid-template-columns: minmax(100px, 1fr) var(--sidebar-width);
    }

    [data-sidebar='left'] {
        --sidebar-order: -1;
        --grid-template-columns: var(--sidebar-width) minmax(100px, 1fr);
    }
}

/* The sidebar is a desktop-only panel, exactly like the original
   (the aside carries ct-hidden-md / ct-hidden-sm in the markup). */
@media (max-width: 999.98px) {
    [data-sidebar] {
        --grid-template-columns: 100%;
    }

    [data-sidebar] > aside {
        display: none;
    }
}

/* ------------------------------------------------------- entries listing */
[data-layout*='grid'] {
    display: grid;
    grid-template-columns: var(--grid-template-columns);
    grid-column-gap: var(--grid-columns-gap);
    grid-row-gap: var(--grid-columns-gap);
}

.entries[data-layout='grid'] {
    --grid-template-columns: repeat(3, minmax(0, 1fr));
}

[data-sidebar] .entries[data-layout='grid'] {
    --grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1199.98px) {
    .entries[data-layout='grid'] {
        --grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    [data-sidebar] .entries[data-layout='grid'] {
        --grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 689.98px) {
    .entries[data-layout='grid'],
    [data-sidebar] .entries[data-layout='grid'] {
        --grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* enhanced grid: 1 column on small phones, 6 columns from 690px up where the
   first two cards of every five take half the row and the next three a third
   (6-layout/entries/enhanced-grid.scss) */
[data-layout='enhanced-grid'] {
    --grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 690px) {
    [data-layout='enhanced-grid'] {
        --grid-template-columns: repeat(6, 1fr);
    }

    [data-layout='enhanced-grid'] > * {
        grid-column: span 3;
    }
}

@media (min-width: 1000px) {
    [data-layout='enhanced-grid'] > * {
        grid-column: span 2;
    }

    [data-layout='enhanced-grid'] > *:nth-child(5n + 1),
    [data-layout='enhanced-grid'] > *:nth-child(5n + 2) {
        grid-column: span 3;
    }
}
