/* --- General Stylings --- */
:root {
    color-scheme: light only;
}

* {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: #202020;
    --wrapper-max: 60rem;
    --wrapper-padding: 2em;
    --section-padding: 0.65em;
    user-select: none;
}

a {
    color: #2f649b;
    text-decoration: none;
}
a:hover {
    color: #4f84bb;
    text-decoration: underline;
}
a:active {
    top: 1px;
    left: -1px;
}
a.disabled {
    pointer-events: none;
    color: #a0a0a0;
}

hr {
    border: 0;
    border-bottom: 1px solid #808080;
    padding: 0 !important;
}

body {
    position: relative;
    display: none;
    background-color: #c0c0c0;
    background-image: url("pic/main_bg.png");
}
a.shortcut {
    display: block;
    position: relative;
    visibility: hidden;
    top: calc(-8.25rem - var(--wrapper-padding)*2);
}

.text-align-left {
    text-align: left;
}
.text-align-right {
    text-align: right;
}
.text-align-center {
    text-align: center;
}
.tilt-right {
    padding-left: 50%;
}
.tilt_left {
    padding-right: 50%;
}

.wrapper {
    /* main body */
    position: relative;
    max-width: var(--wrapper-max);
    margin: auto;
    background-color: #e0e0e0;
    box-shadow: 0.25rem 0.25rem 0.75rem rgba(0,0,0,0.5);
}

.hero {
    --hero-height: 50vh;
    max-width: calc(var(--wrapper-max) + var(--wrapper-padding)*2);
    height: var(--hero-height);
    max-height: calc(var(--wrapper-max) / 1.67);
    margin: auto;
    margin-bottom: 2em;
    position: relative;
}
.hero > img {
    width: 100%;
    height: var(--hero-height);
    max-height: calc(var(--wrapper-max) / 1.67);
    object-fit: cover;
    object-position: 50% 50%;
    transform: skewY(-1.35deg);
}
.hero_index {
    padding-top: calc(var(--wrapper-padding) * 3.5) !important;
}
.hero_title {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    padding-left: 10%;
    padding-right: 10%;
    bottom: calc(var(--hero-height)/2 - 2rem);
}
.hero_cht {
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    text-shadow: -1px -1px 0 #e0e0e0, 1px -1px 0 #e0e0e0, -1px 1px 0 #e0e0e0, 1px 1px 0 #e0e0e0;
}
.hero_eng {
    font-weight: 700;
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    letter-spacing: 0.1em;
    text-shadow: -1px -1px 0 #e0e0e0, 1px -1px 0 #e0e0e0, -1px 1px 0 #e0e0e0, 1px 1px 0 #e0e0e0;
}

*[class^="section_with"] {
    /* wrapper for card with title, with & without image */
    display: flex;
    box-sizing: border-box;
    width: 100%;
    padding: 0 var(--wrapper-padding) 1em;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}
.section_with_image > section {
    height: fit-content;
}
.section_with_image > div > img {
    display: flex;
    margin: auto;
    padding: 0 1em;
    box-sizing: border-box;
    width: 100%;
    min-width: 180px;
    max-width: 400px;
    max-height: 500px;
    object-fit: contain;
}
.section_with_image > div > img + img {
    /* add space between subsequent section images */
    margin-top: 30vh;
}
.reverse {
    flex-direction: row-reverse;
}
.condense > section {
    flex-basis: 60%;
    /* min-width: min(55vw, calc(0.55 * var(--wrapper-max))); */
    flex-grow: 1;
}
img.touch_box {
    padding: 0 !important;
}

.section_goback {
    text-align: right;
    padding: 0 var(--wrapper-padding) 1em;
    font-size: 0.9rem;
}

section {
    /* card with title */
    position: relative;
    display: block;
    width: 100%;
    font-size: 0.9rem;
    outline: 1px solid #808080;
    border-radius: 0 0.5em 0.5em 0.5em;
    background-color: #e0e0e0;
    margin-bottom: var(--wrapper-padding);
}
section > * {
    padding: var(--section-padding);
}
section p + p {
    padding-top: var(--section-padding);
}
section > h1 {
    /* card title */
    display: flex;
    justify-content: space-between;
    background-color: #b0b0b0;
    border-bottom: 1px solid #808080;
    border-radius: 0 0.5em 0 0;
    font-size: 0.9rem;
    /* white-space: nowrap; */
}

