/**
 * THE LIVING INK JOURNEY — Artistic Scroll-Driven Homepage Animation
 * Brand: Emran Rafid (Vintage Editorial × Modern Digital Learning)
 *
 * Core Principles:
 * 1. Progressive Enhancement: If JS fails or is disabled, all content is 100% visible and interactive.
 * 2. Pointer-events: none on all decorative ink layers.
 * 3. Accessibility: prefers-reduced-motion: reduce disables all motion.
 * 4. Responsive: Tailored path density for Desktop, Tablet, and Mobile.
 */

/* ========================================================
   1. LIVING INK SVG CANVAS OVERLAY
   ======================================================== */
.er-living-ink-layer,
.er-ink-nib,
.er-living-ink-svg {
  display: none !important;
}

/* Master Traveling Ink Stroke */
.er-ink-path-main {
  fill: none;
  stroke: var(--er-espresso, #49362D);
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.78;
  filter: drop-shadow(0 0.5px 0.5px rgba(36, 35, 31, 0.15));
}

/* Accent guideline stroke */
.er-ink-path-accent {
  fill: none;
  stroke: var(--er-terracotta, #AD654B);
  stroke-width: 1.2px;
  stroke-dasharray: 4, 4;
  opacity: 0.65;
}

/* Traveling Ink Nib (Leading Calligraphy Dot) */
.er-ink-nib {
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--er-espresso, #49362D);
  box-shadow: 0 0 0 2px var(--er-paper, #F3EFE5), 0 0 0 3.5px var(--er-terracotta, #AD654B);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.er-ink-nib.is-active {
  opacity: 1;
}

/* Geometric Logo Diamonds & Milestone Nodes along the Ink Path */
.er-ink-node {
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.er-ink-diamond {
  transform: rotate(45deg);
  transform-origin: center;
}

.er-ink-diamond--teal {
  fill: #0D9488;
}

.er-ink-diamond--terracotta {
  fill: #AD654B;
}

.er-ink-diamond--amber {
  fill: #D97706;
}

.er-ink-node-circle {
  fill: var(--er-paper, #F3EFE5);
  stroke: var(--er-espresso, #49362D);
  stroke-width: 1.5px;
}

/* ========================================================
   2. CONTROLLED SCATTERED ASSEMBLY (ACTIVATED ONLY VIA JS)
   ======================================================== */
/* Only apply initial animation transforms when JS initializes and marks body */
body.er-motion-ready {
  overflow-x: hidden;
}

/* Sections receive relative positioning to anchor ink layers properly */
body.er-motion-ready .er-hero-section,
body.er-motion-ready .er-section {
  position: relative;
}

/* Hero Opening Assembly */
body.er-motion-ready #hero .er-eyebrow-wrap {
  will-change: transform, opacity;
}

body.er-motion-ready #hero .er-hero-title {
  will-change: transform, opacity;
}

body.er-motion-ready #hero .er-analog-paper-card {
  will-change: transform, opacity;
}

/* Scene A: About Me Collage */
body.er-motion-ready #about-intro .er-intro-left {
  will-change: transform, opacity;
}

body.er-motion-ready #about-intro .er-editorial-card {
  will-change: transform, opacity;
}

body.er-motion-ready #about-intro .er-pill {
  display: inline-block;
  will-change: transform, opacity;
}

/* Scene B: Featured Courses Assembly */
body.er-motion-ready #featured-courses .er-card--course {
  will-change: transform, opacity;
}

/* Scene C: Free Learning Noticeboard */
body.er-motion-ready #free-learning .er-noticeboard {
  will-change: transform, opacity;
}

body.er-motion-ready #free-learning .er-notice-item {
  will-change: transform, opacity;
}

/* Scene D: Free Tutorials (YouTube 4-Col Grid) */
body.er-motion-ready #free-tutorials .er-card--video {
  will-change: transform, opacity;
}

body.er-motion-ready #free-tutorials .er-channel-promo-strip {
  will-change: transform, opacity;
}

/* Scene E: Resources Library */
body.er-motion-ready #resources-library .er-card--resource {
  will-change: transform, opacity;
}

body.er-motion-ready #resources-library .er-nav-pill {
  will-change: transform, opacity;
}

/* Scene F: Portfolio / Selected Work */
body.er-motion-ready #portfolio .er-card--project {
  will-change: transform, opacity;
}

/* Scene G: Professional Journey Timeline */
body.er-motion-ready #journey .er-timeline-item {
  will-change: transform, opacity;
}

body.er-motion-ready #journey .er-timeline-badge {
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.er-motion-ready #journey .er-timeline-item.is-activated .er-timeline-badge {
  background-color: var(--er-terracotta, #AD654B);
  color: #ffffff;
  border-color: var(--er-espresso, #49362D);
  transform: scale(1.12);
}

/* Scene H: Blog / Notes From My Desk */
body.er-motion-ready #latest-writing .er-card--post {
  will-change: transform, opacity;
}

/* Scene I: Postcard & Footer Closure */
body.er-motion-ready #newsletter .er-postcard {
  will-change: transform, opacity;
}

body.er-motion-ready #newsletter .er-stamp--terracotta {
  will-change: transform;
}

/* ========================================================
   3. ARCHITECTURAL / EDITORIAL CONSTRUCTION MARKS
   ======================================================== */
.er-ink-corner-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--er-border-dark, #B5A591);
  border-style: solid;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.er-ink-corner-mark--tl {
  top: -6px;
  left: -6px;
  border-width: 1.5px 0 0 1.5px;
}

.er-ink-corner-mark--br {
  bottom: -6px;
  right: -6px;
  border-width: 0 1.5px 1.5px 0;
}

.is-assembled .er-ink-corner-mark {
  opacity: 0.85;
}

/* ========================================================
   4. ACCESSIBILITY & PREFERS-REDUCED-MOTION
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
  .er-living-ink-layer,
  .er-ink-nib {
    display: none !important;
  }

  body.er-motion-ready * {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ========================================================
   5. RESPONSIVE DESIGN ADJUSTMENTS
   ======================================================== */
@media (max-width: 1024px) {
  .er-ink-path-main {
    stroke-width: 1.6px;
    opacity: 0.7;
  }
}

@media (max-width: 768px) {
  /* On mobile, keep the ink path focused on a graceful vertical margin guide */
  .er-living-ink-layer {
    opacity: 0.65;
  }

  .er-ink-nib {
    width: 7px;
    height: 7px;
  }

  .er-ink-path-main {
    stroke-width: 1.4px;
  }
}
