@import url("https://fonts.googleapis.com/css2?family=Caveat&family=Source+Sans+Pro:wght@300;400&display=swap");

@font-face {
  font-family: "Charter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/XCharter.woff2") format("woff2");
}

@font-face {
  font-family: "Charter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/XCharter-Bold.woff2") format("woff2");
}

:root {
  --serif: "Charter", Georgia, serif;
  --sans: "Source Sans Pro", Arial, sans-serif;
  --hand: "Caveat", cursive;
  --text-color: #333;
  --link-color: #0066cc;
  --muted-color: #666;
  --border-color: #333;
  --border-color-light: #ddd;
  --sidebar-bg: #fff;
  --paper: linear-gradient(
    to bottom,
    rgba(150, 150, 100, 0.1) 0%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 200, 0.1) 100%
  );
}

[data-theme="dark"] {
  color-scheme: dark;
  --text-color: #dcdcdc;
  --link-color: #6cb2ff;
  --muted-color: #9a9a9a;
  --border-color: #4a4a4a;
  --border-color-light: #333;
  --sidebar-bg: #18181a;
  --paper: linear-gradient(to bottom, #1c1c1e 0%, #141416 100%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 2rem 5%;
  color: var(--text-color);
  background: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid var(--link-color);
}

a:hover {
  opacity: 0.7;
}

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  border: 0;
  border-bottom: 1px solid var(--link-color);
  padding: 0;
  color: var(--text-color);
  background: transparent;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle:hover {
  opacity: 0.7;
}

.theme-toggle .icon-dark {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-light {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-dark {
  display: inline;
}

.title {
  margin-bottom: 2.25rem;
  padding-top: 2rem;
  text-align: center;
}

.title h1 {
  margin: 0;
  color: var(--text-color);
  font-size: 2.5rem;
  font-variant: small-caps;
  font-weight: 400;
  letter-spacing: 0.075em;
  line-height: 1.3;
}

.title h1 a {
  color: inherit;
  border-bottom: 0;
}

.home-button {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 10;
  border-bottom: 1px solid var(--link-color);
  color: var(--link-color);
  font-size: 1.5rem;
  line-height: 1;
}

.main-content {
  max-width: 800px;
  margin: 0 auto;
}

.home-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color-light);
}

.home-nav a {
  font-size: 0.95rem;
}

.header {
  position: relative;
  display: flex;
  gap: 3rem;
  max-width: 1000px;
  margin: 2rem auto 3rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.header-left {
  flex: 1;
  min-width: 0;
}

.header-right {
  width: 280px;
  flex-shrink: 0;
}

.header h3,
.sidebar-section h3 {
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  font-variant: small-caps;
  font-weight: 600;
  line-height: 1.2;
}

.header h4,
.sidebar-section h4 {
  margin: 1.5rem 0 0.8rem;
  font-size: 0.9rem;
  font-variant: small-caps;
  font-weight: 500;
}

.header p {
  margin: 0.5em 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sidenote {
  position: absolute;
  top: 8.9rem;
  left: calc(100% - 4rem);
  width: 10rem;
  color: var(--text-color);
  font-family: var(--hand);
  font-size: 15px;
  line-height: 1.1;
  transform: rotate(-5deg);
  white-space: nowrap;
}

h1,
h2 {
  font-variant: small-caps;
  font-weight: 400;
}

h1 {
  margin: 1.5em 0 0.5em;
  font-size: 1.8rem;
  line-height: 1.3;
}

h2 {
  margin: 1.5em 0 0.5em;
  font-size: 1.4rem;
  line-height: 1.7;
}

h3 {
  margin: 1.3em 0 0.5em;
  font-size: 1.1rem;
  font-weight: 500;
}

article {
  line-height: 1.7;
}

article p {
  margin: 1em 0;
}

.post-meta {
  margin-bottom: 2rem;
  color: var(--muted-color);
  font-size: 0.9rem;
}

.post-subtitle {
  margin: -0.25rem 0 0.35rem;
  color: var(--muted-color);
  font-size: 1rem;
}

.post h1 {
  margin-top: 1.5em;
}

.post-content {
  line-height: 1.75;
}

.post-content p {
  margin: 1em 0;
  text-indent: 1.5em;
}

.post-content blockquote p,
.post-content figure p {
  text-indent: 0;
}

.post-content blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border-color-light);
  color: var(--muted-color);
}

.post-content figure {
  margin: 1.75rem 0;
}

.post-content img,
.post-content picture {
  display: block;
  max-width: 100%;
  height: auto;
}

.post-content hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border-color-light);
}

.post-content sup {
  line-height: 0;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.25rem 0 2rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border-color-light);
  border-bottom: 1px solid var(--border-color-light);
}

.post-action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border-color-light);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: var(--muted-color);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.post-action-button:hover,
.post-action-button[aria-pressed="true"] {
  color: var(--link-color);
  border-color: var(--link-color);
}

.like-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.action-count {
  color: var(--muted-color);
  font-size: 0.9rem;
}

.share-button {
  margin-left: auto;
}

.share-status {
  min-width: 4.75rem;
  color: var(--muted-color);
  font-size: 0.9rem;
}

.section-list {
  margin: 2rem 0;
}

.section-item {
  margin-bottom: 1.5rem;
}

.section-link {
  border-bottom: 1px dotted var(--muted-color);
  font-size: 1rem;
}

.section-subtitle {
  margin-left: 0.45rem;
  color: var(--muted-color);
  font-size: 0.9rem;
}

.metadata {
  margin-left: 0.5rem;
  color: var(--muted-color);
  font-size: 0.9rem;
  white-space: nowrap;
}

.page-list {
  margin-top: 2rem;
}

.page-list p {
  margin: 1.2rem 0;
}

.feedback-form {
  margin-top: 2rem;
}

.feedback-box {
  padding: 1rem;
}

.feedback-box label {
  display: block;
  margin: 0 0 0.4rem;
  font-variant: small-caps;
  font-size: 0.9rem;
}

.feedback-box input,
.feedback-box textarea {
  width: 100%;
  border: 1px solid var(--border-color-light);
  margin-bottom: 1rem;
  padding: 0.6rem;
  color: var(--text-color);
  background: transparent;
  font: inherit;
}

.feedback-box textarea {
  min-height: 11rem;
  resize: vertical;
}

.feedback-note {
  margin: 1.5rem 0 0;
  color: var(--muted-color);
  font-size: 0.95rem;
  line-height: 1.55;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
}

.feedback-actions button {
  border: 1px solid var(--link-color);
  padding: 0.35rem 0.8rem;
  color: var(--link-color);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.feedback-actions button:hover {
  opacity: 0.7;
}

.feedback-status {
  margin: 0.75rem 0 0;
  color: var(--muted-color);
  font-size: 0.9rem;
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color-light);
  color: var(--muted-color);
  font-size: 0.9rem;
  text-align: center;
}

footer p {
  margin: 0.25rem 0;
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem 5%;
  }

  .title h1 {
    font-size: 1.8rem;
    overflow-wrap: anywhere;
  }

  .home-nav {
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
  }

  .header {
    flex-direction: column;
    gap: 2rem;
  }

  .header-right {
    width: 100%;
  }

  .sidenote {
    position: static;
    display: inline-block;
    margin-top: 0.25rem;
    margin-left: 1.5rem;
    white-space: normal;
  }

  .metadata {
    display: inline-block;
    margin-left: 0.35rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 4%;
    font-size: 15px;
  }

  .title {
    margin-bottom: 1.5rem;
  }

  .title h1 {
    font-size: 1.5rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.1rem;
  }
}
