/* Typography and Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-text: #2c2c2c;
  --color-text-muted: #666;
  --color-link: #1a0dab;
  --color-link-hover: #000;
  --color-border: #e5e5e5;
  --color-background: #fefefe;
  --color-accent: #f8f9fa;
  --max-width: 1200px;
  --line-height: 1.85;
  --spacing-unit: 2rem;
}

/* Dark mode variables */
[data-theme="dark"] {
  --color-text: #e5e5e5;
  --color-text-muted: #a0a0a0;
  --color-link: #66b3ff;
  --color-link-hover: #ffffff;
  --color-border: #404040;
  --color-background: #1a1a1a;
  --color-accent: #2a2a2a;
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: 22px;
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-background);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

main {
  margin: calc(var(--spacing-unit) * 3) 0;
  flex: 1;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header and Navigation */
header {
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-unit) 0;
  margin-bottom: calc(var(--spacing-unit) * 2);
  background: var(--color-background);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.425rem;
}

.nav-brand {
  font-weight: 600;
  font-size: 1.65rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.nav-brand:hover {
  color: var(--color-link);
}

.nav-links {
  display: flex;
  gap: calc(var(--spacing-unit) * 2.25);
  align-items: center;
}

.nav-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
  font-size: 1.5rem;
  padding: 0 0.5rem;
}

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

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-text);
  transition: width 0.2s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem 1.125rem;
  font-family: var(--font-sans);
  font-size: 1.275rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: calc(var(--spacing-unit) * 1.5);
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  transform: scale(1.05);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.2;
  margin: calc(var(--spacing-unit) * 1.5) 0 var(--spacing-unit) 0;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 3.2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: calc(var(--spacing-unit) * 1.5);
}

h2 {
  font-size: 2.2rem;
  font-weight: 600;
  margin-top: calc(var(--spacing-unit) * 2);
  padding-top: var(--spacing-unit);
  border-top: 1px solid var(--color-border);
}

h3 {
  font-size: 1.7rem;
  font-weight: 600;
}

p {
  margin: 0 0 var(--spacing-unit) 0;
  text-align: justify;
  hyphens: auto;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-link-hover);
  background: transparent;
}

/* Lists */
ul, ol {
  margin: var(--spacing-unit) 0;
  padding-left: calc(var(--spacing-unit) * 1.5);
}

li {
  margin: calc(var(--spacing-unit) * 0.25) 0;
}

/* Blockquotes */
blockquote {
  margin: calc(var(--spacing-unit) * 1.5) 0;
  padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
  border-left: 3px solid var(--color-border);
  background: var(--color-accent);
  font-style: italic;
  border-radius: 0 6px 6px 0;
}

blockquote p {
  margin: 0;
}

/* Code */
code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.9em;
  background: var(--color-accent);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: #d73a49;
}

pre {
  background: var(--color-accent);
  padding: var(--spacing-unit);
  border-radius: 6px;
  overflow-x: auto;
  margin: calc(var(--spacing-unit) * 1.5) 0;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Home Page Specific */
.home-header {
  text-align: center;
  margin: calc(var(--spacing-unit) * 4) 0 calc(var(--spacing-unit) * 3) 0;
}

.home-title {
  font-size: 3.8rem;
  font-weight: 700;
  margin-bottom: var(--spacing-unit);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-link) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-sans);
}

.home-subtitle {
  font-size: 1.6rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-bottom: calc(var(--spacing-unit) * 2);
  font-family: var(--font-sans);
}

.home-content {
  font-size: 1.3rem;
  line-height: 2.1;
  text-align: center;
  max-width: 38rem;
  margin: 0 auto;
  font-family: var(--font-sans);
}

/* Post and Project Lists */
.post-list, .project-list {
  margin: calc(var(--spacing-unit) * 2) 0;
}

.post-item, .project-item {
  margin: calc(var(--spacing-unit) * 1.5) 0;
  padding: var(--spacing-unit);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.post-item::before, .project-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-link);
  transition: width 0.3s ease;
}

.post-item:hover::before, .project-item:hover::before {
  width: 100%;
}

.post-item:hover, .project-item:hover {
  border-color: var(--color-text-muted);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.post-title, .project-title {
  font-size: 1.3rem;
  margin: 0 0 calc(var(--spacing-unit) * 0.5) 0;
}

.post-meta, .project-meta {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-unit);
}

