/* ============================================================
   Stylesheet for phomarkon.github.io
   Layout pattern adapted from jonbarron/jonbarron.github.io
   (https://github.com/jonbarron/jonbarron.github.io).

   Typography rule: BOLD only — no italics anywhere on the page.
   Bold is used sparingly to mark emphasis (paper titles, venues,
   awards). Use of italics in HTML class names (.paper-venue,
   etc.) is purely legacy — visual rendering is bold.
   ============================================================ */

/* ---------- Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap');

body,
td,
th,
tr,
p,
a,
strong,
li,
ol,
ul,
h1,
h2,
h3,
h4 {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 15px;
  color: #1c1c1c;
  font-style: normal;
}

p {
  line-height: 1.55;
  margin: 0.5em 0;
}

/* ---------- Links ---------- */
a {
  color: #1772d0;
  text-decoration: none;
}

a:focus,
a:hover {
  color: #0b4f9c;
  text-decoration: none;
}

/* ---------- Headings (bold only, no italics, no underlines) ---------- */
h2 {
  margin: 36px 0 10px;
  font-weight: 700;
  font-size: 19px;
  padding: 0;
  border: 0;
  letter-spacing: 0.01em;
}

h3 {
  margin: 22px 0 6px;
  font-weight: 700;
  font-size: 15px;
  padding: 0;
  letter-spacing: 0.01em;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 24px;
  align-items: start;
  margin: 0 auto 8px;
  max-width: 800px;
}

.hero-text {
  min-width: 0; /* allow grid item to shrink below content */
}

.hero-photo-wrap {
  display: flex;
  justify-content: center;
}