ol {
    margin: 0 1em;
}
ol > li {
    padding-left: 0.5em;
}

ul {
    list-style: square;
    margin: 0 1em;
}
li + li {
    margin-top: 1em;
}
ul.single li + li {
    margin: 0.25em 0;
}

.table-2col {
    grid-template-columns: max-content auto; /* 2 columns layout */
}
.table-3col {
    grid-template-columns: max-content max-content auto; /* 3 columns layout */
}
*[class^="table-"] {
    display: grid;
    gap: var(--section-padding);
}
*[class^="table-"] input {
    box-sizing: border-box;
    width: 100%;
    min-width: 200px;
}
*[class^="table-"] input[type="checkbox"] {
    box-sizing: border-box;
    width: unset;
    min-width: unset;
}
*[class^="table-"] button {
    margin-top: 1em;
}
.colspan {
    grid-column: 1 / -1;
}

.table-border {
    display: grid;
    grid-template-columns: max-content auto;
    gap: 1px;
    border: 1px solid #808080;
    background-color: #808080;
}
.table-border > div {
    background-color: #e0e0e0;
    padding: 0.5em;
}

form > input {
    display: block;
    margin: 1em auto;
    font-size: 0.9em;
    width: 90%;
}
button {
    font-size: 0.9rem;
    border: none;
    background-color: #202020;
    border-radius: 0.5em;
    padding: 0.25em 1em;
    margin-bottom: 0.25em;
    color: #ffffff;
}
button:hover {
    background-color: #fff;
    color: #202020;
    outline: 1px solid #808080;
}
button > a {
    text-decoration: none;
    color: #ffffff !important;
}
button > a:hover {
    color: #202020 !important;
}

.error {
    color: #b05050;
}

[class^="caption_"] {
    position: relative;
    font-size: 0.7rem;
    margin-left: 2em;
}
[class^="caption_"]::before {
    position: absolute;
    left: -1em;
}
.caption_1::before {
    content: "*";
}
.caption_2::before {
    content: "**";
}
p.single {
    padding-top: 0em;
}

/* --- Header & Footer Stylings --- */
header {
    display: grid;
    position: fixed;
    z-index: 999;
    top: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: var(--wrapper-max);
    grid-template-columns: max-content auto;
    padding: var(--wrapper-padding);
    background-color: #e0e0e0;
}
header + * {
    padding-top: calc(var(--wrapper-padding)*5) !important;
}

.logo a {
    outline: none;
}
.logo img {
    height: 56px;
    float: left;
}
.logo_cht {
    padding-left: 10vh;
    font-family: DFKai-SB, BiauKai, TW-Kai;
    font-size: 25px;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0.1rem 0.1rem 0.2rem #888;
}
.logo_eng {
    padding-left: 10vh;
    font-family: Arial, Helvetica, sans-serif;
    font-stretch: condensed;
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0.1rem 0.1rem 0.2rem #888;
}

.brand_in_copy {
    text-align: right;
    font-size: 0.8rem;
    white-space: nowrap;
}

.copyright {
    max-width: var(--wrapper-max);
    margin: 1em auto;
    text-align: right;
    font-size: 0.7rem;
}

.login {
    position: relative;
    margin-top: 0.5em;
}
#login_menu_toggle {
    display: none;
}
#login_menu_toggle:checked ~ .login_menu {
    opacity: 1;
}
.login_icon {
    float: right;
    height: 1rem;
}
.login_menu {
    opacity: 0; /* visually hidden */
    overflow: hidden;
    position: absolute;
    padding: 0.5em;
    border: 1px solid #808080;
    box-shadow: 0.1rem 0.1rem 0.2rem rgba(0,0,0,0.5);
    background-color: #e0e0e0;
    top: 1rem;
    right: 0px;
    text-align: right;
    z-index: 10;
    transition: opacity 200ms;
}
#errorMsg {
    text-align: center;
    font-size: 0.8rem;
}

