/* The Long Haul — the Haitruck blog.
   Brand: Outfit + navy/red/aqua/cream palette (see Colors.swift / palette.png).
   Motion notes: transform+opacity only; micro 100–200ms, standard 200–400ms,
   sequences 400–700ms; everything gated behind prefers-reduced-motion. */

@font-face {
  font-family: 'Outfit';
  src: url('/blog/assets/Outfit-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  --red:        #E63746;
  --cream:      #F2FAEF;
  --aqua:       #A7DADC;
  --blue:       #447A9C;
  --navy:       #1D3658;
  --navy-black: #08121F;
  --navy-char:  #152A45;
  --navy-mid:   #2A4A6E;
  --card:       #0D1D33;

  --ink:        var(--cream);
  --ink-dim:    rgba(242, 250, 239, .62);
  --line:       rgba(167, 218, 220, .14);

  --ease-out:   cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-enter: cubic-bezier(0, 0, .2, 1);
  --ease-exit:  cubic-bezier(.4, 0, 1, 1);

  --wrap: 1120px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--navy-black);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red); color: var(--cream); }

img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap {
  width: min(var(--wrap), calc(100% - 2.5rem));
  margin-inline: auto;
}

/* ---------- reading progress (post pages) ---------- */

.progress-track {
  position: fixed; inset: 0 0 auto 0; height: 3px;
  z-index: 60; pointer-events: none;
}
.progress-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--red), #ff6b5e);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- header ---------- */

.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem clamp(1.1rem, 4vw, 2.5rem);
  background: rgba(8, 18, 31, .55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: transform .45s var(--ease-out), border-color .3s linear;
}
.site-head.scrolled { border-color: var(--line); }
.site-head.hidden { transform: translateY(-110%); }

/* "haitruck" goes home (the waitlist); "/blog" returns to the blog index */
.brand {
  display: inline-flex; align-items: center;
  color: var(--cream);
}
.brand a { text-decoration: none; color: inherit; }
.brand .brand-home {
  display: inline-flex; align-items: center; gap: .65rem;
}
.brand .slug { color: var(--aqua); font-weight: 400; transition: color .2s linear; }
.brand .slug:hover { color: var(--cream); }
/* the wheel is the real app-icon tire, background removed, used as an alpha
   mask so it can be tinted with currentColor anywhere it appears */
.wheel {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url('/blog/assets/wheel.png') center / contain no-repeat;
  mask: url('/blog/assets/wheel.png') center / contain no-repeat;
}
.brand .wheel {
  width: 34px; height: 34px; color: var(--cream);
  will-change: transform;
}
.wordmark {
  font-weight: 700; font-size: 1.18rem; letter-spacing: -.02em;
}

/* CTA pill — squash & stretch on press, glow as secondary action */
.cta-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--red); color: var(--cream);
  text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .62rem 1.25rem; border-radius: 999px;
  min-height: 44px;
  box-shadow: 0 0 0 0 rgba(230, 55, 70, 0);
  transition: transform .2s var(--ease-spring), box-shadow .25s var(--ease-enter);
}
.cta-pill:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px -4px rgba(230, 55, 70, .55);
}
.cta-pill:active { transform: scale(1.04, .94); }
.cta-pill svg { width: 15px; height: 15px; transition: transform .2s var(--ease-out); }
.cta-pill:hover svg { transform: translateX(3px); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 92svh;
  display: grid; place-items: center;
  isolation: isolate;
  overflow: hidden;
  /* fallback for no-WebGL: brand gradient */
  background:
    radial-gradient(120% 90% at 80% 10%, var(--navy-char) 0%, transparent 55%),
    radial-gradient(100% 80% at 15% 85%, var(--navy) 0%, transparent 50%),
    var(--navy-black);
}
.page-post .hero { min-height: 62svh; }