.name {
  margin: 0;
  padding: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.name .surname {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-style: normal;
}

.contactemail {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: #555;
  letter-spacing: 0.01em;
}

.nickname {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 400;
  color: #888;
  letter-spacing: 0.02em;
  font-style: normal;
}

.contactemail a {
  color: #555;
}

.contactemail a:hover,
.contactemail a:focus {
  color: #1772d0;
}

.contactemail .at {
  color: #aaa;
  letter-spacing: 0.04em;
  padding: 0 1px;
}

.hero-photo {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

.born {
  margin: 4px 0 14px;
  color: #555;
  font-size: 13px;
  font-weight: 400;
}

.summary {
  margin: 12px 0 14px;
  font-size: 14px;
  line-height: 1.55;
}

.summary .seealso {
  margin-top: 8px;
  color: #555;
  font-size: 13px;
}

/* ---------- Contact icons ---------- */
.contacts {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.contacts a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #1c1c1c;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  text-decoration: none;
  line-height: 1;
}

.contacts a:focus,
.contacts a:hover {
  color: #1772d0;
}

.contacts svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.contacts .label {
  display: inline;
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
}

/* ---------- Publications (BOLD only, no italics) ---------- */
.papertitle {
  font-weight: 700;
}

/* Venues: bolded via class — visual rendering is bold, not italic. */
.paper-venue {
  font-weight: 700;
  font-style: normal;
}

/* Underline my name anywhere it appears. (Name convention, not italic.) */
em.me {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  font-style: normal;
  font-weight: 400;
}

/* ---------- Numbered publications list ---------- */
.ol-pubs {
  margin: 8px 0 0 0;
  padding-left: 22px;
}

.ol-pubs li {
  margin-bottom: 0;
  padding: 10px 0 11px;
  line-height: 1.45;
  border-bottom: 1px solid #ececec;
}

.ol-pubs li:last-child {
  border-bottom: 0;
}

.ol-pubs li::marker {
  color: #8a8a8a;
  font-size: 13px;
}

.ol-pubs li .papertitle {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 2px;
  line-height: 1.35;
}

.ol-pubs li .authors {
  margin: 0 0 2px;
  font-size: 14px;
  color: #444;
}

.ol-pubs li .tldr {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.ol-pubs li .links {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: #999;
}

.ol-pubs li .links a {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid #cfd8e3;
  border-radius: 3px;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11.5px;
  font-weight: 700;
}

.ol-pubs li .links a:hover {
  background: #eef4fb;
  border-color: #1772d0;
}

/* ---------- Awards table ---------- */
.awards-table {
  margin: 4px 0 8px;
}

.award-row td {
  padding: 5px 12px 5px 0;
  vertical-align: top;
  border: 0;
}

.award-row td:first-child {
  width: 100px;
  white-space: nowrap;
}

.award-name {
  font-weight: 700;
}

/* ---------- Page background ---------- */
body {
  margin: 32px auto;
  padding: 0 16px;
  max-width: 800px;
  background: #ffffff;
  overflow-x: hidden; /* belt-and-braces against any rogue overflow */
}

/* Long URLs and author lists should wrap, not push the page sideways.
   Applied selectively — only to rows/lists that carry long links and names.
   Regular prose uses normal wrapping. */
.ol-pubs li,
.news-row td,
.award-row td,
.links,
.section-note {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.section-note {
  font-size: 13px;
  color: #555;
  margin: -4px 0 18px;
}

@media (max-width: 720px) {
  body {
    margin: 16px auto;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: left;
  }
  .hero-photo-wrap {
    order: -1;
    margin-bottom: 4px;
  }
  .hero-photo {
    max-width: 160px;
  }

  /* Stack date above content for news/awards so narrow screens aren't crowded. */
  .news-row td,
  .award-row td {
    display: block;
    width: 100% !important;
    padding: 4px 0;
    white-space: normal;
  }
  .news-row td:first-child,
  .award-row td:first-child {
    font-size: 12px;
    color: #888;
    padding-bottom: 2px;
  }
}

@media (max-width: 480px) {
  .name {
    font-size: 24px;
  }
  .hero-photo {
    max-width: 130px;
  }
  .contacts {
    gap: 14px;
  }
  /* On narrow phones, icon labels are redundant (aria-label remains). */
  .contacts .label {
    display: none;
  }
  h2 {
    font-size: 17px;
  }
}

/* ---------- News ---------- */
.news-table {
  margin-top: 4px;
}

.news-row td {
  padding: 5px 12px 5px 0;
  vertical-align: top;
}

.news-row td:first-child {
  width: 100px;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  margin: 56px auto 0;
  padding: 18px 0 16px;
  max-width: 800px;
  border-top: 1px solid #e8e8e8;
}

.site-footer .credit {
  color: #999;
  font-size: 11px;
  margin: 0;
}

.site-footer .credit a {
  font-size: inherit;
}

.site-footer .page-updated {
  color: #aaa;
  font-size: 11px;
  margin: 8px 0 0;
  letter-spacing: 0.04em;
}

/* ---------- Side line-stack navigation (ChatGPT-style) ---------- */
.side-nav {
  position: fixed;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 100;
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 12px;
}

.side-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-nav li {
  display: flex;
  justify-content: flex-end;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 12px;
  color: #888;
  text-decoration: none;
}

.side-nav .dot {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: #b8b8b8;
  transition: width 180ms ease, height 180ms ease, background 180ms ease;
}

.side-nav a:hover .dot,
.side-nav a.is-active .dot {
  width: 30px;
  height: 3px;
  background: #1c1c1c;
}

.side-nav a.is-active .dot {
  background: #1772d0;
}

.side-nav .label {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #1c1c1c;
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.side-nav a:hover .label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.side-nav a.is-active .label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 900px) {
  /* The fixed bottom-nav needs room — keep page content from hiding under it. */
  body {
    padding-bottom: 72px;
  }

  .side-nav {
    top: auto;
    bottom: 14px;
    right: 12px;
    left: 12px;
    transform: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 6px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .side-nav ul {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    width: 100%;
  }

  .side-nav li {
    flex: 1 1 auto;
  }

  .side-nav a {
    width: auto;
    height: 16px;
    padding: 0 6px;
    flex-direction: column;
    gap: 2px;
  }

  /* Permanent short label under each line on mobile */
  .side-nav .label {
    position: static;
    transform: none;
    background: transparent;
    color: #555;
    padding: 0;
    margin: 0;
    font-size: 9px;
    opacity: 0.85;
    pointer-events: none;
    letter-spacing: 0.01em;
    text-align: center;
  }

  .side-nav a:hover .label,
  .side-nav a.is-active .label {
    color: #1772d0;
    transform: none;
  }

  .side-nav .dot {
    width: 16px;
    height: 2px;
  }

  .side-nav a:hover .dot,
  .side-nav a.is-active .dot {
    width: 22px;
  }

  /* On narrow mobile, hide long labels — dot alone signals the section. */
  .side-nav .label {
    display: none;
  }
}

@media (max-width: 380px) {
  .side-nav .label {
    display: none;
  }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  background: #fff;
  color: #1c1c1c;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: #1772d0;
  border-color: #1772d0;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

/* Show the moon in light mode (switch to dark) and the sun in dark mode. */
.theme-toggle .icon-sun {
  display: none;
}

/* ---------- Dark mode ----------
   Applied via <html data-theme="dark">, set by the inline script in
   index.html from the saved choice or the system preference. */
:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="dark"] body {
  background: #1c1c1c;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] td,
:root[data-theme="dark"] th,
:root[data-theme="dark"] tr,
:root[data-theme="dark"] p,
:root[data-theme="dark"] a,
:root[data-theme="dark"] strong,
:root[data-theme="dark"] li,
:root[data-theme="dark"] ol,
:root[data-theme="dark"] ul,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] .name,
:root[data-theme="dark"] .contacts a,
:root[data-theme="dark"] .contacts .label {
  color: #e8e8e8;
}

:root[data-theme="dark"] a {
  color: #6aa9f0;
}

:root[data-theme="dark"] a:focus,
:root[data-theme="dark"] a:hover {
  color: #a8cdf7;
}

:root[data-theme="dark"] .contacts a:focus,
:root[data-theme="dark"] .contacts a:hover,
:root[data-theme="dark"] .contactemail a:focus,
:root[data-theme="dark"] .contactemail a:hover {
  color: #6aa9f0;
}

:root[data-theme="dark"] .born,
:root[data-theme="dark"] .summary .seealso,
:root[data-theme="dark"] .section-note,
:root[data-theme="dark"] .contactemail,
:root[data-theme="dark"] .contactemail a {
  color: #b8b8b8;
}

:root[data-theme="dark"] .contactemail .at {
  color: #888;
}

:root[data-theme="dark"] .nickname {
  color: #999;
}

:root[data-theme="dark"] .site-footer {
  border-top-color: #444;
}

:root[data-theme="dark"] .site-footer .credit {
  color: #888;
}

:root[data-theme="dark"] .site-footer .page-updated {
  color: #777;
}

:root[data-theme="dark"] .theme-toggle {
  background: #262626;
  border-color: #444;
  color: #e8e8e8;
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .theme-toggle:focus-visible {
  color: #6aa9f0;
  border-color: #6aa9f0;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .side-nav .dot {
  background: #555;
}

:root[data-theme="dark"] .side-nav a:hover .dot {
  background: #e8e8e8;
}

:root[data-theme="dark"] .side-nav a.is-active .dot {
  background: #6aa9f0;
}

/* Inverted tooltip, mirroring the dark-on-light pill in light mode. */
:root[data-theme="dark"] .side-nav .label {
  background: #e8e8e8;
  color: #1c1c1c;
}

@media (max-width: 900px) {
  :root[data-theme="dark"] .side-nav {
    background: rgba(40, 40, 40, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

/* Publications: dark-theme overrides */
:root[data-theme="dark"] .ol-pubs li { border-bottom-color: #2c2f36; }
:root[data-theme="dark"] .ol-pubs li .authors { color: #b8bcc4; }
:root[data-theme="dark"] .ol-pubs li .tldr { color: #d4d7dc; }
:root[data-theme="dark"] .ol-pubs li .links a { border-color: #3a4556; }
:root[data-theme="dark"] .ol-pubs li .links a:hover { background: #1c2636; border-color: #6cb0ff; }
