/* ============================================================
   Nomaly — Built different. By design.
   Dark-first, monochrome + single coral accent (the anomaly).
   ============================================================ */

:root {
  --bg: #161616;
  --surface: #1b1b1b;
  --border: #2e2e2e;
  --text: #f2f2f2;
  --text-muted: #8f8f8f;
  --text-subtle: #6a6a6a;
  --ink: #1a1a1a;
  --accent: #e8503a;
  --line-dark: #3a3a3a;
  --line-light: #cfcfcf;

  --max: 1120px;
  --pad: clamp(20px, 5vw, 64px);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Lexend', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }

/* constellation canvas sits behind everything, faint */
#constellation {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

main, .site-header, .mobile-nav, .site-footer { position: relative; z-index: 1; }

/* ---------- shared layout ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 12vw, 150px) var(--pad);
}

.section-head { max-width: 720px; margin-bottom: clamp(40px, 6vw, 72px); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 20px;
}

h1, h2, h3, h4 { font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; }

h2 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 300; }
h2 { color: var(--text); }

.section-lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-muted);
  margin-top: 20px;
  max-width: 60ch;
}
.section-lead.muted { color: var(--text-subtle); font-size: 1rem; }

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

/* ---------- header ---------- */
/* floating glass pill header */
.site-header {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--max), calc(100% - 28px));
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 9px 9px 9px 22px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.site-header.scrolled {
  background: rgba(16, 16, 16, 0.72);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand { display: inline-flex; align-items: center; justify-self: start; }
.wordmark { height: 28px; width: auto; display: block; }
.wordmark-sm { height: 26px; }

.nav { display: flex; align-items: center; justify-self: center; gap: clamp(14px, 2vw, 30px); }
.nav a {
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
  white-space: nowrap;
}
.nav a:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 10px; justify-self: end; }

.nav-cta {
  background: #ffffff;
  color: #141414 !important;
  border: 1px solid #ffffff;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.nav-cta:hover { background: #ececec; transform: translateY(-1px); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.menu-toggle span {
  width: 22px; height: 1.5px; background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

.mobile-nav[hidden] { display: none; }
.mobile-nav {
  position: fixed;
  top: 74px;
  left: 14px;
  right: 14px;
  z-index: 49;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 18px 16px;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.mobile-nav a { padding: 13px 0; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav .nav-cta { color: #141414 !important; text-align: center; margin-top: 12px; padding: 12px; }

/* mobile bottom tab bar (shown only on phones) */
.bottom-nav { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 999px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
              border-color 0.2s var(--ease), color 0.2s var(--ease);
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); background: #f05c46; }
.btn-ghost { border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-lg { padding: 16px 34px; font-size: 1.05rem; font-family: var(--mono); }

/* ---------- hero ---------- */
.hero-wrap {
  position: relative;
  overflow: hidden;
}
/* full-width animated shader layer behind the hero (dark-toned) */
#hero-shader {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* immediate fallback until the shader JS loads (or if it can't run) */
  background:
    radial-gradient(1100px 620px at 78% 14%, rgba(232, 80, 58, 0.14), transparent 60%),
    radial-gradient(900px 520px at 8% 92%, rgba(232, 80, 58, 0.06), transparent 55%),
    var(--bg);
}
#hero-shader canvas,
#hero-shader .nm-shader {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
/* subtle vignette so the headline always has contrast over the shader */
#hero-shader::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 100% at 50% 40%, transparent 45%, rgba(22, 22, 22, 0.55) 100%);
}
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(90px, 16vh, 180px) var(--pad) clamp(60px, 10vw, 110px);
  text-align: center;
}
.hero-title {
  font-size: clamp(2.8rem, 8vw, 6rem);
  font-weight: 300;
  line-height: 1.04;
  margin: 8px auto 0;
}
/* big anomaly logo as the hero centerpiece */
.hero-logo {
  margin: 10px auto 0;
  line-height: 0;
}
.hero-logo svg {
  width: clamp(280px, 46vw, 600px);
  height: auto;
  display: block;
  margin: 0 auto;
}
.hero-tagline {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 26px auto 0;
}
.hero-sub {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--text-muted);
  max-width: 42ch;
  margin: 28px auto 0;
}
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}
.descriptor {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: 64px;
  text-transform: lowercase;
}

