/* pareshpawar.com — custom overrides on top of Tailwind + DaisyUI (both loaded from CDN). */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

code, pre, kbd, samp {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* Brand colour override: force DaisyUI primary to #00cd81 in every theme.
   DaisyUI v4.12+ uses space-separated OKLCH (L% C H-degrees) for its CSS vars.
   #00cd81 ≈ oklch(72.06% 0.162 160). */
[data-theme] {
  --p: 72.06% 0.162 160;   /* primary — #00cd81 */
  --pc: 18% 0.03 160;      /* primary-content (dark green text on primary) */
  --a: 70% 0.17 162;       /* accent — slightly darker green */
  --ac: 18% 0.03 160;      /* accent-content */
}

/* Gradient text for brand accents */
.pp-gradient-text {
  background: linear-gradient(90deg, #00cd81 0%, #00c081 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Subtle hover lift */
.zoom { transition: transform 300ms ease-out; }
.zoom:hover { transform: scale(1.02); }

/* Scroll progress bar (Alpine-driven) */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #00cd81, #00c081);
  z-index: 60;
  transition: width 120ms linear;
  pointer-events: none;
}

/* Custom scrollbar — carried over from the original design */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00cd81, #00c081);
  border-radius: 10px;
}

/* Focus ring in brand green */
:focus-visible {
  outline: 2px solid #00cd81;
  outline-offset: 2px;
}

html { scroll-behavior: smooth; }

/* ───────────────────────────────────────────────────────────
   Navbar: live status chip with pulsing dot.
─────────────────────────────────────────────────────────── */
.pp-status-dot {
  --pp-dot-rgb: 0, 205, 129;
  width: 8px; height: 8px; border-radius: 999px;
  background-color: rgb(var(--pp-dot-rgb));
  transition: background-color 400ms ease;
  animation: pp-pulse 2.2s ease-out infinite;
  flex-shrink: 0;
}
@keyframes pp-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--pp-dot-rgb), 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(var(--pp-dot-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--pp-dot-rgb), 0); }
}

/* Rotating status-chip text — crossfade between items. */
.pp-status-text {
  opacity: 0.8;
  transition: opacity 300ms ease;
  white-space: nowrap;
}
.pp-status-text.is-fading { opacity: 0; }

/* ───────────────────────────────────────────────────────────
   Hero — maker's desk.
   Theme-aware surface + object fills via CSS variables.
─────────────────────────────────────────────────────────── */
.pp-hero {
  --desk-surface: #FAF6EE;
  --desk-wood:    #E8DBC3;
  --ink:          #1F2328;
  --paper-ink:    #2A2420;
  --paper:        #FFFEF8;
  --accent:       #00cd81;
  --accent-deep:  #00a36a;

  position: relative;
  isolation: isolate;
  overflow: hidden;
}

[data-theme="dark"] .pp-hero {
  --desk-surface: #1B1E24;
  --desk-wood:    #262A32;
  --ink:          #E6E8EC;
  --paper:        #2A2F38;
}

/* Scanline overlay — subtle, static. */
.pp-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(0, 0, 0, 0.05) 3px 4px
  );
  mix-blend-mode: multiply;
  z-index: 2;
}
[data-theme="dark"] .pp-hero::after {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(255, 255, 255, 0.035) 3px 4px
  );
  mix-blend-mode: screen;
}

