/* Horizontal walk portfolio — Drew Pomerleau */

:root {
  --sky-top: #9ec8e8;
  --sky-mid: #c5dff2;
  --sky-low: #e8f2f8;
  --ocean-shallow: #5eb0d4;
  --ocean-mid: #2f7fad;
  --ocean-deep: #1a5278;
  --wave-light: rgba(232, 246, 255, 0.55);
  --wave-foam: rgba(255, 255, 255, 0.45);
  --ink: #1c2430;
  --ink-soft: #4a5564;
  --ink-faint: #6b7685;
  --shirt: #4d84c4;
  --accent: #2f6f9f;
  --panel: rgba(255, 255, 255, 0.55);
  --panel-edge: rgba(28, 36, 48, 0.08);
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --chapter-count: 8;
  --vessel-x: 10%;
  --ocean-h: clamp(120px, 20vh, 180px);
}

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

html {
  scroll-behavior: auto;
}

html {
  margin: 0;
  /* Edge-to-edge backdrop — never leaves side gutters */
  background:
    radial-gradient(ellipse 80% 50% at 70% 10%, rgba(255, 255, 255, 0.45), transparent 55%),
    linear-gradient(
      180deg,
      var(--sky-top) 0%,
      var(--sky-mid) 38%,
      var(--sky-low) 58%,
      var(--ocean-shallow) 72%,
      var(--ocean-mid) 86%,
      var(--ocean-deep) 100%
    );
  background-attachment: fixed;
  background-color: var(--ocean-deep);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: transparent;
  /* Do NOT set overflow-x on html/body — it breaks position: sticky */
}

.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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  top: 1rem;
}

/* Chrome */
.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  pointer-events: none;
}

.chrome-hint {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: opacity 0.4s ease;
}

.chrome-hint.is-hidden {
  opacity: 0;
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  pointer-events: auto;
}

.chapter-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.chapter-nav button:hover,
.chapter-nav button:focus-visible {
  color: var(--ink);
  outline: none;
}

.chapter-nav button.is-active {
  color: var(--accent);
  font-weight: 600;
}

/* Scroll distance = chapter count × viewport height */
.scroll-root {
  height: calc(var(--chapter-count) * 100vh);
  position: relative;
}

.stage {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
}

/* Atmosphere */
.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sky-wash {
  display: none;
}

.cloud {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(1px);
  will-change: transform;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  background: inherit;
}

.cloud-a {
  width: 140px;
  height: 42px;
  top: 12%;
  left: 8%;
}

.cloud-a::before {
  width: 70px;
  height: 70px;
  top: -36px;
  left: 18px;
}

.cloud-a::after {
  width: 54px;
  height: 54px;
  top: -24px;
  left: 70px;
}

.cloud-b {
  width: 180px;
  height: 48px;
  top: 22%;
  left: 48%;
  opacity: 0.7;
}

.cloud-b::before {
  width: 80px;
  height: 80px;
  top: -42px;
  left: 30px;
}

.cloud-b::after {
  width: 60px;
  height: 60px;
  top: -28px;
  left: 95px;
}

.cloud-c {
  width: 120px;
  height: 36px;
  top: 16%;
  left: 78%;
  opacity: 0.5;
}

.cloud-c::before {
  width: 56px;
  height: 56px;
  top: -28px;
  left: 22px;
}

.cloud-c::after {
  width: 44px;
  height: 44px;
  top: -20px;
  left: 64px;
}

/* World track */
.world {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: flex;
  width: calc(var(--chapter-count) * 100vw);
  height: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* Ocean — above the world track so it can receive clicks */
.ocean {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: var(--ocean-h);
  z-index: 3;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}

.ocean-depth {
  position: absolute;
  inset: 0;
  width: 100%;
  background:
    linear-gradient(
      180deg,
      rgba(158, 200, 232, 0.2) 0%,
      var(--ocean-shallow) 18%,
      var(--ocean-mid) 55%,
      var(--ocean-deep) 100%
    );
}

.wave {
  position: absolute;
  left: -50%;
  width: 200%;
  height: 48px;
  background-repeat: repeat-x;
  background-size: 180px 48px;
  will-change: transform;
}

.wave--back {
  top: 6%;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 48' preserveAspectRatio='none'%3E%3Cpath d='M0 28 C20 12 40 12 60 28 C80 44 100 44 120 28 C140 12 160 12 180 28 V48 H0 Z' fill='%237ec8e6'/%3E%3C/svg%3E");
  animation: wave-drift 11s linear infinite;
}

.wave--mid {
  top: 22%;
  opacity: 0.7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 48' preserveAspectRatio='none'%3E%3Cpath d='M0 26 C22 10 38 10 60 26 C82 42 98 42 120 26 C142 10 158 10 180 26 V48 H0 Z' fill='%234a9fc9'/%3E%3C/svg%3E");
  animation: wave-drift 7.5s linear infinite reverse;
  height: 56px;
  background-size: 200px 56px;
}

.wave--front {
  top: 42%;
  opacity: 0.85;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 48' preserveAspectRatio='none'%3E%3Cpath d='M0 24 C18 8 42 8 60 24 C78 40 102 40 120 24 C138 8 162 8 180 24 V48 H0 Z' fill='%232f7fad'/%3E%3C/svg%3E");
  animation: wave-drift 5.2s linear infinite;
  height: 64px;
  background-size: 160px 64px;
}

.ocean-foam {
  position: absolute;
  left: -10%;
  top: 0;
  width: 120%;
  height: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28' preserveAspectRatio='none'%3E%3Cpath d='M0 16 C10 6 20 6 30 16 C40 26 50 26 60 16 C70 6 80 6 90 16 C100 26 110 26 120 16 V28 H0 Z' fill='rgba(255,255,255,0.35)'/%3E%3C/svg%3E");
  background-size: 120px 28px;
  background-repeat: repeat-x;
  animation: wave-drift 4s linear infinite;
  mix-blend-mode: soft-light;
}

@keyframes wave-drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-180px);
  }
}

