/* =========================================
   phaige — Kinetic Design System
   ========================================= */

:root {
  --teal:        #1A4A5A;
  --teal-mid:    #2D6E7E;
  --teal-light:  #4A9BAA;
  --coral:       #D46B5E;
  --coral-light: #E8A89E;
  --ink:         #0F1419;
  --graphite:    #3D454C;
  --stone:       #6B7680;
  --mist:        #DFE3E7;
  --silk:        #F1F0ED;
  --bg:          #FAF9F6;
  --white:       #FFFFFF;
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ---------- HERO ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

/* Drawing lines */
.hero-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.draw-line {
  fill: none;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
}

.draw-line.animated {
  animation: draw 3s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.ln-1 { stroke: var(--teal-light); opacity: 0.18; }
.ln-2 { stroke: var(--coral); opacity: 0.12; }
.ln-3 { stroke: var(--teal-mid); opacity: 0.14; }

.ln-2.animated { animation-delay: 0.4s; }
.ln-3.animated { animation-delay: 0.8s; }

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* Pulse dots */
.pulse-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pulse {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  opacity: 0;
}

.pulse.active {
  animation: pulseDot 4s ease-in-out infinite;
}

.pulse:nth-child(2) { background: var(--teal-light); animation-delay: 0.8s; }
.pulse:nth-child(3) { background: var(--coral-light); animation-delay: 1.6s; }
.pulse:nth-child(4) { background: var(--teal-mid); animation-delay: 2.4s; }
.pulse:nth-child(5) { background: var(--teal-light); animation-delay: 3.2s; }

@keyframes pulseDot {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  20% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.8); }
  80% { opacity: 0; transform: scale(2.6); }
}

/* Hero content */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 28px;
  max-width: 860px;
}

.hero-logo {
  display: block;
  width: clamp(180px, 28vw, 280px);
  height: auto;
  margin: 0 auto 40px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.hero-logo.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-tag.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7.5vw, 88px);
  font-weight: 500;
  line-height: 1.08;
  color: var(--teal);
}

.h1-line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.h1-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.h1-line[data-delay="1"] {
  transition-delay: 0.18s;
}

.hero-sub {
  margin-top: 28px;
  font-size: clamp(15px, 1.8vw, 19px);
  color: var(--graphite);
  font-weight: 300;
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease 0.5s, transform 0.8s ease 0.5s;
}

.hero-sub.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll hint */
.scroll-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 52px;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--mist);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.6s ease 1s;
}

.scroll-hint.visible {
  opacity: 1;
}

.scroll-arrow {
  display: block;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--stone);
  border-bottom: 1.5px solid var(--stone);
  transform: rotate(45deg) translateY(-2px);
  animation: bobDown 2s ease-in-out infinite;
}

@keyframes bobDown {
  0%, 100% { transform: rotate(45deg) translateY(-2px); }
  50%      { transform: rotate(45deg) translateY(3px); }
}

/* ---------- WORK ---------- */

.work {
  padding: 140px 0 100px;
  background: var(--white);
  overflow: hidden;
}

.work-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px;
}

.label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--coral);
}

.work-intro h2 {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  color: var(--teal);
  line-height: 1.1;
}

/* Stages container */
.stages {
  margin-top: 80px;
  position: relative;
}