/* --- Navigation Stylings --- */
nav {
    position: absolute;
    grid-column: 1 / -1;
    border-width: 1px 0px;
    border-color: #808080;
    border-style: solid;
    background-color: #f0f0f0;
    background-image: linear-gradient(0deg, #c0c0c0, #f0f0f0);
    top: 100%;
    left: 0;
    right: 0;
    margin: 0 calc(-1 * var(--wrapper-padding)) 0;
    padding: 0.5em calc(var(--wrapper-padding)/2);
    min-height: 2rem;
}
#menu_toggle {
    display: none;
}
nav > label {
    display: none;
    user-select: none;
    font-size: 1.5rem;
    cursor: pointer;
}
nav a {
    position: relative;
    isolation: isolate;
    display: block;
    text-decoration: none;
    color: #202020;
}
nav a:hover {
    color: #ffffff;
    text-shadow: -1px -1px 0 #5286bc, 1px -1px 0 #5286bc, -1px 1px 0 #5286bc, 1px 1px 0 #5286bc;
    transition: 0.15s ease;
    text-decoration: none;
}
nav a::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -0.25em;
    bottom: -0.25em;
    left: -0.5em;
    right: -0.5em;
    border: 1px solid #5286bc;
    background-color: #bbd0e8;
    opacity: 0;
    transition: opacity 0.3s ease;
}
nav a:hover::before {
    opacity: 1;
}
.menu_selected {
    color: #ffffff;
    text-shadow: -1px -1px 0 #5286bc, 1px -1px 0 #5286bc, -1px 1px 0 #5286bc, 1px 1px 0 #5286bc;
}
.menu_selected::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -0.25em;
    bottom: -0.25em;
    left: -0.5em;
    right: -0.5em;
    border: 1px solid #6296cc;
    background-color: #cbe0f8;
    opacity: 1;
}
nav ul {
    display: inline-flex;
    list-style: none;
    padding: 0;
    gap: 2em;
}
nav li {
    position: relative;
    margin-top: 0;
    font-size: 0.8rem;
}
*[class^="dropdown-"] {
    display: none;
    width: max-content;
    max-height: calc(100vh - 14rem);
    overflow-y: auto;
    scrollbar-width: thin;
    position: absolute;
    flex-direction: column;
    background-color: #f0f0f0;
    background-image: linear-gradient(0deg, #c0c0c0, #f0f0f0);
    border: 1px solid #808080;
    box-shadow: 0.25em 0.4em 0.75em rgba(0,0,0,0.5);
    padding: 1em;
    top: 100%;
    gap: 0.65em;
    z-index: 2;
}
.menu_home:hover .dropdown-home {
    display: flex !important;
}
.menu_info:hover .dropdown-info {
    display: flex !important;
}
.menu_colour:hover .dropdown-colour {
    display: flex !important;
}
.menu_download:hover .dropdown-download {
    display: flex !important;
}
.menu_catalog:hover .dropdown-catalog {
    display: flex !important;
}
.menu_novelty:hover .dropdown-novelty {
    display: flex !important;
}

/* --- index.html ---- */
.google_map {
    grid-column: 1 / -1;
    display: block;
    border: 0;
    width: 95%;
    height: 50vh;
    padding: 0;
    outline: 1px solid #808080;
    border-radius: 0.5em;
    margin: 1em auto;
}

/* --- home.html --- */
.fluct_table {
    display: grid;
    grid-template-columns: max-content auto;
    width: max-content;
    margin: var(--section-padding);
    padding: 1px;
    gap: 1px;
    background-color: #808080;
}
.fluct_table > div {
    background-color: #e0e0e0;
    padding: 0.5em;
}
.fluct_table > div:nth-child(odd) {
    background-color: #d0d0d0;
}
.fluct_table > div:nth-child(even) {
    text-align: right;
}

.terms > div {
    position: relative;
    isolation: isolate;
    margin-left: 1em;
}
.terms > div:nth-child(odd)::before {
    position: absolute;
    left: -1em;
    content: "■";
}
.terms > div:nth-child(even)::before {
    position: absolute;
    left: -1em;
    content: ":";
}

.netprice_example > span {
    position: relative;
    cursor: pointer;
    margin: 0 0.5em;
}
.netprice_example > span > div {
    display: none;
    position: absolute;
    background-color: #f0f0f0;
    border: 1px solid #808080;
    border-radius: 0.5em;
    padding: 0.5em;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    text-align: center;
    z-index: 2;
}
.netprice_example > span:hover > div {
    display: block;
}

.netprice_formula {
    list-style: none;
}
.netprice_formula > li {
    position: relative;
    isolation: isolate;
}
.netprice_formula > li::before {
    /* make list symbols align center */
    position: absolute;
    left: -0.75em;
    transform: translateX(-50%);
}
.netprice_formula > li:nth-child(1)::before {
    content: "*";
}
.netprice_formula > li:nth-child(2)::before {
    content: "^";
}
.netprice_formula > li:nth-child(3)::before {
    content: "#";
}
.netprice_formula > li:nth-child(4)::before {
    content: "@";
}

/* --- info.html --- */
.download_list {
    list-style: none;
    padding-top: 0;
    padding-bottom: 0;
}
.download_list > li {
    position: relative;
    padding: 0;
    margin: 0.5em 0;
}
.download_list > li::before {
    content: "> ";
    position: absolute;
    left: -1em;
}

/* --- colour.html --- */
.col_table {
    width: 100%;
    border-collapse: collapse;
}
.col_table :is(th, td) {
    padding: 0.5em;
    text-align: left;
    vertical-align: top;
}
.col_table > thead {
    position: sticky;
    z-index: 2;
    background-color: #b0b0b0;
    top: 10.75rem;
}
.col_table > thead::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #808080;
}
.col_table tr[tyk] {
    position: relative;
}
.col_table tr[tyk]::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #b0b0b0;
}

