@import url('https://fonts.googleapis.com/css2?family=Gugi&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Megrim&display=swap');

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

:root {
  --color-primary: #605aa6;
  --color-primary-hover: #433f75;
  --color-draft: #a6605a;
  --color-draft-hover: #7a453e;
  --color-draft-bg: rgba(166, 96, 90, 0.1);
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-border: #e0e0e0;
  --color-header-bg: #f6f6f6;
  --spacing: 0.5rem;
  --max-width: 780px;
  --border-radius: 4px;
  --font-display: "Megrim", cursive, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #9966cc;
    --color-primary-hover: #b380e0;
    --color-draft: #d17e73;
    --color-draft-hover: #e89387;
    --color-draft-bg: rgba(209, 126, 115, 0.15);
    --color-bg: #1a1a1a;
    --color-text: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --color-border: #404040;
    --color-header-bg: #2d2d2d;
  }
}

[data-theme="dark"] {
  --color-primary: #9966cc;
  --color-primary-hover: #b380e0;
  --color-draft: #d17e73;
  --color-draft-hover: #e89387;
  --color-draft-bg: rgba(209, 126, 115, 0.15);
  --color-bg: #1a1a1a;
  --color-text: #e0e0e0;
  --color-text-muted: #a0a0a0;
  --color-border: #404040;
  --color-header-bg: #2d2d2d;
}

[data-theme="light"] {
  --color-primary: #605aa6;
  --color-primary-hover: #433f75;
  --color-draft: #a6605a;
  --color-draft-hover: #7a453e;
  --color-draft-bg: rgba(166, 96, 90, 0.1);
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666666;
  --color-border: #e0e0e0;
  --color-header-bg: #f6f6f6;
}

html {
  font-family:
    "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 16px;
  line-height: 1.6;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 1.5rem 0 .1rem 0;
  line-height: 1.3;
  font-weight: 600;
  /* font-family: var(--font-display); */
}

h1 {
  font-size: xx-large;
}

h2 {
  font-size: x-large;
}

h3 {
  font-size: large;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.1rem;
}

h6 {
  font-size: 1rem;
}

/* p { */
/*   margin: 1rem 0; */
/* } */

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

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* Lists */
ul,
ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

li {
  margin: 0.5rem 0;
}

/* Header & Navigation */
.site-header {
  padding: calc(var(--spacing) * 2) 0;
  text-align: center;
}

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

.header-title {
  margin-bottom: 0.5rem;
}

.header-title a {
  font-family: var(--font-display);
  font-size: xxx-large;
  text-decoration: none;
  font-weight: 600;
}


.header-title .name-first {
  color: var(--color-text);
}

.header-title .name-last {
  color: var(--color-primary);
}

.header-title .name-domain {
  color: var(--color-text-muted);
  font-weight: 400;
}

.header-nav {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.header-nav li {
  margin: 0;
}

.header-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: normal;
  padding: 0.25rem 0.5rem;
}

.header-nav a:hover,
.header-nav a:active,
.header-nav a.active {
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-decoration-thickness: 4px;
  text-underline-offset: 4px;
}

/* Theme toggle - positioned at top right */
.theme-toggle-fixed {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

.theme-toggle-button {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  opacity: 0.6;
}

.theme-toggle-button:hover {
  opacity: 1;
  background: var(--color-header-bg);
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
}

footer hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-bottom: 1rem;
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: 60vh;
}

/* Grid System */
.homepage-header {
  margin: 2rem 0;
  background: var(--color-header-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
}

.homepage-header-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

@media (min-width: 768px) {
  .homepage-header-content {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }
}

.homepage-header-image {
  flex: 0 0 25%;
  max-width: 200px;
}

.homepage-header-image img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  display: block;
}

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

.homepage-header h1 {
  margin-top: 0;
}

.homepage-header p {
  margin: 1rem 0;
}

.homepage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .homepage-grid {
    grid-template-columns: 60% 40%;
  }
}

.homepage-left,
.homepage-right {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Article & Cards */
article {
  margin: 1.5rem 0;
  background: var(--color-bg);
}

article p {
  margin-bottom: 1rem;
}

article h1:first-child,
article h2:first-child,
article h3:first-child {
  margin-top: 0;
}

/* Buttons */
button,
.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--color-primary-hover);
}

button.outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

button.outline:hover {
  background: var(--color-primary);
  color: white;
}

