/* ==========================================================================
   Arkil Patel — personal site styles (shared by homepage + blog)
   ========================================================================== */

:root {
  --bg:            #f4f0e6;
  --surface:       #fbf9f3;
  --text:          #36322b;
  --text-muted:    #7c7363;
  --heading:       #221f18;
  --accent:        #0e6f64;
  --accent-strong: #0a574e;
  --accent-soft:   rgba(14, 111, 100, 0.09);
  --accent-border: rgba(14, 111, 100, 0.26);
  --border:        #e4ddcd;
  --shadow:        0 1px 2px rgba(60, 50, 30, .05), 0 12px 32px rgba(60, 50, 30, .07);
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg:            #19160f;
  --surface:       #211d15;
  --text:          #d9d3c5;
  --text-muted:    #9a9286;
  --heading:       #f1ece1;
  --accent:        #62cabb;
  --accent-strong: #8ad9cd;
  --accent-soft:   rgba(98, 202, 187, 0.10);
  --accent-border: rgba(98, 202, 187, 0.30);
  --border:        #322c20;
  --shadow:        0 1px 2px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.30);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}

::selection { background: var(--accent-soft); }
img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ---------- Layout (homepage) ---------- */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 30px 90px;
  display: flex;
  gap: 60px;
}
.sidebar { width: 232px; flex-shrink: 0; }
.sidebar-inner { position: sticky; top: 56px; }
.content { flex: 1; min-width: 0; }

/* ---------- Sidebar ---------- */
.name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.15rem;
  line-height: 1.08;
  letter-spacing: .2px;
  color: var(--heading);
  margin: 0;
}
.name b { font-weight: 600; }
.name a { color: inherit; text-decoration: none; }
.name a:hover { color: var(--accent); text-decoration: none; }

.avatar {
  width: 170px;
  height: auto;
  display: block;
  margin: 20px 0 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.role { margin: 14px 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--text-muted); }

.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 22px; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 5px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav a i { width: 17px; text-align: center; font-size: 0.95rem; color: var(--accent); opacity: .85; }

.nav a.nav-blog { color: var(--accent); font-weight: 600; }
.nav a.nav-blog i { opacity: 1; }

.theme-toggle {
  margin-top: 24px;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

/* ---------- Top nav (tabbed pages) ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  min-height: 40px;
  margin-bottom: 34px;
}
.topnav a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.topnav a:hover { color: var(--accent); text-decoration: none; }
.topnav a.active { color: var(--heading); border-bottom-color: var(--accent); }
.topnav .theme-toggle { margin-top: 0; margin-left: 4px; }

/* ---------- Sections ---------- */
.section { margin-top: 58px; }
.section:first-child { margin-top: 4px; }
.page > .section:first-child { margin-top: 0; }

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--heading);
  margin: 0 0 20px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.about { font-size: 1rem; line-height: 1.72; color: var(--text); }
.about p { margin: 0 0 1.1em; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.about p:last-child { margin-bottom: 0; }

.label { font-weight: 600; color: var(--heading); }

/* ---------- News ---------- */
.news-item { display: grid; grid-template-columns: 104px 1fr; gap: 18px; padding: 9px 0; }
.news-date { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.news-text { margin: 0; font-size: 0.95rem; line-height: 1.55; }

/* ---------- Publications ---------- */
.pub-links { display: flex; flex-wrap: wrap; gap: 18px; margin: -6px 0 6px; font-size: 0.88rem; }
.pub-links a { color: var(--text-muted); }
.pub-links a:hover { color: var(--accent); text-decoration: none; }

.pub { padding: 16px 0; border-bottom: 1px solid var(--border); }
.pub:last-of-type { border-bottom: 0; }

.pub-title { font-weight: 500; font-size: 1rem; line-height: 1.45; color: var(--heading); }
a.pub-title:hover { color: var(--accent); text-decoration: none; }

.pub-authors { margin: 5px 0 0; font-size: 0.9rem; line-height: 1.5; color: var(--text-muted); }
.me { color: var(--accent); font-weight: 700; }

.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 13px; margin-top: 10px; }
.venue {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  padding: 2px 9px;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: 5px;
  padding: 3px 8px;
}
[data-theme="dark"] .badge { color: #0b1411; }

/* icon links for pdf / code / abstract, etc. */
.taglink {
  color: var(--text-muted);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  transition: color .2s ease, transform .2s ease;
}
.taglink:hover { color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.pub-meta .venue + .taglink, .pub-meta .badge + .taglink { margin-left: 1px; }

/* ---------- Service / lists ---------- */
.subhead {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--heading);
  margin: 22px 0 10px;
}
.subhead:first-child { margin-top: 0; }

.entry-list { margin: 0; padding: 0; list-style: none; }
.entry-list li { padding: 7px 0; font-size: 0.93rem; line-height: 1.5; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; gap: 18px; }
.entry-list li:last-child { border-bottom: 0; }
.entry-list .when { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; padding-top: 1px; }
.entry-title { font-weight: 500; color: var(--heading); }

.inline-list { margin: 0; font-size: 0.93rem; line-height: 1.7; }

/* ---------- Institutions ---------- */
.institutions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 26px 8px;
  align-items: end;
  margin-top: 30px;
}
.inst { text-align: center; }
.inst-logo { height: 58px; display: flex; align-items: center; justify-content: center; }
.inst-logo img {
  max-height: 42px;
  max-width: 112px;
  width: auto;
  object-fit: contain;
  filter: grayscale(1) opacity(.55);
  transition: filter .25s ease;
}
.inst-logo img:hover { filter: grayscale(0) opacity(1); }
[data-theme="dark"] .inst-logo img { filter: brightness(0) invert(1) opacity(.6); }
[data-theme="dark"] .inst-logo img:hover { filter: brightness(0) invert(1) opacity(.95); }
.inst-name { margin-top: 9px; font-size: 0.78rem; color: var(--text); }
.inst-years { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Footer ---------- */
.footer {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }

/* ==========================================================================
   Blog
   ========================================================================== */
.topbar {
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .home-link {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--heading);
  font-weight: 500;
}
.topbar .home-link:hover { color: var(--accent); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a { color: var(--text-muted); font-size: 0.9rem; }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }
.topbar .theme-toggle { margin-top: 0; }

.article { max-width: 720px; margin: 0 auto; padding: 30px 26px 90px; }

.post-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.post-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.3rem;
  line-height: 1.15;
  color: var(--heading);
  margin: 0 0 16px;
  letter-spacing: .2px;
}
.post-meta { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 6px; }
.post-paper {
  margin: 18px 0 30px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.post-paper .label { display: block; margin-bottom: 3px; }

.post-body { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.post-body p { margin: 0 0 1.25em; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.post-body h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--heading);
  margin: 2em 0 .6em;
}
.post-body strong { color: var(--heading); font-weight: 600; }
.post-body ul { margin: 0 0 1.25em; padding-left: 1.2em; }
.post-body li { margin: .35em 0; }
.post-body blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent-border);
  color: var(--text-muted);
  font-style: italic;
}

