/* ==========================================================================
   HTP Software — red / white / black
   ========================================================================== */

:root {
  --red: #89171a;
  --red-bright: #b81e23;
  --red-soft: rgba(137, 23, 26, 0.08);
  --black: #0d0d0f;
  --ink: #1a1a1d;
  --grey: #55555c;
  --line: #e8e6e4;
  --white: #ffffff;
  --off-white: #faf9f8;
  --font-sans: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sora", "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 72px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

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

.mono { font-family: var(--font-mono); }

h1, h2, h3, h4 { font-family: var(--font-display); }

.container {
  width: min(1160px, 100% - 48px);
  margin-inline: auto;
}

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

/* ==========================================================================
   Preloader
   ========================================================================== */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--black);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.is-done { opacity: 0; visibility: hidden; }

.preloader-mark {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: baseline;
  animation: preloader-pulse 1.2s ease-in-out infinite;
}

.preloader-mark .bracket { color: var(--red-bright); }

.preloader-text {
  overflow: hidden;
  white-space: nowrap;
  animation: preloader-type 0.9s steps(3) both;
}

@keyframes preloader-type { from { max-width: 0; } to { max-width: 3ch; } }
@keyframes preloader-pulse { 50% { opacity: 0.75; } }

/* ==========================================================================
   Scroll progress
   ========================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--red-bright));
  z-index: 60;
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: background 0.35s ease, box-shadow 0.35s ease, height 0.35s ease;
  color: var(--white); /* logo text over dark hero */
}

.nav.is-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line), 0 8px 30px rgba(13, 13, 15, 0.06);
  height: 62px;
  color: var(--black);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo { display: inline-flex; color: inherit; }
.nav-logo svg { height: 30px; width: auto; transition: transform 0.3s var(--ease-out); }
.nav-logo:hover svg { transform: scale(1.04); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  position: relative;
  color: inherit;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 0;
}

.nav-links a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--red-bright);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease-out);
}

.nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: left; }

.nav-cta {
  background: var(--red);
  color: var(--white) !important;
  padding: 10px 20px !important;
  border-radius: 999px;
  transition: background 0.25s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}

.nav-cta:hover {
  background: var(--red-bright);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(137, 23, 26, 0.35);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: radial-gradient(1200px 700px at 75% 20%, #1c1416 0%, var(--black) 55%);
  color: var(--white);
  overflow: hidden;
  padding: calc(var(--nav-h) + 48px) 0 96px;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-glow {
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 800px;
  max-height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 30, 35, 0.16), transparent 65%);
  top: -20%;
  right: -15%;
  animation: glow-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes glow-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-8%, 10%) scale(1.15); }
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
}

.hero-eyebrow {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.hero-eyebrow span { color: var(--red-bright); }

.hero-title {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}

.accent-underline {
  position: relative;
  white-space: nowrap;
}

.accent-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.04em;
  width: 100%;
  height: 0.14em;
  background: linear-gradient(90deg, var(--red), var(--red-bright));
  border-radius: 3px;
  transform: scaleX(0);
  transform-origin: left;
  animation: underline-in 0.8s var(--ease-out) 1s forwards;
}

@keyframes underline-in { to { transform: scaleX(1); } }

.hero-rotator {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
}

.rotator {
  position: relative;
  display: inline-block;
  min-width: 15ch;
  height: 1.6em;
}

.rotator-word {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  color: var(--red-bright);
  opacity: 0;
  transform: translateY(60%);
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}

.rotator-word.is-active { opacity: 1; transform: translateY(0); }
.rotator-word.is-leaving { opacity: 0; transform: translateY(-60%); }

.hero-sub {
  color: rgba(255, 255, 255, 0.62);
  max-width: 48ch;
  margin-bottom: 34px;
  font-size: 1.02rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease,
    background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn-arrow { transition: transform 0.25s var(--ease-out); }
.btn:hover .btn-arrow { transform: translateX(4px); }

.btn-primary {
  background: linear-gradient(120deg, var(--red), var(--red-bright));
  color: var(--white);
  box-shadow: 0 10px 30px rgba(137, 23, 26, 0.35);
}

.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 38px rgba(184, 30, 35, 0.45); }

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--white);
}

