/* ==========================================================================
   AlgoZig — Core theme
   Brand palette, typography, layout shell, header, buttons, footer.
   ========================================================================== */

:root {
  /* Brand palette */
  --az-bg: #11152f;
  --az-surface: #191e3d;
  --az-accent: #7566c1;
  --az-accent-soft: #9a8ce0;
  --az-text: #f5f5fa;
  --az-muted: #b7bcd0;
  --az-line: #303653;

  /* Derived tones */
  --az-accent-hover: #8478cc;
  --az-accent-dim: rgba(117, 102, 193, 0.14);
  --az-accent-line: rgba(117, 102, 193, 0.42);
  --az-surface-raise: #1e2447;
  --az-line-soft: rgba(48, 54, 83, 0.62);
  --az-line-strong: #3d4468;
  --az-header: rgba(17, 21, 47, 0.82);

  /* Typography */
  --az-font-display: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
  --az-font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --az-font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Rhythm */
  --az-radius-sm: 8px;
  --az-radius: 14px;
  --az-radius-lg: 20px;
  --az-shell: 1240px;
  --az-header-h: 76px;
  --az-section-y: clamp(5rem, 9vw, 8.5rem);

  /* Motion */
  --az-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--az-bg);
  color: var(--az-text);
  font-family: var(--az-font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: rgba(117, 102, 193, 0.4);
  color: #fff;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--az-accent-soft);
  text-decoration: none;
  transition: color 0.2s var(--az-ease);
}

a:hover {
  color: var(--az-text);
}

p {
  margin: 0 0 1rem;
  color: var(--az-muted);
}

p:last-child {
  margin-bottom: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.75rem;
  font-family: var(--az-font-display);
  color: var(--az-text);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.028em;
}

h1 {
  font-size: clamp(2.8rem, 5.2vw, 4.4rem);
}

h2 {
  font-size: clamp(2.1rem, 3.8vw, 3.05rem);
}

h3 {
  font-size: clamp(1.28rem, 1.9vw, 1.55rem);
  letter-spacing: -0.022em;
}

