/* ==========================================================================
   Dr. Lei Hua - site stylesheet
   Styling is based on the Hugo "Jane" theme by xianmin.
   Colours, sizes and spacing are grouped below so they are easy to tweak.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/dancing-script-vietnamese-400-normal.woff2) format("woff2"),
       url(/assets/fonts/dancing-script-vietnamese-400-normal.woff) format("woff");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
                 U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
                 U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/dancing-script-latin-ext-400-normal.woff2) format("woff2"),
       url(/assets/fonts/dancing-script-latin-ext-400-normal.woff) format("woff");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/dancing-script-latin-400-normal.woff2) format("woff2"),
       url(/assets/fonts/dancing-script-latin-400-normal.woff) format("woff");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   Theme variables - change a colour here and it updates everywhere
   -------------------------------------------------------------------------- */

:root {
  --ink:     rgba(0, 0, 0, 0.84);  /* body text                */
  --muted:   #8a8a8a;              /* dates, copyright         */
  --accent:  #c05b4d;              /* links, hover, mobile nav */
  --page:    #fefefe;              /* page background          */
  --surface: #ffffff;              /* the white article card   */
  --pale:    #f2f2f5;              /* area around the card     */
  --rule:    #d3d3d3;              /* the line under the title */

  --body-font:  "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --title-font: Athelas, Georgia, "Times New Roman", serif;
  --logo-font:  "Dancing Script", Chancery, "Segoe Script", "Brush Script MT", cursive;

  --content-width: 1080px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: var(--body-font);
  font-weight: 400;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
}

.container {
  width: var(--content-width);
  margin: 0 auto;
}

.site-frame { overflow-x: hidden; }

.page-panel {
  position: relative;
  z-index: 1;
  min-height: 100%;
  background: var(--page);
  transition: transform 0.3s;
}

/* --------------------------------------------------------------------------
   Header and desktop navigation
   -------------------------------------------------------------------------- */

.site-header::before,
.site-header::after { content: ""; display: table; }
.site-header::after  { clear: both; }

.logo-wrapper {
  float: left;
  padding-left: 15px;
}

.logo,
.mobile-logo {
  font-family: var(--logo-font);
  font-weight: 400;
}

.logo {
  display: inline-block;
  font-size: 36px;
  line-height: 64.8px;
  transform: scaleX(1.18);
  transform-origin: 0;
}

.desktop-nav ul {
  float: right;
  margin: 1em 0;
  padding-right: 15px;
  font-family: var(--title-font);
}

.desktop-nav li {
  position: relative;
  display: inline-block;
  margin: 0 1em;
}

.desktop-nav li + li { margin-left: 10px; }

.desktop-nav a { font-size: 18px; }
.desktop-nav a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Main content card
   -------------------------------------------------------------------------- */

.main-area      { background: var(--pale); }
.content-wrapper { padding: 3em 0 1px; }

.post {
  margin: 0 5em 3em;
  padding: 3em 5em;
  background: var(--surface);
}

.post-header {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--rule);
  text-align: center;
}

.post-title {
  margin: 0;
  font-family: var(--title-font);
  font-size: 1.8em;
  font-weight: 400;
}

.post-meta { color: var(--muted); font-size: 14px; }
.post-meta time { font-size: 15px; }

.post-content { overflow-wrap: break-word; }

.post-content a {
  color: var(--accent);
  word-break: break-word;
}

.post-content a:hover { border-bottom: 1px solid var(--accent); }
.post-content strong  { font-weight: 700; }

/* Centred image, e.g. the book cover. Use <p class="figure"> in content/*.md */
.post-content .figure {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.post-content .figure img { max-width: 100%; height: auto; }

/* A linked image: no underline, just a gentle fade on hover. */
.post-content .figure a,
.post-content .figure a:hover { border-bottom: 0; }
.post-content .figure a img { transition: opacity 0.2s; }
.post-content .figure a:hover img { opacity: 0.8; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer { margin-top: 2em; }

.social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-height: 61px;
}

.social-links a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #292929;
}

.social-links a + a { margin-left: 0.5em; }
.social-links a:hover { color: var(--accent); }

.social-links svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.linkedin-mark {
  display: grid;
  place-items: end center;
  width: 26px;
  height: 26px;
  padding-bottom: 1px;
  color: #fff;
  background: #292929;
  border-radius: 2px;
  font: 700 18px/1 Arial, sans-serif;
  text-shadow: 0 0 #fff;
}

.social-links a:hover .linkedin-mark { background: var(--accent); }

.copyright {
  margin: 10px 0;
  color: var(--muted);
  font-family: var(--title-font);
  text-align: center;
}

.copyright a { color: var(--accent); }
.copyright-year { display: block; }
.heart { font-size: 14px; }

/* --------------------------------------------------------------------------
   Mobile navigation - hidden on desktop, shown below 1080px
   -------------------------------------------------------------------------- */

.mobile-navbar,
.mobile-menu { display: none; }

@media screen and (max-width: 1080px) {

  .container { width: 100%; }

  .mobile-navbar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99;
    width: 100%;
    height: 50px;
    background: var(--page);
    box-shadow: 0 2px 2px #cacaca;
    text-align: center;
    transition: transform 0.3s;
  }

  .mobile-logo {
    display: inline-block;
    margin-right: 50px;
    font-size: 22px;
    line-height: 50px;
  }

  .menu-button {
    position: relative;
    float: left;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
  }

  .menu-button span {
    position: absolute;
    top: 24.5px;
    left: 15px;
    width: 20px;
    height: 1px;
    background: currentColor;
    transition: transform 0.35s, opacity 0.2s;
  }

  .menu-button span:first-child { transform: translateY(-6px); }
  .menu-button span:last-child  { transform: translateY(6px); }

  .menu-button.active span:first-child  { transform: rotate(45deg); }
  .menu-button.active span:nth-child(2) { opacity: 0; }
  .menu-button.active span:last-child   { transform: rotate(-45deg); }

  .mobile-menu {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 0;
    width: 180px;
    min-height: 100vh;
    background: rgba(248, 245, 236, 0.92);
    transform: translateX(-180px);
    transition: transform 0.3s;
  }

  .mobile-menu ul {
    margin: 50px 0 0;
    padding: 0;
    border-top: 1px solid #f8f5ec;
    list-style: none;
  }

  .mobile-menu a {
    display: block;
    padding: 10px 30px;
    border-bottom: 1px solid #f8f5ec;
    font-family: var(--title-font);
    font-size: 18px;
  }

  .mobile-menu a:hover { color: var(--accent); }

  .menu-open .mobile-menu   { transform: translateX(0); }
  .menu-open .page-panel,
  .menu-open .mobile-navbar { transform: translateX(180px); }

  .site-header {
    padding-top: 50px;
    text-align: center;
  }

  .logo-wrapper,
  .desktop-nav { display: none; }
}

@media screen and (min-width: 900px) and (max-width: 1080px) {
  .content-wrapper { padding: 2em 0 1px; }
  .post { margin: 0 2em 2em; }
}

@media screen and (min-width: 504px) and (max-width: 899px) {
  .content-wrapper { padding: 1em 0 1px; }
  .post { margin: 0 1em 2em; padding: 1em; }
}

@media screen and (max-width: 503px) {
  .content-wrapper { padding: 1em 0 1px; }
  .post { margin: 0 0 2em; padding: 1em; }
  .post-title { font-size: 1.5em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
