:root {
    --maxTextWidth: 1000px;
    --line-height:1.28em;
    --margin:24px;
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400&display=swap');

@font-face {
    font-family: "unstately";
    src: url("../fonts/Unstately.otf") format("opentype");
    font-weight:normal;
    font-style:normal;
}

@font-face {
    font-family: "runic";
    src: url("../fonts/Runic_Siri.otf") format("opentype");
    font-weight:normal;
    font-style:normal;
}

* {
    box-sizing:border-box;
    hyphens: auto;
    -ms-hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;

    font-weight:normal;
}

html {
    font-size: clamp(16px, 10vw, 24px);
}

body {
    font-family: "runic";
    line-height:var(--line-height);
    letter-spacing:.75px;
    position:relative;
    margin:0;
    padding:0;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
}

span.chinese {
    font-family: "Noto Serif SC", serif;
    font-weight: 300;
    font-style: normal;
}

img, video, iframe {
    max-width:100%;
    max-height:100%;
    background: #0000000d;
}

iframe {
    width:100%;
    aspect-ratio: 16 / 9;
}

a {
    color: rgb(181, 0, 181);
    text-decoration: underline wavy 2px;
    text-underline-offset:.15em;
}

a:visited, .header a {
    color:slategray;
}

.icon a, .header a {
    text-decoration:none;
}

p {
    margin: 1em 0;
}

.project:first-of-type, p:first-of-type, .icons + p {
    margin: 0 0 1em 0;
}

p:last-of-type {
    margin-bottom:0;
}

/*!temporarily nullifying italics since runic.otf doesn't have italics!*/
i, em {
    font-style:normal;
}


/* SECTIONS - FLAT LAYOUT (no sticky) */
.main {
    position:relative;
    width:100%;
    min-height:100dvh;

    padding: var(--margin);

    display:grid;
    grid-template-columns: 1fr;
    gap: calc(var(--margin) * 2); /* larger gap for differentiation without sticky */
    justify-content:center;
    justify-items: center;
}

.main > *:nth-child(2) {
    margin-top: calc(-1 * var(--margin)); /* to maintain the same gap between first and second elements */
}

.main::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.main::-webkit-scrollbar-track {
    background: rgb(233, 233, 233);
    border-radius: 0;
}

.main::-webkit-scrollbar-thumb {
    background: rgb(218, 218, 218);
    border-radius: 0;
}

.main > * {
    width:100%;
    max-width: var(--maxTextWidth);
}

/* NO STICKY - just regular flow */
.constant {
    /* No sticky positioning */
    padding: 0;
}

.stickyContainer {
    /* No sticky positioning, just regular margin */
    margin: 0;
}

.sticky_bg {
    background: white;
}

/* ICONS */
.icon {
    display:inline;
}

.icon * {
    width:auto;
    height:auto;
    max-height:10em;
    max-width:14em;
}

/* FOOTER */
footer {
    width:100%;
    display:grid;
    justify-items: center;
}

.footer-header {
    display:block;
    font-size:.55rem;
}

.footer-gallery {
    max-width: var(--maxTextWidth);
    display:grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: auto;
    gap: var(--margin);
    justify-items:center;
    align-items:start;
    transition: all 0.3s ease;
}

footer img {
    width: 100%;
    height:auto;
    object-fit: contain;
}

/* PRELOADER */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  background: white;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.5s;
  z-index: 9999;
}

.preloader-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1em;
  color: black;

  opacity: 0;
  animation: fadeIn 1s forwards;
  animation-delay: .5s;
  -webkit-animation-delay: .5s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* MEDIA QUERIES */
@media screen and (max-width: 1200px) {
    .main {
        padding: var(--margin);
    }
}

@media screen and (max-width: 1000px) {
    .footer-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media screen and (max-width: 800px) {
    .icon img, .icon video {
        max-height:8em;
        max-width:12em;
    }
}

@media screen and (max-width: 480px) {
    :root {
        --margin:16px;
    }

    html {
        font-size: 16px;
    }

    .icon img, .icon video {
        max-height:6em;
        max-width:10em;
    }

    .footer-gallery {
        gap: calc(var(--margin) / 2);
        grid-template-columns: repeat(2, 1fr);
    }
}
