/* =============================================================
   Muhammad Hasan Ferdous — academic site
   Design: refined academic, warm paper background, serif typography
   ============================================================= */

:root {
  /* Color tokens */
  --bg: #fafaf7;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-soft: #3a3a3a;
  --text-muted: #6b6b6b;
  --accent: #6b3535;
  --accent-hover: #8b2c2c;
  --border: #e8e5dc;
  --border-soft: #efece4;
  --code-bg: #f4f1e9;

  /* Typography */
  --serif: 'Charter', 'Iowan Old Style', 'Cambria', 'Georgia', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;

  /* Layout */
  --content-width: 720px;
  --wide-width: 880px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

/* =============================================================
   Navigation
   ============================================================= */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.nav-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.005em;
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.15s ease;
  margin-right: 1.5rem; /* Fallback for browsers without flex gap */
}

.nav-links a:last-child {
  margin-right: 0;
}

@supports (gap: 1rem) {
  .nav-links a {
    margin-right: 0;
  }
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* =============================================================
   Layout containers
   ============================================================= */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  padding: 3rem 0 5rem;
}

section {
  margin: 3rem 0;
}

section:first-of-type {
  margin-top: 0;
}

/* =============================================================
   Typography
   ============================================================= */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  line-height: 1.25;
}

h1 {
  font-size: 2.1rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
  font-weight: 600;
}

h4 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
  font-weight: 600;
}

p {
  margin: 0 0 1.1rem;
}

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

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 3px;
  color: var(--text);
}

ul, ol {
  margin: 0 0 1.1rem;
  padding-left: 1.4rem;
}

li {
  margin: 0.25rem 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  font-style: italic;
  color: var(--text-soft);
}

blockquote p:last-child {
  margin-bottom: 0;
}

small, .muted {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* =============================================================
   Hero / About section on homepage
   ============================================================= */
.hero {
  margin: 1rem 0 3rem;
}

.hero-meta {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.hero-meta a {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.hero-meta a:hover {
  color: var(--accent);
}

.hero-meta strong {
  color: var(--text-soft);
  font-weight: 500;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1.25rem 0 0;
  font-family: var(--sans);
  font-size: 0.92rem;
}

.social-links a {
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  margin-right: 1.25rem; /* Fallback */
}

.social-links a:last-child {
  margin-right: 0;
}

@supports (gap: 1rem) {
  .social-links a {
    margin-right: 0;
  }
}

.social-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =============================================================
   Lists for publications, news, etc.
   ============================================================= */
.entry-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.entry-list > li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-soft);
}

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

.entry-list > li:first-child {
  padding-top: 0;
}

.pub-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.pub-title a {
  color: var(--text);
  border-bottom: none;
}

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  font-size: 0.94rem;
  color: var(--text-soft);
  margin-bottom: 0.15rem;
}

.pub-venue {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--text-muted);
  font-style: italic;
}

.pub-links {
  margin-top: 0.4rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.pub-links a {
  color: var(--accent);
  border-bottom: 1px dotted var(--accent);
}

.pub-links a:hover {
  border-bottom-style: solid;
}

.pub-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.12rem 0.5rem;
  border-radius: 3px;
  background: var(--code-bg);
  color: var(--accent);
  margin-right: 0.5rem;
  vertical-align: 0.15em;
}

/* News list */
.news-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.news-list > li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

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

.news-date {
  flex: 0 0 auto;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--text-muted);
  min-width: 110px;
  font-variant-numeric: tabular-nums;
}

.news-body {
  flex: 1 1 350px;
  font-size: 0.97rem;
}

.news-body a {
  border-bottom: 1px solid var(--border);
}

.news-body a:hover {
  border-bottom-color: var(--accent);
}

/* =============================================================
   Software cards
   ============================================================= */
.software-card {
  margin: 2rem 0;
  padding: 1.5rem 1.5rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.software-card h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.software-card .install {
  font-family: var(--mono);
  font-size: 0.92rem;
  background: var(--code-bg);
  padding: 0.5rem 0.85rem;
  border-radius: 3px;
  margin: 0.85rem 0;
  display: inline-block;
}

.software-card .links {
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.software-card .status {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =============================================================
   Tables
   ============================================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.94rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.data-table th {
  font-family: var(--sans);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  background: transparent;
}

.data-table tr:last-child td {
  border-bottom: 1px solid var(--border);
}

/* =============================================================
   Page-specific helpers
   ============================================================= */
.page-intro {
  margin: 0 0 2rem;
  color: var(--text-soft);
}

.page-intro p {
  font-size: 1.05rem;
}

.thrust {
  margin: 1.75rem 0;
}

.thrust h3 {
  margin-bottom: 0.5rem;
}

.thrust-note {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.3rem;
}

.market-banner {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

.market-banner p {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.98rem;
  color: var(--text-soft);
}

.download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.25rem 0;
  font-family: var(--sans);
  font-size: 0.92rem;
}

.download-list a {
  color: var(--accent);
  border-bottom: 1px dotted var(--accent);
  margin-right: 1.5rem; /* Fallback */
}

.download-list a:last-child {
  margin-right: 0;
}

@supports (gap: 1rem) {
  .download-list a {
    margin-right: 0;
  }
}

.download-list a:hover {
  border-bottom-style: solid;
}

/* =============================================================
   Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer .container-wide {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}

.site-footer a {
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.site-footer a:hover {
  color: var(--accent);
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .nav-inner {
    padding: 0.85rem 1.25rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.85rem;
  }

  main {
    padding: 2rem 0 3rem;
  }

  .news-list > li {
    flex-direction: column;
    gap: 0.2rem;
  }

  .news-date {
    min-width: 0;
  }

  blockquote {
    padding: 0.75rem 1rem;
  }

  .market-banner {
    padding: 1rem 1.25rem;
  }
}

/* Subtle entrance for content */
@media (prefers-reduced-motion: no-preference) {
  main > section {
    animation: fadeUp 0.5s ease-out backwards;
  }

  main > section:nth-child(1) { animation-delay: 0.05s; }
  main > section:nth-child(2) { animation-delay: 0.12s; }
  main > section:nth-child(3) { animation-delay: 0.18s; }
  main > section:nth-child(4) { animation-delay: 0.24s; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Selection */
::selection {
  background: var(--accent);
  color: #ffffff;
}
