/* ============================================================
   Yinghua Zhou — personal site
   Elegant type: Fraunces (display) + Newsreader (body)
   Warm "skin" background, teal/amber accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Newsreader:opsz,ital,wght@6..72,0,400;6..72,0,500;6..72,0,600;6..72,1,400&display=swap');

:root {
  --bg:        #fdfbf7;   /* near-white with a faint warmth */
  --bg-tint:   #f5efe5;
  --card:      #ffffff;
  --border:    #ece3d5;
  --ink:       #2a2620;
  --muted:     #7a7063;
  --accent:    #d2691e;   /* orange */
  --accent-2:  #9c4a12;   /* deeper burnt orange (hover) */
  --highlight: #ffe9b0;
  --quote:     #35302a;   /* blockquote text */

  --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --serif-body:    'Newsreader', Georgia, 'Times New Roman', serif;
}

/* ---- night mode ---- */
:root[data-theme="dark"] {
  --bg:        #191510;
  --bg-tint:   #2a241d;
  --card:      #221e17;
  --border:    #38312a;
  --ink:       #ece6dc;
  --muted:     #a99e8e;
  --accent:    #ec9550;   /* brighter orange for contrast on dark */
  --accent-2:  #f4b276;
  --highlight: #4d3f1c;
  --quote:     #d8d1c5;
}
:root[data-theme="dark"] body { color: var(--ink); }

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
td,
th,
tr,
p,
a,
li,
div {
  font-family: var(--serif-body);
  font-size: 16px;
  line-height: 1.5;
}

strong { font-family: var(--serif-body); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .15s ease;
}
a:focus,
a:hover {
  color: var(--accent-2);
  text-decoration: none;
}

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  color: var(--ink);
  font-weight: 600;
}

h2 {
  margin: 0;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: .2px;
}