/* SVG connecting flow path */
.stages-path {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.stages-path path {
  stroke: var(--mist);
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.stages-path.drawing path {
  stroke-dashoffset: 0;
}

/* Individual stage */
.stage {
  position: relative;
  display: flex;
  align-items: center;
  padding: 64px 0;
  z-index: 1;
}

.stage:not(:last-child) {
  margin-bottom: 20px;
}

/* Alternating alignment */
.stage:nth-child(even) {
  justify-content: flex-end;
}

.stage:nth-child(odd) .stage-body {
  margin-right: auto;
}

.stage:nth-child(even) .stage-body {
  margin-left: auto;
  text-align: right;
}

/* Giant ghost number */
.stage-ghost {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(160px, 22vw, 280px);
  font-weight: 600;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--mist);
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.9s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.stage.in-view .stage-ghost {
  opacity: 1;
  transform: scale(1);
}

/* Ghost positioning - alternating sides */
.stage:nth-child(odd) .stage-ghost {
  right: -5%;
  top: 50%;
  transform: scale(0.85) translateY(-50%);
}

.stage:nth-child(even) .stage-ghost {
  left: -5%;
  top: 50%;
  transform: scale(0.85) translateY(-50%);
}

.stage.in-view:nth-child(odd) .stage-ghost {
  transform: scale(1) translateY(-50%);
}

.stage.in-view:nth-child(even) .stage-ghost {
  transform: scale(1) translateY(-50%);
}

/* Color transition on ghost */
.stage.in-view .stage-ghost {
  -webkit-text-stroke-color: var(--coral-light);
  transition: opacity 0.9s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), -webkit-text-stroke-color 0.8s ease 0.3s;
}

/* Stage content body */
.stage-body {
  position: relative;
  max-width: 480px;
  z-index: 2;
}

.stage-label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--coral);
  margin-bottom: 12px;
}

.stage-body h3 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 500;
  color: var(--teal);
  line-height: 1.1;
}

.stage-body p {
  margin-top: 14px;
  font-size: 15px;
  color: var(--stone);
  max-width: 44ch;
  line-height: 1.7;
}

.stage:nth-child(even) .stage-body p {
  margin-left: auto;
}

/* ---------- ABOUT ---------- */

.about {
  padding: 128px 0;
  background: var(--bg);
}

.about-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 40px;
}

.about h2 {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.8vw, 44px);
  font-weight: 400;
  color: var(--teal);
  line-height: 1.16;
}

.about-text {
  margin-top: 20px;
  font-size: 16px;
  color: var(--graphite);
  line-height: 1.75;
}

/* ---------- CONTACT ---------- */

.contact {
  background: var(--silk);
  padding: 112px 0;
}

.contact-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 40px;
}

.contact h2 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  color: var(--teal);
  line-height: 1.1;
}

.contact > .contact-inner > p:first-of-type {
  margin-top: 14px;
  color: var(--stone);
  font-size: 16px;
  margin-bottom: 40px;
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone);
}

.form-group input,
.form-group textarea {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--mist);
  border-radius: 8px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(74, 155, 170, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--stone);
  opacity: 0.5;
}

.form-btn {
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--white);
  background: var(--coral);
  border: none;
  border-radius: 999px;
  padding: 13px 32px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.form-btn:hover {
  background: #c2604f;
  transform: translateY(-1px);
}

.form-alt {
  margin-top: 24px;
  font-size: 13px;
  color: var(--stone);
}

.form-alt a {
  color: var(--coral);
  border-bottom: 1px solid var(--coral-light);
  transition: color 0.2s;
}

.form-alt a:hover {
  color: var(--teal);
}

/* ---------- FOOTER ---------- */

.footer {
  background: var(--ink);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

.footer a {
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.2s;
}
.footer a:hover {
  color: rgba(255, 255, 255, 0.7);
}

.footer-brand {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

/* ---------- KINETIC REVEAL ---------- */

.kin-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.kin-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.stage.kin-reveal:nth-child(2) { transition-delay: 0.12s; }
.stage.kin-reveal:nth-child(3) { transition-delay: 0.24s; }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 768px) {
  .hero-content { padding: 0 20px; }
  .hero-logo { font-size: 20px; margin-bottom: 32px; }

  .work-inner,
  .about-inner,
  .contact-inner { padding: 0 24px; }

  .work { padding: 100px 0 72px; }

  .stages-path { display: none; }

  .stage { padding: 40px 0; }
  .stage:not(:last-child) { margin-bottom: 0; }

  .stage:nth-child(even) { justify-content: flex-start; }
  .stage:nth-child(even) .stage-body { margin-left: 0; text-align: left; }
  .stage:nth-child(even) .stage-body p { margin-left: 0; }

  .stage-ghost {
    font-size: 120px;
    right: -10% !important;
    left: auto !important;
  }

  .about { padding: 80px 0; }
  .contact { padding: 80px 0; }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-btn {
    align-self: stretch;
  }

  .footer { padding: 16px 20px; }
}