.post-excerpt, .project-excerpt {
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* Footer */
footer {
  margin-top: calc(var(--spacing-unit) * 4);
  padding: 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

footer .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

footer p {
  width: 100%;
  text-align: center;
  margin: 0;
}

/* Popup Preview */
.popup-preview {
  display: none;
  position: absolute;
  z-index: 1000;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  width: 700px;
  max-width: 700px;
  max-height: 600px;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  border-radius: 8px;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.popup-preview-header {
  background: var(--color-accent);
  border-bottom: 1px solid var(--color-border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.popup-preview-dots {
  display: flex;
  gap: 4px;
}

.popup-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f56;
}

.popup-preview-dot:nth-child(2) {
  background: #ffbd2e;
}

.popup-preview-dot:nth-child(3) {
  background: #27ca3f;
}

.popup-preview-url {
  flex: 1;
  text-align: center;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-external-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.2s ease;
  margin-left: 8px;
}

.popup-external-link:hover {
  color: var(--color-link);
}

.popup-preview-content {
  padding: 0;
  overflow: hidden;
  flex: 1;
  max-height: 572px;
  position: relative;
}

.iframe-container {
  width: 100%;
  height: 572px;
  overflow: hidden;
}

.popup-preview-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.popup-preview h4 {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  font-family: var(--font-sans);
}

.popup-preview p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.popup-meta {
  font-style: italic;
  margin-bottom: 12px !important;
  color: var(--color-text-muted);
}

.popup-text {
  margin-bottom: 12px;
  color: var(--color-text);
  font-size: 0.8rem;
  line-height: 1.5;
}

.popup-footer {
  background: var(--color-accent);
  border-top: 1px solid var(--color-border);
  padding: 8px 12px;
  margin-top: 0;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.popup-link {
  color: var(--color-link);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.popup-loading {
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 20px 0;
}

.popup-error {
  text-align: center;
  color: var(--color-text-muted);
  padding: 20px 0;
}

.popup-error p {
  margin-bottom: 12px !important;
}

/* Profile Section */
.profile-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: calc(var(--spacing-unit) * 3);
  margin: calc(var(--spacing-unit) * 3) 0;
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.profile-image-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 220px;
  flex-shrink: 0;
}

.profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 3px solid var(--color-border);
  transition: all 0.3s ease;
  display: block;
  max-width: 120px;
  max-height: 120px;
  min-width: 120px;
  min-height: 120px;
}

.profile-image:hover {
  border-color: var(--color-link);
}

.profile-image.large {
  width: 180px;
  height: 180px;
  max-width: 180px;
  max-height: 180px;
  min-width: 180px;
  min-height: 180px;
  margin-bottom: var(--spacing-unit);
}

.profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  min-width: 0;
  margin: 0;
  padding: 0;
  max-width: none;
}

.profile-name {
  font-size: 3.2rem;
  font-weight: 700;
  margin: 0 0 calc(var(--spacing-unit) * 0.5) 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-link) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-sans);
}

.profile-title {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--spacing-unit) 0;
  font-weight: 400;
  font-family: var(--font-sans);
}

.social-links {
  display: flex;
  gap: var(--spacing-unit);
  margin-top: var(--spacing-unit);
}

.social-links.vertical {
  flex-direction: column;
  gap: 1.2rem;
  display: flex;
  align-items: center;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  height: 40px;
  border-radius: 6px;
  background: var(--color-accent);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 1.1rem;
  padding: 0 1.1rem 0 0.5rem;
  box-sizing: border-box;
  gap: 0.7rem;
}

.social-link:hover {
  background: var(--color-link);
  color: white;
  border-color: var(--color-link);
  transform: translateY(-2px);
}

.social-link svg {
  display: block;
  width: 28px;
  height: 28px;
  stroke: var(--color-text-muted);
  transition: stroke 0.2s, background 0.2s;
}

.social-link:hover svg {
  stroke: var(--color-link);
}

.profile-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 220px;
  gap: 1.5rem;
}

.social-links.with-labels {
  align-items: flex-start;
}

.icon-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.15rem;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.social-link:hover .icon-label {
  color: var(--color-link);
}

/* Article Content Styling */
.post-content, .project-content, article {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  line-height: 2.15;
  color: var(--color-text);
  width: 80vw;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.meta-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.collaborators {
  font-size: 1.08rem;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  margin-right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.collaborators a {
  color: var(--color-link);
  border-bottom: 1px solid var(--color-link);
  text-decoration: none;
  transition: color 0.2s, border-bottom-color 0.2s;
}

.collaborators a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-link-hover);
}