.col_table td:nth-of-type(1) {
    width: 18%;
}
.col_table td:nth-of-type(2) {
    width: 10%;
}
.col_table td:nth-of-type(3) {
    width: 24%;
}
.col_table td:nth-of-type(4) {
    width: 18%;
}
.col_table td:nth-of-type(5) {
    width: 30%;
}

.sort_buttons {
    position: sticky;
    z-index: 3;
    bottom: 0px;
    display: inline-flex;
    gap: 0.5em;
    float: right;
}
.sort_buttons > button {
    box-shadow: 0.25em 0.4em 0.75em rgba(0,0,0,0.5);
}

.preview {
    position: relative;
    cursor: pointer;
}
.preview > img:first-child {
    width: 30px;
    height: 30px;
}
.preview span {
    display: none;
    position: absolute;
    z-index: 20;
    top: -150px;
    left: 15px;
    width: 300px;
    height: 300px;
    border: 1px solid black;
    box-shadow: 0.25em 0.4em 0.75em rgba(0,0,0,0.5);
    background-image: url("pic/ajax-loader.gif");
    background-color: #e0e0e0;
    background-position: center;
    background-repeat: no-repeat;
    text-align: center;
    vertical-align: middle;
}
.preview > img:hover + span {
    display: block;
}

/* --- download.html --- */
.hr_list > li + li {
    margin-top: 1em;
    position: relative;
}
.hr_list > li + li::after {
    content: "";
    position: absolute;
    top: -0.5em;
    left: calc(-2.5 * var(--section-padding));
    right: calc(-2.5 * var(--section-padding));
    height: 1px;
    background-color: #808080;
}

