:root {
  --bg: #07080a;
  --text: #f4f5f7;
  --muted: #a3a8b0;
  --line: rgb(255 255 255 / .1);
  --accent: #f05138; /* the only accent, same as the glow in the video */
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, Roboto, sans-serif;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

svg { width: 1em; height: 1em; flex: none; }

.accent { color: var(--accent); }

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

/* ---------------------------------------------------------------- Typewriter */

.typed-line { white-space: nowrap; }

.caret {
  display: inline-block;
  width: .08em;
  height: .82em;
  margin-left: .06em;
  vertical-align: -.04em;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 18px rgb(240 81 56 / .6);
  animation: blink 1s steps(1) infinite;
}

/* Solid while typing or deleting, blinking only when idle */
.caret.is-typing { animation: none; }

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------------------------------------------------------------- Hero */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1.25rem, 3vh, 2.5rem);
  min-height: 100vh;
  min-height: 100svh; /* correct height on mobile with the address bar */
  padding: 0 var(--gutter) clamp(1.5rem, 4vh, 3rem);
  overflow: hidden;
  background: var(--bg);
}

/* Media layer: the fallback image is the background, the video sits on top */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
  background-image: url("../assets/img/hero-poster.jpg");
  background-image: image-set(
    url("../assets/img/hero-poster.webp") type("image/webp"),
    url("../assets/img/hero-poster.jpg") type("image/jpeg")
  );
  background-position: center;
  background-size: cover;
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  opacity: 0;                    /* shown only once it is actually playing */
  transition: opacity 1.2s ease;
}

.hero__video.is-ready { opacity: 1; }

/* Overlay: darker on the left behind the headline and at the bottom behind the cards,
   the right side stays open so the swifts are visible */
.hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(7 8 10 / .72) 0%, rgb(7 8 10 / .35) 45%, rgb(7 8 10 / 0) 75%),
    linear-gradient(to bottom, rgb(7 8 10 / .35) 0%, rgb(7 8 10 / 0) 25%, rgb(7 8 10 / 0) 55%, rgb(7 8 10 / .8) 100%);
}

/* ---------------------------------------------------------------- Nav */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -.025em;
  text-decoration: none;
}

.nav__mark {
  font-size: 1.6em;
  color: var(--accent);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.nav__links a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}

.nav__links a:hover {
  color: var(--text);
  background: rgb(255 255 255 / .07);
}

.nav__links .nav__gh {
  border: 1px solid var(--line);
  color: var(--text);
}

/* ---------------------------------------------------------------- Headline */

.hero__content {
  align-self: center;
  max-width: 60rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 1.25rem;
  padding: .4rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(14 15 19 / .5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.pill__dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(240 81 56 / .6);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  70%  { box-shadow: 0 0 0 .5rem rgb(240 81 56 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(240 81 56 / 0); }
}

.hero__title {
  margin: 0;
  font-size: clamp(2.6rem, 6.4vw, 5.5rem);
  line-height: .95;
  font-weight: 800;
  letter-spacing: -.045em;
  text-wrap: balance;
  text-shadow: 0 2px 40px rgb(0 0 0 / .5);
}

.hero__lead {
  max-width: 34rem;
  margin: 1.25rem 0 1.75rem;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: #c3c7cd;
  text-shadow: 0 1px 24px rgb(0 0 0 / .6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .9rem 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 30px rgb(240 81 56 / .3);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgb(240 81 56 / .45);
}

.btn--primary svg { transition: transform .2s ease; }
.btn--primary:hover svg { transform: translateY(2px); }

.btn--ghost {
  border: 1px solid rgb(255 255 255 / .18);
  background: rgb(14 15 19 / .45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
}

.btn--ghost:hover { background: rgb(255 255 255 / .1); }

/* ---------------------------------------------------------------- App cards */

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  scroll-margin-top: 2rem;
}

.app {
  --icon: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--icon) 14%, transparent), transparent 60%),
    rgb(12 13 17 / .62);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.app:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--icon) 55%, transparent);
  box-shadow: 0 20px 50px rgb(0 0 0 / .45), 0 0 40px color-mix(in srgb, var(--icon) 18%, transparent);
}

.app__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .8rem;
}

.app__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: .8rem;
  background: linear-gradient(145deg, var(--icon), color-mix(in srgb, var(--icon) 50%, #000));
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 8px 20px rgb(0 0 0 / .4);
}

.app__index {
  color: rgb(255 255 255 / .22);
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.app__name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 750;
  letter-spacing: -.02em;
}

.app__desc {
  margin: .4rem 0 1rem;
  flex: 1;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--muted);
}

.app__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.app__tags li {
  padding: .2rem .55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}

.app__links {
  display: flex;
  gap: .5rem;
}

.app__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem .95rem;
  border: 1px solid rgb(255 255 255 / .14);
  border-radius: .75rem;
  color: var(--text);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease;
}

.app__btn:hover { background: rgb(255 255 255 / .08); }

.app__btn--primary {
  flex: 1;
  border-color: transparent;
  background: var(--text);
  color: #0b0c0f;
}

.app__btn--primary:hover { background: #fff; }

/* ---------------------------------------------------------------- Focus & motion */

.btn:focus-visible,
.app__btn:focus-visible,
.nav a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .nav__links a:not(.nav__gh) { display: none; }
  .hero__title { font-size: min(2.6rem, 10.4vw); } /* longest typed phrase fits down to 320px */
  .btn { flex: 1 1 100%; justify-content: center; }
}

/* Users who prefer reduced motion get the static background only */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__video { display: none; }
  .pill__dot,
  .caret { animation: none; }
  .btn,
  .btn svg,
  .app,
  .app__btn { transition: none; }
  .btn--primary:hover,
  .app:hover { transform: none; }
}
