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

/* ─── Fonts ─── */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ─── Variables ─── */
:root {
  --bg: #161616;
  --fg: #E4E4E4;
  --fg-secondary: #B8B8B8;
  --link: #FFFFFF;
  --border: #3A3A3A;
  --accent: #5A5A5A;
  --max-width: 760px;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-title: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
  --font-size: 17px;
  --line-height: 1.7;
}

/* ─── Base ─── */
html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  text-transform: lowercase;
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

::selection {
  background: #3A3A3A;
  color: #FFFFFF;
}

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

.nav-logo {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-decoration: none;
  color: var(--fg-secondary);
  letter-spacing: 0.08em;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--link);
}

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

/* ─── Home ─── */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro h1 {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.home-intro p {
  color: var(--fg-secondary);
  font-size: 1rem;
  max-width: 600px;
}

.home-section {
  margin-bottom: 2.5rem;
}

.home-section h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--fg);
}

.essay-list {
  list-style: none;
}

.essay-list li {
  margin-bottom: 1.25rem;
}

.essay-list .essay-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-secondary);
  display: block;
  margin-bottom: 0.15rem;
}

.essay-list a {
  font-size: 1.05rem;
}

.project-list {
  list-style: none;
}

.project-list li {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.project-list li::before {
  content: "• ";
  color: var(--fg-secondary);
}

.note-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.note-list li {
  margin-bottom: 0.75rem;
  color: var(--fg-secondary);
}

.note-list .note-date {
  color: var(--accent);
}

/* ─── Essays ─── */
.essay-header {
  margin-bottom: 2rem;
}

.essay-header h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.essay-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-secondary);
}

.essay-body {
  font-size: 1rem;
}

.essay-body p {
  margin-bottom: 1.25rem;
}

.essay-body h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.essay-body h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.essay-body code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: #1E1E1E;
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
}

.essay-body pre {
  background: #1E1E1E;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border-radius: 2px;
}

.essay-body pre code {
  background: none;
  padding: 0;
}

.essay-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1.25rem;
  color: var(--fg-secondary);
}

.essay-body ul, .essay-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.essay-body li {
  margin-bottom: 0.35rem;
}

.essay-footer {
  margin-top: 3rem;
}

.essay-nav {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ─── Project ─── */
.project-header {
  margin-bottom: 2rem;
}

.project-header h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.project-tech {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-secondary);
}

.project-body {
  font-size: 1rem;
}

.project-body p {
  margin-bottom: 1.25rem;
}

.project-body h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.project-footer {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ─── List pages ─── */
.page-header {
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
}

.item-list {
  list-style: none;
}

.item-list li {
  margin-bottom: 1.5rem;
}

.item-list .item-title {
  font-size: 1.05rem;
}

.item-list .item-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-secondary);
  display: block;
  margin-top: 0.1rem;
}

/* ─── Reading ─── */
.reading-section {
  margin-bottom: 2rem;
}

.reading-section h2 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.reading-section ul {
  list-style: none;
}

.reading-section li {
  margin-bottom: 0.75rem;
}

.reading-section li .reading-note {
  display: block;
  font-size: 0.9rem;
  color: var(--fg-secondary);
  margin-top: 0.1rem;
}

/* ─── Stack tags ─── */
.stack {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.stack li a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
}

.stack li a:hover {
  border-color: var(--fg-secondary);
  color: #FFFFFF;
}

/* ─── Showcase projects ─── */
.showcase {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1.5rem;
}

.showcase li {
  margin-bottom: 1.1rem;
}

.showcase .project-name {
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.1rem;
}

.showcase .project-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-secondary);
  line-height: 1.5;
}

.about-body p, .cv-body p {
  margin-bottom: 1rem;
}

.about-body h2, .cv-body h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.cv-body .cv-section {
  margin-bottom: 1.5rem;
}

.cv-body .cv-item {
  margin-bottom: 1rem;
}

.cv-body .cv-item-title {
  font-weight: 600;
}

.cv-body .cv-item-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-secondary);
}

/* ─── HR ─── */
.hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ─── Footer ─── */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
}

.footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--fg-secondary);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  :root {
    --font-size: 16px;
  }

  .nav {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .home-intro h1 {
    font-size: 1.6rem;
  }

  .essay-header h1,
  .project-header h1,
  .page-header h1 {
    font-size: 1.4rem;
  }
}
