/* =========================================================
   Sven Heim – unified academic design
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root{
  --text: #2c2c2c;
  --text2: #4a4a4a;
  --text3: #777;

  --line: #e2e2e2;
  --line-strong: rgba(0,0,0,.14);

  --bg: #fafafa;
  --white: #fff;

  --link: #2b5278;
  --link-h: #1a3d5c;

  --serif: 'Crimson Pro', Georgia, serif;
  --sans: 'DM Sans', -apple-system, system-ui, sans-serif;

  --w: 1080px;
  --pad: 2.5rem;

  /* Photo crop tuning */
  --photo-focus-y: 8%;
  --photo-focus-y-mobile: 10%;
}

html{ font-size: 16px; scroll-behavior: smooth; }
body{
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

a{ color: var(--link); text-decoration: none; }
a:hover{
  color: var(--link-h);
  text-decoration: underline;
  text-decoration-color: rgba(43,82,120,.28);
  text-underline-offset: 3px;
}
img{ max-width: 100%; height: auto; display: block; }

/* Italics consistent (no serif swap) */
em{ font-family: inherit; font-style: italic; font-size: inherit; line-height: inherit; }

/* ---------------- Header ---------------- */
header{
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 99;
}

.header-inner{
  max-width: var(--w);
  margin: 0 auto;
  padding: .7rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-name{
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
  text-decoration: none;
}

nav{ display: flex; gap: .2rem; align-items: center; }

nav a{
  font-size: .82rem;
  font-weight: 500;
  color: var(--text2);
  padding: .28rem .55rem;
  border-radius: 4px;
  text-decoration: none;
}

nav a:hover,
nav a.active{
  color: var(--link);
  background: rgba(0,0,0,.04);
  text-decoration: none;
}

.nav-toggle{
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
}

.nav-toggle span{
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text2);
  margin: 4px 0;
}

@media (max-width: 700px){
  .nav-toggle{ display: block; }
  nav{ display: none; width: 100%; flex-direction: column; align-items: flex-start; }
  nav.open{ display: flex; }
  .header-inner{ flex-wrap: wrap; }
}

/* ---------------- Main ---------------- */
main{
  max-width: var(--w);
  margin: 0 auto;
  padding: 2.5rem var(--pad) 4rem;
}

/* ---------------- Hero (Home) ---------------- */
.hero{
  display: flex;
  gap: 2.8rem;
  align-items: center;
  margin-bottom: 1.8rem;
}

.hero-content{ flex: 1; min-width: 0; }

.hero-photo{
  width: 250px;
  min-width: 250px;
  height: 250px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center var(--photo-focus-y);
  order: 2;           /* desktop: photo right */

  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.hero-content h1{
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .1rem;
}

.sub{
  font-size: .9rem;
  color: var(--text3);
  margin-bottom: 1rem;
}

.bio{
  font-size: .9rem;
  color: var(--text2);
  line-height: 1.72;
  max-width: 78ch;
}
.bio p{ margin-bottom: .7rem; }

.links-row{
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: 1rem;
}

.links-row a{
  font-size: .77rem;
  font-weight: 500;
  color: var(--link);
  padding: .22rem .5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  text-decoration: none;
}

.links-row a:hover{ border-color: var(--link); text-decoration: none; }

.links-row .cv-link{
  background: var(--link);
  color: var(--white);
  border-color: var(--link);
  font-weight: 600;
}
.links-row .cv-link:hover{
  background: var(--link-h);
  border-color: var(--link-h);
  color: var(--white);
}

/* ✅ MOBILE: photo first, then name/sub centered, bio left */
@media (max-width: 700px){
  .hero{
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
  }

  .hero-photo{
    width: 190px;
    min-width: 190px;
    height: 190px;
    order: -1; /* photo above text */
    object-position: center var(--photo-focus-y-mobile);
  }

  .hero-content{
    width: 100%;
    text-align: left; /* bio + general text left */
  }

  .hero-content h1,
  .hero-content .sub{
    text-align: center; /* header centered */
  }

  .links-row{
    justify-content: center;
  }
}

/* ---------------- Section titles ---------------- */
.section-title{
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2.2rem 0 .8rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
}

/* ---------------- News meta line ---------------- */
.news-meta{
  display: flex;
  align-items: baseline;
  gap: .35rem;
  margin: .05rem 0 .35rem;
  font-size: .72rem;
  color: var(--text3);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.news-year{ font-weight: 500; }
.news-type{ font-weight: 600; }
.news-sep{ opacity: .75; }

/* ---------------- Items / lists ---------------- */
.pub-item{
  padding: 1.0rem 0;
  border-bottom: 1px solid var(--line-strong);
  max-width: 92ch;
}
.pub-item:last-child{ border-bottom: none; }

.pub-item h3{
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 .25rem;
  color: var(--text);
}
.pub-item h3 a{ color: var(--link); }
.pub-item h3 a:hover{ color: var(--link-h); }

.meta{
  font-size: .80rem;
  color: var(--text3);
  margin-bottom: .35rem;
}

.pub-item p{
  font-size: .86rem;
  color: var(--text2);
  line-height: 1.55;
  margin-top: .25rem;
}
.pub-item p + p{ margin-top: .45rem; }

/* Press links */
.press-links{
  font-size: .78rem;
  color: var(--text3);
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .55rem;
  align-items: baseline;
  max-width: 92ch;
}
.press-links a{ white-space: nowrap; }

/* Expertises list */
.content-list{
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-width: 92ch;
}
.content-list li{
  padding: 1.0rem 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text2);
  font-size: .86rem;
  line-height: 1.55;
}
.content-list li:last-child{ border-bottom: none; }
.content-list a{ font-weight: 600; color: var(--link); }
.content-list a:hover{ color: var(--link-h); }

/* Teaching: years right aligned (optional helper) */
.item-head{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
}
.item-title{ margin: 0; }
.item-year{
  font-size: .80rem;
  color: var(--text3);
  white-space: nowrap;
  text-align: right;
}

/* Teaching: remove separators between courses (ONLY on Teaching page) */
.page-teaching .pub-item{
  border-bottom: none;
  padding: .55rem 0;
}
.page-teaching .pub-item:last-child{ border-bottom: none; }
.page-teaching .pub-item p{ margin-top: .15rem; }

@media (max-width: 700px){
  .item-head{ grid-template-columns: 1fr; gap: .25rem; }
  .item-year{ text-align: left; }
  .pub-item, .press-links, .content-list{ max-width: 100%; }
}

/* Footer */
footer{
  max-width: var(--w);
  margin: 0 auto;
  padding: 1.2rem var(--pad);
  border-top: 1px solid var(--line);
  font-size: .73rem;
  color: var(--text3);
  text-align: center;
}