button.contrast {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

button.contrast:hover {
  background: var(--color-border);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="search"],
textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Post Meta (date and tags under title) */
.post-meta {
  margin: 0 0 2rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.post-meta .tags {
  margin: 0.5rem 0 0 0;
}

/* Tags */
.tags {
  margin: 1rem 0;
}

.tags a {
  display: inline;
  margin-right: 0;
  margin-bottom: 0;
  font-size: 0.875rem;
  color: var(--color-primary);
}

.tags a:not(:last-child)::after {
  content: " • ";
  color: var(--color-text);
}

.tags a:hover {
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding: 1rem 0;
}

.pagination span {
  display: flex;
  gap: 0.5rem;
}

.pagination a,
.pagination strong {
  padding: 0.25rem 0.5rem;
}

/* Publications */
.publications-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.publications-list li {
  list-style: none;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.publications-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.publication-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.publication-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.publication-description {
  margin: 0;
  font-size: 0.95rem;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
}

figure {
  margin: 2rem 0;
}

/* Code blocks */
pre {
  background: #f5f5f5;
  border: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: 1rem 0;
}

code {
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre code {
  background: transparent;
  padding: 0;
}

@media (prefers-color-scheme: dark) {
  pre {
    background: #2d2d2d;
    border-color: #404040;
  }

  code {
    background: #2d2d2d;
  }
}

[data-theme="dark"] pre {
  background: #2d2d2d;
  border-color: #404040;
}

[data-theme="dark"] code {
  background: #2d2d2d;
}

[data-theme="light"] pre {
  background: #f5f5f5;
  border-color: var(--color-border);
}

[data-theme="light"] code {
  background: #f5f5f5;
}

/* PlantUML diagrams */
.plantuml-diagram {
  margin: 2rem 0;
  text-align: center;
}

.plantuml-diagram svg {
  max-width: 100%;
  height: auto;
}

/* Search */
#search-results {
  margin-top: 1rem;
}

#search-results article {
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: var(--color-primary);
  color: white;
  border-radius: var(--border-radius);
}

/* Utilities */
small {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

strong {
  font-weight: 600;
}

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

/* Fragment missing warning styles */
.fragment-missing {
  background-color: #fee;
  border-left: 4px solid #dc2626;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.25rem;
}

[data-theme="dark"] .fragment-missing {
  background-color: rgba(220, 38, 38, 0.1);
  border-left-color: rgba(220, 38, 38, 0.5);
}

.fragment-missing p {
  margin: 0.5rem 0;
}

.fragment-missing code {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.fragment-missing pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.75rem;
  border-radius: 0.25rem;
  overflow-x: auto;
}

[data-theme="dark"] .fragment-missing pre {
  background-color: rgba(0, 0, 0, 0.3);
}

.fragment-missing pre code {
  background-color: transparent;
  padding: 0;
}

/* Draft Indicators */
.draft-indicator {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-draft);
  color: white;
  border-radius: var(--border-radius);
  margin-left: 0.5rem;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Draft article styling */
article.draft-item {
  border-left: 4px solid var(--color-draft);
  padding: 0.5rem 0 0.1rem 0.5rem;
  background: var(--color-draft-bg);
  border-radius: var(--border-radius);
}

/* Draft content page (full page view) */
.draft-content {
  border-left: 4px solid var(--color-draft);
  padding-left: 1.5rem;
}

.draft-warning {
  background: var(--color-draft-bg);
  border: 1px solid var(--color-draft);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
}

/* Draft links in lists */
a.draft-link {
  color: var(--color-draft);
}

a.draft-link:hover {
  color: var(--color-draft-hover);
}

/* Draft post meta */
.post-meta.draft {
  border-bottom-color: var(--color-draft);
}

/* Comments section */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.comments-list {
  margin-top: 1.5rem;
}

.comment {
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: var(--color-header-bg);
  border-radius: var(--border-radius);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.comment-meta strong {
  font-weight: 600;
  color: var(--color-text);
}

.comment-date {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.comment-content {
  color: var(--color-text);
  line-height: 1.6;
}

/* Comment form */
.comment-form-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: var(--color-header-bg);
  border-radius: var(--border-radius);
}

.comment-form-section h3 {
  margin-top: 0;
}

.form-field {
  margin-bottom: 1.25rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-field .required {
  color: var(--color-draft);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-field small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.form-help {
  margin: 1rem 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.comment-form-section button {
  padding: 0.75rem 1.5rem;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.comment-form-section button:hover {
  background-color: var(--color-primary-hover);
}

.messages {
  margin-bottom: 1.5rem;
}

.message {
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--border-radius);
  border-left: 4px solid;
}

.message-success {
  background-color: rgba(76, 175, 80, 0.1);
  border-left-color: #4caf50;
  color: var(--color-text);
}

.message-error {
  background-color: var(--color-draft-bg);
  border-left-color: var(--color-draft);
  color: var(--color-text);
}