/* Jumping fish */
.fish-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}

.fish-jump {
  position: absolute;
  width: 52px;
  height: 30px;
  margin: 0;
  transform: translate(-50%, 0);
  transform-origin: 50% 50%;
  animation: fish-leap 0.85s cubic-bezier(0.33, 0.8, 0.45, 1) forwards;
  filter: drop-shadow(0 4px 6px rgba(15, 50, 80, 0.25));
}

.fish-jump svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fish-jump.is-left {
  animation-name: fish-leap-left;
}

.fish-jump.is-left svg {
  transform: scaleX(-1);
}

.fish-splash {
  position: absolute;
  width: 36px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0;
  animation: fish-splash 0.7s ease-out forwards;
  pointer-events: none;
}

@keyframes fish-leap {
  0% {
    transform: translate(-50%, 12px) rotate(-25deg) scale(0.5);
    opacity: 0;
  }
  12% {
    opacity: 1;
    transform: translate(-40%, -20px) rotate(-10deg) scale(1);
  }
  45% {
    transform: translate(-20%, -110px) rotate(8deg) scale(1.05);
  }
  78% {
    opacity: 1;
    transform: translate(10%, -24px) rotate(28deg) scale(0.95);
  }
  100% {
    transform: translate(18%, 28px) rotate(40deg) scale(0.55);
    opacity: 0;
  }
}

@keyframes fish-leap-left {
  0% {
    transform: translate(-50%, 12px) rotate(25deg) scale(0.5);
    opacity: 0;
  }
  12% {
    opacity: 1;
    transform: translate(-60%, -20px) rotate(10deg) scale(1);
  }
  45% {
    transform: translate(-80%, -110px) rotate(-8deg) scale(1.05);
  }
  78% {
    opacity: 1;
    transform: translate(-110%, -24px) rotate(-28deg) scale(0.95);
  }
  100% {
    transform: translate(-118%, 28px) rotate(-40deg) scale(0.55);
    opacity: 0;
  }
}

@keyframes fish-splash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  35% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
  }
}

/* Chapters */
.chapter {
  flex: 0 0 100vw;
  width: 100vw;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  padding:
    clamp(4.5rem, 10vh, 6.5rem)
    clamp(1.25rem, 4vw, 3rem)
    calc(var(--ocean-h) + 1.5rem)
    clamp(320px, 42vw, 48vw);
  opacity: 0.28;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.chapter.is-active {
  opacity: 1;
  transform: translateY(0);
}

.chapter-copy {
  max-width: min(34rem, 100%);
}

.brand-intro {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.brand {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.chapter h1,
.chapter h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.chapter h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
}

.chapter h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.55rem);
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  max-width: 34ch;
}

.beat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.beat-list li {
  color: var(--ink-soft);
  font-size: 0.98rem;
  padding-left: 0.95rem;
  border-left: 2px solid rgba(47, 111, 159, 0.35);
}

.beat-list strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.beat-list span {
  display: block;
  color: var(--ink-faint);
  font-size: 0.92rem;
}

.beat-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.beat-list a:hover,
.beat-list a:focus-visible {
  border-bottom-color: currentColor;
  color: var(--ink);
  outline: none;
}

.toolkit {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toolkit h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
}

.toolkit p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.education,
.freelance-note {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-faint);
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  margin-top: 0.5rem;
}