.hero-canvas {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
}
/* post-header photo (Pexels) — slow settle-in instead of the shader */
.hero-photo {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  animation: settle 16s var(--ease-out) both;
}
@keyframes settle {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}
.hero-credit {
  position: absolute; right: 1.1rem; bottom: .8rem;
  font-size: .72rem; color: rgba(242, 250, 239, .45);
}
.hero-credit a { color: rgba(167, 218, 220, .7); text-decoration: none; }
.hero-credit a:hover { color: var(--aqua); }
.hero-veil {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to bottom,
      rgba(8, 18, 31, .38) 0%,
      rgba(8, 18, 31, .10) 40%,
      rgba(8, 18, 31, .55) 78%,
      var(--navy-black) 100%);
}

.hero-inner {
  text-align: center;
  padding: 7rem 1.25rem 4rem;
  max-width: 62rem;
}

.eyebrow {
  color: var(--red);
  font-weight: 700; font-size: .82rem;
  letter-spacing: .34em; text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.hero-title {
  font-size: clamp(3.4rem, 11vw, 8rem);
  font-weight: 800; line-height: .98;
  letter-spacing: -.035em;
  color: var(--cream);
  text-wrap: balance;
}
/* word-by-word rise — follow-through via stagger */
.hero-title .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(.55em) rotate(2deg);
}
body.ready .hero-title .w {
  animation: word-rise .8s var(--ease-out) forwards;
  animation-delay: calc(.12s + var(--i, 0) * .09s);
}
@keyframes word-rise {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.hero-sub {
  margin: 1.4rem auto 0;
  max-width: 38rem;
  color: var(--ink-dim);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  font-weight: 300;
}

/* generic entrance used across pages */
.reveal-up {
  opacity: 0; transform: translateY(24px);
}
body.ready .reveal-up {
  animation: rise .7s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * .1s);
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* scroll cue — anticipation loop */
.scroll-cue {
  position: absolute; bottom: 2rem; left: 50%;
  width: 26px; height: 42px;
  transform: translateX(-50%);
  border: 2px solid rgba(242, 250, 239, .35);
  border-radius: 14px;
}
.scroll-cue span {
  position: absolute; top: 7px; left: 50%;
  width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px;
  background: var(--aqua);
  animation: cue 1.8s var(--ease-out) infinite;
}
@keyframes cue {
  0%   { transform: translateY(-2px); opacity: 0; }   /* wind-up */
  25%  { opacity: 1; }
  70%  { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* ---------- ticker ---------- */

.ticker {
  border-block: 1px solid var(--line);
  background: rgba(21, 42, 69, .35);
  overflow: hidden;
  padding: .8rem 0;
  user-select: none;
}
.ticker-track {
  display: flex; gap: 2.6rem; width: max-content;
  animation: ticker 36s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track span {
  display: inline-flex; align-items: center; gap: 2.6rem;
  white-space: nowrap;
  font-weight: 600; font-size: .85rem;
  letter-spacing: .28em; text-transform: uppercase;
  color: rgba(167, 218, 220, .75);
}
.ticker-track i {
  font-style: normal; color: var(--red); font-size: .7rem;
}
@keyframes ticker {
  to { transform: translateX(-50%); }
}

/* ---------- post cards ---------- */

main.wrap { padding-block: 4.5rem 2rem; }

.section-label {
  display: flex; align-items: center; gap: 1rem;
  color: var(--ink-dim);
  font-size: .82rem; font-weight: 700;
  letter-spacing: .3em; text-transform: uppercase;
  margin-bottom: 2.2rem;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.grid {
  display: grid; gap: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

/* scroll-in reveal (observer adds .in), staggered via --d */
.card {
  opacity: 0; transform: translateY(36px);
  transition:
    opacity .7s var(--ease-out) var(--d, 0s),
    transform .7s var(--ease-out) var(--d, 0s);
}
.card.in { opacity: 1; transform: none; }

.card-link {
  display: flex; flex-direction: column; height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  transition:
    transform .3s var(--ease-out),
    border-color .3s linear,
    box-shadow .35s var(--ease-enter);
}
.card-link:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: rgba(167, 218, 220, .35);
  box-shadow: 0 24px 48px -18px rgba(0, 0, 0, .6);
}

/* cover: the post's Pexels photo; brand-gradient fallback when a post
   has no image */
.card-cover {
  position: relative;
  aspect-ratio: 16 / 8.6;
  overflow: hidden;
  background:
    radial-gradient(130% 120% at 12% 0%, color-mix(in srgb, var(--tint) 28%, transparent) 0%, transparent 55%),
    linear-gradient(160deg, var(--navy-char), var(--navy-black) 75%);
}
.card-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease-out);
}
.card-link:hover .card-cover img { transform: scale(1.06); }
.card-cover::after { /* legibility veil under the tag + wheel */
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8, 18, 31, .6), transparent 55%);
}
.card-cover .wheel {
  position: absolute; right: 1rem; bottom: .9rem; z-index: 1;
  width: 42px; height: 42px;
  color: var(--cream);
  filter: drop-shadow(0 2px 8px rgba(8, 18, 31, .65));
  transition: transform .9s var(--ease-out);
}
.card-link:hover .card-cover .wheel { transform: rotate(80deg); } /* wheel rolls */
.card-tag {
  position: absolute; left: 1.1rem; bottom: 1rem; z-index: 1;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--tint);
  padding: .3rem .75rem;
  border: 1px solid color-mix(in srgb, var(--tint) 55%, transparent);
  border-radius: 999px;
  background: rgba(8, 18, 31, .5);
  white-space: nowrap;
}

