/* ============================================================
   Fonts
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Cinzel+Decorative:wght@400&family=EB+Garamond:ital,wght@0,400;0,500;0,700;1,400;1,500&display=swap');

/* ============================================================
   Theme Variables
   ============================================================ */
:root {
  --bg:             #000000;
  --bg-surface:     #181e19;
  --bg-card:        #1f2820;
  --bg-card-hover:  #252f26;
  --hunter:         #3d6b42;
  --hunter-light:   #4e8855;
  --hunter-dim:     #2d5031;
  --orange:         #e8940a;
  --orange-light:   #f5a623;
  --orange-dim:     #b8740a;
  --text:           #dde8de;
  --text-muted:     #7a9c7e;
  --text-faint:     #4a6e4e;
  --border:         #2a3d2c;
  --border-light:   #3a543c;
  --nav-height:     60px;
  --radius:         6px;
  --max-width:      860px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'EB Garamond', 'Georgia', serif;
  font-size: 1.05rem;
  line-height: 1.85;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--orange); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--orange-light); }

img { max-width: 100%; display: block; }

/* ============================================================
   Navigation
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--hunter);
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.2;
}
.nav-brand:hover .nav-brand-title { color: var(--orange-light); }

.nav-brand-title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--orange);
  letter-spacing: 0.04em;
}

.nav-brand-sub {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.62rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  font-style: italic;
}

.nav-links {
  display: flex;
  gap: 0;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text-muted);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* ============================================================
   Page Layout
   ============================================================ */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  color: var(--text);
  line-height: 1.3;
}

h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.6rem; margin-bottom: 0.4rem; color: var(--hunter-light); }
h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }

p { margin-bottom: 1.2rem; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1.2rem; }
li { margin-bottom: 0.3rem; }

blockquote {
  border-left: 3px solid var(--hunter);
  padding: 0.6rem 1.2rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}

code {
  font-family: 'Courier New', monospace;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--orange-light);
}

pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.2rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9em;
  color: var(--text);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ============================================================
   Hero (Home)
   ============================================================ */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero-layout {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-text { flex: 1; }

.hero-photo {
  flex: 0 0 38%;
  display: flex;
  justify-content: center;
}

.headshot-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px dashed var(--hunter-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* When an actual image is used, swap in: */
.hero-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--hunter);
}

@media (max-width: 560px) {
  .hero-layout { flex-direction: column-reverse; gap: 1.5rem; }
  .hero-photo { flex: 0 0 auto; width: 150px; }
}

.hero-title {
  font-size: 3.4rem;
  font-family: 'Cinzel', serif;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}

.hero-subtitle {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--orange);
  letter-spacing: 0.06em;
  margin-bottom: 1.2rem;
}

.hero-eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--orange);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: 0.8rem;
}

.hero h1 { font-size: 2.8rem; margin-bottom: 1rem; }

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--orange);
  color: #111;
}
.btn-primary:hover {
  background: var(--orange-light);
  color: #111;
}

.btn-secondary {
  background: transparent;
  color: var(--orange);
  border: 1.5px solid var(--orange);
}
.btn-secondary:hover {
  background: var(--orange);
  color: #111;
}

.btn-gap { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ============================================================
   Section Cards (Home)
   ============================================================ */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: var(--hunter-light);
  background: var(--bg-card-hover);
}

.card-icon {
  font-size: 1.6rem;
  margin-bottom: 0.8rem;
  line-height: 1;
  height: 70px;
  display: flex;
  align-items: flex-start;
}

.card-icon svg {
  display: block;
}

/* Euler-Lagrange equation in math card */
.card-icon-math {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 0.8rem;
}

.card-icon-math .katex-display {
  margin: 0;
  text-align: left;
}

.card-icon-math .katex {
  color: var(--text);
}

.card h3 {
  color: var(--orange);
  margin-bottom: 0.4rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* ============================================================
   About Page
   ============================================================ */
.about-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.avatar-placeholder {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--hunter-dim);
  border: 3px solid var(--hunter);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.about-meta h1 { margin-bottom: 0.2rem; }
.about-meta .tagline {
  color: var(--orange);
  font-size: 0.95rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin-bottom: 0;
}

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

/* ============================================================
   Blog Index
   ============================================================ */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 { margin-bottom: 0.4rem; }
.page-header p { color: var(--text-muted); margin-bottom: 0; }

.post-list { list-style: none; padding: 0; margin: 0; }

.post-item {
  display: block;
  padding: 1.4rem 1.5rem;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
  color: inherit;
}

.post-item:hover {
  border-color: var(--hunter-light);
  background: var(--bg-card-hover);
  color: inherit;
}

.post-item-title {
  font-size: 1.15rem;
  font-family: 'Cinzel', serif;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.post-item-meta {
  font-size: 0.8rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.post-item-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* Pinned post */
.post-item-pinned {
  border-color: var(--hunter);
}

.pinned-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hunter-light);
  border: 1px solid var(--hunter);
  border-radius: 3px;
  padding: 0.1em 0.5em;
  vertical-align: middle;
  margin-left: 0.4rem;
}

/* Tags */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2em 0.7em;
  border-radius: 3px;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
}

