/* ============================================
   Card Site Design — inspired by yevhenboichuk.com
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(20, 30, 50, 0.9);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #14b8a6;
  --accent-light: #2dd4bf;
  --accent-dark: #0d9488;
  --border: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(20, 184, 166, 0.3);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --section-number-size: 8rem;
  --sidebar-width: 80px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

body {
  font-family: var(--font-sans);
  line-height: 1.7;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ---------- Sidebar Navigation ---------- */
.sidebar-nav {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0;
  z-index: 100;
  background: rgba(10, 15, 26, 0.8);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.sidebar-logo:hover {
  color: var(--accent-light);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  list-style: none;
}

.sidebar-links a {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}
.sidebar-links a:hover,
.sidebar-links a.active {
  color: var(--accent);
}
.sidebar-links a::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height var(--transition);
}
.sidebar-links a.active::before {
  height: 100%;
}

.sidebar-social {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
.sidebar-social a {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: color var(--transition);
}
.sidebar-social a:hover {
  color: var(--accent);
}

/* ---------- Mobile Navigation ---------- */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 100;
  background: rgba(10, 15, 26, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.mobile-nav .logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 26, 0.98);
  backdrop-filter: blur(20px);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}
.mobile-menu.open {
  display: flex;
}
.mobile-menu a {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color var(--transition);
}
.mobile-menu a:hover {
  color: var(--accent);
}

/* ---------- Main Content ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ---------- Section ---------- */
.section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 6rem 4rem;
  overflow: hidden;
}

.section-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.section-number {
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  font-size: var(--section-number-size);
  font-weight: 900;
  color: rgba(148, 163, 184, 0.05);
  line-height: 1;
  z-index: 1;
  user-select: none;
}

/* ---------- Hero Section ---------- */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero-tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 550px;
  line-height: 1.6;
  margin-bottom: 2.5rem;
}

.hero-location {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}
.btn-primary:hover {
  background: var(--accent-light);
  color: var(--bg-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(20, 184, 166, 0.3);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: transparent;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Section Title ---------- */
.section-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 3rem;
  line-height: 1.7;
}

/* ---------- About Section ---------- */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Blog/Projects Cards ---------- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--transition);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.post-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-card-summary {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.post-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(20, 184, 166, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.read-more {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Contact Section ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text-secondary);
}
.contact-item:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.contact-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 184, 166, 0.1);
  border-radius: 10px;
  color: var(--accent);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.contact-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.contact-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.contact-social {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}
.contact-social a {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all var(--transition);
}
.contact-social a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer a {
  color: var(--accent);
}

/* ---------- Single Post Page ---------- */
.post-page {
  margin-left: var(--sidebar-width);
  padding: 4rem;
  min-height: 100vh;
}

.post-header {
  max-width: 800px;
  margin: 0 auto 3rem;
}

.post-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 2rem;
  text-decoration: none;
  transition: color var(--transition);
}
.post-back-link:hover {
  color: var(--accent);
}

.post-page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.post-cover {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2rem;
}

/* ---------- Post Content (Prose) ---------- */
.post-content {
  max-width: 800px;
  margin: 0 auto;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.75em;
  letter-spacing: -0.01em;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }
.post-content h4 { font-size: 1.1rem; }

.post-content p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