/* --- catalogue.html --- */
.article_search > * {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}
.cards_grid {
    display: grid;
    gap: 0.5em;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.cards_grid > div {
    box-sizing: border-box;
    width: 100%;
    padding: var(--section-padding) 0;
    border: 1px solid #808080;
    border-radius: 0.5em;
    display: flex;
    flex-flow: column;
    justify-content: space-evenly;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    height: 100%;
    text-align: center;
}
.cards_grid img {
    display: inline;
    object-fit: contain;
}
.cards_grid .brand {
    align-self: flex-start;
    margin-left: var(--section-padding);
    height: 25px;
}
.cards_grid p {
    margin-top: 0.5em;
}

/* --- novelty.html --- */
.novelty_catalog a {
    position: relative;
}
.novelty_catalog img {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
}
.novelty_catalog a:hover + img {
    display: block;
}

/* --- types.html --- */
.sub_img {
    position: absolute;
    right: 0;
}

/*************** MEDIA QUERIES: larger tablets ***************/
@media (max-width: 720px) {
    * {
        --wrapper-padding: 1em;
    }

    .logo > div {
        display: none;
    }

    .brand_in_copy {
        font-stretch: condensed;
        letter-spacing: -0.3px;
    }

    .copyright {
        font-stretch: condensed;
        letter-spacing: -0.3px;
    }
    
    a.shortcut {
        display: block;
        position: relative;
        visibility: hidden;
        top: calc(-8.25rem - var(--wrapper-padding));
    }
    
    form > input {
        font-stretch: condensed;
        letter-spacing: -0.3px;
    }
    button {
        font-stretch: condensed;
        letter-spacing: -0.3px;
    }

    .menu_icon_open {
        display: block;
    }
    .menu_icon_close {
        display: none;
    }
    #menu_toggle:checked ~ ul {
        display: flex;
    }
    #menu_toggle:checked ~ label > .menu_icon_open {
        display: none;
    }
    #menu_toggle:checked ~ label > .menu_icon_close {
        display: block;
    }
    nav {
        max-height: calc(100vh - 14rem);
        overflow-y: auto;
    }
    nav > label {
        display: block;
        position: fixed;
    }
    nav ul {
        display: none;
        flex-direction: column;
        gap: 1em;
        padding-top: 0.5em;
    }
    nav li {
        box-sizing: border-box;
        width: 100%;
    }
    nav > ul > li {
        padding-left: 2rem;
    }
    li[class^="menu_"] + li[class^="menu_"]::after {
        content: "";
        position: absolute;
        top: -1.25em;
        left: 0;
        right: 0;
        height: 1px;
        background-color: #b0b0b0;
    }
    *[class^="dropdown-"] {
        display: flex;
        position: relative;
        box-sizing: border-box;
        width: 100%;
        max-height: max-content;
        background-color: transparent;
        background-image: none;
        border: none;
        box-shadow: none;
        list-style: square;
        margin-left: 0;
    }
    *[class^="dropdown-"] > li {
        padding-left: 1em;
    }

    .aside {
        display: none;
    }

    /* --- colour.html --- */
    .col_table > thead {
        top: 8.5rem;
    }

    .col_table :is(th, td) {
        font-size: 0.8rem;
    }
}

/*************** MEDIA QUERIES: phones ***************/
@media (max-width: 600px) {
    .hero {
        --hero-height: 35vh;
    }

    .brand_in_copy {
        letter-spacing: -1px;
    }

    .section_with_image {
        flex-wrap: wrap;
    }
    .section_with_image > div {
        height: max-content;
    }
    .section_with_image > div > img {
        max-width: min(300px, 66vw);
        max-height: 66vw;
    }
    .section_with_image > div > img + img {
        /* Make subsequent section images disappear in phone mode */
        display: none;
    }
    
    .condense > section {
        flex-basis: content;
    }

    .table-2col {
        grid-template-columns: auto;
    }
    .table-2col input {
        min-width: 300px;
    }

    /* --- info.html --- */
    .terms > div:nth-child(odd) {
        text-decoration: underline;
    }
    .terms > div:nth-child(even)::before {
        content: "";
    }
    
    /* --- colour.html --- */
    .col_table thead {
        display: none;
    }
    .col_table td {
        display: grid;
        grid-template-columns: 16ch auto;
        padding: 0.25rem 1rem;
        font-size: 0.9rem !important;
        white-space: nowrap;
    }
    .col_table td::before {
        white-space: pre;
    }
    .col_table td:first-child {
        padding-top: 1rem;
    }
    .col_table td:last-child {
        padding-bottom: 1rem;
    }
    .col_table td:nth-of-type(1)::before {
        content: "平 底／尖 底\a Flatback / Chaton";
    }
    .col_table td:nth-of-type(2)::before {
        content: "顏 色 編 碼\a Colour Code";
    }
    .col_table td:nth-of-type(3)::before {
        content: "顏 色 名 稱\a Colour Name";
    }
    .col_table td:nth-of-type(4)::before {
        content: "價 格 類 別\a Price Category";
    }
    .col_table td:nth-of-type(5)::before {
        content: "其 他 資 料\a Remarks";
    }
    
    .col_table tr[tyk] {
        display: block;
        max-width: calc(100vw - 3px - var(--wrapper-padding)*2);
    }
    .col_table tr[tyk]::after {
        right: unset;
        width: calc(100vw - 3px - var(--wrapper-padding)*2);
    }
    .preview span {
        top: unset;
        left: unset;
        bottom: 30px;
        right: -75px;
    }
}