.tag:hover { border-color: var(--orange); color: var(--orange); background: transparent; }
.tag-active { border-color: var(--orange); color: var(--orange-light); background: rgba(232,148,10,0.08); }

/* Tag bar on blog index */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Tags below post items */
.post-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1.5rem 0.8rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state p { font-size: 1rem; }

/* ============================================================
   Blog Post
   ============================================================ */

/* Narrower reading column for post pages */
.post-main {
  max-width: 700px;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.post-back:hover { color: var(--orange); }

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-family: 'Cinzel', serif;
}

.post-meta {
  font-size: 0.82rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.6rem;
}

/* Tags on post page */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

/* ---- Table of Contents ---- */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--hunter);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin-bottom: 2.5rem;
  font-size: 0.92rem;
}

.toc-title {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  margin-top: 0;
}

.toc-list {
  margin: 0;
  padding-left: 1.2rem;
}

.toc-item { margin-bottom: 0.2rem; }
.toc-item a { color: var(--text-muted); font-size: 0.9rem; transition: color 0.2s; }
.toc-item a:hover { color: var(--orange); }
.toc-sub { padding-left: 1rem; font-size: 0.85rem; }

/* ---- Post Body ---- */
.post-body {
  font-family: 'EB Garamond', 'Georgia', serif;
  font-size: 1.12rem;
  line-height: 1.95;
}

.post-body h1,
.post-body h2,
.post-body h3 {
  font-family: 'Cinzel', serif;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  scroll-margin-top: 80px;
}

.post-body h2 { color: var(--hunter-light); font-size: 1.4rem; }
.post-body h3 { color: var(--text-muted); font-size: 1.1rem; }

/* ---- Illuminated Drop Cap ---- */
.post-body > p:first-of-type::first-letter {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 4.4em;
  font-weight: 400;
  line-height: 0.78;
  float: left;
  color: var(--orange);
  margin-right: 0.09em;
  margin-top: 0.06em;
  padding: 0.06em 0.14em 0.04em;
  border: 1px solid var(--hunter);
  background: var(--bg-card);
  box-shadow: inset 0 0 10px rgba(61, 107, 66, 0.25), 0 0 6px rgba(232, 148, 10, 0.1);
}

/* ---- Image Captions ---- */
.post-figure {
  margin: 2rem auto;
  text-align: center;
}

.post-figure img {
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 100%;
}

.post-figure figcaption {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: 'EB Garamond', serif;
}

/* ---- Prev / Next Navigation ---- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; }

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: inherit;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.post-nav a:hover {
  border-color: var(--hunter-light);
  background: var(--bg-card-hover);
  color: inherit;
}

.post-nav-next a { align-items: flex-end; }

.post-nav-label {
  font-size: 0.75rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
}

.post-nav-title {
  font-size: 0.95rem;
  font-family: 'Cinzel', serif;
  color: var(--text-muted);
  line-height: 1.3;
}

@media (max-width: 500px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .post-nav-next a { align-items: flex-start; }
}

/* KaTeX display math */
.post-body .katex-display {
  overflow-x: auto;
  padding: 1rem 0;
}

/* ============================================================
   Contact Page
   ============================================================ */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
}

.contact-info h2 { margin-bottom: 0.8rem; font-size: 1.3rem; }
.contact-info p { font-size: 0.92rem; color: var(--text-muted); }
.contact-info ul { list-style: none; padding: 0; }
.contact-info li { margin-bottom: 0.6rem; font-size: 0.9rem; color: var(--text-muted); }
.contact-info li span { color: var(--orange); margin-right: 0.5rem; }

form { width: 100%; }

.form-group { margin-bottom: 1.4rem; }

.form-group label {
  display: block;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-family: 'EB Garamond', 'Georgia', serif;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--hunter-light);
  box-shadow: 0 0 0 3px rgba(78, 136, 85, 0.15);
}

.form-group textarea { resize: vertical; min-height: 130px; }

.form-submit {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.loading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: 2rem 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  padding: 1rem 1.5rem;
  background: rgba(232, 148, 10, 0.08);
  border: 1px solid var(--orange-dim);
  border-radius: var(--radius);
  color: var(--orange-light);
  font-size: 0.9rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .contact-layout { grid-template-columns: 1fr; gap: 2rem; }
  .about-header { flex-direction: column; gap: 1rem; }
  .nav-brand { font-size: 1rem; }
  .nav-links a { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  main { padding: 2rem 1rem 3rem; }
}