/* The SVG desk itself. */
.pp-desk {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.08));
}
[data-theme="dark"] .pp-desk {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

/* Each hot object is wrapped in <a><g class="pp-obj">…</g></a>.
   NOTE: never translate/scale the object on hover — it moves out from
   under the cursor and triggers a mouseenter/leave oscillation loop.
   Hover feedback is filter + outline only, which do not change the
   element's bounding box or hit region. */
.pp-desk a { cursor: pointer; outline: none; }
.pp-desk .pp-obj {
  transition: filter 180ms ease-out;
}
.pp-desk a:hover .pp-obj,
.pp-desk a:focus-visible .pp-obj {
  filter: drop-shadow(0 0 6px rgba(0, 205, 129, 0.55))
          drop-shadow(0 2px 4px rgba(0, 205, 129, 0.35));
}
.pp-desk a:hover .pp-obj-outline,
.pp-desk a:focus-visible .pp-obj-outline {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 5 3;
}
.pp-desk .pp-obj-outline {
  fill: none;
  stroke: transparent;
  stroke-width: 2;
  pointer-events: none;
}

/* Pi LED pulse. */
.pp-led {
  animation: pp-led-blink 3s steps(1, end) infinite;
}
@keyframes pp-led-blink {
  0%, 92%, 100% { fill: #E63946; opacity: 1; }
  94%, 98%      { opacity: 0.25; }
}

/* CRT glitch — applied briefly (~480ms) via .is-glitching on .pp-hero.
   Only the desk shifts; text column stays put so layout doesn't jitter.
   RGB split via stacked drop-shadows, horizontal jitter on the desk,
   and a tear/scan overlay above everything. */
.pp-hero.is-glitching .pp-desk {
  animation: pp-glitch-desk 480ms steps(1, end);
}
@keyframes pp-glitch-desk {
  0%    { transform: translate(0, 0); filter: none; }
  8%    { transform: translate(-4px, 0);
          filter: drop-shadow(3px 0 0 rgba(255, 0, 80, 0.75))
                  drop-shadow(-3px 0 0 rgba(0, 220, 255, 0.75)); }
  22%   { transform: translate(3px, 1px); filter: none; }
  35%   { transform: translate(-2px, 0);
          filter: drop-shadow(-4px 0 0 rgba(0, 255, 180, 0.7))
                  drop-shadow(2px 0 0 rgba(255, 0, 120, 0.7)); }
  52%   { transform: translate(2px, -1px); filter: none; }
  68%   { transform: translate(-1px, 0);
          filter: drop-shadow(2px 0 0 rgba(255, 0, 60, 0.6)); }
  82%   { transform: translate(1px, 0); filter: none; }
  100%  { transform: translate(0, 0); filter: none; }
}
.pp-hero.is-glitching::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background-image:
    repeating-linear-gradient(to bottom,
      rgba(255,255,255,0.22) 0 1px,
      transparent 1px 3px,
      rgba(0,0,0,0.18) 3px 4px,
      transparent 4px 8px);
  mix-blend-mode: overlay;
  animation: pp-glitch-scan 480ms steps(1, end);
}
[data-theme="dark"] .pp-hero.is-glitching::before { mix-blend-mode: screen; }
@keyframes pp-glitch-scan {
  0%    { opacity: 0;   transform: translateY(0); }
  6%    { opacity: 0.9; transform: translateY(-10px); }
  18%   { opacity: 0.3; transform: translateY(6px); }
  34%   { opacity: 0.7; transform: translateY(-4px); }
  56%   { opacity: 0.4; transform: translateY(2px); }
  78%   { opacity: 0.2; transform: translateY(0); }
  100%  { opacity: 0;   transform: translateY(0); }
}

/* Keyboard typing animation — 5 keys flash brand green in sequence,
   then a quiet pause before looping. Each key has its own delay. */
.pp-key-type {
  animation: pp-key-press 3.6s linear infinite;
}
@keyframes pp-key-press {
  0%   { fill: #00cd81; }
  5%   { fill: #00cd81; }
  6%   { fill: #2B2F38; }
  100% { fill: #2B2F38; }
}

/* Caption box that updates on hover/focus. */
.pp-caption {
  min-height: 1.75rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.pp-caption::before {
  content: "› ";
  color: var(--accent);
  font-weight: 600;
}

/* Reduced motion — kill pulses, typing, glitch, hover transitions. */
@media (prefers-reduced-motion: reduce) {
  .pp-status-dot,
  .pp-led,
  .pp-key-type { animation: none; }
  .pp-hero.is-glitching .pp-desk,
  .pp-hero.is-glitching::before { animation: none; }
  .pp-desk .pp-obj,
  .pp-status-text,
  .pp-status-dot { transition: none; }
}

/* Hide until Alpine initialises (avoids flicker) */
[x-cloak] { display: none !important; }

/* ───────────────────────────────────────────────────────────
   Form controls — force DaisyUI theme variables so
   @tailwindcss/forms can't reset them to hard-coded white.
   Applied globally (public site + dashboard). Buttons excluded.
─────────────────────────────────────────────────────────── */
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
textarea,
select,
select[multiple],
[multiple] {
  background-color: oklch(var(--b1));
  color: oklch(var(--bc));
  border-color: oklch(var(--b3));
}
input::placeholder, textarea::placeholder { color: oklch(var(--bc) / 0.45); }
select[multiple] { background-image: none; }
/* Better visibility for datetime-local's native calendar icon in dark mode */
[data-theme="dark"] input::-webkit-calendar-picker-indicator { filter: invert(0.9); }

/* ───────────────────────────────────────────────────────────
   CKEditor 5 — re-theme with DaisyUI CSS variables so the
   editor follows light/dark alongside the rest of the UI.
─────────────────────────────────────────────────────────── */
.ck.ck-editor {
  --ck-color-base-background: oklch(var(--b1));
  --ck-color-base-foreground: oklch(var(--b2));
  --ck-color-base-border: oklch(var(--b3));
  --ck-color-base-text: oklch(var(--bc));

  --ck-color-toolbar-background: oklch(var(--b2));
  --ck-color-toolbar-border: oklch(var(--b3));

  --ck-color-button-default-hover-background: oklch(var(--b3));
  --ck-color-button-default-active-background: oklch(var(--b3));
  --ck-color-button-on-background: oklch(var(--b3));
  --ck-color-button-on-hover-background: oklch(var(--b3));

  --ck-color-text: oklch(var(--bc));
  --ck-color-focus-border: oklch(var(--p));
  --ck-color-focus-outer-shadow: oklch(var(--p) / 0.2);

  --ck-color-input-background: oklch(var(--b1));
  --ck-color-input-border: oklch(var(--b3));
  --ck-color-input-text: oklch(var(--bc));

  --ck-color-dropdown-panel-background: oklch(var(--b2));
  --ck-color-dropdown-panel-border: oklch(var(--b3));
  --ck-color-list-background: oklch(var(--b2));
  --ck-color-list-button-hover-background: oklch(var(--b3));

  --ck-color-link-default: oklch(var(--p));
}
/* Balloon panels (link tooltips, image caption editor) — they live
   outside .ck-editor so set them at the document level. */
.ck-body-wrapper .ck-balloon-panel {
  background: oklch(var(--b2));
  border-color: oklch(var(--b3));
  color: oklch(var(--bc));
}
.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused {
  border-color: oklch(var(--p));
  box-shadow: 0 0 0 3px oklch(var(--p) / 0.15);
}
/* Content text must explicitly follow the theme — CKEditor hard-codes it. */
.ck-editor__editable, .ck-content { color: oklch(var(--bc)) !important; background-color: oklch(var(--b1)); }
.ck-content a { color: oklch(var(--p)); }
.ck-content blockquote { border-color: oklch(var(--b3)); color: oklch(var(--bc) / 0.7); }
.ck-content code, .ck-content pre { background: oklch(var(--b2)); color: oklch(var(--bc)); }

/* Invert CKEditor button icons in dark mode so they remain legible */
[data-theme="dark"] .ck.ck-icon { color: oklch(var(--bc)); }
[data-theme="dark"] .ck.ck-button .ck-button__label { color: oklch(var(--bc)); }

/* ───────────────────────────────────────────────────────────
   File input ("Choose file") — darker in dark mode.
─────────────────────────────────────────────────────────── */
.file-input { background-color: oklch(var(--b1)); color: oklch(var(--bc)); }
.file-input::file-selector-button {
  background-color: oklch(var(--b3));
  color: oklch(var(--bc));
  border: 0;
  padding: 0.5rem 0.75rem;
  margin-right: 0.75rem;
  font-weight: 600;
}

/* Long URLs and fixed-width embeds in (mostly legacy, scraped) post bodies must
   not widen the page on phones. */
.prose a { overflow-wrap: anywhere; }
.prose iframe, .prose img, .prose video, .prose embed { max-width: 100%; }
