/* ==========================================================================
   Maurício Barbosa-Alves - personal site
   Minimal. Plain HTML/CSS, no framework. Type-driven, boxless.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------- */
:root {
  --bg:           #fdfcf9;          /* very light warm */
  --text:         #1a1a1a;
  --text-muted:   #555;
  --text-soft:    #888;
  --accent:       #1f3a5f;
  --rule:         #e8e4da;          /* very subtle dividers */

  --font-serif: "Crimson Pro", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 46rem;       /* wider content column */
  --wide:    56rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #14161a;
    --text:       #e6e3dc;
    --text-muted: #a8a59d;
    --text-soft:  #7a776f;
    --accent:     #9bb6d8;
    --rule:       #2a2d33;
  }
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.5rem; margin: 3rem 0 1.25rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; font-weight: 500; }
p  { margin: 0 0 1rem; }

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

.skip-link { position: absolute; top: -100px; left: 0; padding: 0.5rem 1rem; background: var(--accent); color: #fff; }
.skip-link:focus { top: 0; }

/* --- Header / nav -------------------------------------------------------- */
.site-header {
  padding: 1.4rem 0 0.6rem;
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 50;
}
.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-header__brand {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: none;
}
.site-header__brand:hover { color: var(--accent); }

.site-nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  border-bottom: none;
}
.site-nav a:hover, .site-nav a.is-active { color: var(--text); }

/* --- Hero ---------------------------------------------------------------- */
.hero { padding: 1.5rem 0 1rem; }
.hero__grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 560px) {
  .hero__grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero__photo { max-width: 200px; }
}
.hero__photo {
  width: 100%;
  height: auto;                  /* keep the photo's natural aspect ratio */
}
.hero__name { font-size: 2rem; margin-bottom: 0.15rem; }
.hero__title { color: var(--text-muted); font-size: 1rem; margin: 0 0 0.4rem; }
.hero__email { font-size: 1rem; margin: 0 0 1rem; }
.hero__email a { font-weight: 500; }
.hero__bio   { font-size: 1rem; }
.hero__bio p:last-child { margin-bottom: 0; }
.hero__fields {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Profile links: plain text, separated by middle dots */
.profile-links {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.9;
}
.profile-links a {
  color: var(--accent);
  margin-right: 0.9rem;
  white-space: nowrap;
}
.profile-links a + a::before {
  content: "·";
  color: var(--text-soft);
  margin-right: 0.9rem;
  margin-left: -0.9rem;
  padding-right: 0.55rem;
  pointer-events: none;
  border-bottom: none;
  display: inline-block;
}
/* Hide all decorative SVG icons in minimalist mode */
.profile-links svg { display: none; }

/* --- Sections ------------------------------------------------------------ */
section { padding: 0; }
.section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 3rem 0 1.5rem;
  color: var(--text);
}

/* --- News list ----------------------------------------------------------- */
.news-list {
  list-style: none;
  padding: 0; margin: 0;
}
.news-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
}
.news-list li:last-child { border-bottom: none; }
.news-list time {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
@media (max-width: 480px) {
  .news-list li { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* --- Papers (flat, boxless, type-led) ----------------------------------- */
.papers { display: block; }

.paper {
  padding: 0.4rem 0 0.7rem;
}
.papers .paper:first-of-type { padding-top: 0.2rem; }
.paper--featured {} /* nothing special — the journal name does the work */

.paper__badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--text-soft);
}
.paper__badge--published { color: #8a6a0c; }   /* discreet warm gold for QJE */
@media (prefers-color-scheme: dark) {
  .paper__badge--published { color: #d4a72c; }
}

.paper__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 0.25rem;
  line-height: 1.35;
}
.paper__title a {
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.paper__title a:hover { border-bottom-color: var(--accent); }

.paper__authors {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}
.paper__meta {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-soft);
  margin: 0 0 0.65rem;
}
.paper__meta em {
  font-weight: 600;
  color: var(--text);
}

/* Link row: Abstract toggle + plain text links, dot separators, no boxes */
.paper__links {
  display: block;
  font-size: 0.9rem;
  margin-top: 0.4rem;
}
.paper__links a,
.paper__links button.paper__abs-btn {
  color: var(--accent);
  margin-right: 0.85rem;
  white-space: nowrap;
  display: inline;
}
.paper__links button.paper__abs-btn {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 50%, transparent);
}
.paper__links button.paper__abs-btn[aria-expanded="true"] {
  color: var(--text-muted);
  border-bottom-color: var(--text-soft);
}
.paper__links button.paper__abs-btn:hover { border-bottom-color: var(--accent); }

/* Disclosure indicator: triangle that flips when the abstract is open */
.paper__abs-btn::before {
  content: "\25B8\00A0";              /* ▸ + nbsp */
  display: inline-block;
  font-size: 0.8em;
  color: var(--text-soft);
}
.paper__abs-btn[aria-expanded="true"]::before {
  content: "\25BE\00A0";              /* ▾ + nbsp */
}

/* Separator dot between adjacent items in the link row */
.paper__links > * + *::before {
  content: "·";
  color: var(--text-soft);
  margin-right: 0.85rem;
  margin-left: -0.85rem;
  padding-right: 0.5rem;
  pointer-events: none;
  border-bottom: none;
  display: inline-block;
}

.paper__abstract-body {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.paper__abstract-body p { margin: 0; }

/* --- Code / replication: plain inline list ------------------------------ */
.code-grid { display: block; margin-top: 0.5rem; }
.code-card {
  padding: 0.4rem 0;
  font-size: 0.95rem;
  border: none;
  background: none;
}
.code-card h3 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  display: inline;
  margin: 0;
}
.code-card p { display: inline; color: var(--text-muted); margin: 0 0 0 0.4rem; font-size: 0.95rem; }

/* --- Teaching ------------------------------------------------------------ */
.teaching-block { margin: 0 0 2.5rem; }
.teaching-block h3 {
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
}
.course-list { list-style: none; padding: 0; margin: 0; }
.course-list li {
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}
.course-list li:first-child { border-top: none; padding-top: 0.3rem; }
.course-list .course-title { font-weight: 500; color: var(--text); }
.course-list .course-meta {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-left: 0.4rem;
  font-style: italic;
}
.course-list .course-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* --- Contact ------------------------------------------------------------- */
.contact dl {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: 0.95rem;
}
.contact dt { color: var(--text-soft); }
.contact dd { margin: 0; color: var(--text); }
@media (max-width: 480px) {
  .contact dl { grid-template-columns: 1fr; gap: 0.05rem 0; }
  .contact dd { margin-bottom: 0.5rem; }
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 3rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  text-align: center;
  border-top: 1px solid var(--rule);
}
.site-footer a { color: var(--text-muted); border-bottom: none; }
.site-footer a:hover { color: var(--accent); }
