/* ============================================================
   ivolinengong.com — shared stylesheet (Phase 1 + Phase 2)
   Carlini-style: serif typography, small-caps headings/nav,
   two-column bio+profile-card layout. Teal accent, no deps.
   ============================================================ */

/* Tokens */
:root {
  --bg:           #FFFFFF;
  --text:         #1F2937;
  --text-strong:  #111827;
  --text-muted:   #6B7280;
  --accent:       #0F766E;
  --border:       #E5E7EB;
  --card-bg:      #FAFAFA;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --measure: 1100px;
  --news-max-h: 380px;
  --news-max-h-mobile: 320px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

/* Typography — serif, single weight, small-caps for headings/nav */
body {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Hoefler Text", "Times New Roman", Georgia, serif;
  color: var(--text);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
}

h1,
h2,
h3 {
  color: var(--text-strong);
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin: 0;
}

/* Mobile body size */
@media (max-width: 639px) {
  body {
    font-size: 16px;
  }
}

/* ------------------------------------------------------------
   Site header (top bar: title left, nav right, divider below)
   ------------------------------------------------------------ */

.site-header {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-10) var(--space-6);
  max-width: var(--measure);
  margin-inline: auto;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 639px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-6) var(--space-6) var(--space-4);
  }
}

.site-title {
  font-size: 28px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.site-title:hover {
  text-decoration: none;
}

.site-title:visited {
  color: var(--accent);
}

@media (max-width: 639px) {
  .site-title {
    font-size: 24px;
  }
}

.site-nav {
  display: flex;
  flex-direction: row;
  gap: var(--space-8);
  font-size: 15px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

@media (max-width: 639px) {
  .site-nav {
    gap: var(--space-4);
    font-size: 14px;
  }
}

.site-nav a,
.site-nav span {
  color: var(--accent);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.site-nav [aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

.site-nav [data-todo="phase-2"] {
  color: var(--text-muted);
  cursor: default;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  width: auto;
  height: auto;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 1000;
}

/* ------------------------------------------------------------
   Main content shell
   ------------------------------------------------------------ */

main {
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--space-12) var(--space-10) var(--space-16);
}

@media (max-width: 639px) {
  main {
    padding: var(--space-8) var(--space-6) var(--space-12);
  }
}

/* ------------------------------------------------------------
   Two-column bio layout: bio text left, profile card right
   ------------------------------------------------------------ */

.bio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-12);
  align-items: start;
  margin-bottom: var(--space-12);
}

@media (max-width: 899px) {
  .bio-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }
}

/* Bio paragraphs */
.bio-text p {
  margin: 0 0 var(--space-4) 0;
  font-size: 17px;
  line-height: 1.6;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 639px) {
  .bio-text p {
    font-size: 16px;
  }
}

/* Profile card — boxed right-column identity panel */
.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}

@media (max-width: 899px) {
  .profile-card {
    max-width: 360px;
    margin-inline: auto;
  }
}

.profile-card .headshot {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 25%;
  border-radius: var(--radius-md);
  display: block;
  margin-bottom: var(--space-4);
}

.profile-card .identity {
  font-size: 17px;
  line-height: 1.45;
  margin: 0;
}

.profile-card .identity p {
  margin: 0 0 var(--space-1) 0;
}

.profile-card .identity .name {
  color: var(--text-strong);
}

.profile-card .identity .role {
  color: var(--text);
}

.profile-card .identity .email {
  color: var(--text);
}

.profile-card .profile-links {
  margin-top: var(--space-3);
  font-size: 17px;
}

.profile-card .profile-links .sep {
  color: var(--text-muted);
  margin: 0 var(--space-1);
}

/* ------------------------------------------------------------
   Sections (news, future selected work, etc.)
   ------------------------------------------------------------ */

section {
  margin-block: var(--space-12);
}

section h2 {
  font-size: 22px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-4) 0;
}

/* Page-level H2 (e.g. "Publications", "Talks", "Writing", "Code") —
   when it's a direct child of <main>, it acts as the page title and
   needs comfortable breathing room before the first content entry. */
main > h2 {
  font-size: 22px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-10) 0;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 639px) {
  main > h2 {
    margin-bottom: var(--space-8);
  }
}

