@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Texturina:ital,opsz,wght@0,12..72,100..900;1,12..72,100..900&display=swap');

html {
  font-size: 18px;
}

:root {
  --bg-color: #2f5270;
  --text-color: #f0cd9a;
  --link-color: #cc8b5b;
}

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

body {
  font-family: 'Geist', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 5rem;
  padding: 0;
  display: flex;
  min-height: 100vh;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}

h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }

.content-block .name {
  font-family: 'Texturina', serif;
  font-size: 2.0rem;
  font-weight: 600;
}

body.no-scroll {
  height: 100vh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  margin-right: 250px;
}

.content-block {
  margin-bottom: 2rem;
  width: 100%;
  color: var(--text-color);
  line-height: 1.6;
}

.content-block:first-child {
  width: 75%;
}

.content-block h2 {
  color: var(--text-color);
  margin-top: 0;
}

/* Right-side nav (replaces old .sidebar) */
nav {
  position: fixed;
  top: 10.5rem;
  right: 5rem;
  height: auto;
  width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 2rem;
  box-sizing: border-box;
  z-index: 10;
}

nav a {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  text-align: right;
  transition: color 0.3s;
}

nav a:hover {
  text-decoration: underline;
}

nav a.active {
  text-decoration: underline;
}

nav a.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Social links (above the divider, dimmed) */
.social-links {
  display: flex;
  gap: 2rem;
  margin: 1rem 0 0.75rem;
  width: 75%;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.social-links:hover {
  opacity: 1;
}

.social-links a {
  color: var(--text-color);
  text-decoration: underline;
  font-size: 1rem;
}

/* Dotted divider (under social links, before next section) */
.bio-divider {
  border: none;
  border-top: 3px dotted var(--text-color);
  width: 75%;
  margin: 0 0 2rem;
}

/* Section heading inside content blocks */
.content-block h3 {
  color: var(--text-color);
  font-weight: 600;
  margin: 0 0 0.75rem;
}

/* Default link style (body text links are orange) */
a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Hamburger (mobile only) */
.hamburger {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  cursor: pointer;
  background: none;
  border: none;
  padding: 10px;
}

.hamburger span {
  display: block;
  width: 30px;
  height: 3px;
  margin: 6px 0;
  background-color: var(--text-color);
  transition: all 0.3s;
}

/* Edit toggle */
#edit-toggle {
  background: none;
  border: none;
  font-family: 'Geist', sans-serif;
  font-size: 1.2rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 0;
  opacity: 0.4;
  text-align: right;
  display: block;
  margin-bottom: 1rem;
}

#edit-toggle:hover {
  opacity: 1;
}

.edit-mode #edit-toggle {
  opacity: 1;
  text-decoration: underline;
}

.edit-mode [contenteditable="true"] {
  outline: none;
  border-bottom: 1px solid var(--text-color);
  padding-bottom: 2px;
}

/* Writing */
.post-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-list li {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.post-date {
  opacity: 0.5;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-list a {
  color: var(--text-color);
  text-decoration: none;
}

.post-list a:hover {
  text-decoration: underline;
}

/* Bookshelf */
.book-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.book-list li {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.book-author {
  opacity: 0.5;
  flex-shrink: 0;
}

.book-title {
  font-style: italic;
}

/* Writing preview on home */
.writing-preview {
  width: 75%;
  margin-top: 0;
}

/* Post page — rendered markdown */
#post-body h1, #post-body h2 {
  margin: 1.5rem 0 0.5rem;
}

#post-body h1:first-child, #post-body h2:first-child {
  margin-top: 0;
}

#post-body p {
  margin-bottom: 1rem;
}

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

#post-body code {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

#post-body blockquote {
  border-left: 3px solid var(--link-color);
  padding-left: 1rem;
  opacity: 0.8;
  margin: 1rem 0;
}

/* Date line under post title */
#post-body .post-date-display {
  opacity: 0.55;
  font-size: 0.95rem;
  margin: -0.25rem 0 1.75rem;
}

/* Footnotes (rendered by marked-footnote) */
#post-body .footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px dotted var(--text-color);
  font-size: 0.9rem;
  opacity: 0.85;
}

#post-body .footnotes ol {
  padding-left: 1.5rem;
  margin: 0;
}

#post-body .footnotes li {
  margin-bottom: 0.5rem;
}

#post-body .footnotes li p {
  display: inline;
  margin: 0;
}

#post-body .footnote-ref a,
#post-body .footnote-backref {
  color: var(--link-color);
  text-decoration: none;
}

#post-body .footnote-ref a:hover,
#post-body .footnote-backref:hover {
  text-decoration: underline;
}

#post-body .footnote-backref {
  margin-left: 0.35rem;
}

/* Color panel */
#color-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  font-family: 'Geist', sans-serif;
}

#color-toggle {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--text-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  transition: opacity 0.2s;
  line-height: 1;
}

#color-toggle:hover {
  opacity: 1;
}

#color-controls {
  position: absolute;
  bottom: 40px;
  right: 0;
  background: var(--bg-color);
  border: 1px solid var(--text-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  white-space: nowrap;
  min-width: 180px;
}

#color-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-color);
}

#color-controls .key-label {
  width: 32px;
  font-size: 0.85rem;
}

#color-controls input[type="color"] {
  width: 32px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--text-color);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

#color-controls input[type="text"] {
  flex: 1;
  background: transparent;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.85rem;
  text-transform: uppercase;
  width: 80px;
  outline: none;
}

#color-controls input[type="text"]:focus {
  border-color: var(--link-color);
}

#color-controls .swap-row {
  justify-content: flex-start;
  gap: 0.5rem;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px dotted var(--text-color);
}

#color-controls button {
  background: none;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.25rem;
}

#color-controls button:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

/* Mobile */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    margin: 0;
  }

  .hamburger {
    display: block;
  }

  #color-panel {
    display: none;
  }

  .main-content {
    margin-right: auto;
    padding: 4rem 1rem 1rem 1rem;
  }

  .footer {
    max-width: 100%;
  }

  .content-block:first-child {
    width: 100%;
  }

  nav {
    position: fixed;
    top: -300px;
    left: 0;
    right: auto;
    width: 100%;
    height: auto;
    background-color: var(--bg-color);
    z-index: 999;
    padding: 70px 2rem 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: top 0.3s ease, opacity 0.3s ease, visibility 0s 0.3s;
  }

  nav a {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
  }

  nav.active {
    top: 0;
    visibility: visible;
    opacity: 1;
    transition: top 0.3s ease, opacity 0.3s ease, visibility 0s 0s;
  }
}