.card-body { padding: 1.35rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.card-date { color: var(--ink-dim); font-size: .84rem; margin-bottom: .45rem; }
.card-title {
  color: var(--cream);
  font-size: 1.34rem; font-weight: 700; line-height: 1.22;
  letter-spacing: -.015em;
  transition: color .25s linear;
}
.card-link:hover .card-title { color: var(--aqua); }
.card-desc {
  color: var(--ink-dim); font-size: .95rem; font-weight: 300;
  margin-top: .55rem; flex: 1;
}
.card-more {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-top: 1.15rem;
  color: var(--red); font-weight: 600; font-size: .92rem;
}
.card-more svg { width: 15px; height: 15px; transition: transform .25s var(--ease-spring); }
.card-link:hover .card-more svg { transform: translateX(5px); }

/* featured card — spans grid, photo left / text right */
.card.featured { grid-column: 1 / -1; }
.card.featured .card-link { flex-direction: row; min-height: 300px; }
.card.featured .card-cover { flex: 1.15; aspect-ratio: auto; }
.card.featured .card-body { flex: 1; justify-content: center; padding: 2.2rem; }
.card.featured .card-title { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
.card.featured .card-desc { flex: 0 1 auto; font-size: 1.05rem; }
@media (max-width: 720px) {
  .card.featured .card-link { flex-direction: column; }
  .card.featured .card-cover { aspect-ratio: 16 / 8.6; }
}

/* ---------- article (post page) ---------- */

.crumb {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--aqua); text-decoration: none;
  font-size: .9rem; font-weight: 600;
  margin-bottom: 1.6rem;
}
.crumb svg { width: 14px; height: 14px; transition: transform .25s var(--ease-out); }
.crumb:hover svg { transform: translateX(-4px); }

.post-title {
  font-size: clamp(2.2rem, 5.6vw, 4rem);
  font-weight: 800; line-height: 1.06;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.post-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.4rem;
  margin-top: 1.3rem;
  color: var(--ink-dim); font-size: .92rem;
}
.post-meta .tag { color: var(--aqua); text-transform: capitalize; }

.article {
  max-width: 46rem;
  margin-inline: auto;
  padding-block: 3.5rem 1rem;
  font-size: 1.11rem; font-weight: 300;
  color: rgba(242, 250, 239, .88);
}
.article > * { margin-bottom: 1.35rem; }
.article strong { font-weight: 600; color: var(--cream); }

.article h2, .article h3 {
  color: var(--cream); font-weight: 700; letter-spacing: -.02em;
  margin-top: 2.6rem; line-height: 1.25;
}
.article h2 { font-size: 1.75rem; padding-left: 1rem; position: relative; }
.article h2::before { /* red slash marker */
  content: '';
  position: absolute; left: 0; top: .3rem; bottom: .3rem;
  width: 4px; border-radius: 2px;
  background: var(--red);
  transform: skewY(-12deg);
}
.article h3 { font-size: 1.3rem; }

.article a {
  color: var(--aqua);
  text-decoration: none;
  background-image: linear-gradient(var(--red), var(--red));
  background-repeat: no-repeat;
  background-size: 0% 2px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size .3s var(--ease-out), color .2s linear;
}
.article a:hover { background-size: 100% 2px; color: var(--cream); }

.article ul, .article ol { padding-left: 1.4rem; }
.article li { margin-bottom: .55rem; }
.article li::marker { color: var(--red); font-weight: 600; }

.article blockquote {
  background: var(--navy-char);
  border-left: 4px solid var(--aqua);
  border-radius: 0 14px 14px 0;
  padding: 1.1rem 1.4rem;
  font-weight: 400;
  color: var(--cream);
}
.article blockquote > :last-child { margin-bottom: 0; }

.article code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .92em;
  background: var(--navy-char);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .4em;
}
.article pre {
  background: var(--navy-char);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
}
.article pre code { background: none; border: 0; padding: 0; }

