/* ==========================================================================
   Sajag Case Study - Editorial Canvas & Seamless Artboard Flow
   Preserves 100% Exact Figma Alignment, Spacing, Typography & Artwork (Node 1:6068)
   ========================================================================== */

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

:root {
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --color-bg-page: #ffffff;
  --color-bg-canvas: #ffffff;
  --color-border-subtle: rgba(226, 232, 240, 0.8);
  --color-brand-blue: #0066ff;
  --color-brand-blue-hover: #0052cc;
  --color-brand-blue-subtle: rgba(0, 102, 255, 0.08);
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  
  /* Large external monitors (1600px+): full width breadth */
  --canvas-max-width: 1198px;
}

/* Laptops & Standard Desktops (1201px - 1599px):
   Automatically scales canvas to 980px (~82% of original).
   Replicates the comfortable feeling of 85%-90% zoom so content
   is never overwhelming and leaves ample breathing room for navigation. */
@media (min-width: 1201px) and (max-width: 1599px) {
  :root {
    --canvas-max-width: 980px;
  }
}

/* Compact laptops & horizontal tablets (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
  :root {
    --canvas-max-width: 900px;
  }
}

/* Tablets and Mobile Phones (<= 1024px):
   Takes 100% fluid width naturally with zero overflow */
@media (max-width: 1024px) {
  :root {
    --canvas-max-width: 100%;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #ffffff;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
  width: 0;
  height: 0;
}

body {
  font-family: var(--font-body);
  background-color: #ffffff;
  color: var(--color-text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Incoming White Transition Curtain from Portfolio Zoom */
.portfolio-transition-curtain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  z-index: 99999999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}

html.is-entering-transition .portfolio-transition-curtain {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   Sticky Header & Navigation
   ========================================================================== */

.cs-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border-subtle);
  transition: box-shadow 0.25s ease;
}

.cs-header-inner {
  max-width: var(--canvas-max-width);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.cs-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.cs-nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.cs-nav-logo .logo-dot {
  color: var(--color-brand-blue);
}

.cs-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  background: var(--color-brand-blue-subtle);
  color: var(--color-brand-blue);
  border: 1px solid rgba(0, 102, 255, 0.18);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.cs-back-link:hover {
  background: var(--color-brand-blue);
  color: #ffffff;
  border-color: var(--color-brand-blue);
  transform: translateX(-2px);
  box-shadow: 0 4px 14px rgba(0, 102, 255, 0.25);
}

.cs-nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.cs-nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cs-nav-link:hover {
  color: var(--color-text-main);
}

/* ==========================================================================
   Editorial Canvas Flow (100% Exact Figma Alignment)
   ========================================================================== */

.case-study-canvas {
  width: 100%;
  max-width: var(--canvas-max-width);
  margin: 0 auto;
  background: #ffffff;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  position: relative;
  flex: 1;
}

.case-section {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  border: none;
  position: relative;
}

/* Heading Block Scroll Transition */
.cs-heading-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  position: relative;
  
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

/* Body / Diagram Block Staggered Scroll Transition */
.cs-body-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  position: relative;
  
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.18s, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.18s;
  will-change: opacity, transform;
}

/* Hero block */
.cs-canvas-block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Revealed State Triggered on Scroll */
.case-section.is-revealed .cs-heading-block,
.case-section.is-revealed .cs-body-block,
.case-section.is-revealed .cs-canvas-block {
  opacity: 1;
  transform: translateY(0);
}

.cs-heading-block img,
.cs-body-block img,
.cs-canvas-block img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  vertical-align: top;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ==========================================================================
   Screen Reader & SEO Accessibility
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Case Study Footer
   ========================================================================== */

.cs-footer {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid var(--color-border-subtle);
  padding: 2.5rem 1.5rem;
  margin-top: auto;
}

.cs-footer-inner {
  max-width: var(--canvas-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cs-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cs-footer-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text-main);
}

.cs-footer-sub {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.cs-footer-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cs-btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-main);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.cs-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateX(-2px);
}

.cs-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-radius: 9999px;
  background: var(--color-brand-blue);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.cs-btn-primary:hover {
  background: var(--color-brand-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 102, 255, 0.3);
}

/* ==========================================================================
   Responsive & Accessibility Adaptations
   ========================================================================== */