h4 {
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

strong {
  color: var(--az-text);
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--az-accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 2000;
  padding: 0.6rem 1rem;
  border-radius: var(--az-radius-sm);
  background: var(--az-accent);
  color: #fff;
  font-size: 0.9rem;
  transition: top 0.2s var(--az-ease);
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--az-shell);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section {
  position: relative;
  padding-block: var(--az-section-y);
}

.section--surface {
  background: var(--az-surface);
  border-top: 1px solid var(--az-line-soft);
  border-bottom: 1px solid var(--az-line-soft);
}

/* Light contrast sections: soft white and grey warmth inside the dark shell */
.section--light,
.section--light-alt {
  --az-bg: #f7f7fb;
  --az-surface: #ffffff;
  --az-text: #151a33;
  --az-muted: #545b74;
  --az-line: #d8dae6;
  --az-line-soft: rgba(62, 68, 96, 0.14);
  --az-line-strong: #c3c6d6;
  --az-accent: #6a5ab6;
  --az-accent-hover: #5a4ba2;
  --az-accent-soft: #5f50a0;
  --az-accent-dim: rgba(106, 90, 182, 0.1);
  --az-accent-line: rgba(106, 90, 182, 0.32);
  --az-surface-raise: #ffffff;
  position: relative;
  background-color: var(--az-bg);
  color: var(--az-text);
  border-top: 1px solid var(--az-line-soft);
  border-bottom: 1px solid var(--az-line-soft);
}

.section--light-alt {
  --az-bg: #eceef4;
  --az-line: #d2d5e3;
}

.section--light h2,
.section--light-alt h2,
.section--light h3,
.section--light-alt h3,
.section--light h4,
.section--light-alt h4 {
  color: var(--az-text);
}

.section--light .eyebrow,
.section--light-alt .eyebrow {
  color: #5b4d9c;
}

.section--light .eyebrow::before,
.section--light-alt .eyebrow::before {
  background: rgba(106, 90, 182, 0.5);
}

.section--light .btn-ghost,
.section--light-alt .btn-ghost {
  border-color: #cdd0de;
  color: var(--az-text);
  background: #ffffff;
}

.section--light .btn-ghost:hover,
.section--light-alt .btn-ghost:hover,
.section--light .btn-ghost:focus-visible,
.section--light-alt .btn-ghost:focus-visible {
  border-color: var(--az-accent);
  color: var(--az-accent);
  background: #ffffff;
}

.section--light ::selection,
.section--light-alt ::selection {
  background: rgba(106, 90, 182, 0.24);
  color: #14172e;
}

.section--divided {
  border-top: 1px solid var(--az-line-soft);
}

.section-head {
  max-width: 780px;
  margin-bottom: clamp(2.25rem, 4vw, 3.25rem);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head--center .section-lead {
  margin-inline: auto;
}

/* Eyebrow label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  font-family: var(--az-font-body);
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--az-accent-soft);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--az-accent-line);
}

.section-head--center .eyebrow::before {
  display: none;
}

.eyebrow--dot::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--az-accent);
}

.eyebrow--plain::before {
  display: none;
}

.section-lead {
  max-width: 62ch;
  font-size: clamp(1.07rem, 1.3vw, 1.2rem);
  line-height: 1.72;
  color: var(--az-muted);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  --bs-btn-focus-box-shadow: 0 0 0 3px rgba(117, 102, 193, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.8rem 1.45rem;
  border-radius: 100px;
  border: 1px solid transparent;
  font-family: var(--az-font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color 0.22s var(--az-ease), border-color 0.22s var(--az-ease),
    color 0.22s var(--az-ease), transform 0.22s var(--az-ease), box-shadow 0.22s var(--az-ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  flex: none;
  transition: transform 0.25s var(--az-ease);
}

.btn-brand {
  background: var(--az-accent);
  border-color: var(--az-accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.btn-brand:hover,
.btn-brand:focus-visible {
  background: var(--az-accent-hover);
  border-color: var(--az-accent-hover);
  color: #fff;
}

.btn-brand:hover svg {
  transform: translateX(2px);
}

.btn-ghost {
  background: transparent;
  border-color: var(--az-line);
  color: var(--az-text);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(154, 140, 224, 0.07);
  border-color: var(--az-line-strong);
  color: var(--az-text);
}

.btn-quiet {
  padding-inline: 0;
  border: 0;
  background: transparent;
  color: var(--az-accent-soft);
}

.btn-quiet:hover {
  color: var(--az-text);
}

.btn-quiet:hover svg {
  transform: translateX(3px);
}

.btn-lg {
  padding: 0.95rem 1.75rem;
  font-size: 1.06rem;
}

.btn-block {
  width: 100%;
}

/* Text link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--az-accent-soft);
}

.link-arrow svg {
  transition: transform 0.25s var(--az-ease);
}

.link-arrow:hover {
  color: var(--az-text);
}

.link-arrow:hover svg {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Header / navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1030;
  background: var(--az-header);
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  transition: background-color 0.3s var(--az-ease), border-color 0.3s var(--az-ease);
}

.site-header.is-scrolled {
  background: rgba(17, 21, 47, 0.94);
  border-bottom-color: var(--az-line-soft);
}

.site-header .navbar {
  --bs-navbar-padding-y: 0;
  height: var(--az-header-h);
  padding: 0;
}

.site-header .navbar > .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
}

/* Logo */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--az-text);
  flex: none;
}

.brand:hover {
  color: var(--az-text);
}

.brand-logo {
  display: block;
  width: auto;
  height: 38px;
  transition: transform 0.35s var(--az-ease);
}

.brand:hover .brand-logo {
  transform: translateY(-1px);
}

.footer-brand .brand-logo {
  height: 34px;
}

/* Desktop nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav .nav-link {
  position: relative;
  padding: 0.6rem 0.9rem;
  border-radius: 100px;
  color: var(--az-muted);
  font-size: 1.04rem;
  font-weight: 450;
  transition: color 0.2s var(--az-ease), background-color 0.2s var(--az-ease);
}

.site-nav .nav-link:hover {
  color: var(--az-text);
  background: rgba(154, 140, 224, 0.06);
}

.site-nav .nav-link.active {
  color: var(--az-text);
}

.site-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.12rem;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--az-accent-soft);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.28s var(--az-ease);
}

.site-nav .nav-link:hover::after {
  transform: translateX(-50%) scaleX(0.55);
}

.site-nav .nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: none;
}

.header-actions .btn {
  padding: 0.68rem 1.3rem;
  font-size: 1rem;
}

/* Mobile toggle */
.navbar-toggler {
  display: none;
  padding: 0.45rem;
  border: 1px solid var(--az-line);
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(117, 102, 193, 0.28);
}

.navbar-toggler-icon {
  width: 22px;
  height: 22px;
  background-image: none;
  position: relative;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--az-text);
  transition: transform 0.25s var(--az-ease), opacity 0.2s var(--az-ease);
}

.navbar-toggler-icon::before {
  top: 8px;
}

.navbar-toggler-icon::after {
  bottom: 8px;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
  transform: translateY(2.5px) rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
  transform: translateY(-2.5px) rotate(-45deg);
}

/* Mobile panel */
@media (min-width: 992px) {
  .mobile-panel {
    display: none !important;
  }
}

