/* === Dark Theme Variables === */
:root {
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --text-primary: #e8e8e8;
  --text-secondary: #b3b3b3;
  --text-heading: #ffffff;
  --link-color: #fb7185;
  --border-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --code-bg: #1a1a1a;
  --code-text: #fb7185;
}

/* === Screen Reader Only === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* === Skip Links (Accessibility) === */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--vds-accent, #3584E4);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 600;
  z-index: 100000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.8;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 2rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

main {
  max-width: 90%;
  margin: 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  margin-bottom: 1rem;
}

/* === Breadcrumbs === */
.breadcrumbs {
  background: var(--bg-secondary);
  border-left: 3px solid var(--link-color);
  padding: 0.75rem 1rem;
  margin: 0 0 2rem 0;
  border-radius: 4px;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.95rem;
}

.breadcrumbs a {
  text-decoration: none;
  color: var(--link-color);
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.breadcrumbs a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.breadcrumbs .breadcrumb-separator {
  margin: 0 0.5rem;
  color: var(--text-secondary);
  font-weight: bold;
}

.breadcrumbs li:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

/* === Footer Elements === */
footer p {
  margin-bottom: 1rem;
}

footer p:not(:first-child) {
  margin-top: 1rem;
}

footer .footer-credits,
footer .footer-copyright {
  font-size: 0.875rem;
}

footer a {
  color: inherit;
  text-decoration: underline;
}

/* === Post Meta === */
.post-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.post-meta span {
  margin-left: 1rem;
}

/* === Post Footer === */
.post-footer p {
  color: var(--text-secondary);
}

/* === Blog Archives Section === */
.blog-archives {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.blog-archives details {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.blog-archives details:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.blog-archives summary {
  cursor: pointer;
  padding: 0.75rem;
  background: rgba(251, 113, 133, 0.1);
  border-radius: 4px;
  transition: background 0.2s ease;
  user-select: none;
}

.blog-archives summary:hover {
  background: rgba(251, 113, 133, 0.2);
}

.blog-archives summary strong {
  color: var(--link-color);
}

.blog-archives ul {
  list-style: none;
  padding: 1rem 0 0 0;
  margin: 0;
}

.blog-archives li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.blog-archives li:last-child {
  border-bottom: none;
}

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

.blog-archives a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* === Blog Post List === */
main > ul {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

main > ul > li {
  background: var(--bg-secondary);
  border-left: 3px solid var(--link-color);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

main > ul > li:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(251, 113, 133, 0.2);
}

main > ul > li h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

main > ul > li h2 a {
  color: var(--text-heading);
  text-decoration: none;
  transition: color 0.2s ease;
}

main > ul > li h2 a:hover {
  color: var(--link-color);
}

main > ul > li p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Blog Post Content === */
article {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
}

article header h1 {
  color: var(--text-heading);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--link-color);
  padding-bottom: 1rem;
}

article .post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

article .post-meta span {
  margin-left: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

article .post-meta a {
  color: var(--link-color);
  text-decoration: none;
}

article .post-meta a:hover {
  text-decoration: underline;
}

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

article .post-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

article .post-footer a {
  color: var(--link-color);
  text-decoration: none;
  margin-right: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(251, 113, 133, 0.1);
  border-radius: 3px;
  transition: background 0.2s ease;
}

article .post-footer a:hover {
  background: rgba(251, 113, 133, 0.2);
}

/* === Code Blocks === */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
}

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

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
}

thead {
  background: rgba(251, 113, 133, 0.1);
}

th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-heading);
  border-bottom: 2px solid var(--border-color);
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* === Blockquotes === */
blockquote {
  border-left: 4px solid var(--link-color);
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p {
  margin: 0.5rem 0;
}

/* === Images === */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* Clickable images with zoom cursor */
img[alt*="Architettura"] {
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

img[alt*="Architettura"]:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(251, 113, 133, 0.3);
}

/* === Image Lightbox === */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  animation: fadeIn 0.3s ease;
}

.lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(251, 113, 133, 0.5);
  cursor: zoom-out;
  margin: 0;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  font-weight: bold;
  color: var(--text-heading);
  cursor: pointer;
  transition: color 0.3s ease;
  user-select: none;
  z-index: 10000;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* === Icon Hover Micro-Animations === */
.icon {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon:hover {
  transform: scale(1.1) translateY(-4px);
}

.icon:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

/* Icon group icons - slightly smaller effect */
.icon-group .icon:hover {
  transform: scale(1.08) translateY(-2px);
}

/* Start Menu items hover effect */
.start-menu-item {
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.start-menu-item:hover {
  transform: translateX(4px);
}

.start-menu-item:active {
  transform: translateX(2px) scale(0.98);
}

/* Taskbar button hover */
#taskbar button,
#taskbar .social-btn {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease;
}

#taskbar button:hover,
#taskbar .social-btn:hover {
  transform: scale(1.1);
}

#taskbar button:active,
#taskbar .social-btn:active {
  transform: scale(0.95);
}

