/* Custom styles to complement Bulma */

/* CSS Variables for Theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #1a1a1a;
  --text-primary: #4a4a4a;
  --text-secondary: #7a7a7a;
  --text-inverse: #ffffff;
  --border-color: #dbdbdb;
  --shadow-color: rgba(10, 10, 10, 0.1);
  --navbar-bg: #f5f5f5;
  --box-bg: #ffffff;
  --code-bg: #f5f5f5;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --bg-dark: #0a0a0a;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-inverse: #1a1a1a;
  --border-color: #3a3a3a;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --navbar-bg: #2a2a2a;
  --box-bg: #2a2a2a;
  --code-bg: #3a3a3a;
}

/* Apply theme variables */
html {
  scroll-behavior: smooth;
}

body {
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar.is-light {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 30;
}

[data-theme="dark"] .navbar.is-light {
  background-color: rgba(245, 245, 245, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .navbar.is-light .navbar-item,
[data-theme="dark"] .navbar.is-light .theme-toggle {
  color: #4a4a4a;
}

[data-theme="dark"] .navbar.is-light .navbar-item:hover {
  color: #485fc7;
  background-color: rgba(0, 0, 0, 0.05);
}

.box {
  position: relative;
  background-color: var(--box-bg);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

[data-theme="dark"] .box {
  background-color: rgba(42, 42, 42, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.box:hover {
  box-shadow: 0 1em 2em -0.5em rgba(10,10,10,0.2), 0 0px 0 1px rgba(10,10,10,0.02);
  transform: translateY(-4px);
  border-color: rgba(122, 141, 234, 0.3);
}

[data-theme="dark"] .box:hover {
  box-shadow: 0 1em 2em -0.5em rgba(0,0,0,0.5), 0 0px 0 1px rgba(255,255,255,0.1);
}

.footer.has-background-light {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .footer.has-background-light {
  background-color: rgba(245, 245, 245, 0.95);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .footer.has-background-light .has-text-grey {
  color: #7a7a7a !important;
}

/* Theme toggle button */
.theme-toggle {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

/* Reading Progress Bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #485fc7, #7a8dea);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease-out;
}

[data-theme="dark"] .reading-progress-bar {
  background: linear-gradient(90deg, #7a8dea, #a0b2ff);
}

.title,
.subtitle {
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.title a, .subtitle a {
  color: var(--text-primary);
}

.title a:hover {
  color: #485fc7;
}

[data-theme="dark"] .title a:hover {
  color: #7a8dea;
}

.has-text-grey {
  color: var(--text-secondary) !important;
}

.content {
  color: var(--text-primary);
}

/* Archive page border for items */
.has-border-bottom {
  border-bottom: 1px solid #f5f5f5;
}

/* Smooth transitions and animated underlines */
a {
  transition: color 0.2s ease;
  position: relative;
}

.content a:not(.button):not(.tag) {
  text-decoration: none;
  background-image: linear-gradient(to right, #485fc7, #7a8dea);
  background-size: 0% 2px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}

.content a:not(.button):not(.tag):hover {
  background-size: 100% 2px;
}

[data-theme="dark"] .content a:not(.button):not(.tag) {
  background-image: linear-gradient(to right, #7a8dea, #a0b2ff);
}

.button {
  transition: all 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5em 1em -0.25em rgba(10,10,10,0.2);
}

/* Code blocks */
pre {
  background-color: #282c34;
  color: #abb2bf;
  padding: 1.5rem;
  overflow-x: auto;
  border-radius: 6px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
               Consolas, "Liberation Mono", "Courier New", monospace;
}

code {
  background-color: #f5f5f5;
  color: #f14668;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
               Consolas, "Liberation Mono", "Courier New", monospace;
}

pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.9em;
}

/* Content styling for blog posts */
.content.is-medium {
  font-size: 1.125rem;
  line-height: 1.8;
}

.content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #f5f5f5;
  padding-bottom: 0.5rem;
}

.content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content p {
  margin-bottom: 1.25rem;
}

.content ul, .content ol {
  margin-left: 2rem;
  margin-bottom: 1.25rem;
}

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

/* Blockquotes */
.content blockquote {
  background-color: #f5f5f5;
  border-left: 4px solid #485fc7;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  color: #000000;
}

/* Tables */
.content table {
  margin: 1.5rem 0;
}

/* Skills section on about page */
.skill-category {
  padding: 1rem;
}

/* Timeline for experience section */
.timeline .box {
  border-left: 3px solid #485fc7;
  margin-left: 1rem;
}

/* Responsive navbar burger */
@media screen and (max-width: 1023px) {
  .navbar-menu {
    background-color: white;
    box-shadow: 0 8px 16px rgba(10,10,10,0.1);
  }
  
  .navbar-menu.is-active {
    display: block;
  }
}

/* Improve readability on mobile */
@media screen and (max-width: 768px) {
  .title.is-1 {
    font-size: 2rem;
  }
  
  .title.is-2 {
    font-size: 1.75rem;
  }
  
  .content.is-medium {
    font-size: 1rem;
  }
}

/* Archive tabs */
.tabs a {
  border-bottom-color: #dbdbdb;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  color: #4a4a4a;
}

.tabs li.is-active a {
  border-bottom-color: #485fc7;
  color: #485fc7;
}

/* Tag hover effects */
.tag.is-light:hover {
  background-color: #e8e8e8;
}

a.tag.is-light:hover {
  background-color: #d5d5d5;
}

/* Footer spacing */
.footer {
  margin-top: 4rem;
}

/* Print styles */
@media print {
  .navbar, .footer {
    display: none;
  }
  
  .content {
    max-width: 100%;
  }
}

/* Accessibility improvements */
a:focus,
button:focus {
  outline: 2px solid #485fc7;
  outline-offset: 2px;
}

/* Center-align all images in blog post content */
.content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 0.5em 1em -0.125em rgba(10,10,10,0.1);
}

/* Blog and project thumbnail images - ensure they fill containers without whitespace */
.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Blog post card layout using background images */
.blog-post-item {
  display: flex;
  gap: 2rem;
  align-items: stretch;
}

.blog-post-thumbnail {
  flex-shrink: 0;
  width: 25%;
  min-width: 200px;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: 0 0.5em 1em -0.125em rgba(10,10,10,0.1);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
}

.box:hover .blog-post-thumbnail {
  transform: scale(1.05);
  box-shadow: 0 0.75em 1.5em -0.25em rgba(10,10,10,0.15);
}

.blog-post-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Responsive: Stack on mobile */
@media screen and (max-width: 768px) {
  .blog-post-item {
    flex-direction: column;
    gap: 1rem;
  }

  .blog-post-thumbnail {
    width: 100%;
    min-width: auto;
  }
}

/* Project card layout using background images */
.project-item {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.project-thumbnail {
  flex-shrink: 0;
  width: 128px;
  height: 128px;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: 0 0.5em 1em -0.125em rgba(10,10,10,0.1);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
}

.box:hover .project-thumbnail {
  transform: scale(1.05);
  box-shadow: 0 0.75em 1.5em -0.25em rgba(10,10,10,0.15);
}

.project-content {
  flex: 1;
}

/* Responsive: Stack on mobile */
@media screen and (max-width: 768px) {
  .project-item {
    flex-direction: column;
    gap: 1rem;
  }

  .project-thumbnail {
    width: 100%;
    height: 200px;
  }
}

/* Homepage specific styles */
.hero-section {
  background-color: #1a1a1a;
  padding: 4rem 1.5rem;
}

.hero-intro {
  margin-bottom: 5rem;
}

.hero-title {
  color: white;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  color: white;
}

.hero-charts {
  margin-top: 4rem;
}

.hero-chart-canvas {
  max-height: 180px;
}

.hero-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 180px;
}

.hero-cta-buttons {
  margin-top: 5rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hero-btn-primary {
  background-color: #f0f723;
  color: black;
  font-weight: bold;
  border: none;
}

.hero-btn-secondary {
  background-color: #0d0787;
  color: white;
  font-weight: bold;
  border: none;
}

/* About page specific styles */
.experience-date {
  min-width: 80px;
}

/* Archive page tab content visibility */
.tab-content-hidden {
  display: none;
}

/* Search toggle button */
.search-toggle {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.search-toggle:hover {
  color: #485fc7;
}

[data-theme="dark"] .navbar.is-light .search-toggle {
  color: #4a4a4a;
}

[data-theme="dark"] .navbar.is-light .search-toggle:hover {
  color: #485fc7;
}

/* Search modal styling */
.modal-card {
  max-width: 800px;
  width: 90%;
}

[data-theme="dark"] .modal-card {
  background-color: var(--bg-secondary);
}

[data-theme="dark"] .modal-card-head {
  background-color: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-card-title {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-card-body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Pagefind UI styling to match Bulma theme */
.pagefind-ui__search-input {
  font-family: inherit;
  font-size: 1.25rem;
  padding: 0.75rem 1rem;
  border: 2px solid #dbdbdb;
  border-radius: 6px;
  width: 100%;
  transition: border-color 0.2s ease;
  color: #363636;
  background-color: #ffffff;
}

.pagefind-ui__search-input::placeholder {
  color: #7a7a7a;
}

.pagefind-ui__search-input:focus {
  border-color: #485fc7;
  outline: none;
  box-shadow: 0 0 0 0.125em rgba(72, 95, 199, 0.25);
}

[data-theme="dark"] .pagefind-ui__search-input {
  background-color: #ffffff;
  color: #1a1a1a;
  border-color: var(--border-color);
}

[data-theme="dark"] .pagefind-ui__search-input::placeholder {
  color: #7a7a7a;
}

[data-theme="dark"] .pagefind-ui__search-input:focus {
  border-color: #7a8dea;
  box-shadow: 0 0 0 0.125em rgba(122, 141, 234, 0.25);
}

.pagefind-ui__result {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 1rem;
  background-color: var(--box-bg);
  transition: all 0.2s ease;
}

.pagefind-ui__result:hover {
  border-color: #485fc7;
  box-shadow: 0 0.5em 1em -0.125em rgba(10,10,10,0.1);
  transform: translateY(-2px);
}

[data-theme="dark"] .pagefind-ui__result {
  background-color: var(--bg-dark);
  border-color: var(--border-color);
}

[data-theme="dark"] .pagefind-ui__result:hover {
  border-color: #7a8dea;
  box-shadow: 0 0.5em 1em -0.125em rgba(0,0,0,0.3);
}

.pagefind-ui__result-title,
.pagefind-ui__result-link {
  color: #363636;
  font-weight: 600;
}

[data-theme="dark"] .pagefind-ui__result-title,
[data-theme="dark"] .pagefind-ui__result-link,
[data-theme="dark"] .pagefind-ui__result-title a,
[data-theme="dark"] .pagefind-ui__result a {
  color: #ffffff !important;
}

.pagefind-ui__result-link:hover {
  color: #485fc7;
}

[data-theme="dark"] .pagefind-ui__result-link:hover {
  color: #7a8dea;
}

.pagefind-ui__result-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.pagefind-ui__message {
  color: var(--text-secondary);
  padding: 1rem;
  text-align: center;
}

/* Pagefind filter styling */
.pagefind-ui__filter-panel {
  background-color: var(--box-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .pagefind-ui__filter-panel {
  background-color: var(--bg-dark);
}

.pagefind-ui__filter-group {
  margin-bottom: 1rem;
}

.pagefind-ui__filter-group:last-child {
  margin-bottom: 0;
}

.pagefind-ui__filter-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pagefind-ui__filter-value {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem;
  background-color: #f5f5f5;
  border: 1px solid #dbdbdb;
  border-radius: 4px;
  color: #4a4a4a;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagefind-ui__filter-value:hover {
  background-color: #e8e8e8;
  border-color: #b5b5b5;
}

.pagefind-ui__filter-value--selected {
  background-color: #485fc7;
  color: white;
  border-color: #485fc7;
}

.pagefind-ui__filter-value--selected:hover {
  background-color: #3a51bb;
  border-color: #3a51bb;
}

[data-theme="dark"] .pagefind-ui__filter-value {
  background-color: var(--bg-dark);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .pagefind-ui__filter-value:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-secondary);
}

[data-theme="dark"] .pagefind-ui__filter-value--selected {
  background-color: #7a8dea;
  border-color: #7a8dea;
  color: white;
}

[data-theme="dark"] .pagefind-ui__filter-value--selected:hover {
  background-color: #6879d8;
  border-color: #6879d8;
}

/* Remove spacing between Creative Commons icons in footer */
.footer .fab {
  margin-left: -0.2em;
}
