/* ===========================================================
   José Alberto Ferreira — personal site
   Two-column layout: sticky left sidebar + wide content area.
   Light & conversational, accent colour, generous spacing.
   Restyle quickly via the variables below.
   =========================================================== */
:root {
  --ink:      #16213a;
  --body:     #33414f;
  --muted:    #6a7682;
  --accent:   #1e3a63;     /* dark navy */
  --accent-dk:#132542;     /* deeper navy (hover / gradient end) */
  --tint:     #eceff5;
  --line:     #e4e8ec;
  --bg:       #ffffff;
  --bg-soft:  #f8fafb;
  --maxw:     1200px;
  --sidebar:  280px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--body);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); text-decoration: underline; }

/* ---------- Coloured top bar ---------- */
.topbar {
  background: linear-gradient(90deg, var(--accent-dk), var(--accent));
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 8px rgba(27,39,51,.12);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 13px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.tb-brand { color: #fff; font-family: var(--serif); font-weight: 600; font-size: 1.28rem; letter-spacing: 0; }
.tb-brand:hover { color: #fff; text-decoration: none; opacity: .92; }
.tb-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.tb-nav a { color: rgba(255,255,255,.82); font-size: .96rem; padding: 6px 13px; border-radius: 7px; }
.tb-nav a:hover { color: #fff; background: rgba(255,255,255,.14); text-decoration: none; }
.tb-nav a.active { color: #fff; font-weight: 600; background: rgba(255,255,255,.2); }

/* ---------- Two-column shell ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: 64px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 40px 80px;
  align-items: start;
}
.content { min-width: 0; padding-top: 6px; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 84px; }
.sb-photo { display: block; width: 230px; margin-bottom: 18px; }
.sb-photo img { width: 230px; height: 230px; object-fit: cover; border-radius: 12px; box-shadow: 0 6px 22px rgba(27,39,51,.14); display: block; }
.sb-name { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; line-height: 1.18; margin-bottom: 13px; width: 230px; text-align: center; }
.sb-name a { color: var(--ink); }
.sb-name a:hover { color: var(--accent); text-decoration: none; }
.sb-affils { margin-bottom: 18px; width: 230px; text-align: center; border-top: 1px solid var(--line); padding-top: 13px; }
.affil-item { margin-bottom: 10px; line-height: 1.3; }
.affil-item:last-child { margin-bottom: 0; }
.affil-role { color: var(--ink); font-weight: 600; font-size: .95rem; }
.affil-org { color: var(--muted); font-size: .88rem; }
.affil-org a { color: var(--accent); }
.sidebar .socials { width: 230px; justify-content: center; }
.sb-foot { text-align: center; width: 230px; }
.sb-foot { color: var(--muted); font-size: .82rem; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Typography ---------- */
h1, h2, h3 { color: var(--ink); line-height: 1.2; font-weight: 600; font-family: var(--serif); }
h1 { font-size: 2.45rem; margin: 0 0 .3em; letter-spacing: -.005em; }
h2 { font-size: 1.55rem; margin: 0 0 1rem; padding-bottom: .4rem; border-bottom: 2px solid var(--tint); }
h3 { font-size: 1.18rem; margin: 1.4em 0 .3em; }
.home-welcome { font-size: 1.45rem; margin-bottom: .45em; }
p { margin: 0 0 1.1em; }
section { margin-bottom: 52px; }
.lead { font-size: 1.18rem; color: var(--muted); line-height: 1.6; }
.greet { color: var(--accent); font-weight: 600; font-size: 1.05rem; margin: 0 0 .2em; }
.affil { color: var(--muted); }

/* ---------- Social icons ---------- */
.socials { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.socials a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--muted); background: var(--bg);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 7px; color: var(--accent); font-size: .96rem; font-weight: 500; margin: 6px 8px 6px 0; transition: all .15s ease; }
.btn:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-solid { background: var(--accent); color: #fff; }
.btn-solid:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

/* ---------- Horizontal feature grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; background: var(--bg-soft); }
.card h3 { margin-top: 0; }
.card .q { color: var(--muted); font-style: italic; font-size: .96rem; }
.tint-panel { background: var(--tint); border-radius: 12px; padding: 24px 28px; }

/* ---------- Research: collapsible papers ---------- */
.paper { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; background: var(--bg); overflow: hidden; }
.paper[open] { border-color: var(--accent); box-shadow: 0 4px 18px rgba(27,39,51,.06); }
.paper > summary { cursor: pointer; list-style: none; padding: 17px 20px; display: flex; gap: 14px; align-items: baseline; justify-content: space-between; }
.paper > summary::-webkit-details-marker { display: none; }
.paper > summary:hover { background: var(--bg-soft); }
.paper .ptitle { font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.paper .pauthors { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.paper .chev { color: var(--accent); flex-shrink: 0; font-size: .8rem; transition: transform .2s ease; }
.paper[open] .chev { transform: rotate(90deg); }
.paper .pbody { padding: 0 20px 20px; }
.paper .status { display: inline-block; font-size: .76rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--accent-dk); background: var(--tint); padding: 2px 9px; border-radius: 20px; margin-bottom: 10px; }
.plinks { display: flex; gap: 16px; flex-wrap: wrap; font-size: .92rem; margin-top: 4px; }

/* ---------- CV embedded PDF viewer ---------- */
.pdf-frame { height: 88vh; min-height: 600px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-soft); }
.pdf-frame object, .pdf-frame iframe { width: 100%; height: 100%; border: 0; }
.pdf-fallback { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .topbar-inner { padding: 12px 22px; gap: 6px 14px; }
  .tb-brand { font-size: 1.05rem; }
  .tb-nav a { padding: 5px 10px; font-size: .92rem; }
  .layout { grid-template-columns: 1fr; gap: 28px; padding: 28px 22px 60px; }
  .sidebar { position: static; display: flex; flex-direction: column; align-items: flex-start; }
  .sb-photo, .sb-photo img { width: 140px; height: 140px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  body { font-size: 16.5px; }
}
