/* Custom Styles - Optimized & Best Practices */

/* CSS Variables for maintainability */
:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Monaco, Consolas, monospace;
  --color-orange: #f97316;
  --color-orange-dark: #ea580c;
  --color-border: #e2e8f0;
  --color-bg-light: #f8fafc;
  --color-bg-code: #f1f5f9;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 6px;
}

/* Typography - Apply once at root level */
body {
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6,
.page__title,
.archive__item-title,
.author__name,
.masthead__inner-wrap nav a,
.greedy-nav a {
  font-family: var(--font-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

pre, code, .highlight {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Content Layout */
.page__content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.page__content h1,
.page__content h2,
.page__content p,
.page__content ul {
  text-align: left;
}

.page__content h1 { font-size: 2.2em; }
.page__content h2 { font-size: 1.6em; margin-top: 2em; }
.page__content p { margin-bottom: 1.3em; font-size: 1.05em; }

/* Homepage intro paragraph */
.page__content > p:first-of-type {
  font-size: 1.1em;
  line-height: 1.8;
  margin-bottom: 1.5em;
}

/* Images - Standardized */
.page__content img {
  max-width: 700px;
  width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Portfolio carousel images - square and cropped */
.portfolio-carousel .portfolio-card .archive__item-excerpt img {
  width: 100% !important;
  height: 400px !important;
  max-width: 600px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  margin: 1em auto !important;
  display: block !important;
}

/* All other excerpt images (non-carousel) */
.archive__item-excerpt img {
  max-width: 700px;
  width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Videos - Standardized */
.page__content iframe {
  max-width: 800px;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  margin: 2em auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* Badge Links */
.link-badges {
  text-align: center;
  margin: 2em 0;
}

.badge-link {
  display: inline-block;
  padding: 0.75em 2em;
  margin: 0.75em;
  background: var(--color-orange);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(249, 115, 22, 0.3);
  font-weight: 600;
  font-size: 1em;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}

.badge-link:hover {
  background: var(--color-orange-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(249, 115, 22, 0.3);
  color: #fff;
}

.badge-link:visited { color: #fff; }

/* Buttons */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.btn:hover { opacity: 0.9; }

/* Portfolio Cards */
.archive__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.archive__item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.archive__item-title {
  font-size: 1.3em;
  margin-bottom: 0.5rem;
}

.archive__item-excerpt { line-height: 1.6; }

/* Author Profile */
.author__avatar img { border-radius: 50%; }

.author__name {
  font-size: 1.6em;
  letter-spacing: -0.02em;
}

.author__bio {
  font-size: 0.95em;
  line-height: 1.6;
  font-weight: 500;
}

.sidebar .author__urls { font-size: 0.9em; }

/* Code Blocks */
pre {
  border: 1px solid var(--color-border);
  background: var(--color-bg-light);
  border-radius: var(--radius-lg);
}

code {
  background: var(--color-bg-code);
  padding: 0.2em 0.5em;
  font-size: 0.9em;
  border-radius: var(--radius-sm);
}

/* Utilities */
html { scroll-behavior: smooth; }
.page__share { display: none; }

/* Portfolio Carousel - Horizontal Scroll */
.portfolio-carousel-wrapper {
  position: relative;
  max-width: 1400px;
  margin: 3em auto;
  padding: 0 3em;
}

.portfolio-carousel {
  display: flex;
  gap: 2.5em;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 1em 0 2em 0;

  /* Hide scrollbar but keep functionality */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.portfolio-carousel::-webkit-scrollbar {
  display: none;
}

.portfolio-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.portfolio-card .archive__item {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Navigation Arrows */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-orange);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.carousel-nav:hover {
  background: var(--color-orange-dark);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.carousel-nav-left {
  left: 0;
}

.carousel-nav-right {
  right: 0;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .portfolio-card {
    flex: 0 0 calc(50% - 1em);
  }

  .portfolio-carousel-wrapper {
    padding: 0 2em;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .portfolio-card {
    flex: 0 0 calc(90% - 1em);
  }

  .portfolio-carousel-wrapper {
    padding: 0 1em;
  }

  .carousel-nav {
    width: 40px;
    height: 40px;
  }
}
