/* =========================================================
   Evan Rowbotham — Global Styles (clean)
   ========================================================= */

:root{
  --bg:#151a21;
  --surface:#202833;
  --text:#e9edf3;
  --muted:#aeb8c6;
  --border:#3a4658;
  --accent:#8f72d6;
  --panel:var(--surface);
  --card:var(--surface);
  --line:var(--border);
  --rule-line:#57667d;
  --brand:#5f96dc;
  --shadow:0 8px 24px rgba(0,0,0,.35);
  --radius:14px;

  --list-thumb-size: 90px;

  --interests-title-size: 34px;
  --interests-item-size: 18px;
  --bullet-size: 22px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
html{ overflow-anchor:none; }

body{
  margin:0;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",
               system-ui,"Segoe UI",Roboto,Helvetica,Arial,
               "Apple Color Emoji","Segoe UI Emoji";
  line-height:1.6;
  text-rendering:optimizeLegibility;
}

main{
  flex:1;
}

a{ color:var(--text); text-decoration:none; border-bottom:1px solid transparent; }
a:hover{ color:var(--brand); border-bottom-color:var(--brand); }
.muted{ color:var(--muted); }

.container{
  max-width:1180px;
  margin:0 auto;
  padding:0 28px;
}

/* =========================================================
   Top Bar
   ========================================================= */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(21,26,33,.82);
  backdrop-filter:saturate(180%) blur(10px);
  border-bottom:1px solid var(--line);
}

.topbar-inner{
  height:76px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  margin-left:0;
  border-bottom-color:transparent;
}
.brand:hover{ border-bottom-color:transparent; }

.favicon-lg{
  width:32px;
  height:32px;
  border-radius:8px;
  border:none;
  background:transparent;
}

.brand-name{
  font-family:"SF Pro Display",-apple-system,BlinkMacSystemFont,system-ui !important;
  font-weight:800 !important;
  font-size:22px !important;
  line-height:1 !important;
  letter-spacing:.2px !important;
  white-space:nowrap;
  font-synthesis:none;
  -webkit-font-smoothing:antialiased;
}

.topnav{
  display:flex;
  gap:24px;
  align-items:center;
  flex-wrap:nowrap;
}
.topnav a{
  color:var(--muted);
  border-bottom-color:transparent;
  white-space:nowrap;
}
.topnav a:hover,
.topnav a.active{ color:var(--text); }

.menu-toggle{
  display:none;
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:10px;
  width:42px;
  height:42px;
  padding:9px 8px;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:5px;
  cursor:pointer;
  position:relative;
  z-index:70;
}

.menu-toggle span{
  display:block;
  width:100%;
  height:2px;
  background:var(--text);
  border-radius:999px;
}

/* =========================================================
   Hero
   ========================================================= */
.hero{
  display:grid;
  grid-template-columns:320px 1fr;
  gap:44px;
  align-items:center;
  padding:52px 0 18px;
}

.hero-photo{
  width:300px;
  height:300px;
  object-fit:cover;
  border-radius:28px;
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  background:var(--panel);
}

.display{
  font-size:56px;
  line-height:1.06;
  margin:0 0 10px;
  font-weight:800;
  letter-spacing:-.6px;
}
.lead{ color:var(--muted); font-size:18px; margin:0 0 16px; }

.hero-socials{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  font-weight:600;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:var(--panel);
  border-bottom-color:transparent;
}
.btn:hover{ border-bottom-color:transparent; }

/* Research interests */
.hero-research{
  grid-column:1 / -1;
  margin-top:14px;
  padding-top:12px;
}
.research-title{
  margin:6px 0 12px;
  font-size:var(--interests-title-size);
  font-weight:800;
  letter-spacing:-.3px;
  white-space:nowrap;
}
.research-list{
  margin:0;
  padding-left:0;
  list-style:none;
}
.research-list li{
  position:relative;
  margin:10px 0;
  padding-left:22px;
  font-size:var(--interests-item-size);
  line-height:1.7;
}
.research-list li::before{
  content:"•";
  position:absolute;
  left:0;
  top:0.05em;
  font-size:var(--bullet-size);
  line-height:1;
  color:var(--muted);
}

/* =========================================================
   Sections + heads
   ========================================================= */
.section{ padding:24px 0 8px; }
.h2{ font-size:26px; font-weight:800; margin:0; }

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--line);
  padding-bottom:8px;
  margin-bottom:16px;
}

