/* ================================================
   THEME VARIABLES & BASE COLORS
================================================= */
:root {
  --accent: #D4AF37;
  --bg-light: #ffffff;
  --bg-dark: #000000;
  --text-light: #000000;
  --text-dark: #ffffff;
  --selected-button: #ccc;
  --logo-text-color: var(--bg-light); /* default for light theme */
}

/* Light and dark theme modes */
[data-theme='light'] { 
  --bg: var(--bg-light); 
  --text: var(--text-light); 
  --line-color: #444;  
  --chat--bg: #f9f9f9;
}

[data-theme='dark'] { 
  --bg: var(--bg-dark); 
  --text: var(--text-dark); 
  --line-color: #f5f0e1; 
  --chat-bg: #111;
}

[data-theme='dark'] {
  --logo-text-color: var(--bg-dark);
}

/* ================================================
   GLOBAL LAYOUT
================================================= */
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', 'Space Grotesk', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* ================================================
   HEADER & TITLE
================================================= */

/* Animated "Sheriff Analytics" text */
header h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  transition: color 0.5s;
  display: inline-block;
}

/* Header container */
header {
  text-align: center;
  padding: 8rem 2rem 4rem;
  position: relative;
  z-index: 1;
}

header h2 {
  font-size: 1.5rem;
  font-weight: 400;
}

.scroll-hint {
  margin-top: 2rem;
  font-size: 1rem;
  opacity: 0.7;
}

/* ================================================
   HOME BUTTON (Top Left)
================================================= */
#homeBtn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background-color: var(--bg);
  color: var(--accent);
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s, color 0.3s;
}

#homeBtn:hover {
  background-color: var(--accent);
  color: var(--bg);
}

/* ================================================
   BACKGROUND CHART (QQQ Performance)
================================================= */
canvas#backgroundChart { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
}

/* ================================================
   MOBILE STYLING (Responsive Adjustments)
================================================= */
@media (max-width: 768px) {
  canvas#backgroundChart {
    display: none !important; /* hide QQQ chart on mobile */
  }

  /* Prevent horizontal scrolling */
  body, html {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  /* Resize insight cards for smaller screens */
  .insight-card {
    max-width: 90%;
    padding: 15px;
    margin: 10px auto;
    font-size: 0.95rem;
  }

  .insight-card img {
    width: 100%;
    height: auto;
    display: block;
  }
}

/* ================================================
   GENERAL ELEMENT STYLES
================================================= */
.gold { color: var(--accent); }
.divider { border-top: 1px solid var(--accent); margin: 2rem 0; opacity: 0.3; }

section {
  padding: 6rem 2rem;
  max-width: 900px;
  margin: auto;
  position: relative;
  z-index: 1;
}

section h3 {
  font-size: 2rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  margin-bottom: 1rem;
}

.about p strong { font-weight: 700; }

/* ================================================
   PORTFOLIO SECTION
================================================= */
.portfolio {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
}

.portfolio-card {
  padding: 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  transition: transform 0.3s, box-shadow 0.3s;
  width: 180px;
  text-align: center;
}

.portfolio-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.portfolio-chart-container {
  width: 100%;
  max-width: 700px;
  height: 400px;
  margin: 2rem auto;
  position: relative;
  z-index: 2;
}

/* Portfolio filter buttons */
.portfolio-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.portfolio-filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.portfolio-filter-btn.selected {
  background: var(--selected-button);
}

/* ================================================
   INSIGHTS SECTION (BLOG CARDS)
================================================= */
.insights {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
  z-index: 2;
}

/* Insight cards */
.insight-card {
  padding: 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  transition: transform 0.3s, box-shadow 0.3s;
  width: 300px;
  max-height: 200px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  z-index: 5;
}

.insight-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Collapse/Expand content */
.insight-card p { display: none; margin-top: 0.5rem; }
.insight-card p:first-of-type { display: block; }

.insight-card .read-more {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: var(--accent);
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Overlay behind expanded card */
.insight-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 9998;
}

/* Expanded state */
.insight-card.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 80%;
  max-height: 82%;
  overflow-y: auto;
  z-index: 9999;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border-radius: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Read more button repositioned when expanded */
.insight-card.expanded .read-more {
  position: relative;
  bottom: auto;
  right: auto;
  margin-top: 2rem;
  align-self: flex-end;
}

/* Show all text when expanded */
.insight-card.expanded p { display: block; }

