/* =========================================================================
   Beulah Divya Kannan — Portfolio
   Theme: "Ops Console" — dark, data-driven operations dashboard
   Custom CSS layered on top of Tailwind (Play CDN).
   ========================================================================= */

:root {
  /* ---- Palette (CSS variables) ---- */
  --bg:         #0B0E11;   /* page canvas */
  --surface:    #11161C;   /* cards / panels */
  --surface-2:  #161D26;   /* raised panels */
  --line:       rgba(198, 242, 78, 0.10);
  --line-soft:  rgba(255, 255, 255, 0.07);
  --text:       #E6EDF3;   /* primary text */
  --muted:      #8B97A7;   /* secondary text */
  --faint:      #5A6675;   /* tertiary / labels */

  --lime:       #C6F24E;   /* primary accent */
  --cyan:       #5EEAD4;   /* secondary accent */
  --amber:      #FFB454;   /* tertiary accent */

  --lime-glow:  rgba(198, 242, 78, 0.35);
  --cyan-glow:  rgba(94, 234, 212, 0.30);

  --radius:     16px;
  --maxw:       1200px;

  --font-sans:  "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

/* ---- Base ---- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.font-mono { font-family: var(--font-mono); }

::selection { background: var(--lime); color: #0B0E11; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: #232c38; border-radius: 99px; border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #2f3a49; }

/* Focus visibility for keyboard users */
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================================
   Background system: animated grid + moving aurora + cursor spotlight
   ========================================================================= */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-grid {
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 64px 64px, 64px 64px; }
}

.bg-aurora {
  background:
    radial-gradient(40rem 30rem at 12% -10%, var(--lime-glow), transparent 60%),
    radial-gradient(36rem 28rem at 88% 8%, var(--cyan-glow), transparent 62%),
    radial-gradient(30rem 24rem at 70% 100%, rgba(255,180,84,0.10), transparent 60%);
  opacity: 0.7;
  animation: auroraPulse 14s ease-in-out infinite alternate;
}

@keyframes auroraPulse {
  from { transform: translateY(0) scale(1); opacity: 0.55; }
  to   { transform: translateY(-2%) scale(1.05); opacity: 0.85; }
}

/* Cursor-following spotlight (set via JS custom props) */
.bg-spotlight {
  background: radial-gradient(
    24rem 24rem at var(--mx, 50%) var(--my, 20%),
    rgba(198, 242, 78, 0.08), transparent 70%
  );
  transition: background 0.2s ease-out;
}

/* Film grain for texture */
.bg-grain {
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* =========================================================================
   Typography helpers
   ========================================================================= */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--lime);
}

