/* =========================================================
   style.css
   Global visual styles for the whole website.
   ========================================================= */

/* CSS Variables for consistent theming and easy maintenance */
:root {
  /* Layout */
  --max-width: 1280px;
  --padding-x: 22px;
  --sidebar-width: 260px;
  --sidebar-gap: 55px;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 14px;
  --font-size-xs: 13px;
  --line-height-base: 1.7;
  
  /* Colors */
  --color-white: #fdfbf3;
  --color-bg: #faf7ec;
  --color-text-primary: #3d4144;
  --color-text-secondary: #666;
  --color-text-tertiary: #888;
  --color-text-dark: #333;
  --color-text-link: #2f7ea5;
  --color-text-link-hover: #1b5f80;
  --color-text-nav: #555;
  --color-text-nav-hover: #222;
  --color-border-light: #eeead9;
  --color-border-subtle: #e9e5d5;
  --color-border-light-left: #ddd8c4;
  --color-bg-notice: #f4f0e1;
  --color-icon: #888;
  --color-muted: #777;
  --color-gray-light: #999;
}

/* Dark ("black background, white text") mode palette.
   Overrides the same CSS variables used everywhere else, so every
   component that already reads var(--color-*) picks up the dark
   colors automatically without needing separate dark-mode rules.
   Backgrounds use a softened dark gray (not pure black) and the
   light-mode background above is a warm off-white (not pure white)
   so neither mode is a harsh, eye-straining black-on-white or
   white-on-black extreme. */
html.dark-mode {
  --color-white: #2a2a2a;
  --color-bg: #242424;
  --color-text-primary: #e4e4e4;
  --color-text-secondary: #bbb;
  --color-text-tertiary: #999;
  --color-text-dark: #f0f0f0;
  --color-text-link: #6cb6e0;
  --color-text-link-hover: #94cdf0;
  --color-text-nav: #ccc;
  --color-text-nav-hover: #fff;
  --color-border-light: #3a3a3a;
  --color-border-subtle: #383838;
  --color-border-light-left: #4a4a4a;
  --color-bg-notice: #2e2e2e;
  --color-icon: #aaa;
  --color-muted: #aaa;
  --color-gray-light: #777;
}

/* Smooth transition when switching modes. */
body, .masthead, .greedy-nav, .sidebar, main, footer {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Make width/height calculations easier and more predictable. */
* {
  box-sizing: border-box;
}

/* Smooth scrolling when clicking internal anchor links. */
html {
  scroll-behavior: smooth;
}

/* Global page appearance. */
body {
  margin: 0;
  color: var(--color-text-primary);
  background: var(--color-bg);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

/* Default hyperlink style. */
a {
  color: var(--color-text-link);
  text-decoration: none;
}

/* Visual feedback when hovering over links. */
a:hover {
  color: var(--color-text-link-hover);
  text-decoration: underline;
}

/* =========================================================
   TOP NAVIGATION / MASTHEAD
   ========================================================= */

.masthead {
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-white);
  min-height: 74px;
}

.masthead__inner-wrap {
  max-width: var(--max-width);
  margin: auto;
  padding: 0 var(--padding-x);
  min-height: 74px;
  display: flex;
  align-items: center;
}

.site-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-right: auto;
}

.site-title a {
  color: var(--color-text-dark);
  text-decoration: none;
}

.greedy-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.greedy-nav a {
  color: var(--color-text-nav);
  font-size: var(--font-size-sm);
}

.greedy-nav a:hover {
  color: var(--color-text-nav-hover);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  border: 0;
  background: none;
  font-size: 22px;
  cursor: pointer;
}

.mode-toggle {
  border: 0;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-text-nav);
  padding: 0;
  line-height: 1;
}

.mode-toggle:hover {
  color: var(--color-text-nav-hover);
}


/* =========================================================
   MAIN TWO-COLUMN PAGE LAYOUT
   ========================================================= */