.papertitle {
  font-family: var(--serif-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .1px;
}

.name {
  padding-top: 20px;
  margin: 0;
  font-family: var(--serif-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: .3px;
}

/* ---- profile photo: round, not clickable ---- */
.profile-pic {
  width: 246px;
  height: 246px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(60, 45, 25, .16);
  border: 3px solid var(--card);
  cursor: default;
}

/* mobile-only floated photo — the text wraps around it on narrow screens */
.profile-pic-mobile { display: none; }

/* ---- contact line + links row ---- */
.contact-line { color: var(--muted); }

/* image-swap hover cells (kept from template) */
.one {
  width: 160px;
  height: 160px;
  position: relative;
}
.two {
  width: 160px;
  height: 160px;
  position: absolute;
  transition: opacity .2s ease-in-out;
}
.fade { transition: opacity .2s ease-in-out; }

span.highlight { background-color: var(--highlight); }

.colored-box {
  color: #2a2620;
  padding: 20px;
  display: inline-block;
  border-radius: 10px;
}

/* ---- research entries: tight vertical rhythm + top-aligned teaser so the
   text block reads as a compact unit next to the thumbnail ---- */
.entries td { line-height: 1.28; vertical-align: top !important; }
.entries p { margin: 0.28em 0; }
.entries p:empty { margin: 0; display: none; }
.entries .papertitle { line-height: 1.25; }

/* ============================================================
   Blog / Home tab — a simple link, aligned to the content's right edge
   (like a "paper" link in a research entry, just a touch more refined)
   ============================================================ */
.blog-tab {
  position: absolute;
  top: 22px;
  right: max(16px, calc(50% - 400px));   /* the right edge of the centered section */
  z-index: 20;
  font-family: var(--serif-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .3px;
  color: var(--accent);
  padding-bottom: 1px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.blog-tab:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

/* top-right controls: Blog/Home link + day/night toggle, grouped and aligned */
.top-nav {
  position: absolute;
  top: 20px;
  right: max(16px, calc(50% - 400px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-nav .blog-tab { position: static; top: auto; right: auto; }

/* day / night toggle — to the right of the Blog/Home link */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--ink);
  opacity: .66;
  transition: opacity .15s ease, color .15s ease, transform .15s ease;
}
.theme-toggle svg { display: block; width: 18px; height: 18px; }
.theme-toggle:hover { opacity: 1; color: var(--accent); transform: scale(1.1); }

/* ============================================================
   Blog index — vertically stacked banners
   ============================================================ */
.blog-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 78px 20px 80px;   /* clear space below the fixed Home tab */
}
.blog-head { text-align: center; margin-bottom: 34px; }
.blog-head .name { font-size: 44px; }
.blog-head p { color: var(--muted); margin: 6px 0 0; }

.banner-list { display: flex; flex-direction: column; gap: 16px; }

.banner {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 22px 26px;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(60, 45, 25, .07);
  /* smooth reveal */
  opacity: 0;
  transform: translateY(16px);
  animation: banner-in .55s cubic-bezier(.22, .61, .36, 1) forwards;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.banner:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(60, 45, 25, .16);
  border-color: var(--accent);
  color: var(--ink);
}
/* colored left accent bar keyed to category */
.banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--cat, var(--accent));
}
.banner .banner-title {
  font-family: var(--serif-display);
  font-size: 23px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
}
.banner .banner-desc { color: var(--muted); margin: 0 0 8px; }
.banner .banner-meta { color: var(--muted); font-size: 14px; font-style: italic; }

@keyframes banner-in {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Post page
   ============================================================ */
.post {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 22px 90px;
}
.post-nav { margin-bottom: 26px; font-size: 15px; }
.post-nav a { font-family: var(--serif-display); font-weight: 500; }
.post-header { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 12px; }
.post-header h1 {
  font-size: 38px;
  line-height: 1.22;
  margin: 0 0 10px;
}
.post-meta { color: var(--muted); font-size: 15px; font-style: italic; }
.post-tags { margin-top: 10px; }
.post-tags .tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .5px;
  color: var(--accent);
  background: var(--bg-tint);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 0 6px 6px 0;
}

.post-body { font-size: 17px; line-height: 1.75; }
.post-body p { margin: 1.05em 0; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { margin: 1.5em 0 .5em; line-height: 1.3; }
.post-body h3 { font-size: 24px; }
.post-body h4 { font-size: 20px; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.4em auto; }
.post-body img.center { margin-left: auto; margin-right: auto; }
.post-body ul, .post-body ol { padding-left: 1.5em; }
.post-body li { margin: .35em 0; }
.post-body blockquote {
  border-left: 4px solid var(--accent);
  margin: 1.2em 0;
  padding: .2em 1.1em;
  color: var(--quote);   /* readable, not light gray; adapts to theme */
  background: var(--bg-tint);
  border-radius: 0 8px 8px 0;
}
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.post-body a { text-decoration: underline; text-decoration-color: rgba(210,105,30,.4); text-underline-offset: 2px; }

/* table of contents (Leetcode Series page) */
.toc {
  background: var(--bg-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 24px;
  margin: 6px 0 30px;
}
.toc-title {
  font-family: var(--serif-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.toc ol { margin: 0; padding-left: 1.4em; }
.toc li { margin: .3em 0; }
.toc a { text-decoration: none; }
.series-item { margin-top: 42px; }
.series-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin: 0 0 4px;
  scroll-margin-top: 16px;
  letter-spacing: .2px;
}
/* content sub-headings (Code, Approach, …) — secondary to the title, and NOT
   orange (orange is reserved for links); small uppercase label treatment */
.series-item h3, .series-item h4 {
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 1.5em 0 .5em;
}
.series-item h5, .series-item h6 { font-size: 15px; color: var(--ink); font-weight: 600; margin: 1em 0 .3em; }

/* inline code + code blocks */
.post-body code {
  font-family: 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 14px;
  background: var(--bg-tint);
  padding: 2px 6px;
  border-radius: 5px;
}
.post-body pre {
  background: #2b2b2b;
  color: #f8f8f2;
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.post-body pre code { background: none; padding: 0; font-size: 13.5px; color: inherit; }
.post-body .complex-math { overflow-x: auto; }

/* MathJax display scroll on narrow screens */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 620px) {
  .name { font-size: 32px; }
  .post-header h1 { font-size: 30px; }
  .top-nav { top: 14px; }
  .blog-tab { font-size: 16px; }
  .banner { padding: 18px 20px; }
  .banner .banner-title { font-size: 20px; }

  /* header reflows to a single column: photo floats inside the text */
  .photo-cell { display: none; }
  .intro-cell { width: 100% !important; max-width: 100% !important; }
  .profile-pic-mobile {
    display: block !important;
    float: right;
    width: 132px;
    height: 132px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--card);
    box-shadow: 0 4px 14px rgba(60, 45, 25, .16);
    margin: 4px 0 10px 18px;
  }
}
