*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #31548A;
  --blue-dark: #263f6a;
  --blue-light: #e8edf5;
  --text: #1a1a1a;
  --text-muted: #555;
  --border: #ccc;
  --bg: #ffffff;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 0.95rem;
}

#main p {
  margin-bottom: 1rem;
}

/* SITE HEADER */
#site-header {
  background: var(--blue);
  color: #fff;
  padding: 10px 0 8px;
  text-align: center;
  border-bottom: 3px solid var(--blue-dark);
}

#site-header h1 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

#site-header p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.72);
  margin-top: 2px;
}

/* NAVIGATION */
#nav {
  background: var(--blue-dark);
  border-bottom: 2px solid #1a2e4a;
  position: sticky;
  top: 0;
  z-index: 100;
}

#nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0 auto;
  max-width: 1100px;
  padding: 0 12px;
}

#nav ul li a {
  display: block;
  color: #d8e3f0;
  text-decoration: none;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

#nav ul li a:hover,
#nav ul li a.active {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
}

/* MAIN CONTENT */
#main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

/* PAGE TITLE */
.page-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue);
  border-bottom: 2px solid var(--blue);
  padding-bottom: 6px;
  margin-bottom: 18px;
}

/* SECTION HEADING */
.section-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding: 5px 10px;
  margin: 22px 0 12px;
}

/* HOMEPAGE */
.home-intro {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 24px;
  align-items: start;
  margin-bottom: 22px;
}

.home-intro-text h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.1rem;
  color: var(--blue);
  margin-bottom: 10px;
}

.home-intro-text p {
  margin-bottom: 9px;
}

.home-portrait {
  text-align: center;
}

.home-portrait img {
  width: 160px;
  height: 200px;
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--blue);
  display: block;
  margin: 0 auto;
}

.home-portrait figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* SITE INDEX BOX */
.site-index {
  background: var(--blue-light);
  border: 1px solid #b8c8df;
  padding: 13px 16px;
  margin-top: 18px;
}

.site-index h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.92rem;
  color: var(--blue);
  margin-bottom: 9px;
  font-weight: 700;
}

.site-index ul {
  columns: 2;
  list-style: disc;
  padding-left: 18px;
}

.site-index ul li {
  margin-bottom: 4px;
  break-inside: avoid;
  font-size: 0.9rem;
}

/* LINKS */
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ARTICLE LIST */
.article-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.article-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.article-list li a { font-weight: 500; }

/* GENERAL LIST */
.content-list {
  list-style: disc;
  padding-left: 20px;
  margin-bottom: 14px;
}

.content-list li { margin-bottom: 5px; font-size: 0.9rem; }

/* RESUME */
.resume-section { margin-bottom: 8px; }

.resume-entry { margin-bottom: 15px; }

.resume-entry .resume-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.resume-entry .resume-title { font-weight: 600; }
.resume-entry .resume-org { color: var(--blue); font-style: italic; }
.resume-entry .resume-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.resume-entry ul {
  margin-top: 4px;
  padding-left: 18px;
  list-style: disc;
}

.resume-entry ul li { margin-bottom: 3px; font-size: 0.88rem; }

.resume-download {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--blue-light);
  border: 1px solid #b8c8df;
  font-size: 0.88rem;
  display: inline-block;
}

/* PROJECTS */
.project-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fafafa;
}

.project-card h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.98rem;
  color: var(--blue);
  margin-bottom: 5px;
}

.project-card p {
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.project-card .project-links { font-size: 0.82rem; }

/* LINKS PAGE */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.link-card {
  border: 1px solid var(--border);
  padding: 11px 13px;
  background: #fafafa;
}

.link-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--blue);
}

.link-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* READING LIST */
.book-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.book-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.book-list li .book-author { color: var(--text-muted); }

/* DOWNLOADS */
.download-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.download-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.download-list li .dl-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* CONTACT */
.contact-table {
  width: 100%;
  max-width: 480px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.contact-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.contact-table td:first-child {
  font-weight: 600;
  color: var(--blue);
  width: 120px;
}

/* ARTICLE PAGE */
.article-body { max-width: 680px; }

.article-body h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.4rem;
  color: var(--blue);
  margin-bottom: 5px;
  line-height: 1.3;
}

.article-body .article-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.article-body p {
  margin-bottom: 14px;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.96rem;
  line-height: 1.75;
  color: #222;
}

.article-body h3 {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1rem;
  color: var(--blue);
  margin: 18px 0 7px;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.83rem;
}

/* FOOTER */
#site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.65);
  text-align: center;
  padding: 11px;
  font-size: 0.76rem;
  border-top: 2px solid #1a2e4a;
  margin-top: 40px;
}

#site-footer a { color: rgba(255,255,255,0.82); }

/* UTILITY */
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  #site-header h1 { font-size: 1.2rem; }

  #nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #nav ul li a { padding: 9px 9px; font-size: 0.75rem; }

  .home-intro { grid-template-columns: 1fr; }

  .home-portrait {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    text-align: left;
  }

  .home-portrait img { width: 100px; height: 125px; margin: 0; }

  .site-index ul { columns: 1; }

  .links-grid { grid-template-columns: 1fr; }
}