.post-figure { margin: 2em 0; text-align: center; }
.post-figure img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
/* Optional size modifiers — add to <figure class="post-figure sm"> etc. (image stays centered) */
.post-figure.md img { max-width: 560px; }
.post-figure.sm img { max-width: 420px; }
.post-figure.xs img { max-width: 300px; }
.post-figure figcaption { margin-top: 11px; font-size: 0.82rem; line-height: 1.5; color: var(--text-muted); text-align: center; }

.post-end { margin-top: 50px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Citations & references ---------- */
.cite {
  vertical-align: super;
  font-size: 0.68em;
  font-weight: 600;
  line-height: 0;
  margin-left: 1px;
  white-space: nowrap;
}
.cite::before { content: "["; }
.cite::after { content: "]"; }
.cite a { color: var(--accent); font-weight: 600; }

.references { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--border); }
.references h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--heading);
  margin: 0 0 18px;
}
.ref-list { margin: 0; padding-left: 1.5em; }
.ref-list li {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 14px;
  padding: 4px 6px;
  scroll-margin-top: 24px;
}
.ref-list li:target { background: var(--accent-soft); border-radius: 6px; }
.ref-list .ref-title { color: var(--text); font-style: italic; }
.ref-list a { color: var(--accent); }
.ref-back { margin-left: 6px; text-decoration: none; }

/* Blog listing */
.blog-list { max-width: 720px; margin: 0 auto; padding: 20px 26px 90px; }
.blog-list .section-title { font-size: 2rem; }
.post-card { display: block; padding: 22px 0; border-bottom: 1px solid var(--border); }
.post-card:hover { text-decoration: none; }
.post-card:hover .post-card-title { color: var(--accent); }
.post-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.post-card-title { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; line-height: 1.25; color: var(--heading); margin: 0 0 8px; transition: color .2s ease; }
.post-card-desc { font-size: 0.95rem; line-height: 1.55; color: var(--text-muted); margin: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .layout { flex-direction: column; gap: 8px; padding: 40px 24px 64px; }
  .sidebar { width: 100%; text-align: center; }
  .sidebar-inner { position: static; }
  .avatar { margin: 18px auto 0; width: 150px; }
  .nav { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 24px; margin-top: 18px; }
  .nav a { gap: 0; padding: 4px; font-size: 0; }            /* hide text labels, keep for screen readers */
  .nav a i { width: auto; font-size: 1.3rem; opacity: 1; }  /* show larger, tappable icons */
  .role { max-width: 320px; margin-left: auto; margin-right: auto; }
  .section:first-child { margin-top: 36px; }
  .topnav { justify-content: center; flex-wrap: wrap; gap: 20px; margin: 4px 0 26px; }
}

@media (max-width: 680px) {
  .institutions { grid-template-columns: repeat(2, 1fr); gap: 24px 8px; }
  .entry-list li { flex-direction: column; gap: 2px; }
  .entry-list .when { font-size: 0.78rem; }
  .post-title { font-size: 1.9rem; }
  .post-body { font-size: 1rem; }
}

@media (max-width: 520px) {
  .news-item { grid-template-columns: 1fr; gap: 2px; }
  .news-date { font-weight: 600; }
}
