/* =========================================================
   Jasone Ramírez-Ayerbe — personal site
   Light + automatic dark mode, single source of content.
   ========================================================= */

/* ---- Design tokens ---- */
:root{
  --max: 820px;

  --bg: #ffffff;
  --surface: #fafafa;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e6e6e6;
  --accent: #2f6f9f;        /* muted academic blue */
  --accent-soft: #eaf2f8;
  --link: var(--accent);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #0f1216;
    --surface: #161a20;
    --text: #e7e8ea;
    --muted: #9aa1ac;
    --border: #262b33;
    --accent: #7fb0dc;
    --accent-soft: #18222c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 18px rgba(0,0,0,.35);
  }
}

/* ---- Base ---- */
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
html, body{ margin:0; padding:0; }

body{
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Layout ---- */
.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Top navigation ---- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand{
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
}
.brand:hover{ text-decoration: none; color: var(--accent); }

.menu{ display: flex; gap: 6px; flex-wrap: wrap; }

.menu a{
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.menu a:hover{ text-decoration: none; color: var(--text); background: var(--surface); }

.menu a.active{
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Page title ---- */
.page-title{ margin: 48px 0 8px; }

h1{
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2{
  font-family: var(--serif);
  font-weight: 600;
  margin: 44px 0 18px;
  font-size: 23px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.subtitle{
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 19px;
}

/* ---- Home: bio (single block, responsive) ---- */
.bio{ margin-top: 30px; }

.profile-photo{
  float: right;
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 18px;
  margin: 4px 0 18px 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.bio p{ margin: 0 0 16px; }

.clear{ clear: both; }

/* ---- Contact / link pills ---- */
.contact{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  clear: both;
}

.contact a{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, transform .12s, color .15s;
}
.contact a:hover{
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ---- News ---- */
.news-list{ list-style: none; margin: 0; padding: 0; }
.news-list li{
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.news-list li:last-child{ border-bottom: 0; }
.news-date{
  flex: 0 0 92px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 14.5px;
  padding-top: 1px;
}

/* ---- Talks ---- */
.year-head{
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  margin: 26px 0 6px;
  letter-spacing: .02em;
}
.talk-list{ list-style: none; margin: 0; padding: 0; }
.talk-list li{
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.talk-list li:last-child{ border-bottom: 0; }
.talk-title{ font-weight: 600; }
.talk-venue{ color: var(--muted); font-size: 14.5px; }

/* ---- Cards: papers / teaching / talks ---- */
.card{
  margin: 16px 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.card:hover{ border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }

.card-title{ margin: 0 0 5px; font-weight: 700; font-size: 17px; line-height: 1.4; }
.card-meta{ margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.card-desc{ margin: 0; color: var(--text); font-size: 15.5px; }

.tag{
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---- Footer ---- */
.footer{
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 22px 0 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---- Mobile ---- */
@media (max-width: 640px){
  body{ font-size: 16.5px; }
  h1{ font-size: 30px; }
  h2{ font-size: 21px; }
  .subtitle{ font-size: 17px; }

  .page-title{ margin-top: 34px; }

  .profile-photo{
    float: none;
    display: block;
    width: min(260px, 70vw);
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto 22px;
  }

  .news-list li{ flex-direction: column; gap: 2px; }
  .news-date{ flex-basis: auto; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior: auto !important; }
}