/* ---------- capability strip (marquee) ---------- */
.strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 20px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.strip-track {
  display: flex;
  align-items: center;
  gap: 26px;
  width: max-content;
  animation: marquee 34s linear infinite;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.strip-track .dot { color: var(--accent); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.strip:hover .strip-track { animation-play-state: paused; }

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(24px, 3vw, 40px);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.card:hover { border-color: #3a3a3a; transform: translateY(-4px); }
.card:hover .stray { transform: translateY(-3px); }
.card-mark { margin-bottom: 24px; }
.card-mark svg { width: 120px; height: auto; }
.card-mark .stray { transition: transform 0.4s var(--ease); transform-origin: center; }
.card h3 { font-size: 1.5rem; margin-bottom: 12px; }
.card p { color: var(--text-muted); }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}

/* ---------- why different ---------- */
.why-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}
.why-copy h2 { margin-top: 4px; }
.why-visual { display: flex; justify-content: center; }
.scatter { width: 100%; max-width: 360px; height: auto; }
.scatter .signal-label {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--accent);
}
.scatter .signal-ring { transform-box: fill-box; transform-origin: center; }
.scatter .noise circle { fill: #4a4a4a; }

/* ---------- how we work ---------- */
.method {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  font-family: var(--mono);
  font-size: clamp(0.82rem, 1.4vw, 0.98rem);
  line-height: 2;
  color: var(--text);
  overflow-x: auto;
}
.c-obj { color: var(--text); }
.c-dot { color: var(--text-subtle); }
.c-fn { color: var(--accent); }
.c-cmt { color: var(--text-subtle); }

.steps { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.steps li {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.step-n {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  padding-top: 3px;
  min-width: 26px;
}
.steps h4 { font-size: 1.1rem; margin-bottom: 4px; }
.steps p { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- about ---------- */
.about-body { max-width: 68ch; }
.about-body p { color: var(--text-muted); font-size: clamp(1.05rem, 1.6vw, 1.2rem); margin-bottom: 22px; }
.about-body em { color: var(--text); font-style: italic; }
.ghost-inline {
  display: inline-block;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 4px;
  padding: 0 6px;
  font-style: italic;
  line-height: 1.2;
}
.about-signoff { color: var(--text) !important; font-weight: 500; }

/* ---------- contact ---------- */
.contact { text-align: center; }
.contact-inner { max-width: 620px; margin: 0 auto; }
.contact h2 { margin: 6px 0 0; }
.contact .section-lead { margin-left: auto; margin-right: auto; }
.contact .btn { margin-top: 36px; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px var(--pad);
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  flex-wrap: wrap;
}
.footer-tag { color: var(--text-subtle); font-size: 0.85rem; margin-top: 14px; }
.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
}
.footer-meta a { color: var(--text-muted); transition: color 0.2s var(--ease); }
.footer-meta a:hover { color: var(--accent); }

/* ---------- selected work (device mockups) ---------- */
.work-showcase {
  display: flex;
  flex-direction: column;
  gap: clamp(72px, 12vw, 150px);
}
.work-item {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: clamp(36px, 6vw, 90px);
}
/* alternate sides */
.work-item:nth-child(even) .work-devices { order: 2; }

.work-devices { position: relative; padding-bottom: 6%; }

/* laptop */
.device-laptop { position: relative; z-index: 1; display: block; }
.laptop-screen {
  display: block;
  border: 9px solid #1b1b1d;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1440 / 785;
  box-shadow: 0 34px 70px rgba(0, 0, 0, 0.55);
  transition: transform 0.4s var(--ease);
}
.laptop-screen img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center; display: block;
}
.laptop-base {
  display: block;
  width: 114%;
  margin: 0 -7%;
  height: 16px;
  background: linear-gradient(#2a2a2e, #141416);
  border-radius: 3px 3px 11px 11px;
  position: relative;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.45);
}
.laptop-base::after {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 15%; height: 6px; background: #0c0c0e; border-radius: 0 0 7px 7px;
}
.device-laptop:hover .laptop-screen { transform: translateY(-4px); }

/* phone overlapping */
.device-phone {
  position: absolute;
  z-index: 2;
  width: 22%;
  right: -3%;
  bottom: -2%;
}
.work-item:nth-child(even) .device-phone { right: auto; left: -3%; }
.phone-screen {
  display: block;
  position: relative;
  border: 6px solid #1b1b1d;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 375 / 812;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}
.phone-screen img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center; display: block;
}
.phone-screen::before {
  content: "";
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 34%; height: 5px; background: #1b1b1d; border-radius: 3px; z-index: 3;
}

/* info */
.work-info h3 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin-bottom: 14px; }
.work-info p { color: var(--text-muted); font-size: 1rem; max-width: 42ch; }
.work-info .tags { margin-top: 20px; }
.work-link {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
  transition: color 0.2s var(--ease);
}
.work-link:hover { color: var(--accent); }

/* gentle float animation on the phone */
@media (prefers-reduced-motion: no-preference) {
  .device-phone { animation: work-float 6.5s ease-in-out infinite; }
  .work-item:nth-child(even) .device-phone { animation-delay: -3s; }
}
@keyframes work-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ---------- team ---------- */
.team-carousel {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.team-track {
  display: flex;
  gap: clamp(16px, 2vw, 26px);
  width: max-content;
  animation: team-slide 36s linear infinite;
  will-change: transform;
}
.team-carousel:hover .team-track { animation-play-state: paused; }
@keyframes team-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.team-card { flex: 0 0 auto; width: clamp(200px, 19vw, 240px); text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .team-carousel { overflow-x: auto; }
  .team-track { animation: none; }
}
.team-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.team-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  filter: grayscale(1) contrast(1.02);
  transition: filter 0.4s var(--ease), transform 0.5s var(--ease);
}
.team-card:hover .team-photo img { filter: grayscale(0); transform: scale(1.04); }
.team-socials {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.team-card:hover .team-socials { opacity: 1; transform: translateY(0); }
.team-socials a {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #141414;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.team-socials a:hover { background: var(--accent); color: #fff; }
.team-socials svg { width: 15px; height: 15px; }
.team-card h3 { font-size: 1.1rem; margin-top: 16px; }
.team-role { color: var(--text-muted); font-size: 0.88rem; margin-top: 3px; }

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .site-header {
    grid-template-columns: auto;
    width: auto;
    max-width: calc(100% - 24px);
    left: 12px;
    transform: none;
    padding: 9px 18px;
    border-radius: 14px;
    border: none;
  }
  .nav { display: none; }
  .header-actions { display: none; }
  .menu-toggle { display: none; }
  .mobile-nav { display: none !important; }
  body { padding-bottom: 92px; }

  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 60;
    padding: 9px 6px;
    border-radius: 22px;
    background: rgba(20, 20, 20, 0.72);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-subtle);
    font-size: 0.64rem;
    font-weight: 500;
    transition: color 0.2s var(--ease);
  }
  .bottom-nav a svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .bottom-nav a.active { color: var(--accent); }

  .cards { grid-template-columns: 1fr; }
  .work-item { grid-template-columns: 1fr; gap: 30px; }
  .work-item:nth-child(even) .work-devices { order: 0; }
  .work-devices { padding-bottom: 2%; }
  .device-phone { width: 26%; }
  .why-grid { grid-template-columns: 1fr; }
  .why-visual { order: -1; }
  .method { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; align-items: flex-start; }
  .footer-meta { text-align: left; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