.post-date, .project-date {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.15rem;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.post-content h1, .project-content h1, article h1 {
  font-size: 3.2rem;
  font-weight: 700;
  margin: 3rem 0 2rem 0;
  letter-spacing: -0.02em;
}

.post-content h2, .project-content h2, article h2 {
  font-size: 2.1rem;
  font-weight: 600;
  margin: 2.7rem 0 1.7rem 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.4em;
}

.post-content h3, .project-content h3, article h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.3rem 0 1.3rem 0;
  color: var(--color-text-muted);
}

.post-content h4, .project-content h4, article h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.8rem 0 1rem 0;
  color: var(--color-text-muted);
}

.post-content p, .project-content p, article p {
  margin: 0 0 2em 0;
  line-height: 2.15;
  color: var(--color-text);
}

.post-content ul, .project-content ul, article ul,
.post-content ol, .project-content ol, article ol {
  margin: 2em 0 2em 2em;
  padding-left: 2em;
}

.post-content li, .project-content li, article li {
  margin: 0.8em 0;
  padding-left: 0.3em;
}

.post-content blockquote, .project-content blockquote, article blockquote {
  margin: 2em 0;
  padding: 1.2em 2em;
  border-left: 3px solid var(--color-link);
  background: var(--color-accent);
  color: var(--color-text-muted);
  font-style: italic;
  border-radius: 0 8px 8px 0;
}

.post-content code, .project-content code, article code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.98em;
  background: var(--color-accent);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  color: #d73a49;
}

.post-content pre, .project-content pre, article pre {
  background: var(--color-accent);
  padding: 1.2em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2em 0;
  border: 1px solid var(--color-border);
}

.post-content pre code, .project-content pre code, article pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-content img, .project-content img, article img {
  display: block;
  margin: 2em auto;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

.post-content table, .project-content table, article table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 1rem;
}

.post-content th, .project-content th, article th {
  text-align: left;
  padding: 0.7em 1em;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-accent);
}

.post-content td, .project-content td, article td {
  padding: 0.7em 1em;
  border-bottom: 1px solid var(--color-border);
}

.post-content tr:nth-child(even), .project-content tr:nth-child(even), article tr:nth-child(even) {
  background: var(--color-accent);
}

.post-content a, .project-content a, article a {
  color: var(--color-link);
  border-bottom: 1px solid var(--color-link);
  transition: color 0.2s, border-bottom-color 0.2s;
}

.post-content a:hover, .project-content a:hover, article a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-link-hover);
}

.post-content time, .project-content time, article time {
  font-size: 0.95em;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

.post-date, .project-date {
  margin-top: -1.2rem;
  margin-bottom: 2.5rem;
  font-size: 0.98rem;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.inline-date, .post-content time.inline-date, .project-content time.inline-date, article time.inline-date {
  display: inline-block;
  font-size: 0.98em;
  color: var(--color-text-muted);
  background: var(--color-accent);
  border-radius: 4px;
  padding: 0.1em 0.6em;
  margin: 0 0.2em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  vertical-align: middle;
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --spacing-unit: 1rem;
  }
  
  body {
    font-size: 16px;
  }
  
  .container {
    padding: 0 calc(var(--spacing-unit) * 0.75);
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .home-title {
    font-size: 2.5rem;
  }
  
  .nav-links {
    gap: var(--spacing-unit);
  }
  
  .nav-links a {
    font-size: 0.9rem;
  }
  
  .theme-toggle {
    margin-left: calc(var(--spacing-unit) * 0.5);
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .profile-section {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-unit);
  }
  
  .profile-image {
    width: 100px;
    height: 100px;
  }
  
  .profile-name {
    font-size: 2rem;
  }
  
  .social-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  nav {
    flex-direction: column;
    gap: var(--spacing-unit);
    align-items: flex-start;
  }
  
  .nav-links {
    gap: calc(var(--spacing-unit) * 0.75);
    flex-wrap: wrap;
  }
  
  .theme-toggle {
    margin-left: 0;
    margin-top: calc(var(--spacing-unit) * 0.5);
  }
} 

@media (max-width: 900px) {
  .profile-section {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-unit);
    max-width: 100%;
  }
  .profile-image-block, .profile-info {
    min-width: 0;
    width: 100%;
    align-items: center;
    text-align: center;
  }
  .social-links.vertical,
  .social-links.with-labels {
    align-items: center;
  }
} 