.all-link{
  color:var(--muted);
  border-bottom-color:transparent;
}
.all-link:hover{ color:var(--text); }

/* =========================================================
   List pages
   ========================================================= */
.list-page{ padding:36px 0 28px; }
.display.big{ font-size:40px; font-weight:800; margin:10px 0 18px; }

.year{ font-size:22px; font-weight:700; margin-bottom:8px; }
.rule{
  display:block;
  width:100%;
  border:0;
  height:1px;
  background:var(--rule-line);
  margin:0 0 18px;
}
.talk-entry{
  margin:0 0 28px;
}
.talk-month{
  font-size:16px;
  font-style:normal;
  font-weight:500;
  color:var(--muted);
}
.talk-title-line{
  margin:0 0 3px;
  line-height:1.2;
}
.talk-title{
  font-size:21px;
  font-weight:800;
}
.talk-meta,
.talk-venue{
  margin:0 0 4px;
  font-size:16px;
  line-height:1.3;
}
.talk-meta{
  margin-bottom:0;
}
.talk-venue{
  margin-bottom:0;
}

/* =========================================================
   Rows (Projects/Publications pages)
   - correct spacing
   - pill on RIGHT side
   ========================================================= */
.row{
  display:grid;
  grid-template-columns: auto 1fr auto;
  gap:18px;
  align-items:center;
  padding:20px 18px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--card);
  box-shadow:var(--shadow);
  margin-bottom:16px;
}

/* Keep list rows identical width on desktop for projects/publications */
@media (min-width:901px){
  #projects-list-page,
  #publications-list-page,
  #talks-list-page{
    width:60vw;
    max-width:60vw;
    margin-left:auto;
    margin-right:auto;
    padding-left:0;
    padding-right:0;
  }
  #projects-list-page .row,
  #publications-list-page .row{
    width:100%;
    max-width:none;
    margin-left:0;
    margin-right:0;
  }
  #projects-list-page .rule,
  #publications-list-page .rule,
  #talks-list-page .rule{
    width:100%;
  }
  #talks-list-page .talk-entry{
    width:100%;
  }
}

.thumb{
  width:var(--list-thumb-size);
  height:var(--list-thumb-size);
  border-radius:10px;
  border:1px solid var(--line);
  object-fit:cover;
  background:var(--panel);
}

.row-main{
  min-width:0;
}

.row-title{
  margin:0 0 10px;
  font-size:18px;
  font-weight:800;
  line-height:1.25;
}

.title-mobile{
  display:none;
}

.row-authors,
.row-venue{
  margin:0;
  font-size:15px;
  line-height:1.4;
}

.row-authors{ margin-bottom:6px; }

.row-authors b,
.row-authors strong{
  font-size:1em;
  line-height:inherit;
  font-weight:800;
}

.pill,
.pill:visited{
  justify-self:end;
  white-space:nowrap;
  color:var(--brand);
  font-weight:700;
  border-bottom-color:transparent;
  padding:6px 0;
}
.pill:hover{
  border-bottom-color:transparent;
}

/* =========================================================
   Homepage: Latest Projects card grid
   ========================================================= */
#latest-projects.home-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:20px;
}

/* turn rows into square cards ONLY on the homepage projects grid */
#latest-projects.home-grid > .row{
  display:flex;
  flex-direction:column;
  padding:0;
  margin:0;
  aspect-ratio:1 / 1;
  overflow:hidden;
  border-radius:var(--radius);
}

/* image at top */
#latest-projects.home-grid > .row > img.thumb{
  width:100%;
  height:60%;
  border:0;
  border-bottom:1px solid var(--line);
  border-radius:0;
  object-fit:contain;
  object-position:center;
  background:var(--panel);
}

/* text block */
#latest-projects.home-grid > .row .row-main{
  padding:14px 14px 0;
}

/* keep only title on home cards */
#latest-projects.home-grid > .row .row-authors,
#latest-projects.home-grid > .row .row-venue{
  display:none;
}

/* put link at bottom-left of card */
#latest-projects.home-grid > .row .pill{
  justify-self:auto;
  align-self:flex-start;
  margin-top:auto;
  padding:12px 14px 14px;
}

