/* =============================================================
   tufte.css — Ahmed Boughdiri · Dark green theme
   ============================================================= */

@charset "UTF-8";

@font-face {
  font-family: "et-book";
  src: url("../fonts/et-book-roman-line-figures.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "et-book";
  src: url("../fonts/et-book-display-italic-old-style-figures.woff") format("woff");
  font-weight: normal;
  font-style: italic;
}
@font-face {
  font-family: "et-book";
  src: url("../fonts/et-book-bold-line-figures.woff") format("woff");
  font-weight: bold;
  font-style: normal;
}

:root {
  --green: #2d6a4f;
  --green-hover: #1b4332;
  --bg: #fffff8;
  --text: #111;
  --muted: #555;
  --border: #ddd;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }

body {
  font-family: "et-book", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2.5rem;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: transparent;
  color: white;
  font-family: "et-book", Georgia, serif;
  font-size: 1.1rem;
  font-weight: bold;
  text-decoration: none;
  border-bottom: none;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  transition: background-color 0.15s;
}
.site-badge:hover { background-color: transparent; border-bottom: none; opacity: 0.8; }
.site-badge img { width: 80px; height: 80px; }

.site-nav { display: flex; gap: 2rem; align-items: center; }

.site-nav a {
  font-family: "et-book", Georgia, serif;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
  letter-spacing: 0.03em;
}
.site-nav a.active, .site-nav a:hover { color: var(--green); border-bottom: none; }

/* --- Page content --- */
article, section {
  margin-top: 6rem;
  margin-left: auto;
  margin-right: auto;
  width: 87.5%;
  max-width: 1400px;
  padding: 2rem 2rem 5rem;
}

/* --- Typography --- */
h1 {
  font-weight: 400;
  font-size: 3.4rem;
  line-height: 1.05;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  width: 60%;
}

h2 {
  font-style: italic;
  font-weight: 400;
  font-size: 2.2rem;
  margin-top: 0;
  margin-bottom: 0.3rem;
  width: 100%;
}

p {
  font-size: 1.45rem;
  line-height: 2.1rem;
  margin-top: 1.2rem;
  margin-bottom: 0;
  width: 58%;
}

p.subtitle {
  font-style: italic;
  font-size: 1.7rem;
  line-height: 1;
  margin-top: 0.8rem;
  width: 58%;
}

ul, ol {
  font-size: 1.3rem;
  line-height: 2rem;
  width: 58%;
  padding-left: 1.5rem;
}

/* --- Links --- */
a { color: inherit; text-decoration: none; border-bottom: none; }
article a, section a { color: var(--green); border-bottom: 1px solid transparent; transition: border-color 0.1s; }
article a:hover, section a:hover { border-bottom-color: var(--green); }

/* --- Section divider --- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0 2rem;
  width: 75%;
}

/* --- Intro block: photo column left, bio right --- */
.intro-block {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  width: 78%;
}

/* Photo column: image + social icons stacked below */
.intro-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.intro-photo img {
  width: 160px;
  height: auto;
  border-radius: 2px;
  display: block;
}

/* Social icons row — under photo, icon only (except email) */
.social-icons {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--green) !important;
  border-bottom: 1px solid transparent !important;
  white-space: nowrap;
}
.social-icons a:hover { border-bottom-color: var(--green) !important; }

.social-icons svg {
  width: 18px;
  height: 18px;
  fill: var(--green);
  flex-shrink: 0;
}

/* Bio text column */
.intro-text p {
  width: 100%;
  font-size: 1.4rem;
  line-height: 2rem;
  margin-top: 0.8rem;
}

.cv-line {
  margin-top: 1.2rem;
  font-size: 1.3rem;
  width: 100%;
}

/* --- Publications table --- */
.publications-section, .talks-section {
  margin-top: 0.5rem;
  width: 82%;
}

.publications-section table, .talks-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.25rem;
  line-height: 1.85rem;
  margin-top: 0.5rem;
}

.publications-section td, .talks-section td {
  padding: 0.8rem 0.8rem 0.8rem 0;
  vertical-align: top;
  border-top: 1px solid var(--border);
}

.publications-section td:first-child, .talks-section td:first-child {
  white-space: nowrap;
  font-style: italic;
  color: var(--muted);
  padding-right: 1.8rem;
  width: 4rem;
  font-size: 1.05rem;
}

.pub-title {
  font-weight: bold;
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}
.pub-title a { color: var(--green) !important; border-bottom: 1px solid transparent !important; }
.pub-title a:hover { border-bottom-color: var(--green) !important; }

