/* Computer Modern Unicode, SIL Open Font License */
@font-face { font-family: "CMS"; src: url("fonts/cmunrm.woff") format("woff"); font-weight: normal; font-style: normal; }
@font-face { font-family: "CMS"; src: url("fonts/cmunbx.woff") format("woff"); font-weight: bold; font-style: normal; }
@font-face { font-family: "CMS"; src: url("fonts/cmunti.woff") format("woff"); font-weight: normal; font-style: italic; }
@font-face { font-family: "CMS"; src: url("fonts/cmunbi.woff") format("woff"); font-weight: bold; font-style: italic; }
@font-face { font-family: "CMSS"; src: url("fonts/cmunsl.woff") format("woff"); }

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: #fff;
  color: #333;
  font-family: "CMS", Georgia, "Times New Roman", serif;
  font-size: 18px;
  letter-spacing: -0.02rem;
  line-height: 1.5;
}

a { color: rgb(109, 109, 109); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* Top bar */
.navbar { background: #222; border-bottom: 1px solid #080808; padding: 14px 40px; }
.navbar a { color: #999; font-size: 22px; }
.navbar a:hover, .navbar a:focus { color: #fff; text-decoration: none; }

.container { width: 100%; max-width: 1170px; margin: 0 auto; padding: 0 15px; }

.content { flex: 1; }

/* Headings */
h1, h2, h3 { color: #333; line-height: 1.1; text-align: left; }
h1 { font-size: 300%; font-weight: 500; line-height: 65px; margin: 40px 0 10px; }
h2 { font-size: 150%; margin: 40px 0 20px -1px; } /* -1px lines the letters up with the body text */
h3 { font-size: 115%; margin: 30px 0 20px; }

p { margin: 0 0 10px; }

/* Home page: paper panel on a plain stone background */
.home { background: #dedad0; }
.home .content { display: flex; }
.home .content > .container { display: flex; }
.panel {
  width: 83.333%;
  margin: 0 auto;
  padding: 20px 30px 40px;
  background: #faf9f5;
}
.panel > h2:first-child { margin-top: 10px; }
.intro-photo { display: block; width: 300px; height: auto; margin: 0 0 20px; }
.home .panel a { color: #000; }
.home .panel p a, .preview { color: #0645ad; text-decoration: underline; margin: 0 -2px; padding: 2px; border-radius: 2px; white-space: nowrap; }
.home .panel p a:hover, .home .panel p a:focus, .preview:hover, .preview:focus { background: #e4e4e4; }

/* Looks like a link, but only shows a photo on hover (or tap) */
.preview { position: relative; cursor: default; }
.preview-card {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 1;
  width: 220px;
  padding: 6px 6px 8px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  white-space: normal; /* .preview is nowrap, but captions should wrap */
}
.preview-card img:not(.logo) { display: block; width: 100%; height: auto; }
.preview-caption { display: block; margin-top: 6px; color: #555; font-size: 14px; font-style: italic; line-height: 1.3; text-align: center; }
.preview-caption:first-child { margin-top: 2px; } /* caption-only cards */
.preview:hover .preview-card,.preview:focus .preview-card,.preview:focus-within .preview-card { display: block; }
/* Covers the gap above the card, so the mouse can move onto links inside it */
.preview-card::before { content: ""; position: absolute; bottom: 100%; left: 0; right: 0; height: 10px; }
/* Larger video popup, centred under its paragraph so it can't run off the side */
.video-anchor { position: relative; }
.preview-video { position: static; }
.preview-video .preview-card { width: min(640px, calc(100vw - 30px)); }
.preview-card video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
@media (min-width: 601px) {
  .preview-video .preview-card { top: 100%; } /* no gap, so the mouse can move onto the video */
}
/* Make personal photos harder to save: right-click, long-press and drag
   land on the surrounding element instead of the image */
.intro-photo, .preview-card img, .preview-card video { pointer-events: none; -webkit-user-drag: none; user-select: none; }
.panel { -webkit-touch-callout: none; }
.logo { width: 1em; height: 1em; margin-right: 0.4em; vertical-align: -0.15em; border-radius: 4px; }
/* This icon has built-in blank space around the letters */
.logo[src$="zfellows.png"] { margin: 0 0.18em 0 -0.22em; }

.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.post {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #d6d2c6;
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.post:hover, .post:focus {
  text-decoration: none;
  border-color: #000;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}
.post h3 { margin: 0 0 16px; font-size: 110%; line-height: 1.3; color: #000; }
.post-read { margin-top: auto; font-size: 15px; color: #0645ad; }
.post:hover .post-read, .post:focus .post-read { text-decoration: underline; }

/* Article pages */
.article { max-width: 750px; padding-bottom: 40px; }
.info { color: #555; font-style: italic; font-family: "CMSS", Georgia, serif; font-size: 120%; }

blockquote {
  margin: 0 0 20px 18px;
  padding: 6px 20px;
  background: rgb(245, 245, 245);
  border-radius: 10px;
  font-family: "CMSS", Georgia, serif;
}
pre {
  margin-left: 18px;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 10px;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.article img { display: block; max-width: 100%; height: auto; margin: 10px auto; }
.caption { font-size: 95%; text-align: center; }

@media (min-width: 768px) {
  .article { text-align: justify; }
}

@media (max-width: 600px) {
  .navbar { padding: 10px 20px; }
  .home .content > .container { padding: 0; }
  .panel { width: 100%; padding: 20px 16px 40px; }
  .intro-photo { width: 100%; }
  /* Pin the preview to the screen so it can't run off the edge */
  .preview-card { position: fixed; top: auto; bottom: 16px; }
  h1 { font-size: 240%; line-height: 1.15; }
}

@media print {
  .navbar { display: none; }
}

/* Writing note + "Why?" popup */
.ai-note { font-size: 80%; color: #777; margin: -10px 0 15px; }
.home .panel .ai-note a { color: #0645ad; text-decoration: underline; }
.why-dialog { max-width: 420px; padding: 20px 24px; border: 1px solid #ccc; border-radius: 4px; background: #faf9f5; color: #333; font: inherit; }
.why-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.why-dialog p { margin: 0 0 15px; }
.why-dialog button { font: inherit; padding: 2px 12px; cursor: pointer; }