/* placeholder */
#latest-projects.home-grid > .card-placeholder{
  display:flex;
  align-items:center;
  justify-content:center;
  aspect-ratio:1/1;
  border-radius:var(--radius);
  border:1px dashed var(--line);
  color:var(--muted);
  background:transparent;
}

/* =========================================================
   Homepage: Latest Publications should stay a normal row
   ========================================================= */
#latest-pubs .row{
  margin-bottom:0;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer{
  margin-top:40px;
  padding:22px 0 32px;
  border-top:1px solid var(--line);
}
.footer-center{
  display:flex;
  justify-content:center;
  align-items:center;
}
.copy{ color:var(--muted); font-size:14px; }

/* =========================================================
   JS-driven mobile class (if statement in script.js)
   ========================================================= */
body.is-mobile .favicon-lg{
  width:26px;
  height:26px;
}

body.is-mobile .brand-name{
  font-size:17px !important;
}

body.is-mobile .topbar-inner{
  height:68px;
  position:relative;
}

body.is-mobile .topnav{
  gap:14px;
}

body.is-mobile .hero-socials{
  gap:8px;
}

body.is-mobile .hero-socials .btn{
  font-size:13px;
  padding:7px 12px;
}

body.is-mobile .thumb{
  width:72px;
  height:72px;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width:900px){
  .hero{ grid-template-columns:1fr; gap:10px; }
  .hero-photo{ width:220px; height:220px; }
  .hero > img.hero-photo{ justify-self:center; }
  .hero > div:first-of-type{
    display:flex;
    flex-direction:column;
    align-items:center;
    text-align:center;
    width:90%;
    margin-left:auto;
    margin-right:auto;
  }
  .display{ font-size:40px; }
  .research-title{ white-space:normal; }
  .hero-socials{ justify-content:center; }

  .display,
  .display.big,
  .section-head,
  .rule,
  .year,
  .h2{
    width:90%;
    margin-left:auto;
    margin-right:auto;
  }

  .hero-research{
    width:90%;
    margin-left:auto;
    margin-right:auto;
  }

  .section-head .all-link{
    display:none;
  }

  .menu-toggle{
    display:flex;
  }
  .topnav{
    display:none;
    position:absolute;
    top:calc(100% + 8px);
    right:28px;
    min-width:190px;
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
    padding:12px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--panel);
    box-shadow:var(--shadow);
    z-index:65;
  }
  .topbar.nav-open .topnav{
    display:flex;
  }
  .topnav a{
    width:100%;
    padding:4px 0;
  }

  #latest-projects.home-grid{
    grid-template-columns:1fr;
    justify-items:center;
  }

  .row{
    grid-template-columns: 1fr;
    width:84%;
    margin-left:auto;
    margin-right:auto;
  }
  #projects-list-page .row,
  #publications-list-page .row{
    grid-template-columns:auto 1fr;
    align-items:start;
    column-gap:14px;
    row-gap:10px;
    min-height:170px;
  }
  #projects-list-page .row > .thumb,
  #publications-list-page .row > .thumb{
    grid-column:1;
    grid-row:1;
  }
  #projects-list-page .row > .row-main,
  #publications-list-page .row > .row-main{
    grid-column:2;
    grid-row:1;
  }
  #projects-list-page .row .row-title,
  #publications-list-page .row .row-title{
    margin-bottom:0;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:3;
    overflow:hidden;
  }
  #projects-list-page .row .row-authors,
  #publications-list-page .row .row-authors{
    display:none;
  }
  #projects-list-page .row .row-venue,
  #publications-list-page .row .row-venue{
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }
  #publications-list-page .row .title-desktop{
    display:none;
  }
  #publications-list-page .row .title-mobile{
    display:inline;
  }
  #projects-list-page .row > .pill,
  #publications-list-page .row > .pill{
    grid-column:1 / -1;
    grid-row:2;
    justify-self:end;
    text-align:right;
    padding-top:0;
  }
  #talks-list-page .talk-entry{
    width:84%;
    margin-left:auto;
    margin-right:auto;
  }
  .pill{
    justify-self:start;
  }

  #latest-projects.home-grid > .row,
  #latest-projects.home-grid > .card-placeholder{
    width:84%;
    max-width:360px;
  }
}
/* Homepage project cards: right-align "Read more →" */
#latest-projects.home-grid > .row .pill{
  align-self: flex-end;
  margin-left: auto;
  text-align: right;
}
