/* Catppuccin Macchiato (dark) */
:root {
  --base: #24273a;
  --mantle: #1e2030;
  --crust: #181926;
  --text: #cad3f5;
  --subtext0: #a5adcb;
  --surface0: #363a4f;
  --surface1: #494d64;
  --blue: #8aadf4;
  --green: #a6da95;
  --mauve: #c6a0f6;
  --peach: #f5a97f;
  --red: #ed8796;
  --yellow: #eed49f;
}

/* Catppuccin Latte (light) */
[data-theme="light"] {
  --base: #eff1f5;
  --mantle: #e6e9ef;
  --crust: #dce0e8;
  --text: #4c4f69;
  --subtext0: #6c6f85;
  --surface0: #ccd0da;
  --surface1: #bcc0cc;
  --blue: #1e66f5;
  --green: #40a02b;
  --mauve: #8839ef;
  --peach: #fe640b;
  --red: #d20f39;
  --yellow: #df8e1d;
}

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

html,
body {
  background: var(--base);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.site-wrapper {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-content {
  flex: 1;
}

.site-content h1 {
  margin: 0;
}

/* Header / nav */
.site-header {
  padding: 1rem 0;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--text);
}

.site-header .site-title {
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header nav a {
  color: var(--subtext0);
  font-size: 0.9rem;
}

.site-header nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.search-toggle {
  background: none;
  border: none;
  color: var(--subtext0);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.search-toggle:hover {
  color: var(--text);
}

/* Search overlay */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  justify-content: center;
  padding-top: 20vh;
}

.search-overlay.active {
  display: flex;
}

.search-modal {
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  width: 90%;
  max-width: 480px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#search-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--surface0);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 1rem;
  outline: none;
}

#search-input::placeholder {
  color: var(--subtext0);
}

#search-results {
  overflow-y: auto;
}

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--surface0);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background: var(--surface0);
  text-decoration: none;
}

.search-result-date {
  color: var(--subtext0);
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-left: 1rem;
}

.search-empty {
  padding: 1rem;
  color: var(--subtext0);
  text-align: center;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--subtext0);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

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

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

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

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

/* Portrait */
.portrait {
  height: 200px;
  width: 200px;
  border-radius: 50%;
  object-fit: cover;
  margin: auto;
  margin-bottom: 4rem;
  display: block;
}

/* Social links */
.social-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 2rem;
}

.social-links a {
  color: var(--subtext0);
  display: inline-flex;
}

.social-links a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Blog list */
.post-preview {
  margin-bottom: 2.5rem;
}

.post-preview h1 {
  margin: 0 0 0.25rem;
}

.post-preview h1 a {
  color: var(--text);
}

.post-preview h1 a:hover {
  color: var(--blue);
}

.post-excerpt {
  color: var(--subtext0);
  margin: 0.5rem 0 0;
}

/* Single post */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-weight: 600;
  margin: 0;
  margin-bottom: 0.25rem;
}

.post-meta {
  color: var(--subtext0);
  font-size: 0.85rem;
}

.post-tags {
  margin-top: 0.15rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  font-size: 0.8rem;
  color: var(--subtext0);
  margin-right: 0.35rem;
}

.tag::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z'/%3E%3Ccircle cx='7.5' cy='7.5' r='.5' fill='currentColor'/%3E%3C/svg%3E")
    no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z'/%3E%3Ccircle cx='7.5' cy='7.5' r='.5' fill='currentColor'/%3E%3C/svg%3E")
    no-repeat center / contain;
  flex-shrink: 0;
}

.tag:hover {
  color: var(--text);
  text-decoration: none;
}

.post-tags-inline {
  font-size: 0.8rem;
}

/* Content images */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Content typography */
h1,
h2,
h3 {
  font-weight: 600;
}

.content code {
  background: var(--surface0);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

.content pre {
  background: var(--mantle);
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--surface0);
}

.content pre code {
  background: none;
  padding: 0;
}

.content blockquote {
  border-left: 3px solid var(--surface1);
  margin-left: 0;
  padding-left: 1.25rem;
  color: var(--subtext0);
}

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