.mobile-panel {
  border-top: 1px solid var(--az-line-soft);
  background: rgba(17, 21, 47, 0.98);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.mobile-panel .mobile-nav {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.75rem 0 1.25rem;
  list-style: none;
}

.mobile-panel .nav-link {
  display: block;
  padding: 0.8rem 0.25rem;
  border-bottom: 1px solid var(--az-line-soft);
  color: var(--az-muted);
  font-size: 1.02rem;
}

.mobile-panel .nav-link.active,
.mobile-panel .nav-link:hover {
  color: var(--az-text);
}

.mobile-panel .mobile-cta {
  margin-top: 1.1rem;
}

.site-header + main,
.site-header + .page {
  padding-top: var(--az-header-h);
}

@media (max-width: 991.98px) {
  .site-nav,
  .header-actions .btn {
    display: none;
  }

  .navbar-toggler {
    display: inline-block;
  }

  .site-header .navbar > .shell {
    flex-wrap: wrap;
  }

  .mobile-panel {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  padding-top: clamp(3rem, 5vw, 4.5rem);
  background: #0e1229;
  border-top: 1px solid var(--az-line-soft);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 4vw, 3.5rem);
}

.footer-brand .brand {
  margin-bottom: 1.15rem;
}

.footer-brand p {
  max-width: 36ch;
  font-size: 1rem;
  line-height: 1.75;
}

.footer-col h4 {
  margin-bottom: 1.05rem;
  font-family: var(--az-font-body);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--az-muted);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-list a {
  color: var(--az-text);
  font-size: 1.02rem;
  opacity: 0.82;
  transition: opacity 0.2s var(--az-ease), color 0.2s var(--az-ease);
}

.footer-list a:hover {
  opacity: 1;
  color: var(--az-accent-soft);
}

.footer-note {
  font-size: 0.96rem;
  line-height: 1.7;
  color: var(--az-muted);
}

.footer-address {
  color: var(--az-muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--az-accent-soft);
}

.footer-cta:hover svg {
  transform: translateX(3px);
}

.footer-cta svg {
  transition: transform 0.25s var(--az-ease);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.45rem;
  border-top: 1px solid var(--az-line-soft);
  font-size: 0.9rem;
  color: var(--az-muted);
}

.footer-bottom p {
  margin: 0;
  font-size: inherit;
  color: inherit;
}

.footer-tagline {
  color: var(--az-muted);
}

.footer-tagline span {
  color: var(--az-accent-soft);
}

@media (max-width: 767.98px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }
}

/* --------------------------------------------------------------------------
   Reveal animation
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s var(--az-ease), transform 0.85s var(--az-ease);
  transition-delay: calc(var(--reveal-delay, 0) * 90ms);
}

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

.no-js [data-reveal] {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes azLineUp {
  from {
    opacity: 0;
    transform: translateY(108%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes azRise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes azFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes azFloatAlt {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@keyframes azDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-26px, 22px, 0) scale(1.07);
  }
}

@keyframes azMarquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes azFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Hero entrance */
.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.hero-title .line > span {
  display: block;
  animation: azLineUp 1.05s var(--az-ease) both;
}

.hero-title .line:nth-child(2) > span {
  animation-delay: 0.14s;
}

.hero-enter {
  animation: azRise 1s var(--az-ease) both;
}

.hero-enter--1 {
  animation-delay: 0.06s;
}

.hero-enter--2 {
  animation-delay: 0.2s;
}

.hero-enter--3 {
  animation-delay: 0.34s;
}

.hero-enter--4 {
  animation-delay: 0.46s;
}

.hero-visual {
  animation: azRise 1.15s var(--az-ease) 0.3s both;
}

.mock {
  animation: azFloat 10s ease-in-out infinite;
}

.mock-code {
  animation: azFloatAlt 8.5s ease-in-out infinite;
}

.hero::before {
  animation: azDrift 22s ease-in-out infinite;
}

/* Reduced motion: keep gentle fades, drop movement, floating and marquees. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .mock,
  .mock-code,
  .hero::before,
  .tech-marquee-track {
    animation: none !important;
  }

  [data-reveal] {
    transform: none !important;
    transition: opacity 0.45s linear !important;
    transition-delay: calc(var(--reveal-delay, 0) * 45ms) !important;
  }

  .hero-title .line > span {
    animation: azFadeIn 0.5s ease both !important;
  }

  .hero-title .line:nth-child(2) > span {
    animation-delay: 0.1s !important;
  }

  .hero-enter,
  .hero-visual {
    animation: azFadeIn 0.55s ease both !important;
  }

  .hero-visual {
    animation-delay: 0.18s !important;
  }

  .mock {
    opacity: 1;
  }
}