.text-gradient {
  background: linear-gradient(120deg, var(--text) 0%, var(--text) 55%, var(--lime) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.accent-underline {
  position: relative;
  display: inline;
  background-image: linear-gradient(var(--lime), var(--lime));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.accent-underline.is-visible { background-size: 100% 2px; }

/* Rotating headline */
.headline-rotate {
  display: inline;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.headline-rotate.swapping { opacity: 0; transform: translateY(10px); }
.hl { color: var(--lime); }

/* Accent chip — used for target-role bubbles.
   Uses .chip.chip-accent so it always beats the base .chip rule regardless of source order. */
.chip.chip-accent {
  color: var(--lime);
  border-color: rgba(198, 242, 78, 0.32);
  background: rgba(198, 242, 78, 0.07);
}
.chip.chip-accent:hover {
  color: var(--lime);
  border-color: rgba(198, 242, 78, 0.5);
  background: rgba(198, 242, 78, 0.12);
  transform: translateY(-2px);
}

/* Small label inside cards */
.card-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Blinking terminal caret */
.caret::after {
  content: "▋";
  color: var(--lime);
  margin-left: 2px;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* =========================================================================
   Console window chrome
   ========================================================================= */
.console {
  background: linear-gradient(180deg, var(--surface) 0%, #0d1217 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 40px 80px -40px rgba(0,0,0,0.8);
}

.console-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.console-dot { width: 11px; height: 11px; border-radius: 99px; }

/* =========================================================================
   Cards & chips
   ========================================================================= */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1),
              border-color 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
}
.panel:hover {
  border-color: var(--line);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.7),
              0 0 0 1px rgba(198,242,78,0.08);
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: rgba(255,255,255,0.02);
  transition: all 0.25s ease;
  white-space: nowrap;
}
.chip:hover {
  color: var(--lime);
  border-color: var(--line);
  background: rgba(198,242,78,0.06);
  transform: translateY(-2px);
}

/* Metric figure */
.metric .num {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(120deg, var(--lime), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =========================================================================
   Project / case gallery cards
   ========================================================================= */
.case-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: transform 0.45s cubic-bezier(0.16,1,0.3,1),
              border-color 0.4s ease, box-shadow 0.4s ease;
  will-change: transform;
}
.case-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(28rem 18rem at var(--cx,50%) var(--cy,0%),
              rgba(198,242,78,0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.case-card:hover::before { opacity: 1; }
.case-card:hover {
  border-color: var(--line);
  box-shadow: 0 40px 70px -40px rgba(0,0,0,0.8);
}
.case-card .arrow {
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.case-card:hover .arrow { transform: translate(4px, -4px); }

.case-card.is-hidden {
  display: none;
}

/* Let card tag labels wrap inside the card so a long label never pushes
   the corner arrow out of the (overflow-hidden) card and clips it. */
.case-card .chip { white-space: normal; line-height: 1.3; }

/* Filter tabs */
.tab {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  transition: all 0.25s ease;
}
.tab:hover { color: var(--text); border-color: var(--line); }
.tab.active {
  color: #0B0E11;
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 24px -6px var(--lime-glow);
}

/* =========================================================================
   Modal (case detail)
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 7, 9, 0.7);
  backdrop-filter: blur(8px);
}
.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.modal.open .modal-panel { transform: translateY(0) scale(1); }

/* =========================================================================
   Testimonial bubbles
   ========================================================================= */
.bubble {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), border-color 0.4s ease;
}
.bubble:hover { transform: translateY(-6px); border-color: var(--line); }
.bubble::after {
  /* little chat tail */
  content: "";
  position: absolute;
  left: 34px;
  bottom: -9px;
  width: 18px; height: 18px;
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  transform: rotate(45deg);
}
.avatar {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0B0E11;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.03em;
  padding: 0.85rem 1.4rem;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
  will-change: transform;
}
.btn-primary {
  background: var(--lime);
  color: #0B0E11;
  font-weight: 600;
  box-shadow: 0 0 0 0 var(--lime-glow);
}
.btn-primary:hover { box-shadow: 0 14px 40px -10px var(--lime-glow); }
.btn-ghost {
  border: 1px solid var(--line-soft);
  color: var(--text);
  background: rgba(255,255,255,0.02);
}
.btn-ghost:hover { border-color: var(--line); color: var(--lime); }

/* =========================================================================
   Nav
   ========================================================================= */
.nav {
  transition: background 0.35s ease, border-color 0.35s ease, backdrop-filter 0.35s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(11, 14, 17, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-link {
  position: relative;
  color: var(--muted);
  transition: color 0.25s ease;
}
.nav-link::after {
  content: "";
  position: absolute; left: 0; bottom: -6px;
  width: 100%; height: 2px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--text); }

/* Mobile menu */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.16,1,0.3,1);
}
.mobile-menu.open { max-height: 420px; }

/* Scroll progress bar */
.progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  z-index: 60;
  box-shadow: 0 0 12px var(--lime-glow);
}

/* =========================================================================
   Scroll reveal
   ========================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1),
              transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal[data-delay="5"] { transition-delay: 0.40s; }
.reveal[data-delay="6"] { transition-delay: 0.48s; }

/* Marquee (skills ticker) */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: marquee 30s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Divider label */
.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft), transparent);
}

/* =========================================================================
   "Off the clock" nature gallery (CSS columns masonry)
   ========================================================================= */
.nature-tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  break-inside: avoid;
  background: var(--surface);
}
.nature-tile img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.nature-tile:hover img { transform: scale(1.06); }
.nature-tile figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 30px 14px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(to top, rgba(5, 7, 9, 0.88), rgba(5, 7, 9, 0.25) 70%, transparent);
  opacity: 0.92;
  transition: opacity 0.3s ease;
}
.nature-tile:hover figcaption { opacity: 1; }

/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
