/* home.css — Marc Garellek's homepage
   One file, no build step. Change the colors and fonts in :root and everything follows. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --ink: #1c2430;
  --muted: #5a6572;
  --heading: #182b49;
  --link: #0a5d9c;
  --rule: #d9dfe6;
  --tint: #f1f4f8;

  /* System fonts only: no Google Fonts request, nothing to load. */
  --font-text: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ipa: "Charis SIL", "Doulos SIL", "Gentium Plus", "Noto Serif", "DejaVu Serif", "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181e;
    --ink: #e3e7ec;
    --muted: #9aa5b1;
    --heading: #c8d6ea;
    --link: #7fb6ea;
    --rule: #2b333c;
    --tint: #1d232b;
  }
}

/* ---------- Base ---------- */

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  max-width: 45rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem) clamp(1rem, 4vw, 1.5rem) 3rem;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--font-text);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---------- Headings ---------- */

h1, h2, h3 {
  font-family: var(--font-ui);
  color: var(--heading);
  line-height: 1.2;
}

h1 { font-size: 2rem;    font-weight: 600; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem;  font-weight: 600; margin: 0 0 1rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1.75rem 0 .6rem; }

/* ---------- Links ---------- */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Header ---------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.25rem 2rem;
}

/* Photo that swaps to the MRI image on hover (or keyboard/tap focus). */
.portrait {
  position: relative;
  flex: none;
  width: 9.5rem;
  border-radius: 8px;
  overflow: hidden;
}

.portrait img {
  width: 100%;
}

.portrait .alt {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s;
}

.portrait:hover .alt,
.portrait:focus-within .alt {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .portrait .alt { transition: none; }
}

.who {
  flex: 1 1 16rem;
  min-width: 0;
}

.who p,
.who address {
  margin: 0 0 .9rem;
}

.who address {
  font-style: normal;
}

.ipa {
  font-family: var(--font-ipa);
  color: var(--muted);
}

/* Email address is split with a hidden "@@@" so scrapers can't read it. */
.nospam {
  display: none;
}

/* ---------- Note to prospective students ---------- */

.note {
  margin: 1.5rem 0 0;
  padding: .8rem 1rem;
  background: var(--tint);
  border-radius: 6px;
}

/* ---------- Jump links ---------- */

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.5rem;
  margin: 1.5rem 0 0;
  font-family: var(--font-ui);
  font-size: .95rem;
}

/* ---------- Sections ---------- */

main > section,
body > footer {
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

ul {
  padding-left: 1.25rem;
}

li ul {
  margin-top: .25rem;
}

.section-note {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Publication and presentation lists ---------- */

/* Hanging indent, so it's easy to see where each entry starts. */
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entries li {
  margin: 0 -.5rem .35rem;
  padding: .3rem .5rem .3rem 2rem;
  text-indent: -1.5rem;
  border-radius: 6px;
  scroll-margin-top: 1rem;
}

/* When you arrive from the language list, the matching paper is highlighted. */
.entries li:target,
.entries li:has(:target) {
  background: var(--tint);
}

/* ---------- Back-to-top arrows ---------- */

.back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  margin-left: .35em;
  vertical-align: middle;
  text-indent: 0;
  font: 600 .8rem/1 var(--font-ui);
  color: var(--muted);
  background: var(--tint);
  border-radius: 6px;
  text-decoration: none;
}

.back-to-top::before {
  content: "\2191";
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--link);
  color: var(--bg);
}

/* ---------- Footer ---------- */

body > footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--muted);
}

body > footer p {
  margin: 0;
}

/* ---------- Print ---------- */

@media print {
  :root { --bg: #fff; --ink: #000; --muted: #333; --heading: #000; --link: #000; }
  .back-to-top,
  .jump { display: none; }
  .portrait .alt { display: none; }
  a { text-decoration: none; }
}