/* ================================================
   CONTACT FORM & SOCIAL LINKS
================================================= */
.contact-form, .socials { 
  max-width: 500px; 
  margin: auto; 
  display: flex; 
  flex-direction: column; 
  gap: 1rem; 
  position: relative; 
  z-index: 1; 
}

input, textarea { 
  padding: 0.8rem; 
  border-radius: 6px; 
  border: 1px solid #ccc; 
}

button { 
  background-color: var(--accent); 
  border: none; 
  padding: 0.8rem; 
  color: #000; 
  cursor: pointer; 
  border-radius: 6px; 
}

/* Social link styles */
.socials a { 
  text-decoration: none; 
  color: var(--accent); 
  font-weight: bold; 
  margin: 0.5rem; 
}

.socials a:hover { opacity: 1; }

/* ================================================
   THEME TOGGLE BUTTON (Top Right)
================================================= */
.theme-toggle { 
  position: fixed; 
  top: 1rem; 
  right: 1rem; 
  cursor: pointer; 
  padding: 0.5rem 1rem; 
  border-radius: 6px; 
  border: 1px solid var(--accent); 
  z-index: 10; 
}

/* ================================================
   CHATBOT SECTION
================================================= */
#chatbot {
  max-width: 700px;
  margin: 2rem auto;
}

/* Chat container */
.chat-container {
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1rem;
  max-width: 600px;
  width: 90%;
  min-height: 400px;
  max-height: 500px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  background: var(--chat--bg);
  position: relative;
  z-index: 5;
}

/* Chat messages area */
.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  border-bottom: 1px solid var(--accent);
  padding: 0.5rem 0;
}

/* Input & send area */
.chat-input-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-keywords {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.keyword {
  background: #B0B0B0;
  color: #000;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.keyword:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}

.chat-input {
  flex-grow: 1;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.chat-send {
  background-color: var(--accent);
  border: none;
  padding: 0.6rem 1rem;
  color: #000;
  cursor: pointer;
  border-radius: 6px;
}

.chat-send:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.chat-message { margin: 0.25rem 0; }
.chat-message.user { font-weight: bold; }

/* ================================================
   SOCIAL ICON STYLING
================================================= */
.socials {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.social-icon img {
  width: 32px;
  height: 32px;
  filter: invert(48%) sepia(84%) saturate(750%) hue-rotate(3deg) brightness(97%) contrast(94%);
  transition: transform 0.2s, filter 0.2s;
}

.social-icon img:hover {
  transform: scale(1.2);
  filter: invert(76%) sepia(36%) saturate(741%) hue-rotate(0deg) brightness(105%) contrast(101%);
}

/* ================================================
   LOGO (Hexagon Shield + Text)
================================================= */
.logo-wrapper {
  display: inline-block;
  width: 80px;
  height: 50px;
  position: fixed;
  top: 1rem;
  left: 1rem;
  cursor: pointer;
  z-index: 1000;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  line-height: 0;
  overflow: visible;
}

/* Hexagon shield */
.logo-shield {
  width: 100%;
  height: 100%;
  clip-path: polygon(20% 0%, 80% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%);
  background: linear-gradient(145deg, #D4AF37, #FFD700);
  filter: invert(48%) sepia(84%) saturate(750%) hue-rotate(3deg) brightness(97%) contrast(94%);
  animation: shieldShift 12s infinite linear, glowPulse 6s infinite ease-in-out;
  box-shadow: 0 0 25px rgba(212,175,55,0.4), inset 0 0 8px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

/* "sA" Text Overlay */
.logo-text {
  position: absolute;
  top: 50%;
  left: 45%;
  transform: translate(-50%, -55%) scale(1.05);
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 3.5rem;
  color: var(--logo-text-color);
  transition: color 0.5s ease;
  line-height: 1;
  letter-spacing: -0.08em;
  width: 140%;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

/* ================================================
   ANIMATIONS
================================================= */
@keyframes shieldShift {
  0% { filter: invert(48%) sepia(84%) saturate(750%) hue-rotate(3deg) brightness(97%) contrast(94%); }
  50% { filter: invert(76%) sepia(36%) saturate(741%) hue-rotate(0deg) brightness(105%) contrast(101%); }
  100% { filter: invert(48%) sepia(84%) saturate(750%) hue-rotate(3deg) brightness(97%) contrast(94%); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 25px rgba(212,175,55,0.4), inset 0 0 8px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 35px rgba(255,215,0,0.8), inset 0 0 10px rgba(0,0,0,0.4); }
}