.post-content ul,
.post-content ol {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content pre {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.post-content :not(pre) > code {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.post-content img {
  border-radius: 10px;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.post-content a:hover {
  color: var(--accent-light);
}

/* Embedded HTML content inside posts — dark theme overrides */
.post-content input,
.post-content textarea,
.post-content select,
.post-content button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5em 0.75em;
  font-family: var(--font-sans);
}
.post-content input:focus,
.post-content textarea:focus,
.post-content select:focus {
  outline: none;
  border-color: var(--accent);
}
.post-content button {
  cursor: pointer;
  background: var(--accent-dark);
  color: var(--text-primary);
  border-color: var(--accent);
  transition: background var(--transition);
}
.post-content button:hover {
  background: var(--accent);
}
.post-content label {
  color: var(--text-secondary);
}
.post-content fieldset {
  border-color: var(--border);
}

/* Override white-background containers embedded in posts */
.post-content .tcr-wrap,
.post-content div[style*="background"],
.post-content div[style*="Background"] {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.post-content .tcr-title,
.post-content .tcr-label {
  color: var(--text-primary) !important;
}
.post-content .tcr-input,
.post-content .tcr-select {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.post-content .tcr-tab {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}
.post-content .tcr-tab.active {
  background: rgba(20, 184, 166, 0.15) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.post-content .tcr-btn {
  background: var(--accent-dark) !important;
  color: var(--text-primary) !important;
  border-color: var(--accent) !important;
}
.post-content .tcr-btn:hover {
  background: var(--accent) !important;
}
.post-content .tcr-panel {
  border-color: var(--border) !important;
}
.post-content .tcr-pre {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}
.post-content .tcr-meta {
  color: var(--text-muted) !important;
}
.post-content .tcr-cand-table th {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.post-content .tcr-cand-table td {
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}
.post-content .tcr-cand-table tr:nth-child(even) {
  background: rgba(17, 24, 39, 0.5) !important;
}
.post-content .tcr-cand-table tr:nth-child(odd) {
  background: var(--bg-card) !important;
}
.post-content .tcr-cand-table tr:hover {
  background: rgba(20, 184, 166, 0.08) !important;
}
.post-content .tcr-cand-wrap {
  border-color: var(--border) !important;
}
/* Generic fallback for any inline-styled white containers */
.post-content div[style*="background"] *,
.post-content div[style*="Background"] * {
  color: inherit;
}
.post-content h1 {
  color: var(--text-primary) !important;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.post-content th,
.post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}
.post-content th {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--text-primary);
}
.post-content td {
  color: var(--text-secondary);
}

/* ---------- Post Navigation ---------- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
  max-width: 45%;
}
.post-nav a:hover {
  color: var(--accent);
}
.post-nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.post-nav-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Posts List Page ---------- */
.posts-list-page {
  margin-left: var(--sidebar-width);
  padding: 4rem;
  min-height: 100vh;
}

.posts-list-header {
  max-width: 1100px;
  margin: 0 auto 3rem;
}

.posts-list-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.posts-list-header h1::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 0.75rem;
}

.posts-list-container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ---------- Skeleton / Gradient BG ---------- */
.gradient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -150px;
  right: -100px;
}
.blob-2 {
  width: 400px;
  height: 400px;
  background: #6366f1;
  bottom: -100px;
  left: -100px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .section {
    padding: 4rem 2rem;
  }
  .about-content {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .section-number {
    font-size: 5rem;
  }
}

@media (max-width: 768px) {
  .sidebar-nav {
    display: none;
  }
  .mobile-nav {
    display: flex;
  }
  .main-content,
  .post-page,
  .posts-list-page {
    margin-left: 0;
    padding: 80px 1.25rem 2rem;
  }
  .section {
    min-height: auto;
    padding: 4rem 1.25rem;
  }
  .hero-section {
    min-height: 100vh;
    padding-top: 5rem;
  }
  .hero-title {
    font-size: 2.25rem;
  }
  .about-stats {
    grid-template-columns: 1fr 1fr;
  }
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .section-number {
    font-size: 4rem;
    right: 1rem;
    bottom: 1rem;
  }
  .post-nav {
    flex-direction: column;
  }
  .post-nav a {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .about-stats {
    grid-template-columns: 1fr;
  }
  .hero-buttons {
    flex-direction: column;
  }
  .hero-buttons .btn-primary,
  .hero-buttons .btn-outline {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Animation / Fade In ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- All Posts Link ---------- */
.view-all-posts {
  text-align: center;
  margin-top: 2.5rem;
}
