/* ═══════════════════════════════════════════
   Slate — minimal Hugo theme
   Pure CSS · dark-mode only · Space Mono
   ═══════════════════════════════════════════ */

/* ─── Font Faces ─── */

@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/space-mono-v13-latin-regular.woff2') format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-style: italic;
  font-weight: 400;
  src: url('/fonts/space-mono-v13-latin-italic.woff2') format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  src: url('/fonts/space-mono-v13-latin-700.woff2') format('woff2');
}

/* ─── CSS Variables — Brighter Cool Palette ─── */

:root {
  --bg: #1a1d21;
  --bg-raised: #22262b;
  --text: #d0d5dd;
  --text-bright: #edf0f5;
  --text-muted: #7c8494;
  --accent: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --font: 'Space Mono', monospace;
  --max-width: 48rem;
}

/* ─── Reset / Base ─── */

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

html {
  font-family: var(--font);
  font-size: 17.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
  color: var(--text);
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Typography ─── */

h1, h2, h3, h4 {
  color: var(--text-bright);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
}

strong, b {
  color: var(--text-bright);
  font-weight: 700;
}

em, i {
  font-style: italic;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(148, 163, 184, 0.35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s;
}

a:hover {
  text-decoration-color: var(--accent);
}

blockquote {
  border-left: 2px solid var(--border-hover);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.25rem;
}

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* Code */

code {
  font-family: var(--font);
  font-size: 0.85em;
  background: var(--bg-raised);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--bg-raised);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

/* Tables */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

table img {
  text-align: center;
  margin: 0 auto;
}

th, td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-bright);
  font-weight: 700;
}

/* Images */

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

/* Footnotes */

.footnotes {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

sup a {
  text-decoration: none;
  color: var(--accent);
}

/* ─── Layout ─── */

.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.site-header a {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-bright);
  opacity: 0.7;
}

.site-header a:hover {
  opacity: 1;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-nav a {
  text-transform: lowercase;
  letter-spacing: 0;
  font-weight: 400;
}

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  width: 100%;
  flex: 1;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  height: 4.5rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration-color: var(--border);
}

.site-footer a:hover {
  color: var(--text-bright);
}

/* ─── Components ─── */

/* Section labels */
.section-label {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Section dividers — short dash, minimum ink */
.section-divider {
  border: none;
  height: 1px;
  background: var(--border);
  max-width: 4rem;
  margin: 3.5rem 0;
}

/* Hero */
.hero-section {
  margin-top: 1rem;
  margin-bottom: 3rem;
}

.hero-intro {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 38rem;
  margin-bottom: 1rem;
}

.hero-text {
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 38rem;
}

/* About section */
.about-section {
  margin-bottom: 3rem;
}

.about-section p {
  margin-bottom: 1rem;
}

/* Content sections */
.content-section {
  margin-bottom: 3rem;
}

/* Course blocks */
.courses-grid {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.course-block {
  padding: 0;
}

.course-block h3 {
  color: var(--text-bright);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.course-block .course-code {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.course-block p {
  color: var(--text);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Teaching footer link */
.teaching-footer {
  margin-top: 2.5rem;
  font-size: 1rem;
  color: var(--text);
}

/* Essay entries */
.essay-entry {
  padding: 1rem 0;
  position: relative;
}

.essay-entry h3 {
  color: var(--text-bright);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.essay-entry a.overlay-link {
  position: absolute;
  inset: 0;
  font-size: 0;
  text-decoration: none;
}

.essay-entry time {
  color: var(--text-muted);
}

.essay-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
  line-height: 1.55;
}

/* Newsletter block */
.newsletter-block {
  margin-top: 2rem;
  margin-bottom: 4rem;
  padding: 0;
}

.newsletter-block h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.newsletter-block h3 a {
  color: var(--text-bright);
  text-decoration: none;
}

.newsletter-block h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.newsletter-block p {
  color: var(--text);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* Projects section */
.projects-section {
  margin-top: 1.25rem;
}

.projects-section p {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 1rem;
}

/* Selected essays section */
.selected-essays {
  margin-top: 1.25rem;
  margin-bottom: 4rem;
}

/* Link style */
a.link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(148, 163, 184, 0.35);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a.link:hover {
  text-decoration-color: var(--accent);
}

/* ─── Article (single pages) ─── */

.article-header {
  margin-bottom: 3rem;
}

.article-header h1 {
  margin-bottom: 0.25rem;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.article-content > p:first-child {
  margin-top: 0;
}

/* Tags */
.article-tags {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.article-tags a {
  display: inline-block;
  padding: 0.375rem 1.25rem;
  background: var(--bg-raised);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
}

.article-tags a:hover {
  background: var(--border-hover);
}

/* Post navigation */
.post-nav {
  margin-top: 4rem;
  display: flex;
  border-radius: 0.5rem;
  background: var(--bg-raised);
  font-size: 1rem;
}

.post-nav a {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-bright);
  width: 50%;
  transition: background 0.2s;
}

.post-nav a:hover {
  background: var(--border-hover);
}

.post-nav a:first-child {
  border-radius: 0.5rem 0 0 0.5rem;
  padding-right: 0.75rem;
}

.post-nav a:last-child {
  margin-left: auto;
  justify-content: flex-end;
  border-radius: 0 0.5rem 0.5rem 0;
  padding-left: 0.75rem;
}

.post-nav .arrow {
  flex-shrink: 0;
}

.post-nav a:first-child .arrow {
  margin-right: 0.375rem;
}

.post-nav a:last-child .arrow {
  margin-left: 0.375rem;
}

/* ─── Tag listing page ─── */

.tag-title {
  margin-bottom: 2rem;
}

.page-listing {
  position: relative;
  margin: 1.5rem 0;
}

.page-listing:first-of-type {
  margin-top: 0;
}

.page-listing h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.page-listing time {
  font-size: 0.875rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.page-listing a.overlay-link {
  position: absolute;
  inset: 0;
  font-size: 0;
  text-decoration: none;
}

.page-listing--card {
  padding: 1.5rem 0;
}

.page-listing--card h2 {
  font-size: 1.3rem;
}

.page-listing--card p {
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ─── Teaching Timeline (Tufte dot-strip) ─── */

.cw-timeline {
  display: flex;
  align-items: flex-end;
  margin-top: 2.5rem;
  margin-bottom: 3rem;
}

.cw-timeline-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.cw-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.cw-dot--rice {
  background: var(--accent);
}

.cw-dot--other {
  background: var(--text-muted);
  opacity: 0.6;
}

.cw-timeline-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 8px;
  opacity: 0.5;
  letter-spacing: 0.02em;
}

/* ─── Courses & Workshops shortcode ─── */

.cw-year {
  font-size: 1.4rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  margin-left: 1px;
  opacity: 0.9;
}

/* ─── Typography — Tufte refinements ─── */

/* Blockquote hanging — border sits outside the text column */
.article-content blockquote {
  margin-left: -1rem;
}

/* Figure captions */
figcaption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* In-content hr — short dash, matching section dividers */
.article-content hr {
  max-width: 4rem;
}

/* ─── Utilities ─── */

.sc {
  color: var(--accent);
}

.cw {
  color: var(--accent);
}

/* Details/summary (collapse shortcode) */
details {
  margin: 1rem 0;
}

details summary {
  cursor: pointer;
  color: var(--text-bright);
  font-weight: 600;
}

details summary:hover {
  opacity: 0.8;
}

/* ─── 404 ─── */

.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.not-found p {
  color: var(--text-muted);
}