@media (max-width: 768px) {
  .cs-nav-links {
    display: none;
  }
  
  .cs-header-inner {
    padding: 0.75rem 1rem;
  }
  
  .case-study-canvas {
    box-shadow: none;
  }
  
  .cs-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Minimal Section Dot Navigator
   Appearance:
   - Pure white/transparent page background (no container, border, shadow,
     connecting line, or section counter).
   - Inactive dots: 4px, light gray (#cbd5e1).
   - Active dot: 7px, solid black (#000000), without an outer ring.
   - Distance between dots: exactly ~28px.
   - Active section heading: pure black, 12-13px medium weight, 14px gap to left.
   - Inactive hover/focus: simple text fade, no tooltip box.
   - Generous stationary hit area: at least 44 x 44px.
   - Subtle rolling animation: shallow elliptical path along virtual vertical wheel.
   ========================================================================== */

.cs-dot-nav {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 950;
  pointer-events: auto;
  user-select: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.cs-dot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  gap: 0;
}

.cs-dot-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Pitch between adjacent dot centers: 24px (compact & elegant for 18 sections) */
  height: 24px;
  width: 24px;
}

/* Stationary Click Target with generous invisible hit area (>= 44x44px) */
.cs-dot-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  text-decoration: none;
  outline: none;
  cursor: pointer;
  background: transparent;
  border: none;
}

/* Invisible hit area expanding to 44 x 44px without changing visible dot size */
.cs-dot-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
}

/* Accessible visible keyboard focus */
.cs-dot-link:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 3px;
  border-radius: 50%;
}

/* Wrapper for the visible dot that performs the rolling motion */
.cs-dot-node-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

/* The visible circular dot */
.cs-dot-node {
  border-radius: 50%;
  /* Inactive dots: 4px, light gray */
  width: 4px;
  height: 4px;
  background-color: #cbd5e1;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.22s ease;
  display: block;
}

/* Inactive dot hover / focus-visible */
.cs-dot-item:not(.is-active) .cs-dot-link:hover .cs-dot-node,
.cs-dot-item:not(.is-active) .cs-dot-link:focus-visible .cs-dot-node {
  background-color: #94a3b8;
}

/* Active dot: 7px, solid black, without an outer ring */
.cs-dot-item.is-active .cs-dot-node {
  width: 7px;
  height: 7px;
  background-color: #000000;
  border: none !important;
  box-shadow: none !important;
}

/* Section heading label:
   Black, 12-13px medium-weight text, positioned to the left with 14px gap.
   Stationary and upright (outside the rolling transform). */
.cs-dot-label {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  color: #000000;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.22s ease;
}

/* Active section heading is shown beside its dot */
.cs-dot-item.is-active .cs-dot-label {
  opacity: 1;
}

/* Hovering or keyboard-focusing an inactive dot reveals its section name with a simple text fade */
.cs-dot-item:not(.is-active) .cs-dot-link:hover .cs-dot-label,
.cs-dot-item:not(.is-active) .cs-dot-link:focus-visible .cs-dot-label {
  opacity: 1;
}

/* ==========================================================================
   Subtle Rolling Animation:
   Shallow elliptical path along virtual vertical wheel.
   Restrained: roughly 6-10px vertically with 2-4px horizontal.
   Settles back within 250-350ms.
   ========================================================================== */

.is-rolling-down .cs-dot-node-wrapper {
  animation: csWheelRollDown 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.is-rolling-up .cs-dot-node-wrapper {
  animation: csWheelRollUp 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes csWheelRollDown {
  0% {
    transform: translate3d(0, 0, 0);
  }
  38% {
    transform: translate3d(-3px, 8px, 0);
  }
  72% {
    transform: translate3d(-1px, 2px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes csWheelRollUp {
  0% {
    transform: translate3d(0, 0, 0);
  }
  38% {
    transform: translate3d(-3px, -8px, 0);
  }
  72% {
    transform: translate3d(-1px, -2px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* Pause and reset rolling motion while navigator is hovered or keyboard-focused */
.cs-dot-nav:hover .cs-dot-node-wrapper,
.cs-dot-nav:focus-within .cs-dot-node-wrapper {
  animation: none !important;
  transform: translate3d(0, 0, 0) !important;
}

/* Compact screen height adaptation */
@media (max-height: 800px) {
  .cs-dot-item,
  .cs-dot-link {
    height: 19px;
    width: 19px;
  }
}

/* Narrow screen adaptation: hide when screen space cannot fit rail without overlap */
@media (max-width: 1240px) {
  .cs-dot-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  .case-section {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  .cs-back-link,
  .cs-btn-primary,
  .cs-btn-secondary {
    transition: none !important;
    transform: none !important;
  }
}