.btn-ghost:hover { border-color: var(--white); transform: translateY(-3px); }

.btn-light { background: var(--white); color: var(--red); }
.btn-light:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3); }

.btn-ghost-light { border-color: rgba(255, 255, 255, 0.4); color: var(--white); background: none; }
.btn-ghost-light:hover { border-color: var(--white); transform: translateY(-3px); }

/* Code window */
.hero-visual { perspective: 1200px; }

.code-window {
  background: #141417;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(184, 30, 35, 0.08);
  overflow: hidden;
  transform: rotateY(-6deg) rotateX(2deg);
  transition: transform 0.5s var(--ease-out);
}

.code-window:hover { transform: rotateY(0) rotateX(0); }

.code-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: var(--red-bright); }
.dot-grey { background: #5b5b63; }
.dot-dark { background: #2e2e33; }

.code-filename {
  margin-left: 10px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

.code-body {
  padding: 20px 22px 26px;
  font-size: 0.83rem;
  line-height: 1.75;
  color: #d9d9de;
  min-height: 275px;
  white-space: pre-wrap;
}

.code-body .tk-kw { color: var(--red-bright); }
.code-body .tk-str { color: #e8a1a3; }
.code-body .tk-fn { color: #f2f2f4; font-weight: 700; }
.code-body .tk-cm { color: #6a6a72; }

.code-caret {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--red-bright);
  vertical-align: text-bottom;
  animation: caret-blink 0.9s steps(1) infinite;
}

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

/* Scroll hint */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
}

.scroll-hint-wheel {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--red-bright);
  animation: wheel 1.6s ease-in-out infinite;
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ==========================================================================
   Marquee
   ========================================================================== */

.marquee {
  background: var(--red);
  color: var(--white);
  overflow: hidden;
  padding: 16px 0;
  transform: translateZ(0);
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 40px;
  width: max-content;
  animation: marquee 28s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-item {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee-sep {
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.5);
}

@keyframes marquee { to { transform: translateX(-50%); } }

/* ==========================================================================
   Sections (shared)
   ========================================================================== */

.section { padding: 110px 0; }
.section-alt { background: var(--off-white); }

.section-head { max-width: 640px; margin-bottom: 64px; }

.section-eyebrow {
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.section-eyebrow.light { color: rgba(255, 255, 255, 0.75); }

.section-title {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.section-sub { color: var(--grey); font-size: 1.05rem; }

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }
.reveal[data-delay="3"] { transition-delay: 0.3s; }
.reveal[data-delay="4"] { transition-delay: 0.4s; }
.reveal[data-delay="5"] { transition-delay: 0.5s; }

.reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Services cards
   ========================================================================== */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 28px 30px;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease, border-color 0.35s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--red-bright));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 50px rgba(13, 13, 15, 0.1);
  border-color: transparent;
}

.card:hover::before { transform: scaleX(1); }

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--red-soft);
  color: var(--red);
  margin-bottom: 22px;
  transition: background 0.35s ease, color 0.35s ease, transform 0.35s var(--ease-out);
}

.card-icon svg { width: 26px; height: 26px; }

.card:hover .card-icon {
  background: var(--red);
  color: var(--white);
  transform: scale(1.08) rotate(-4deg);
}

.card h3 { font-size: 1.12rem; font-weight: 700; margin-bottom: 10px; }
.card p { color: var(--grey); font-size: 0.94rem; margin-bottom: 18px; }

.card-tag {
  font-size: 0.75rem;
  color: var(--red);
  background: var(--red-soft);
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-block;
}

/* ==========================================================================
   Process
   ========================================================================== */

.process {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 28px;
  position: relative;
  counter-reset: step;
}

.process::before {
  content: "";
  position: absolute;
  top: 26px;
  left: 4%;
  right: 4%;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--red-bright), var(--red));
  opacity: 0.25;
}

