/* Midsys AI landing page. Plain CSS, no build step.
   One theme for everyone: a West Texas day.
   Shape rule: pills to press, 14px for the product window, nothing else rounded. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Page */
  --bg: #f0ebdf;
  --bg-raised: #f7f3ea;
  --text: #17181f;
  --muted: #55545a;
  --rule: rgb(23 24 31 / 0.14);
  --accent: #a3461f;
  --btn-bg: #17181f;
  --btn-fg: #f0ebdf;
  --nav-bg: rgb(240 235 223 / 0.78);
  --shot-glow: rgb(163 70 31 / 0.18);
  --shot-shade: rgb(70 52 40 / 0.3);
  --grain: 0.05;

  /* The landscape, read by main.js. The floor is the page, so the hero melts into it. */
  --sky-top: #6fa0c6;
  --sky-mid: #b4d0df;
  --sky-horizon: #e9e7d9;
  --sky-glow: #332b1c;
  --ridge-far: #9fb4c8;
  --ridge-near: #8d5a42;
  --stars: 0;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shell: 1240px;
  --gutter: clamp(20px, 4.5vw, 56px);
  --nav-h: 68px;
}

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

html {
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
}

h1,
h2,
h3,
p,
ol,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}
ol {
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 80;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
}
.skip:focus {
  top: 12px;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Type */
.display {
  font-weight: 430;
  font-stretch: 108%;
  letter-spacing: -0.028em;
  line-height: 1.04;
  text-wrap: balance;
}
h1.display {
  font-size: clamp(36px, 5.2vw, 72px);
  max-width: 21ch;
}
h2.display {
  font-size: clamp(30px, 3.9vw, 54px);
  max-width: 22ch;
}
.lede {
  color: var(--muted);
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
  max-width: 54ch;
  text-wrap: pretty;
}
.label {
  font-family: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding-inline: 26px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 560;
  white-space: nowrap;
  transition:
    transform 0.3s var(--ease),
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}
.btn:active {
  transform: translateY(1px) scale(0.985);
}
.btn-solid {
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.btn-line {
  border: 1px solid color-mix(in srgb, var(--text) 32%, transparent);
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.btn-small {
  height: 40px;
  padding-inline: 18px;
  font-size: 15px;
}
@media (hover: hover) {
  .btn-solid:hover {
    transform: translateY(-1px);
  }
  .btn-line:hover {
    border-color: var(--text);
  }
}

/* Nav */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition:
    background-color 0.35s,
    border-color 0.35s;
}
.nav.is-stuck {
  background: var(--nav-bg);
  border-bottom-color: var(--rule);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.nav-row {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-stretch: 108%;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 34px);
  font-size: 15.5px;
}
.nav-links a:not(.btn) {
  color: color-mix(in srgb, var(--text) 78%, transparent);
  transition: color 0.2s;
}
.nav-links a:not(.btn):hover {
  color: var(--text);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0%,
    var(--sky-mid) 42%,
    var(--sky-horizon) 66%,
    var(--ridge-near) 67%,
    var(--bg) 100%
  );
  overflow: clip;
}
.hero-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s ease;
  transform-origin: 50% 70%;
}
.hero-scene.is-live {
  opacity: 1;
}
.hero-copy {
  position: relative;
  z-index: 1;
  padding-top: clamp(112px, 17vh, 164px);
  padding-bottom: 38vh;
}
.hero-copy .lede {
  margin-top: clamp(18px, 2.2vw, 28px);
  color: color-mix(in srgb, var(--text) 80%, transparent);
  max-width: 46ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(26px, 3vw, 40px);
}
.nav-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 55vh;
  pointer-events: none;
}

/* Sections */
.section {
  position: relative;
  padding-block: clamp(88px, 13vw, 176px);
}