.page-wrap {
  max-width: var(--max-width);
  margin: auto;
  padding: 46px var(--padding-x) 70px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--sidebar-gap);
}

.author-profile {
  position: sticky;
  top: 25px;
}

.author-avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 18px;
  background: #eee;
}

.author-profile h1 {
  margin: 0 0 2px;
  color: var(--color-text-dark);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

.author-role {
  margin: 0 0 15px;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* Reset list styles and apply consistent spacing */
.author-links {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  line-height: 1.8;
}

.author-links li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

/* Font Awesome icon styling with proper alignment */
.author-links .icon {
  width: 16px;
  min-width: 16px;
  flex-shrink: 0;
  color: var(--color-icon);
  text-align: center;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-content {
  min-width: 0;
  max-width: 850px;
}

.page {
  padding-top: 0;
}

.intro {
  margin-top: 0;
  font-size: var(--font-size-base);
}

/* =========================================================
   ARTICLE TYPOGRAPHY
   ========================================================= */

h2 {
  margin: 42px 0 15px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-dark);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.3;
}

h3 {
  margin: 25px 0 7px;
  color: var(--color-text-dark);
  font-size: 18px;
  line-height: 1.4;
}

h4 {
  margin: 0 0 4px;
  color: var(--color-text-dark);
  font-size: 17px;
  line-height: 1.4;
}

p {
  margin: 0 0 17px;
}

ul {
  margin-top: 0;
  padding-left: 24px;
}

.notice {
  padding: 18px 22px;
  background: var(--color-bg-notice);
  border-left: 4px solid var(--color-border-light-left);
  margin: 18px 0;
}

.notice p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
}

/* =========================================================
   RESEARCH PROJECTS PAGE
   ========================================================= */

.project {
  padding: 17px 0 18px;
  border-bottom: 1px solid var(--color-border-light);
}

.project h3 {
  margin: 0 0 7px;
  font-size: 17px;
}

.project h3 span {
  float: right;
  color: var(--color-gray-light);
  font-size: var(--font-size-xs);
  font-weight: 400;
}

.project p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* =========================================================
   CV PAGE
   ========================================================= */

.cv-list {
  margin-top: 24px;
}

.cv-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 25px;
  padding: 18px 0;
}

.cv-date {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.cv-item h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.cv-item p {
  margin: 0;
  color: var(--color-text-secondary);
}

.cv-item p.cv-org {
  margin: 0 0 4px;
  color: var(--color-text-primary);
  font-weight: 600;
}

.cv-section-title {
  font-size: 21px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border-subtle);
}

.cv-section-title:first-of-type {
  padding-top: 0;
  border-top: none;
}

.skill-list {
  margin-top: 24px;
  list-style: none;
  padding: 0;
}

.skill-item {
  padding: 10px 0;
}

.skill-item strong {
  display: block;
  margin-bottom: 6px;
}

.skill-item span {
  color: var(--color-text-secondary);
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
  border-top: 1px solid var(--color-border-subtle);
  max-width: var(--max-width);
  margin: auto;
  padding: 24px var(--padding-x) 40px;
  color: var(--color-text-tertiary);
  font-size: 12px;
}

/* =========================================================
   MOBILE RESPONSIVE LAYOUT (max-width: 800px)
   ========================================================= */

@media (max-width: 800px) {
  .masthead,
  .masthead__inner-wrap {
    min-height: 60px;
  }

  .greedy-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 15px var(--padding-x);
    flex-direction: column;
    gap: 12px;
    z-index: 10;
  }

  .greedy-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .page-wrap {
    grid-template-columns: 1fr;
    gap: 35px;
    padding-top: 30px;
  }

  .author-profile {
    position: static;
  }

  .author-avatar {
    width: 120px;
    height: 120px;
  }

  .project h3 span {
    float: none;
    display: block;
    margin-top: 3px;
  }

  .cv-item {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