.pub-authors { color: #444; font-size: 1.05rem; margin-bottom: 0.1rem; }
.pub-venue { font-style: italic; color: var(--muted); font-size: 1.05rem; }

/* --- Type badges --- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-style: normal;
  font-weight: normal;
  margin-left: 0.4rem;
  vertical-align: middle;
  border: 1px solid;
}
.badge-conference { background: #d8f3dc; color: #1b4332; border-color: #74c69d; }
.badge-preprint   { background: #fff3cd; color: #856404; border-color: #ffc107; }
.badge-workshop   { background: #e2d9f3; color: #4a235a; border-color: #9b59b6; }

/* --- Talks --- */
.talk-title { font-size: 1.25rem; font-weight: bold; margin-bottom: 0.15rem; }
.talk-title a { color: var(--green) !important; border-bottom: 1px solid transparent !important; }
.talk-title a:hover { border-bottom-color: var(--green) !important; }
.talk-meta { color: var(--muted); font-size: 1.05rem; font-style: italic; }

/* --- Blog list --- */
.post-list { margin-top: 1rem; width: 62%; list-style: none; padding: 0; }
.post-list li { border-top: 1px solid var(--border); padding: 1.2rem 0; }
.post-list li:last-child { border-bottom: 1px solid var(--border); }
.post-list .post-title { font-size: 1.4rem; font-style: italic; display: block; margin-bottom: 0.15rem; color: var(--green); }
.post-list .post-date { font-size: 1rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
.post-list .post-excerpt { font-size: 1.15rem; line-height: 1.65; color: #444; margin-top: 0.2rem; }

/* --- Post content --- */
section > h1 { width: 62%; }
section > p, section > ul, section > ol { width: 60%; }

/* --- Footer --- */
footer {
  width: 87.5%;
  margin: 0 auto;
  padding: 0.5rem 2rem 3rem;
  font-size: 0.7rem;
  color: #bbb;
  letter-spacing: 0.02em;
}
footer hr { border: none; border-top: 1px solid var(--border); margin-bottom: 0.6rem; }
footer a { color: #bbb; text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 760px) {
  .site-header { padding: 0.7rem 1.2rem; }
  .site-badge { width: 40px; height: 40px; font-size: 0.95rem; }
  .site-nav a { font-size: 1.05rem; }
  article, section { margin-top: 5rem; padding: 1rem 1rem 3rem; width: 100%; }
  h1 { font-size: 2.3rem; width: 100%; }
  h2 { width: 100%; }
  p, ul, ol { width: 100%; font-size: 1.2rem; }
  .intro-block { flex-direction: column; gap: 1.2rem; width: 100%; }
  .intro-photo img { width: 110px; }
  .publications-section, .talks-section, .post-list, .section-divider { width: 100%; }
}
/* =====================================================
   Course chapter styles
   ===================================================== */

.course-chapter { margin-top: 0; }

/* Chapter nav breadcrumb */
.chapter-nav {
  font-size: 1rem !important;
  color: #888;
  font-style: italic;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.8rem;
  margin-bottom: 2rem;
  width: 75% !important;
}
.chapter-nav a { color: var(--green) !important; }

/* Section headings */
.course-chapter section { padding-top: 0; padding-bottom: 0; }

.course-chapter h2 {
  font-size: 2.1rem;
  font-style: italic;
  font-weight: 400;
  margin-top: 3rem;
  margin-bottom: 0.4rem;
  width: 75%;
}

.course-chapter h3 {
  font-style: italic;
  font-weight: 400;
  font-size: 1.7rem;
  margin-top: 2rem;
  margin-bottom: 0.3rem;
  width: 75%;
}

.course-chapter p { width: 68%; }

/* Uniform text size for all content */
.course-chapter p,
.course-chapter li,
.course-chapter td,
.course-chapter th,
.course-chapter div.Definition details > div,
.course-chapter div.Theorem details > div,
.course-chapter div.Proposition details > div,
.course-chapter div.Assumption details > div,
.course-chapter div.Proof details > div {
  font-size: 1.35rem;
  line-height: 2rem;
}

/* Math display blocks */
.course-chapter .math.display,
.course-chapter span.math.display {
  display: block;
  overflow-x: auto;
  margin: 1.2rem 0;
}

/* Tables */
.course-chapter table {
  width: 68%;
  font-size: 1.1rem;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.course-chapter td, .course-chapter th {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

/* Code */
.course-chapter pre, .course-chapter code {
  font-family: "Lucida Console", monospace;
  font-size: 0.9rem;
  background: #f4f4f0;
  padding: 0.2em 0.4em;
  border-radius: 2px;
}
.course-chapter pre {
  padding: 1rem;
  overflow-x: auto;
  width: 68%;
  margin: 1rem 0;
}

/* =====================================================
   Math block boxes — Definition, Theorem, etc.
   Each uses a <details> inside with a <summary>
   ===================================================== */

/* Shared base for all math blocks */
.course-chapter div.Definition details,
.course-chapter div.Theorem details,
.course-chapter div.Proposition details,
.course-chapter div.Assumption details,
.course-chapter div.Proof details {
  width: 70%;
  margin: 1.6rem 0;
  border-radius: 4px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1.8rem;
}

/* summary (the title bar) — shared */
.course-chapter div.Definition details summary,
.course-chapter div.Theorem details summary,
.course-chapter div.Proposition details summary,
.course-chapter div.Assumption details summary,
.course-chapter div.Proof details summary {
  padding: 0.6rem 1rem;
  font-size: 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 4px 4px 0 0;
  user-select: none;
}
.course-chapter details summary::-webkit-details-marker { display: none; }

/* Only Proof is clickable/collapsible */
.course-chapter div.Proof details summary {
  cursor: pointer;
}
.course-chapter div.Proof details summary::before {
  content: "▸";
  font-size: 0.8rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.course-chapter div.Proof details[open] summary::before {
  transform: rotate(90deg);
}

/* Definition/Theorem/Proposition/Assumption — not collapsible, no arrow */
.course-chapter div.Definition details summary,
.course-chapter div.Theorem details summary,
.course-chapter div.Proposition details summary,
.course-chapter div.Assumption details summary {
  cursor: default;
  pointer-events: none;
}

/* Content area inside details */
.course-chapter div.Definition details > div,
.course-chapter div.Theorem details > div,
.course-chapter div.Proposition details > div,
.course-chapter div.Assumption details > div,
.course-chapter div.Proof details > div {
  padding: 0.8rem 1.2rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.course-chapter div.Definition details > div p,
.course-chapter div.Theorem details > div p,
.course-chapter div.Proposition details > div p,
.course-chapter div.Assumption details > div p,
.course-chapter div.Proof details > div p { width: 100%; }

.course-chapter div.Definition details > div ul,
.course-chapter div.Theorem details > div ul,
.course-chapter div.Proposition details > div ul { width: 100%; }

/* --- Definition: green --- */
.course-chapter div.Definition details {
  border: 1.5px solid #74c69d;
  background: #f0faf4;
}
.course-chapter div.Definition details summary {
  background: #d8f3dc;
  color: #1b4332;
  font-weight: bold;
}

/* --- Theorem: deep blue --- */
.course-chapter div.Theorem details {
  border: 1.5px solid #90c2e7;
  background: #f0f6fc;
}
.course-chapter div.Theorem details summary {
  background: #d0e8f7;
  color: #1a3a5c;
  font-weight: bold;
}

/* --- Proposition: soft teal --- */
.course-chapter div.Proposition details {
  border: 1.5px solid #76c8c8;
  background: #f0fafa;
}
.course-chapter div.Proposition details summary {
  background: #d0eeee;
  color: #1a4040;
  font-weight: bold;
}

/* --- Assumption: amber --- */
.course-chapter div.Assumption details {
  border: 1.5px solid #f0b429;
  background: #fffbf0;
}
.course-chapter div.Assumption details summary {
  background: #fff0c0;
  color: #7a4f00;
  font-weight: bold;
}

/* --- Proof: grey, collapsed by default --- */
.course-chapter div.Proof details {
  border: 1.5px solid #ccc;
  background: #fafafa;
}
.course-chapter div.Proof details summary {
  background: #efefef;
  color: #444;
  font-style: italic;
}

/* Force proofs to be closed by default via CSS hint
   (actual open/close is controlled by HTML `open` attr — 
    we override visually with a note) */
.course-chapter div.Proof details:not([open]) > div { display: none; }

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 760px) {
  .course-chapter p,
  .course-chapter h2,
  .course-chapter h3,
  .course-chapter pre,
  .course-chapter table,
  .chapter-nav { width: 100% !important; }

  .course-chapter div.Definition details,
  .course-chapter div.Theorem details,
  .course-chapter div.Proposition details,
  .course-chapter div.Assumption details,
  .course-chapter div.Proof details { width: 100%; }
}

/* --- Course listing on blog index --- */
.course-listing {
  width: 70%;
  margin-bottom: 2.5rem;
}

.course-listing h2 {
  font-size: 1.8rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.course-listing > p {
  width: 100%;
  font-size: 1.2rem;
  color: #444;
  margin-bottom: 1.2rem;
}

.chapter-list {
  list-style: none;
  padding: 0;
  width: 100%;
  counter-reset: chapter-counter;
}

.chapter-list li {
  border-top: 1px solid var(--border);
  padding: 0.7rem 0;
  font-size: 1.2rem;
  line-height: 1.6;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chapter-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.chapter-list a {
  color: var(--green) !important;
  font-style: italic;
  border-bottom: 1px solid transparent !important;
  white-space: nowrap;
}

.chapter-list a:hover {
  border-bottom-color: var(--green) !important;
}

.chapter-excerpt {
  font-size: 1rem;
  color: #888;
  font-style: normal;
}