.process-step { position: relative; padding-top: 70px; }

.process-num {
  position: absolute;
  top: 0;
  left: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--white);
  border: 2px solid var(--red);
  color: var(--red);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}

.process-step:hover .process-num {
  background: var(--red);
  color: var(--white);
  transform: scale(1.1);
  box-shadow: 0 10px 24px rgba(137, 23, 26, 0.3);
}

.process-step h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.process-step p { color: var(--grey); font-size: 0.9rem; }

/* ==========================================================================
   Why HTP (dark)
   ========================================================================== */

.section-dark {
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(137, 23, 26, 0.18), transparent 60%),
    var(--black);
  color: var(--white);
}

.section-dark .section-sub { color: rgba(255, 255, 255, 0.6); }

.why-inner {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 72px;
  align-items: center;
}

.why-copy .btn { margin-top: 28px; }

.why-list { list-style: none; display: grid; gap: 14px; }

.why-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s var(--ease-out);
}

.why-item:hover {
  border-color: rgba(184, 30, 35, 0.5);
  background: rgba(184, 30, 35, 0.07);
  transform: translateX(8px);
}

.why-marker {
  color: var(--red-bright);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.why-item h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 5px; }
.why-item p { color: rgba(255, 255, 255, 0.6); font-size: 0.92rem; }

/* ==========================================================================
   Technology
   ========================================================================== */

.tech-groups { display: grid; gap: 34px; }

.tech-group {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  align-items: start;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.tech-group:last-child { border-bottom: 0; padding-bottom: 0; }

.tech-group h3 {
  color: var(--red);
  font-size: 0.95rem;
  font-weight: 500;
  padding-top: 8px;
}

.tech-chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease,
    transform 0.25s var(--ease-out), box-shadow 0.25s ease;
  cursor: default;
}

.chip:hover {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(137, 23, 26, 0.28);
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact {
  position: relative;
  background: linear-gradient(135deg, var(--red) 0%, #5e0f12 60%, var(--black) 130%);
  color: var(--white);
  overflow: hidden;
  text-align: center;
}

.contact-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  animation: grid-pan 22s linear infinite;
}

@keyframes grid-pan { to { background-position: 56px 56px; } }

.contact-inner { position: relative; }

.contact-title {
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 18px;
}

.contact-sub {
  color: rgba(255, 255, 255, 0.78);
  max-width: 52ch;
  margin: 0 auto 38px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  background: var(--black);
  color: rgba(255, 255, 255, 0.55);
  padding: 56px 0 40px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  text-align: center;
}

.footer-logo { color: var(--white); opacity: 0.9; transition: opacity 0.3s ease; }
.footer-logo:hover { opacity: 1; }
.footer-logo svg { height: 26px; width: auto; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.25s ease;
}

.footer-links a:hover { color: var(--white); }

.footer-note { font-size: 0.78rem; }
.footer-heart { color: var(--red-bright); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .hero-visual { max-width: 560px; }
  .code-window { transform: none; }
  .why-inner { grid-template-columns: 1fr; gap: 48px; }
  .process { grid-template-columns: repeat(2, 1fr); gap: 36px 28px; }
  .process::before { display: none; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(320px, 80vw);
    flex-direction: column;
    justify-content: center;
    background: var(--black);
    color: var(--white);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
  }

  .nav-links.is-open { transform: translateX(0); }
  .nav-links a { font-size: 1.1rem; }
  .nav.is-scrolled .nav-links { color: var(--white); }
  .nav-toggle { position: relative; z-index: 55; }
  .nav-toggle.is-open { color: var(--white); }

  .section { padding: 80px 0; }
  .process { grid-template-columns: 1fr; }
  .tech-group { grid-template-columns: 1fr; gap: 12px; }
  .scroll-hint { display: none; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

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