/* ==============================
   Benedikt Gräßle — site Styles
   Two-column layout with responsive top-bar
   ============================== */

/* ---------- Theme & layout tokens ---------- */
:root{
  /* colors */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e6e6e6;
  --text: #333;
  --text-strong: #222;
  --link: #0066cc;
  --accent: #0a66c2;

  /* sizing */
  --maxw: min(96vw, 1500px);   /* centered page width cap */
  --content-w: 900px;          /* hero + main width on medium/narrow */
  --sidebar-w: 300px;          /* desktop sidebar width */
  --radius: 12px;
  --gap: 24px;

  /* site-icons */
  --icon-size: 26px;
  --brand-orcid: #A6CE39;
  --brand-scholar: #4285F4;
  --brand-rg: #00CCBB;
  --brand-home: #0b5cab;
}

/* ---------- Global resets ---------- */
*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
body{
  font-family: Georgia, serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Header & Tabs ---------- */
.site-header{
  position: sticky; top: 0;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.site-header .brand{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px 6px;
  display: flex; align-items: baseline; gap: 10px;
}
.brand-name{ font-weight: 700; color: var(--text-strong); }
.brand-tagline{ font-size: .9rem; color: #777; }

.tabs{
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex; gap: 8px;
  padding: 12px 20px;
  justify-content: flex-end; /* tabs right aligned */
}
.tab{
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  color: #333; text-decoration: none;
  border: 1px solid transparent;
}
.tab:hover{ background: #f6f8fb; border-color: #dfe3e8; }
.tab.active{ background: #e8f3ff; border-color: #c7e1ff; color: #0b5cab; }

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

/* ---------- Desktop layout: sidebar left, main right ---------- */
.layout{
  display: grid;
  grid-template-columns: minmax(240px, var(--sidebar-w)) minmax(0, 1fr);
  gap: var(--gap);
}
.sidebar{
  grid-column: 1;
  position: sticky; top: 84px; align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.main{
  width: 100%
  grid-column: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 60vh;
}

/* ---------- Sidebar content blocks ---------- */
.profile{ text-align: center; margin-bottom: 16px; } /* legacy hook */
.sidebar .block + .block{ margin-top: 16px; }
.sidebar .block h3{ font-size: 1rem; margin: 0 0 6px; color: var(--text-strong); }
.sidebar .block p, .sidebar .block li{ margin: 0 0 6px; }
.sidebar ul{ padding-left: 18px; margin: 6px 0; }

/* Avatar — keep round reliably everywhere (legacy .profile img + .avatar) */
.profile img,
.avatar{
  width: 100%;
  max-width: 240px;          /* preserves your previous size */
  aspect-ratio: 1 / 1;       /* ensures a square box */
  border-radius: 50%;        /* perfect circle */
  object-fit: cover;         /* crop to fill */
  display: block;
  margin: 8px auto 12px;
}

/* Profile texts (legacy hooks if used) */
.profile h1{ font-size: 1.35rem; line-height: 1.25; margin: 0 0 4px; color: var(--text-strong); }
.profile .title{ font-size: .95rem; color: #555; margin-bottom: 12px; }

/* ---------- Typography & links ---------- */
h1, h2, h3{ color: var(--text-strong); margin-top: .6em; }
a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }
.section{ margin-bottom: 28px; }
.pub-iframe{ border:none; width:100%; height:900px; }

/* ---------- Footer ---------- */
.footer{
  max-width: var(--maxw);
  margin: 12px auto 32px;
  padding: 0 20px;
  text-align: center;
  font-size: .9em; color: #777;
}

/* ---------- Shared social site-icons (works in sidebar & hero) ---------- */
.socials{
  display: flex; gap: 14px;
  align-items: center; justify-content: center;
  margin-top: 10px; margin-bottom: 18px;
  flex-wrap: wrap;                 /* ensure all 4 show even if narrow */
}
.socials .icon{
  display: inline-block;
  width: var(--icon-size); height: var(--icon-size);
  position: relative;
  color: #000; text-decoration: none;
}
.socials .icon::before{
  content: "";
  position: absolute; inset: 0;
  background-color: currentColor;  /* inherits link color */
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  opacity: .95;
  transition: color .15s ease, background-color .15s ease, opacity .15s ease;
}
/* icon masks */
.socials .icon.orcid::before{        -webkit-mask-image:url("/site-icons/orcid.svg");        mask-image:url("/site-icons/orcid.svg"); }
.socials .icon.scholar::before{      -webkit-mask-image:url("/site-icons/googlescholar.svg");      mask-image:url("/site-icons/googlescholar.svg"); }
.socials .icon.researchgate::before{ -webkit-mask-image:url("/site-icons/researchgate.svg"); mask-image:url("/site-icons/researchgate.svg"); }
.socials .icon.home::before{         -webkit-mask-image:url("/site-icons/download.svg");         mask-image:url("/site-icons/download.svg"); }
.socials .icon.home{ scale:2.5; margin-left:1em; }

/* hover brand colors */
.socials .icon.orcid:hover{        color: var(--brand-orcid); }
.socials .icon.scholar:hover{      color: var(--brand-scholar); }
.socials .icon.researchgate:hover{ color: var(--brand-rg); }
.socials .icon.home:hover{         color: var(--brand-home); }
/* keyboard focus */
.socials .icon:focus{ outline: 2px solid var(--brand-home); outline-offset: 2px; }

/* ---------- Hero (top bar) for medium/narrow; sidebar hidden there ---------- */
.profile-hero{ display: none; }
.page-contact{ display: none; }

@media (max-width: 980px){
  :root{ --gap: 0px; }

  .layout{ grid-template-columns: 1fr; }
  .sidebar{ display: none; }                 /* hide desktop sidebar */

  .container{ padding: 0 10px 24px 10px; }

  /* show hero at top, full width container with centered inner width */
  .profile-hero{ display: block; width: 100%; background: none; border: 0; }
  .profile-hero .hero-inner{
    width: min(100%, var(--content-w));
    margin: 0 auto;
    padding: 12px 0;
    display: grid;
    grid-template-columns: auto 1fr;         /* [photo] | [bio+site-icons] */
    column-gap: 16px; row-gap: 6px;
    align-items: center;
  }
  .profile-hero .sb-photo{
    margin-left: 40px;
  }
  .profile-hero .sb-photo .avatar{
    width: 200px; height: 200px; object-fit: cover; border-radius: 50%;
  }
  .profile-hero .sb-bio .name{
    margin: 0; line-height: 1.15; text-align: center; justify-self: center;
  }
  .profile-hero .sb-bio .title{
    margin: 2px 0 0; line-height: 1.2; color: #555;
    text-align: center; justify-self: center;
  }
  .profile-hero .socials{
    justify-content: center;
  }

  /* main matches hero width */
  .main{ width: min(100%, var(--content-w)); margin: 0 auto; }

  /* bottom contact (right-aligned within same width) */
  .page-contact{ display: block; width: 100%; margin-top: var(--gap); }
  .page-contact-inner{
    width: min(100%, var(--content-w));
    margin: 0 auto;
    text-align: right;
    padding: 8px 0 24px;
  }
}

/* ---------- Narrow phones: hero stacks (two rows) ---------- */
@media (max-width: 600px){

  .container{ padding: 0 0 24px 0; }

  .profile-hero .hero-inner{
    grid-template-columns: 1fr;
    row-gap: 10px; text-align: center;
  }
  .profile-hero .sb-photo{ justify-self: center; margin: 0;}
  .profile-hero .sb-photo .avatar{ width: 120px; height: 120px; justify-content: center;}
  .profile-hero .sb-bio .name,
  .profile-hero .sb-bio .title{ text-align: center; }
  .profile-hero .socials{ justify-content: center; }
  .page-contact-inner{ padding: 6px 0 20px; }
  .page-contact .sb-contact h3{ margin: 0 0 6px; }
  .page-contact .sb-contact p { margin: 0 0 8px; }
}

/* ---------- Small desktop tweaks ---------- */
@media (max-width: 900px){
  :root{ --sidebar-w: 260px; }
}
@media (max-width: 720px){
  .profile img{ max-width: 160px; }  /* legacy profile hook */
  .tabs{
    display: block;
    gap: 8px;
    padding: 10px 12px;
    white-space: nowrap;           /* keep each pill on one line */
    overflow-x: auto;              /* allow horizontal scroll when needed */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;         /* hide scrollbar (Firefox) */
  }
  .tabs::-webkit-scrollbar{ display: none; }  /* hide (WebKit) */
}

.cv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cv-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.8em;
}

/* Default date style */
.cv-date {
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

/* Positions: wider column to fit date ranges */
.cv-positions .cv-date {
  flex: 0 0 160px;   /* enough for “MM/YYYY–MM/YYYY” */
}

/* Education: narrower column (only MM/YYYY) */
.cv-education .cv-date {
  flex: 0 0 90px;    /* tighter, fits “MM/YYYY” neatly */
}

.cv-role {
  flex: 1;
}

.talks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.talk {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.6em;
}

.t-date {
  flex: 0 0 70px;   /* enough space for YYYY or MM/YYYY */
  font-weight: 600;
  color: #555;
}

.t-title {
  flex: 1;
  margin-left: 0.2em;
  margin-right: 0.3em;
}

.t-meta {
  flex: 0 0 auto;
  color: #666;
  font-size: 0.95em;
  margin-left: auto; /* pushes location right on wide screens */
}
