/* ============================================
   Personal Website — Rust Book Coal Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600&family=Source+Code+Pro:wght@400;500&display=swap');

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #141617;
  --bg-sidebar: #191b1d;
  --bg-topbar: #141617;
  --bg-inline-code: #1c1e21;
  --bg-blockquote: #1a1d20;
  --text-primary: #c8c8c8;
  --text-secondary: #9a9a9a;
  --text-muted: #6a6a6a;
  --text-heading: #e0e0e0;
  --accent: #2b79a2;
  --accent-hover: #45a0cc;
  --border: #282a2d;
  --border-sidebar: #252729;
  --sidebar-active-bg: #1f2224;
  --max-width: 750px;
  --sidebar-width: 260px;
  --transition: 0.15s ease;
}

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

body {
  font-family: 'Source Sans 3', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---------- Layout ---------- */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.sidebar-brand {
  padding: 1.2rem 1.25rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1.3;
  border-bottom: 1px solid var(--border-sidebar);
}

.sidebar-brand span {
  display: block;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-nav {
  list-style: none;
  padding: 0.75rem 0;
  flex: 1;
}

.sidebar-nav a {
  display: block;
  padding: 0.35rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.6;
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background-color: var(--sidebar-active-bg);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--text-heading);
  font-weight: 500;
  background-color: var(--sidebar-active-bg);
}

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-sidebar);
  display: flex;
  gap: 1.2rem;
}

.sidebar-footer a {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Main Content ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem 3rem;
}

.content-container {
  max-width: var(--max-width);
}

/* ---------- Mobile Nav Toggle ---------- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 200;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 3px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

.overlay.active {
  display: block;
}

/* ---------- Hero Section ---------- */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 1.8rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}

.hero-photo {
  width: 110px;
  height: 110px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  opacity: 0.92;
}

.hero-info h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  font-style: italic;
  font-family: 'Source Serif 4', Georgia, serif;
}

/* ---------- Section ---------- */
.section {
  margin-bottom: 2.2rem;
}

.section-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  text-transform: none;
  letter-spacing: normal;
}

/* ---------- Info List ---------- */
.info-item {
  margin-bottom: 1.4rem;
}

.info-item h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.15rem;
}

.info-item .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.info-item .date {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.info-item p,
.info-item ul {
  color: var(--text-primary);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

.info-item ul {
  list-style: disc;
  padding-left: 1.5rem;
}

.info-item ul li {
  margin-bottom: 0.15rem;
  padding-left: 0;
}

/* ---------- Skills / Tags ---------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: var(--bg-inline-code);
  color: var(--text-primary);
  font-family: 'Source Code Pro', monospace;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ---------- Project Cards ---------- */
.project-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.project-card:last-child {
  border-bottom: none;
}

.project-card h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.15rem;
}

.project-card .project-tech {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.project-card p {
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.project-card .project-link {
  font-size: 0.85rem;
}

/* ---------- Contact List ---------- */
.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.contact-list li:last-child {
  border-bottom: none;
}

.contact-list .contact-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: inline;
  margin-right: 0.4rem;
}

.contact-list .contact-label::after {
  content: ':';
}

/* ---------- Detail List ---------- */
.detail-list {
  list-style: none;
  padding: 0;
}

.detail-list li {
  padding: 0.35rem 0;
  font-size: 0.92rem;
  display: flex;
  gap: 0.5rem;
}

.detail-list .label {
  color: var(--text-heading);
  font-weight: 500;
  min-width: 80px;
}

.detail-list .value {
  color: var(--text-secondary);
}

/* ---------- Research Page ---------- */
.research-notice {
  background: var(--bg-blockquote);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.research-notice strong {
  color: var(--text-heading);
}

.research-card {
  margin-bottom: 0.5rem;
}

.research-card details {
  border-bottom: 1px solid var(--border);
}

.research-card details[open] {
  border-bottom: 1px solid var(--accent);
}

.research-card summary {
  padding: 0.8rem 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  user-select: none;
  transition: color var(--transition);
}

.research-card summary::-webkit-details-marker {
  display: none;
}

.research-card summary::after {
  content: '›';
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.research-card details[open] summary::after {
  transform: rotate(90deg);
}

.research-card summary:hover .research-title {
  color: var(--accent);
}

.research-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  transition: color var(--transition);
}

.research-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

.research-content {
  padding: 0 0 1rem 0;
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.75;
}

.research-content p {
  margin-top: 0.6rem;
}

/* ---------- Page Title ---------- */
.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-style: italic;
  font-family: 'Source Serif 4', Georgia, serif;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 3.5rem 1.25rem 2rem;
  }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }

  .hero-photo {
    width: 90px;
    height: 90px;
  }

  .hero-info h1 {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 3rem 1rem 1.5rem;
  }
}
