/* ============================================================
   CUSTOM CSS - Portfolio Website
   ============================================================
   This file contains custom styles that supplement Tailwind CSS.
   Edit the CSS custom properties below to change the colour scheme.
   ============================================================ */

/* --- CSS Custom Properties (Theme Tokens) --- */
:root {
  --color-primary: #ea580c;
  --color-primary-dark: #c2410c;
  --color-accent: #d97706;
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --transition-speed: 300ms;

  /* --- Tag / Badge colours (interests, job tags, project tags) ---
     Change these two values to restyle ALL tags across the site. */
  --tag-bg:   #ffedd5;  /* soft orange background   */
  --tag-text: #7c2d12;  /* dark orange text          */
}

.dark {
  --tag-bg:   #9a3412;  /* dark orange background   */
  --tag-text: #ffedd5;  /* light orange text         */
}

/* Utility class used on every tag/pill element */
.tag {
  background-color: var(--tag-bg);
  color: var(--tag-text);
}

/* Inline buzzword highlight — use as <span class="hl">word</span> in content.js */
.hl {
  color: #ea580c;
  font-weight: 600;
}

.dark .hl {
  color: #fb923c;
}

/* --- Smooth Scrolling --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* Account for fixed navbar */
}

/* --- Base selection colour --- */
::selection {
  background-color: rgba(234, 88, 12, 0.2);
  color: inherit;
}

.dark ::selection {
  background-color: rgba(251, 146, 60, 0.3);
}

/* --- Utility: Hide Alpine cloaked elements --- */
[x-cloak] {
  display: none !important;
}

/* --- Custom Scrollbar (Webkit) --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}

.dark * {
  scrollbar-color: #475569 transparent;
}

/* --- Typing Cursor Animation --- */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.animate-blink {
  animation: blink 1s infinite;
}

/* --- Line Clamp Utility --- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Focus Styles for Accessibility --- */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Remove outline for mouse clicks but keep for keyboard */
*:focus:not(:focus-visible) {
  outline: none;
}

/* --- Skip to content link (screen reader and keyboard nav) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 9999;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* --- Hero Section Background Gradient --- */
#hero {
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(234, 88, 12, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(217, 119, 6, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at top center, rgba(234, 88, 12, 0.03) 0%, transparent 60%);
}

.dark #hero {
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(234, 88, 12, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(217, 119, 6, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at top center, rgba(234, 88, 12, 0.05) 0%, transparent 60%);
}

/* --- Gradient text fallback for older browsers --- */
@supports not (-webkit-background-clip: text) {
  .bg-clip-text {
    color: #ea580c;
  }
}

/* --- Scroll indicator bounce --- */
@keyframes gentle-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

#hero .animate-bounce {
  animation: gentle-bounce 2s ease-in-out infinite;
}

/* --- Navigation scroll state --- */
#navbar {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

#navbar[data-scrolled="true"] {
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.dark #navbar[data-scrolled="true"] {
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.2);
}

/* --- Hero background: pulsing vignette overlay --- */
@keyframes hero-vignette-pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.75; }
}

.hero-vignette {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.65) 100%);
  animation: hero-vignette-pulse 6s ease-in-out infinite;
}

/* --- Section colour fade transitions --- */
/* Colours: body = surface-50 #fafaf9 (light) / surface-950 #0c0a09 (dark)
            alt  = gray-50   #f9fafb (light) / surface-900 #1c1917 (dark) */

/* Hero bottom fade to body background */
.hero-section-fade {
  background: linear-gradient(to bottom, transparent, #fafaf9);
}
.dark .hero-section-fade {
  background: linear-gradient(to bottom, transparent, #0c0a09);
}

/* Alt-background sections need position:relative for pseudo-elements */
#experience,
#portfolio,
#testimonials {
  position: relative;
}

/* Top fades: sections following a plain section */
#experience::before,
#portfolio::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 72px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(to bottom, #fafaf9, #f9fafb);
}
.dark #experience::before,
.dark #portfolio::before {
  background: linear-gradient(to bottom, #0c0a09, #1c1917);
}

/* Bottom fades: alt sections preceding a plain section */
#experience::after,
#testimonials::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 72px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(to bottom, #f9fafb, #fafaf9);
}
.dark #experience::after,
.dark #testimonials::after {
  background: linear-gradient(to bottom, #1c1917, #0c0a09);
}

/* --- Reduced motion: disable animations for users who prefer it --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* --- Mobile spacing adjustments --- */
@media (max-width: 640px) {
  section {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  #hero {
    padding-top: 5rem;
    min-height: calc(100vh - 4rem);
    min-height: calc(100dvh - 4rem); /* Dynamic viewport height for mobile */
  }
}

/* --- Timeline Responsive Adjustments --- */
@media (max-width: 767px) {
  .timeline-line {
    left: 1rem;
  }
}

/* --- Portfolio Card Image Placeholder --- */
.portfolio-placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark .portfolio-placeholder {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d1b4e 100%);
}

/* --- Modal Backdrop Blur Support --- */
@supports not (backdrop-filter: blur(8px)) {
  .backdrop-blur-sm {
    background: rgba(0, 0, 0, 0.85);
  }
}

/* --- Ensure dark mode images have subtle brightness --- */
.dark img {
  filter: brightness(0.95);
}

.dark img:hover {
  filter: brightness(1);
}

/* --- Active nav link highlight (optional enhancement) --- */
.nav-active {
  color: var(--color-primary);
}

/* --- Print Styles --- */
@media print {
  nav, footer, .no-print, .skip-link {
    display: none !important;
  }

  section {
    break-inside: avoid;
    padding: 1rem 0;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]::after,
  a[href^="mailto:"]::after {
    content: "";
  }
}