.contact-row a {
  color: var(--accent);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.contact-row a:hover,
.contact-row a:focus-visible {
  border-bottom-color: currentColor;
  color: var(--ink);
  outline: none;
}

/* Vessel — captain aboard ship, fixed in the stage */
.vessel {
  position: absolute;
  left: var(--vessel-x);
  bottom: calc(var(--ocean-h) * 0.5);
  z-index: 5;
  width: clamp(200px, 28vw, 300px);
  pointer-events: none;
  transform-origin: 50% 80%;
  animation: vessel-idle 3.2s ease-in-out infinite;
}

.vessel.is-sailing {
  animation-name: vessel-sail;
  animation-duration: 1.1s;
}

.vessel.is-flipped {
  animation-name: vessel-idle-flip;
}

.vessel.is-flipped.is-sailing {
  animation-name: vessel-sail-flip;
  animation-duration: 1.1s;
}

.vessel-sway {
  position: relative;
  width: 100%;
  filter: drop-shadow(0 14px 18px rgba(15, 50, 80, 0.35));
}

.vessel-ship {
  display: block;
  width: 100%;
  height: auto;
}

/* Sibling of the filtered ship wrap — paints above the hull */
.vessel-captain {
  position: absolute;
  left: 78%;
  bottom: 22%;
  width: 23%;
  height: auto;
  translate: -50% 0;
  transform-origin: 50% 100%;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
}

.vessel.is-waving .vessel-captain:not(.is-flipping) {
  animation: captain-wave 1.4s ease-in-out infinite;
}

.vessel-captain.is-flipping {
  transform-origin: 50% 50%;
  animation: captain-backflip 0.7s ease-in-out forwards;
}

/* Forward: natural art (bow into the journey) */
@keyframes vessel-idle {
  0%,
  100% {
    transform: scaleX(1) translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: scaleX(1) translateY(-6px) rotate(1.8deg);
  }
}

@keyframes vessel-sail {
  0%,
  100% {
    transform: scaleX(1) translateY(0) rotate(-2.5deg);
  }
  50% {
    transform: scaleX(1) translateY(-10px) rotate(2.8deg);
  }
}

/* Back: mirrored */
@keyframes vessel-idle-flip {
  0%,
  100% {
    transform: scaleX(-1) translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: scaleX(-1) translateY(-6px) rotate(1.8deg);
  }
}

@keyframes vessel-sail-flip {
  0%,
  100% {
    transform: scaleX(-1) translateY(0) rotate(-2.5deg);
  }
  50% {
    transform: scaleX(-1) translateY(-10px) rotate(2.8deg);
  }
}

@keyframes captain-wave {
  0%,
  100% {
    transform: rotate(0deg);
  }
  40% {
    transform: translateY(-3px) rotate(-3deg);
  }
  70% {
    transform: translateY(-1px) rotate(2deg);
  }
}

@keyframes captain-backflip {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  35% {
    /* Peak: up ~half own height, spin starts as we come down */
    transform: translateY(-50%) rotate(0deg);
  }
  100% {
    transform: translateY(0) rotate(-360deg);
  }
}

/* Progress */
.progress {
  position: absolute;
  left: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  bottom: 1rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  z-index: 20;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: inherit;
  transition: width 0.05s linear;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .chapter {
    transition: none;
  }

  .vessel,
  .vessel.is-sailing,
  .vessel.is-flipped,
  .vessel.is-flipped.is-sailing,
  .vessel.is-waving .vessel-captain,
  .vessel-captain.is-flipping,
  .wave,
  .ocean-foam,
  .fish-jump,
  .fish-splash {
    animation: none;
  }

  .vessel:not(.is-flipped) {
    transform: scaleX(1);
  }

  .vessel.is-flipped {
    transform: scaleX(-1);
  }

  .cloud {
    display: none;
  }
}

/* Narrow screens: copy up top, vessel stays visible below */
@media (max-width: 820px) {
  :root {
    --vessel-x: 50%;
    --ocean-h: clamp(117px, 20vh, 153px);
  }

  .chrome {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .chapter-nav {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .chapter-nav::-webkit-scrollbar {
    display: none;
  }

  .chapter {
    align-items: flex-start;
    padding-top: clamp(5.25rem, 11vh, 6.5rem);
    padding-left: clamp(1rem, 4vw, 1.5rem);
    padding-right: clamp(1rem, 4vw, 1.5rem);
    padding-bottom: calc(var(--ocean-h) + clamp(153px, 29vh, 216px));
  }

  .chapter-copy {
    max-width: 100%;
    max-height: min(48vh, 380px);
    overflow: auto;
    background: linear-gradient(
      180deg,
      rgba(232, 242, 248, 0.92) 0%,
      rgba(232, 242, 248, 0.78) 70%,
      rgba(232, 242, 248, 0.2) 100%
    );
    border-radius: 0;
    padding: 0.25rem 0.15rem 1.5rem;
  }

  .brand {
    font-size: clamp(1.85rem, 9vw, 2.6rem);
  }

  .vessel {
    left: 50%;
    width: clamp(153px, 52vw, 216px);
    margin-left: 0;
    translate: -50% 0;
  }

  .chapter-nav button {
    font-size: 0.72rem;
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
  }

  .chrome-hint {
    display: none;
  }
}

@media (max-width: 520px) {
  .chapter-nav {
    max-width: 100%;
  }

  .beat-list li {
    font-size: 0.92rem;
  }
}