.article hr { /* lane markings */
  border: 0; height: 3px; margin-block: 2.6rem;
  background: repeating-linear-gradient(90deg,
    rgba(242, 250, 239, .25) 0 24px, transparent 24px 52px);
}

.article img { border-radius: 16px; }

/* prev / next */
.pager {
  max-width: 46rem;
  margin-inline: auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem;
  padding-block: 2.5rem 1.5rem;
}
.pager a {
  display: block;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 1.05rem 1.25rem;
  text-decoration: none;
  transition: transform .25s var(--ease-out), border-color .25s linear;
}
.pager a:hover { transform: translateY(-4px); border-color: rgba(167, 218, 220, .35); }
.pager .dir { color: var(--red); font-size: .78rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.pager .t { color: var(--cream); font-weight: 600; margin-top: .3rem; line-height: 1.3; font-size: .98rem; }
.pager a.next { text-align: right; }
.pager .spacer { visibility: hidden; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .spacer { display: none; } }

/* ---------- footer ---------- */

.site-foot {
  margin-top: 5rem;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(90% 130% at 50% 130%, var(--navy-char) 0%, transparent 60%),
    var(--navy-black);
  text-align: center;
  padding: 4.5rem 1.25rem 2.2rem;
}
.foot-title {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800; letter-spacing: -.03em;
  margin-bottom: 1.6rem;
}
.foot-title em { font-style: normal; color: var(--red); }
.site-foot .cta-pill { font-size: 1.05rem; padding: .85rem 1.7rem; }
.foot-fine {
  margin-top: 3.2rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem 1.6rem;
  color: rgba(242, 250, 239, .4); font-size: .85rem;
}
.foot-fine a { color: rgba(167, 218, 220, .7); text-decoration: none; }
.foot-fine a:hover { color: var(--aqua); }
.foot-fine .wheel { width: 22px; height: 22px; color: rgba(242, 250, 239, .4); }

/* ---------- reduced motion / screenshot mode ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hero-title .w, .reveal-up, .card { opacity: 1 !important; transform: none !important; }
}

/* ?noanim — used for deterministic screenshots; mirrors reduced-motion */
body.no-anim .hero-title .w,
body.no-anim .reveal-up,
body.no-anim .card { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
body.no-anim .ticker-track, body.no-anim .scroll-cue span, body.no-anim .hero-photo { animation: none !important; }
body.no-anim { scroll-behavior: auto; }
body.no-anim .hero { min-height: 680px; }
body.page-post.no-anim .hero { min-height: 540px; }