/* News scrollable container */
.news-list {
  max-height: var(--news-max-h);
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  padding-right: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

@media (max-width: 639px) {
  .news-list {
    max-height: var(--news-max-h-mobile);
  }
}

.news-list:focus,
.news-list:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.news-list::-webkit-scrollbar {
  width: 8px;
}

.news-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.news-list::-webkit-scrollbar-thumb:hover {
  background: #D1D5DB;
}

.news-entry {
  margin: 0;
  padding: var(--space-3) 0;
  font-size: 17px;
  line-height: 1.6;
  border-bottom: 1px solid rgba(229, 231, 235, 0.55);
}

.news-entry:first-child {
  padding-top: 0;
}

.news-entry:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

@media (max-width: 639px) {
  .news-entry {
    font-size: 16px;
  }
}

.news-date {
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 0.02em;
  margin-right: var(--space-2);
}

.news-body i,
.news-body em {
  font-style: italic;
}

/* ------------------------------------------------------------
   Links — global rules (apply to body links, news entries,
   profile-card links). Site nav and profile-card overrides
   handled above.
   ------------------------------------------------------------ */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:visited {
  color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ------------------------------------------------------------
   Content-entry patterns (Phase 2: publications / talks / writing)
   ------------------------------------------------------------ */

/* Publication entries */
.pub-entry {
  margin-block-end: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.pub-entry:last-child {
  margin-block-end: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.pub-entry .pub-title {
  font-size: 17px;
  color: var(--text-strong);
  line-height: 1.4;
  margin: 0 0 var(--space-2) 0;
  font-weight: 400;
}

.pub-entry .pub-venue {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 var(--space-3) 0;
}

.pub-entry .pub-links {
  font-size: 15px;
  margin: 0;
}

.pub-entry .pub-links .pub-sep {
  color: var(--text-muted);
  margin: 0 var(--space-2);
}

.pub-entry .pub-tldr {
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  margin: var(--space-2) 0 0 0;
  font-style: italic;
}

/* Publication authors line (between title and venue) */
.pub-entry .pub-authors {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 var(--space-1) 0;
}

/* Action-button row: TLDR / Paper / Code / Blog / Posters / Citation */
.pub-actions {
  list-style: none;
  margin: var(--space-3) 0 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.pub-action {
  margin: 0;
}

/* Anchor-style buttons (Paper, Code, Blog, Posters) */
.pub-action > a,
.pub-action > details > summary {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--accent);
  background: var(--bg);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.pub-action > a:hover,
.pub-action > details > summary:hover {
  background: var(--card-bg);
  text-decoration: none;
}

.pub-action > a:focus-visible,
.pub-action > details > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hide the default disclosure triangle so the summary looks like a button */
.pub-action > details > summary::-webkit-details-marker {
  display: none;
}
.pub-action > details > summary::marker {
  content: '';
}

/* Open state: indicate active state on the summary chip */
.pub-action > details[open] > summary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Revealed TLDR / Citation content */
.pub-action-content {
  margin-top: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  /* Italics for narrative TLDRs */
  font-style: italic;
}

.pub-action-content pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-style: normal;
}

.pub-action-content p {
  margin: 0 0 var(--space-2) 0;
}

.pub-action-content p:last-child {
  margin-bottom: 0;
}

/* Stable-chip-row trick: collapse <li.pub-action> and the nested
   <details> with `display: contents` so the actual leaf elements
   (summary chips, link chips, and the expanded content div) become
   direct children of `.pub-actions`. Each chip then claims its own
   slot in the flex row; the expanded content gets `order: 1` and
   `flex-basis: 100%` so it ALWAYS drops onto a new row underneath
   without disturbing the chip positions. */
.pub-action,
.pub-action > details {
  display: contents;
}

.pub-action > details:not([open]) > .pub-action-content {
  display: none;
}

.pub-action > details[open] > .pub-action-content {
  display: block;
  order: 1;
  flex-basis: 100%;
  /* margin already set in the base rule below */
}

/* Talk entries */
.talk-entry {
  margin-block-end: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.talk-entry:last-child {
  margin-block-end: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.talk-entry .talk-body {
  font-size: 17px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* Writing — year-grouped entries */
.writing-year-group {
  margin-block-end: var(--space-10);
}

.writing-year-group:last-child {
  margin-block-end: 0;
}

.writing-year-group h3 {
  font-size: 17px;
  margin: 0 0 var(--space-4) 0;
}

.writing-entry {
  margin: 0;
  padding: var(--space-4) 0;
  border-bottom: 1px solid rgba(229, 231, 235, 0.55);
}

.writing-entry:first-child {
  padding-top: 0;
}

.writing-entry:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.writing-entry .writing-body {
  font-size: 17px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* ------------------------------------------------------------
   Self-hosted blog posts (for articles written directly on the
   site rather than linked out to Medium/OpenMined). Drop a new
   .html file under /posts/ using the same site-header shell and
   wrap the body in <article class="post">.
   ------------------------------------------------------------ */

.post {
  max-width: 70ch;
  margin-inline: auto;
}

.post header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.post .post-title {
  font-size: 22px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--text-strong);
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 var(--space-2) 0;
}

.post .post-date {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
}

.post p,
.post ul,
.post ol {
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 var(--space-4) 0;
}

.post h2 {
  font-size: 17px;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  margin: var(--space-8) 0 var(--space-3) 0;
}

.post h3 {
  font-size: 17px;
  font-variant: normal;
  letter-spacing: 0;
  margin: var(--space-6) 0 var(--space-2) 0;
}

.post img {
  max-width: 100%;
  height: auto;
  margin: var(--space-4) 0;
  border-radius: var(--radius-md);
}

.post blockquote {
  margin: var(--space-4) 0;
  padding: 0 var(--space-4);
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-style: italic;
}

.post pre {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.post code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--card-bg);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

.post pre code {
  background: transparent;
  padding: 0;
}

/* Code page intro paragraph */
.code-intro {
  font-size: 17px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  max-width: 60ch;
}

/* Mobile font-size adjustments — consolidated for the content-entry section */
@media (max-width: 639px) {
  .pub-entry .pub-title,
  .talk-entry .talk-body,
  .writing-entry .writing-body,
  .code-intro {
    font-size: 16px;
  }
}

/* ------------------------------------------------------------
   Comic post page (/posts/pate-comic.html) — the comic image fills
   the available width so panels are readable; the page itself
   overrides the .post 70ch cap.
   ------------------------------------------------------------ */

.comic-post {
  max-width: 1000px;
}

.comic-figure {
  margin: var(--space-6) 0;
  text-align: center;
}

.comic-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