/* Window header buttons */
.window-header button {
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.window-header button:hover {
  transform: scale(1.15);
}

.window-header button:active {
  transform: scale(0.9);
}

/* === Interact.js Drag States === */
.window.dragging,
.icon-group.dragging {
  cursor: grabbing;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: scale(1.02);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.icon.dragging {
  cursor: grabbing;
  transform: scale(1.15);
  opacity: 0.9;
  z-index: 1000 !important;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.window.resizing,
.icon-group.resizing {
  opacity: 0.95;
}

/* Disable hover effects during drag */
.dragging .icon:hover {
  transform: none;
}

/* === SimpleBar Custom Styles (VDS Theme) === */
.simplebar-scrollbar::before {
  background: var(--vds-accent, #3584E4);
  border-radius: 4px;
  opacity: 0.4;
}

.simplebar-scrollbar.simplebar-visible::before {
  opacity: 0.7;
}

.simplebar-track.simplebar-vertical {
  width: 8px;
  right: 2px;
}

.simplebar-track.simplebar-horizontal {
  height: 8px;
  bottom: 2px;
}

/* Window body needs proper setup for SimpleBar */
.window-body {
  overflow: auto;
}

.window-body[data-simplebar-initialized] {
  overflow: hidden;
}

/* === Tippy.js Custom Styles (VDS Theme) === */
.tippy-box {
  background: rgba(36, 36, 36, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.tippy-box[data-theme~='vds'] {
  background: rgba(36, 36, 36, 0.95);
  color: #ffffff;
}

.tippy-box[data-theme~='vds'] > .tippy-arrow::before {
  border-top-color: rgba(36, 36, 36, 0.95);
}

.tippy-box[data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: rgba(36, 36, 36, 0.95);
}

.tippy-box[data-placement^='left'] > .tippy-arrow::before {
  border-left-color: rgba(36, 36, 36, 0.95);
}

.tippy-box[data-placement^='right'] > .tippy-arrow::before {
  border-right-color: rgba(36, 36, 36, 0.95);
}

.tippy-content {
  padding: 8px 12px;
}

/* === Lucide Icons (VDS Theme) === */
.lucide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lucide-btn svg {
  display: block;
}

/* Window control buttons with Lucide icons */
.window-controls .lucide-btn {
  width: 28px;
  height: 28px;
}

.window-controls .lucide-btn svg {
  width: 14px;
  height: 14px;
}

/* Taskbar icons */
.home-icon svg,
.share-icon svg {
  display: block;
  vertical-align: middle;
}

/* Ensure SVG inherits color */
.lucide svg,
.home-icon svg,
.share-icon svg {
  stroke: currentColor;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  body {
    padding: 1rem;
    padding-bottom: 80px; /* Space for VDS taskbar */
  }

  main {
    max-width: 100%;
  }

  article {
    padding: 1.5rem;
  }

  article header h1 {
    font-size: 1.5rem;
  }

  .blog-archives {
    padding: 1rem;
  }

  main > ul > li {
    padding: 1rem;
  }

  main > ul > li h2 {
    font-size: 1.25rem;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.5rem;
  }
}

/* === VDS Desktop Banner === */
.vds-desktop-banner {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.vds-desktop-btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #3584E4, #1c71d8);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(53, 132, 228, 0.3);
}

.vds-desktop-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(53, 132, 228, 0.5);
}

.vds-desktop-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(53, 132, 228, 0.3);
}

/* Hide banner on VDS homepage */
body.vds-homepage .vds-desktop-banner {
  display: none;
}

/* === Start Menu Mobile Fix (Internal Pages) === */
@media (max-width: 768px) {
  #start-menu {
    position: fixed !important;
    top: auto !important;
    bottom: 80px !important;
    left: 12px !important;
    right: auto !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    height: calc(100vh - 100px) !important;
    height: calc(100dvh - 100px) !important;
    max-height: calc(100vh - 100px) !important;
    max-height: calc(100dvh - 100px) !important;
    min-height: 300px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
}
