:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-accent: #2456ff;
  --color-border: #e6e6e6;
  --max-width: 720px;
  --invert-value: 0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

a:hover {
  text-decoration: underline;
}

a[target="_blank"]:not(:has(img, svg))::after {
  content: " ↗";
  font-size: 0.9em;
}

img {
  max-width: 100%;
  height: auto;
}

.theme-img {
  filter: invert(var(--invert-value));
}

/* Header / nav */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

.brand img {
  width: 24px;
  height: 24px;
  margin-right: 3px;
  margin-bottom: -5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--color-text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.4rem;
  margin: -0.4rem 0;
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  line-height: 0;
}

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

.theme-toggle .icon-sun {
  display: inline;
}

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

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

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

/* Main content */

.site-main {
  min-height: 60vh;
}

.hero {
  padding: 3rem 1.25rem 2rem;
}

.hero h1 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.tagline {
  color: var(--color-muted);
  font-size: 1.1rem;
}

.bio {
  margin-top: 2.5rem;
}

section.wrap {
  padding: 1.5rem 1.25rem 2rem;
}

article.wrap {
  padding: 1.5rem 1.25rem 1.5rem;
}

/* Post list */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-bottom: 1.5rem;
}

.post-list-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.post-list-cover {
  margin-bottom: 0.5rem;
  border-radius: 12px;
  max-width: 100px;
  height: 100px;
  object-fit: cover;
  margin-top: 0.4rem;
}

.post-list-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text);
}

.post-date {
  display: block;
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

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

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

/* Single page / post */

.page .content,
.page .cover {
  margin-top: 1.5rem;
  border-radius: 12px;
}

.page .content :first-child {
  margin-top: 0;
}

.page h1 {
  margin: 0;
}

/* Projects list */

.project-list-image {
  border-radius: 12px;
}

/* Contact form */

.contact-form {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 480px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-field input,
.form-field textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.form-field textarea {
  resize: vertical;
}

.form-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.contact-form .btn {
  align-self: flex-start;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.4rem;
  cursor: pointer;
}

.contact-form .btn:hover {
  opacity: 0.9;
}

.form-notice {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-notice-success {
  color: #1a7f37;
  background: rgba(26, 127, 55, 0.1);
}

.form-notice-error {
  color: #c53030;
  background: rgba(197, 48, 48, 0.1);
}

/* Post footer / share */

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.share {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.share-label {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-right: 0.15rem;
}

.share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--color-text);
  cursor: pointer;
  line-height: 0;
}

.share-icon::after {
  content: none;
}

.share-icon:hover {
  background: var(--color-border);
}

.share-copy .icon-check {
  display: none;
  color: #1a7f37;
}

.share-copy.copied .icon-link {
  display: none;
}

.share-copy.copied .icon-check {
  display: inline;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 0.5rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.not-found {
  text-align: center;
  padding: 4rem 1.25rem;
}

/* Responsive nav */

@media (max-width: 600px) {
  .nav-toggle {
    display: flex;
  }

  .nav-right {
    justify-content: flex-end;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
  }

  .site-nav.open {
    display: flex;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #121212;
    --color-text: #ececec;
    --color-muted: #9b9b9b;
    --color-accent: #6d8dff;
    --color-border: #2a2a2a;
    --invert-value: 1;
  }

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

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

:root[data-theme="dark"] {
  --color-bg: #121212;
  --color-text: #ececec;
  --color-muted: #9b9b9b;
  --color-accent: #6d8dff;
  --color-border: #2a2a2a;
  --invert-value: 1;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
