/* ── Page entrance ───────────────────────────────────── */
@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Layout ──────────────────────────────────────────── */
body {
  max-width: 800px;
  margin: auto;
  padding: 1.5em 1em;
  line-height: 1.65;
  color: #222;
  animation: fadein 0.35s ease-out both;
}

/* ── Navigation ──────────────────────────────────────── */
.menu {
  padding: 0;
  margin-bottom: 0.5em;
}

.menu li {
  display: inline-block;
  margin: 0 0.1em;
}

.menu a {
  text-decoration: none;
  color: #444;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  transition: color 0.15s ease, background 0.15s ease;
}

.menu a:hover {
  color: #1f7fc4;
  background: #eef6fb;
}

.menu a.active {
  color: #1f7fc4;
  font-weight: 700;
}

/* ── Header / Footer text alignment ─────────────────── */
.article-meta {
  text-decoration: none;
  padding: 0;
  background: none;
}

.menu,
.article-meta,
footer {
  text-align: center;
}

.title {
  font-size: 1.1em;
}

/* ── Horizontal rule ─────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 1em 0;
}

/* ── Code ────────────────────────────────────────────── */
pre {
  border: 1px solid #e0e0e0;
  box-shadow: none;
  padding: 1em;
  overflow-x: auto;
  border-radius: 4px;
  background: #fafafa;
}

code {
  background: #f5f5f5;
  border-radius: 3px;
  padding: 0.1em 0.3em;
}

pre code {
  background: none;
  padding: 0;
}

/* ── Media ───────────────────────────────────────────── */
img,
iframe,
video {
  max-width: 100%;
}

main {
  hyphens: auto;
}

/* ── Blockquote ──────────────────────────────────────── */
blockquote {
  background: #f9fbfd;
  border-left: 3px solid #1f7fc4;
  padding: 0.5em 1em;
  margin: 1em 0;
  color: #444;
}

/* ── Tables ──────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  margin: 1em auto;
  border-top: 2px solid #444;
  border-bottom: 2px solid #444;
  width: 100%;
  font-size: 0.9em;
}

table thead th {
  border-bottom: 1px solid #ccc;
  text-align: left;
  padding: 8px 10px;
}

th,
td {
  padding: 7px 10px;
  text-align: left;
}

thead {
  background: #eef6fb;
}

tr:nth-child(even) {
  background: #fafafa;
}

tfoot {
  background: #eef6fb;
}

/* ── Homepage profile block ──────────────────────────── */
#profile {
  float: right;
  max-width: 28%;
  min-width: 120px;
  text-align: center;
  margin: 0 0 1rem 1.5rem;
}

/* ── Footer ──────────────────────────────────────────── */
footer {
  font-size: 0.85em;
  color: #888;
  margin-top: 2rem;
}

footer a {
  text-decoration: none;
  color: #888;
}

footer a:hover {
  color: #1f7fc4;
}

/* ── Footer social icons ─────────────────────────────── */
.footer-social {
  margin: 0.75em 0 0.25em;
  text-align: center;
}

.footer-social a {
  display: inline-block;
  margin: 0 0.35em;
  color: #888;
  text-decoration: none;
}

.footer-social a:hover {
  color: #1f7fc4;
}

/* ── Headings ────────────────────────────────────────── */
h1 {
  font-size: 1.75rem;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  position: relative;
  padding-bottom: 0.4em;
}

h1::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  background: #1f7fc4;
  margin-top: 0.3em;
}

.article-meta h1::after {
  margin-left: auto;
  margin-right: auto;
}

h2 {
  font-size: 1.25rem;
  margin-top: 1.4em;
  margin-bottom: 0.4em;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.2em;
  margin-bottom: 0.3em;
}

p {
  margin-bottom: 0.9em;
}

/* ── Links ───────────────────────────────────────────── */
a {
  color: #1f7fc4;
  transition: color 0.15s ease;
}

a:hover {
  color: #155d94;
}

main a {
  text-decoration: underline;
  text-decoration-color: rgba(31, 127, 196, 0.35);
  text-underline-offset: 3px;
}

main a:hover {
  text-decoration-color: #1f7fc4;
}

/* ── Team headshots ──────────────────────────────────── */
.team-card img {
  border-radius: 8px;
}

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body,
  a,
  .menu a {
    animation: none;
    transition: none;
  }
}

/* ── Mobile tweaks ───────────────────────────────────── */
@media screen and (max-width: 640px) {
  #profile {
    float: none;
    max-width: 60%;
    min-width: 80px;
    margin: 0 auto 1.5rem auto;
    display: block;
  }

  table {
    font-size: 0.82em;
  }

  th,
  td {
    padding: 5px 7px;
  }
}

/* ── Embeds / iframes ────────────────────────────────── */
.embed-frame {
  width: 100%;
  height: clamp(650px, 85vh, 1200px);
  border: 0;
  display: block;
  background: #fff;
}

@media screen and (max-width: 640px) {
  .embed-frame {
    height: clamp(420px, 70vh, 900px);
  }
}

/* ── Site tables (talks, teaching) ───────────────────── */
.site-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  margin: 1.25em 0;
  border-top: 2px solid #222;
  border-bottom: 2px solid #222;
}

.site-table thead tr {
  background: #eef6fb;
  border-bottom: 1px solid #c5dff0;
}

.site-table th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
}

.site-table td {
  padding: 8px 12px;
  vertical-align: top;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.site-table tbody tr:last-child td {
  border-bottom: none;
}

.site-table tbody tr:hover {
  background: #f5fafd;
}

/* Wrap long tables on mobile */
.site-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Talk cards ──────────────────────────────────────── */
.talk-card {
  padding: 0.75em 0;
  border-bottom: 1px solid #e8e8e8;
}
.talk-card:last-child { border-bottom: none; }

.talk-meta {
  font-size: 0.8em;
  color: #888;
  margin-bottom: 0.2em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.talk-title {
  font-weight: 600;
  color: #222;
  margin-bottom: 0.15em;
}

.talk-event {
  font-size: 0.88em;
  color: #555;
}
