/* Avenir by name: Book and Roman share weight 400, so pick Roman explicitly. */
@font-face { font-family: "Site Avenir"; font-weight: 400; src: local("Avenir Roman"), local("Avenir-Roman"); }
@font-face { font-family: "Site Avenir"; font-weight: 400; font-style: italic; src: local("Avenir Oblique"), local("Avenir-Oblique"); }
@font-face { font-family: "Site Avenir"; font-weight: 500; src: local("Avenir Medium"), local("Avenir-Medium"); }
@font-face { font-family: "Site Avenir"; font-weight: 800; src: local("Avenir Heavy"), local("Avenir-Heavy"); }

:root {
  --bg: #fbf9f5;
  --fg: #2a2520;
  --muted: #76706a;
  --accent: #5a3e2b;
  --soft: #f2ede5;
  --rule: #e6dfd4;
}
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 18px/1.65 "Site Avenir", "Nunito Sans", sans-serif;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 4rem 1rem 3rem;
}

h1, h2 { font-weight: 500; line-height: 1.15; }
b, strong { font-weight: 800; }
h1 { font-size: 2.2rem; margin: 0; }
h2 { font-size: 1.25rem; margin: 2.5rem 0 0.75rem; }

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

/* header */
header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2rem; }
.me {
  width: 128px; height: 128px; flex: none;
  object-fit: cover;
  border-radius: 50%;
  background: var(--soft);
}
.tagline { margin: .2rem 0 .5rem; color: var(--muted); }
.links { margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.links a { color: var(--accent); display: inline-flex; transition: color .15s, transform .15s; }
.links a:hover { color: var(--fg); transform: translateY(-2px); }
.links svg { width: 21px; height: 21px; }

@media (max-width: 520px) {
  header { flex-direction: column; text-align: center; }
  .links { justify-content: center; }
}

/* papers */
.note { color: var(--muted); font-size: .85rem; margin: -.5rem 0 0; }
.papers { list-style: none; padding: 0; margin: 1.25rem 0 0; }
.paper { display: grid; grid-template-columns: 200px 1fr; gap: 1.1rem; margin-bottom: 1.6rem; align-items: start; }
.paper .thumb {
  display: block; aspect-ratio: 2 / 1; padding: 4px; border-radius: 8px; overflow: hidden;
  background: #fff; border: 1px solid var(--rule);
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.paper .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.paper:hover .thumb { transform: rotate(-2deg) scale(1.03); }
.paper .title { font-weight: 500; color: var(--fg); text-decoration: none; line-height: 1.35; display: block; }
.paper .title:hover { color: var(--accent); }
.paper span { display: block; font-size: .9rem; line-height: 1.45; margin-top: .2rem; }
.paper .authors { color: var(--muted); }
.paper .authors b { color: var(--fg); font-weight: 800; }
.paper .venue { font-style: italic; }
.paper .extras { font-size: .85rem; }

@media (max-width: 520px) {
  .paper { grid-template-columns: 1fr; gap: .6rem; }
  .paper .thumb { max-width: 280px; }
}

.all summary {
  font-weight: 500; font-size: 1.05rem;
  cursor: pointer; list-style: none; color: var(--muted);
}
.all summary::-webkit-details-marker { display: none; }
.all summary::before { content: "▸ "; display: inline-block; transition: transform .2s; }
.all[open] summary::before { transform: rotate(90deg); }
.all summary:hover { color: var(--accent); }
.all-papers { padding: 0; list-style: none; font-size: .9rem; line-height: 1.5; }
.all-papers li { margin-bottom: .6rem; color: var(--muted); }
.all-papers a { color: var(--fg); text-decoration: none; }
.all-papers a:hover { color: var(--accent); }
.all-papers b { color: var(--fg); font-weight: 800; }

/* game of 24 */
.game {
  margin-top: 3.5rem;
  padding: 1rem 1.2rem;
  background: var(--soft);
  border-radius: 12px;
  font-size: .95rem;
}
.game p { margin: 0; }
#nums { font-family: ui-monospace, monospace; letter-spacing: .1em; font-weight: 500; }
#reroll {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 1.1rem; transition: transform .3s;
}
#reroll:hover { transform: rotate(180deg); color: var(--accent); }
#g24 { display: flex; gap: .5rem; margin-top: .6rem; }
#g24 input {
  flex: 1; min-width: 0;
  font: inherit; font-family: ui-monospace, monospace;
  padding: .35rem .6rem;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg); color: var(--fg);
}
#g24 button {
  font: inherit; padding: .35rem .9rem; cursor: pointer;
  border: 0; border-radius: 8px; background: var(--accent); color: var(--bg);
}
#verdict { min-height: 1.6em; margin-top: .4rem !important; color: var(--muted); }


/* email: click to copy */
.email-wrap { position: relative; display: inline-flex; }
#email {
  display: inline-flex; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent); font: inherit; transition: color .15s, transform .15s;
}
#email:hover { color: var(--fg); transform: translateY(-2px); }
#email-pop {
  position: absolute; top: calc(100% + .5rem); left: 50%; transform: translate(-50%, -4px);
  white-space: nowrap; font-size: .85rem; line-height: 1.3;
  padding: .35rem .65rem; border-radius: 8px;
  background: var(--fg); color: var(--bg);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 2;
}
#email-pop.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#email-pop .addr { user-select: all; font-weight: 500; }
@media (max-width: 520px) {
  #email-pop { left: 0; transform: translate(0, -4px); }
  #email-pop.show { transform: translate(0, 0); }
}

/* small figure-1 thumbnails in the all-papers list */
.all-papers li { display: flex; gap: .75rem; align-items: flex-start; }
.all-papers .mini {
  flex: none; width: 96px; aspect-ratio: 2.2 / 1; margin-top: .2rem;
  padding: 2px; border-radius: 5px; overflow: hidden;
  background: #fff; border: 1px solid var(--rule);
  transition: transform .2s;
}
.all-papers span.mini { visibility: hidden; }  /* no figure: keep the text aligned, show nothing */
.all-papers .mini img { width: 100%; height: 100%; object-fit: contain; display: block; }
.all-papers li:hover a.mini { transform: scale(1.06); }