/* Product */
.product-head .display {
  margin-top: 18px;
}
.product-head .lede {
  margin-top: clamp(18px, 2vw, 26px);
}
.shot {
  margin-top: clamp(44px, 6vw, 84px);
  border-radius: 14px;
  overflow: hidden;
  background: #fafafa;
  box-shadow:
    0 0 0 1px var(--rule),
    0 50px 130px -40px var(--shot-glow),
    0 36px 70px -28px var(--shot-shade);
  transform-origin: 50% 100%;
}
.shot img {
  width: 100%;
  height: auto;
}
.caps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(24px, 3vw, 44px);
  margin-top: clamp(48px, 6vw, 84px);
}
.caps > div {
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.caps dt {
  font-size: 19px;
  font-weight: 560;
  font-stretch: 106%;
  letter-spacing: -0.01em;
}
.caps dd {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

/* Approach */
.approach {
  background: var(--bg-raised);
}
.approach-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.approach-title {
  position: sticky;
  top: calc(var(--nav-h) + 40px);
}
.approach-title .lede {
  margin-top: 18px;
  max-width: 34ch;
}
.principles li + li {
  margin-top: clamp(36px, 4.4vw, 60px);
  padding-top: clamp(36px, 4.4vw, 60px);
  border-top: 1px solid var(--rule);
}
.principles h3 {
  font-size: clamp(22px, 2.3vw, 30px);
  font-weight: 480;
  font-stretch: 106%;
  letter-spacing: -0.018em;
  line-height: 1.2;
}
.principles p {
  margin-top: 12px;
  color: var(--muted);
  max-width: 52ch;
}

/* Contact */
.contact {
  overflow: clip;
  padding-bottom: clamp(120px, 16vw, 220px);
}
.contact-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.contact-inner .lede {
  margin-top: 18px;
  max-width: 44ch;
}
.mail {
  position: relative;
  margin-top: clamp(28px, 4vw, 48px);
  font-size: clamp(26px, 5.2vw, 68px);
  font-weight: 430;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  line-height: 1.15;
  padding-bottom: 0.08em;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 2px no-repeat;
  transition:
    background-size 0.5s var(--ease),
    color 0.3s;
}
@media (hover: hover) {
  .mail {
    background-size: 0% 2px;
    background-position: right bottom;
  }
  .mail:hover {
    background-size: 100% 2px;
    background-position: left bottom;
    color: var(--accent);
  }
}
/* The last light on the horizon, under the address. */
.horizon {
  position: absolute;
  inset: auto 0 0 0;
  height: 62%;
  pointer-events: none;
  background:
    radial-gradient(60% 100% at 50% 100%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    linear-gradient(to right, transparent, color-mix(in srgb, var(--accent) 70%, transparent) 50%, transparent) center
      bottom / 100% 1px no-repeat;
}

/* Footer */
.footer {
  padding-block: 34px;
  color: var(--muted);
  font-size: 14.5px;
}
.footer .brand {
  color: var(--text);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 32px;
}

/* Film grain: fixed, never repainted on scroll. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Motion. Everything below is skipped for people who ask for less of it. */
@media (prefers-reduced-motion: no-preference) {
  /* Arrival: the headline, then the sentence, then the two buttons. */
  .hero-copy > * {
    animation: rise 1s var(--ease) both;
  }
  .hero-copy > :nth-child(2) {
    animation-delay: 0.12s;
  }
  .hero-copy > :nth-child(3) {
    animation-delay: 0.24s;
  }

  /* Sections come up once as they enter view. Hidden only when the script is running. */
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition:
      opacity 0.9s var(--ease),
      transform 0.9s var(--ease);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }
  .js [data-shot] {
    opacity: 0;
    transform: perspective(1600px) rotateX(7deg) scale(0.95);
    transition:
      opacity 1.1s var(--ease),
      transform 1.3s var(--ease);
  }
  .js [data-shot].is-in {
    opacity: 1;
    transform: none;
  }

  /* Leaving the hero: the words lift away and the land comes a step closer. */
  @supports (animation-timeline: scroll()) {
    .hero-copy {
      animation: lift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 70vh;
    }
    .hero-scene {
      animation: approach linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
}
@keyframes lift {
  to {
    opacity: 0;
    transform: translateY(-48px);
  }
}
@keyframes approach {
  to {
    transform: scale(1.07);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-scene {
    transition: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .nav.is-stuck {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .btn-line {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Narrow screens: one column everywhere. */
@media (max-width: 900px) {
  .caps {
    grid-template-columns: repeat(2, 1fr);
  }
  .approach-grid {
    grid-template-columns: 1fr;
  }
  .approach-title {
    position: static;
  }
}
@media (max-width: 640px) {
  body {
    font-size: 16.5px;
  }
  .nav-links a:not(.btn) {
    display: none;
  }
  .hero-copy {
    padding-bottom: 34vh;
  }
  .caps {
    grid-template-columns: 1fr;
  }
  /* The board is three times wider than tall: on a phone, show its left half at a readable size. */
  .shot img {
    height: 250px;
    object-fit: cover;
    object-position: 28% 0;
  }
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
