/* ---------------------------------------------------------------------------
   Cesar Cadena — personal site
   One stylesheet for index.html and publications.html.

   To switch the whole site to a sans-serif face, change --face below.
   To remove dark mode, delete the last block.
--------------------------------------------------------------------------- */

:root {
  --face: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  /* sans alternative:
     --face: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; */

  --ink:      #1b1b1b;   /* body text        */
  --ink-soft: #6a6a6a;   /* metadata, labels */
  --accent:   #215caf;   /* ETH blue         */
  --rule:     #e3e3e3;
  --bg:       #ffffff;

  --measure:  42rem;     /* ~68 characters   */

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
  max-width: var(--measure);
  font-family: var(--face);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  hyphens: auto;
  text-rendering: optimizeLegibility;
}

body.wide { --measure: 48rem; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(33, 92, 175, .3);
}
a:hover { border-bottom-color: var(--accent); }

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

/* --------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.masthead img {
  width: 150px;
  height: 188px;
  object-fit: cover;
  flex: none;
  border-radius: 2px;
}

h1 {
  margin: 0 0 .15rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--ink);
}

.role    { margin: 0 0 .6rem;  font-size: 1.0625rem; }
.affil   { margin: 0;          font-size: .9375rem; color: var(--ink-soft); line-height: 1.5; }
.contact { margin: .6rem 0 0;  font-size: .875rem;  color: var(--ink-soft); line-height: 1.5; }

.contact a       { color: var(--ink-soft); border-bottom-color: rgba(0, 0, 0, .18); }
.contact a:hover { color: var(--accent);   border-bottom-color: var(--accent); }

.pagehead { margin-bottom: .25rem; }
.byline   { margin: .2rem 0 0; font-size: .9375rem; color: var(--ink-soft); }

/* -------------------------------------------------------------------- nav */

nav.main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .35rem 1.75rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: .8125rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

nav.main a {
  color: var(--ink-soft);
  border: 0;
  white-space: nowrap;
}
nav.main a:hover         { color: var(--accent); }
nav.main a[aria-current] { color: var(--ink); font-weight: 600; }

/* light / dark switch — hidden until site.js enables it */
.theme-toggle {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-soft);
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle[hidden] { display: none; }

nav.sections {
  margin-top: 1.1rem;
  font-size: .875rem;
  color: var(--ink-soft);
}
nav.sections a {
  margin-right: 1.25rem;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
nav.sections a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ prose */

.prose   { margin-top: 2.25rem; }
.prose p { margin: 0 0 1.15rem; }

h2 {
  margin: 3.25rem 0 1.4rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  scroll-margin-top: 1.5rem;
}

h2 .count {
  float: right;
  font-weight: 400;
  letter-spacing: .04em;
  opacity: .65;
}

/* ------------------------------------------------------- publication list */

.pubs        { list-style: none; margin: 0; padding: 0; }
.pubs li     { margin: 0 0 1.75rem; }

.pubs .title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: .1rem 0;
}

.pubs .title code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .92em;
}

.pubs .authors,
.pubs .venue {
  display: block;
  font-size: .9375rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.pubs .me { color: var(--ink); }

.links {
  margin-top: .3rem;
  font-size: .8125rem;
  letter-spacing: .02em;
}
.links a {
  margin-right: .9rem;
  border: 0;
  color: var(--accent);
}
.links a:hover { border-bottom: 1px solid var(--accent); }

/* ----------------------------------------------------------------- footer */

footer {
  margin-top: 4rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
footer img { height: 40px; width: auto; opacity: .75; }
footer a   { border: 0; }
footer a:hover img { opacity: 1; }

/* ---------------------------------------------------------- small screens */

@media (max-width: 34rem) {
  body { padding: 2.5rem 1.25rem 4rem; font-size: 1rem; }

  .masthead     { flex-direction: column; gap: 1.25rem; }
  .masthead img { width: 128px; height: 160px; }

  nav.main a     { margin-right: 1.25rem; }
  nav.sections a { display: inline-block; margin: 0 1rem .25rem 0; }

  h2 .count { float: none; margin-left: .5rem; }
}

/* --------------------------------------------------------------- printing */

@media print {
  body { max-width: none; padding: 0; font-size: 10pt; color: #000; }
  nav, footer, .masthead img { display: none; }
  a { color: #000; border: 0; }
  .pubs li { page-break-inside: avoid; }
}

/* -------------------------------------------------------------- dark mode */
/* Two rules, same palette:
     1. the visitor's OS is set to dark and they have not chosen otherwise
     2. the visitor pressed the Dark/Light switch (site.js sets data-theme)
   To drop dark mode entirely, delete both blocks and the switch in the HTML. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:      #e8e6e3;
    --ink-soft: #9b9892;
    --accent:   #7ba7e0;
    --rule:     #2e2e2e;
    --bg:       #141414;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) a          { border-bottom-color: rgba(123, 167, 224, .35); }
  :root:not([data-theme="light"]) footer img { opacity: .85; }
}

:root[data-theme="dark"] {
  --ink:      #e8e6e3;
  --ink-soft: #9b9892;
  --accent:   #7ba7e0;
  --rule:     #2e2e2e;
  --bg:       #141414;
  color-scheme: dark;
}
:root[data-theme="dark"] a          { border-bottom-color: rgba(123, 167, 224, .35); }
:root[data-theme="dark"] footer img { opacity: .85; }

:root[data-theme="light"] { color-scheme: light; }
