/* ============================================
   Personal Site — Compact Typographic Stylesheet
   ============================================ */

:root {
  --text: #1c1b19;
  --bg: #f3e9d6;
  --muted: #7a7870;
  --link: #5c3d1e;
  --rule: #ccc9c0;
  --hover-bg: rgba(92, 61, 30, 0.09);
  --measure: 62ch;
  --sidebar: 11rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #ddd9d0;
    --bg: #1c1a10;
    --muted: #807d74;
    --link: #c9a96e;
    --rule: #333230;
    --hover-bg: rgba(201, 169, 110, 0.12);
  }
}

[data-theme="dark"] {
  --text: #ddd9d0;
  --bg: #1c1a10;
  --muted: #807d74;
  --link: #c9a96e;
  --rule: #333230;
  --hover-bg: rgba(201, 169, 110, 0.12);
}

[data-theme="light"] {
  --text: #1c1b19;
  --bg: #f3e9d6;
  --muted: #7a7870;
  --link: #5c3d1e;
  --rule: #ccc9c0;
  --hover-bg: rgba(92, 61, 30, 0.09);
}

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

html {
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Centaur', 'EB Garamond', 'Times New Roman', 'Times', serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: oldstyle-nums;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}

/* ---- Navigation ---- */

nav {
  grid-column: 1;
  grid-row: 1 / 3;
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg);
}

nav .site-name {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--text);
  font-style: normal;
  font-variant: small-caps;
  font-weight: bold;
  text-transform: lowercase;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

nav ul li a {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  font-variant: small-caps;
  font-weight: normal;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.1s;
  display: inline-block;
  border: 1px solid var(--rule);
  padding: 0.1rem 0.4rem;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--text);
  border-color: var(--text);
}

.theme-toggle {
  cursor: pointer;
  margin-top: 0.75rem;
  display: inline-block;
}

.theme-toggle input {
  display: none;
}

.toggle-track {
  display: inline-flex;
  align-items: center;
  width: 2.6rem;
  height: 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.15rem;
  transition: border-color 0.1s;
}

.toggle-thumb {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 0;
  background: var(--muted);
  transition: transform 0.15s, background 0.1s;
}

.theme-toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(1.3rem);
  background: var(--text);
}

.theme-toggle:hover .toggle-track {
  border-color: var(--text);
}

/* ---- Layout ---- */

main {
  grid-column: 2;
  grid-row: 1;
  max-width: var(--measure);
  margin: 0;
  padding: 2.5rem 1.5rem 6rem;
}

/* ---- Typography ---- */

h1 {
  font-size: 1.35rem;
  font-weight: normal;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1rem;
  font-weight: normal;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2rem;
  margin-bottom: 0.4rem;
}

p {
  margin-bottom: 1.3em;
}

a {
  color: var(--link);
  text-decoration: none;
  padding: 0 0.1em;
}

a::after {
  content: '*';
  font-size: 0.6em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.05em;
  color: var(--link);
}

a:hover {
  background-color: var(--hover-bg);
}

/* No asterisk or hover bg on nav elements */
nav a::after {
  content: none;
}

nav a:hover {
  background-color: transparent;
}

/* ---- Home ---- */

.intro {
  padding-top: 1rem;
}

.intro p {
  font-size: 1rem;
}

.home-image {
  margin-top: 3.5rem;
  display: inline-block;
}

.home-image img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--rule);
  padding: 3px;
}

/* ---- Writing & Blog ---- */

.post-list {
  list-style: none;
  margin-top: 0.75rem;
}

.post-list li {
  padding: 0.2rem 0;
  font-size: 0.95rem;
}


/* ---- CV ---- */

.cv-section {
  margin-bottom: 2rem;
}

.cv-entry {
  display: grid;
  grid-template-columns: 9ch 1fr;
  gap: 0 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.cv-entry .year {
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 0.05rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Blog post / Writing piece ---- */

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

.post-header h1 {
  margin-bottom: 0.3rem;
}

.post-meta {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

article p {
  margin-bottom: 1.3em;
}

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

/* ---- Footer ---- */

footer {
  grid-column: 2;
  grid-row: 2;
  border-top: 1px solid var(--rule);
  padding: 1.25rem 1.5rem;
  font-size: 0.73rem;
  color: var(--muted);
  text-align: left;
  letter-spacing: 0.04em;
  align-self: end;
}

/* ---- Mobile ---- */

@media (max-width: 600px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  nav {
    grid-column: 1;
    grid-row: 1;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.5rem 1rem;
    border-bottom: 1px solid var(--rule);
  }

  nav .site-name {
    font-size: 1.1rem;
    margin-bottom: 0;
  }

  nav ul {
    flex-direction: row;
    gap: 0.4rem;
  }

  .theme-toggle {
    margin-top: 0;
  }

  main {
    grid-column: 1;
    grid-row: 2;
  }

  footer {
    grid-column: 1;
    grid-row: 3;
  }
}
