/* Studio Kilat — custom.css
   Only what Tailwind's utility classes can't do: keyframes, ::selection,
   focus rings, and the accordion / bolt-flash micro-interactions. */

:root {
  --paper: #FAFAF6;
  --ink: #101014;
  --kilat: #2B2BEB;
  --storm: #6B6B76;
  --hairline: rgba(16, 16, 20, 0.12);
}

/* Selection: kilat bg, paper text, everywhere. */
::selection {
  background: var(--kilat);
  color: var(--paper);
}

html {
  scroll-behavior: smooth;
}

/* ---------------------------------------------------------------
   Case-study accordion: pure-CSS collapse via grid-template-rows.
   No JS height measurement — the row animates 0fr -> 1fr, the inner
   wrapper clips. visibility swaps keep closed panels out of the
   accessibility tree and tab order.
   --------------------------------------------------------------- */
.case-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.case-panel.is-open {
  grid-template-rows: 1fr;
}
.case-panel > * {
  overflow: hidden;
  min-height: 0;
  visibility: hidden;
  /* The Tailwind pb-12/md:pb-16 on this element would hold the collapsed
     row open; zero it when closed and animate it with the row height. */
  padding-bottom: 0 !important;
  transition: visibility 0s 300ms, padding-bottom 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.case-panel.is-open > * {
  visibility: visible;
  padding-bottom: 3rem !important;
  transition: visibility 0s, padding-bottom 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 768px) {
  .case-panel.is-open > * {
    padding-bottom: 4rem !important;
  }
}

body {
  background: var(--paper);
  color: var(--ink);
}

/* Keyboard focus only — never on mouse click. Kilat outline, offset,
   square (radius 0 is the whole point of this site). */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--kilat);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------
   Hero rule: draws itself left-to-right once, on load.
   --------------------------------------------------------------- */
.rule-draw {
  transform: scaleX(0);
  transform-origin: left center;
  animation: rule-draw 1.1s cubic-bezier(0.65, 0, 0.15, 1) 0.15s forwards;
}

@keyframes rule-draw {
  to {
    transform: scaleX(1);
  }
}

/* ---------------------------------------------------------------
   Bolt flash: the small lightning glyph that snaps in from the left
   of a work-row project name, or the footer CTA, on hover/focus.
   120ms, no easing softness — it should feel instant, not smooth.
   --------------------------------------------------------------- */
.bolt-flash {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 120ms linear, transform 120ms linear;
}
.group:hover .bolt-flash,
.group:focus-visible .bolt-flash {
  opacity: 1;
  transform: translateX(0);
}

/* Work-row text colour snap on hover/focus. Kept out of Tailwind so the
   text + bolt move on exactly the same 120ms clock. */
.work-row-text {
  transition: color 120ms linear;
}
.group:hover .work-row-text,
.group:focus-visible .work-row-text {
  color: var(--kilat);
}

/* Case-study artifact strokes should feel drawn, not pasted — a short
   stagger on the kilat accent path when a row opens. */
.artifact-accent {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}
.case-panel.is-open .artifact-accent {
  animation: artifact-draw 0.6s ease-out 0.25s forwards;
}
@keyframes artifact-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Live clock: a soft steady pulse on the separator so it reads as
   "live" without being distracting. */
.clock-pulse {
  animation: clock-pulse 2s ease-in-out infinite;
}
@keyframes clock-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------------------------------------------------------
   Reduced motion: every animation above becomes instant / static.
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .rule-draw {
    animation: none;
    transform: scaleX(1);
  }
  .bolt-flash {
    transition: none;
  }
  .work-row-text {
    transition: none;
  }
  .artifact-accent {
    animation: none;
    stroke-dashoffset: 0;
  }
  .clock-pulse {
    animation: none;
  }
  .case-panel,
  .case-panel > * {
    transition: none;
  }
  * {
    scroll-behavior: auto !important;
  }
}
