/* ============================================
   crawley.systems — Industrial Editorial Theme
   ============================================ */

:root {
  /* Core palette */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-elevated: #18181b;
  --bg-card: #141416;
  --border: #27272a;
  --border-subtle: #1e1e21;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Accent — warm amber */
  --accent: #f59e0b;
  --accent-dim: #b45309;
  --accent-glow: rgba(245, 158, 11, 0.15);
  --accent-glow-strong: rgba(245, 158, 11, 0.3);

  /* Terminal greens */
  --term-green: #22c55e;
  --term-blue: #60a5fa;
  --term-red: #ef4444;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --section-pad: clamp(80px, 10vw, 140px);
  --container: 1200px;
}

/* ============ RESET ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============ NAVIGATION ============ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 clamp(20px, 4vw, 48px);
  transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}

.nav--scrolled {
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border-subtle);
}

.nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.nav__logo {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.nav__logo-bracket {
  color: var(--text-muted);
  font-weight: 300;
}

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

.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav__links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  transition: color 0.3s;
}

.nav__links a:hover {
  color: var(--text-primary);
}

.nav__cta {
  background: var(--accent) !important;
  color: var(--bg-primary) !important;
  padding: 8px 20px;
  border-radius: 4px;
  font-weight: 500 !important;
  transition: background 0.3s, transform 0.2s !important;
}

.nav__cta:hover {
  background: #fbbf24 !important;
  transform: translateY(-1px);
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px clamp(20px, 4vw, 48px) 80px;
  overflow: hidden;
}

.hero__grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245, 158, 11, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 158, 11, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 70%);
}

.hero__noise {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

.hero__content {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
}

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  opacity: 0;
  animation: fadeUp 0.8s 0.2s forwards;
}

.hero__label-dot {
  width: 8px;
  height: 8px;
  background: var(--term-green);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.hero__title-line {
  display: block;
  opacity: 0;
  animation: fadeUp 0.8s forwards;
}

.hero__title-line--1 { animation-delay: 0.3s; }
.hero__title-line--2 { animation-delay: 0.45s; color: var(--text-secondary); }
.hero__title-line--3 { animation-delay: 0.6s; }

.hero__title-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero__sub {
  max-width: 580px;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.8s 0.8s forwards;
}

/* Terminal */
.hero__terminal {
  max-width: 640px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  animation: fadeUp 0.8s 1s forwards;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.4),
    0 0 0 1px var(--border-subtle),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

.hero__terminal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.hero__terminal-dots {
  display: flex;
  gap: 6px;
}

.hero__terminal-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.hero__terminal-dots i:nth-child(1) { background: #ef4444; }
.hero__terminal-dots i:nth-child(2) { background: #eab308; }
.hero__terminal-dots i:nth-child(3) { background: #22c55e; }

.hero__terminal-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hero__terminal-body {
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.8;
  min-height: 240px;
}

.term-line {
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s, transform 0.3s;
  white-space: pre;
}

.term-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.term-output {
  color: var(--text-secondary);
}

.term-success {
  color: var(--term-green);
}

.term-json {
  color: var(--term-blue);
}

.term-green {
  color: var(--term-green);
}

.term-prompt {
  color: var(--text-primary);
}

.term-cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

/* Scroll indicator */
.hero__scroll-indicator {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeIn 0.8s 4.5s forwards;
}

.hero__scroll-indicator span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scroll-pulse 2s infinite;
}

@keyframes scroll-pulse {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  50.01% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ============ METRICS BAR ============ */
.metrics {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 0 clamp(20px, 4vw, 48px);
}

.metrics__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 0;
}

.metrics__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.metrics__number {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.metrics__suffix {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: var(--accent);
  font-weight: 300;
}

.metrics__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metrics__divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

/* ============ SECTION UTILITIES ============ */
.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}

/* ============ SERVICES ============ */
.services {
  padding: var(--section-pad) clamp(20px, 4vw, 48px);
}

.services__inner {
  max-width: var(--container);
  margin: 0 auto;
}

.services__header {
  margin-bottom: 64px;
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.service-card {
  background: var(--bg-card);
  padding: 40px 36px;
  position: relative;
  transition: background 0.4s;
  opacity: 0;
  transform: translateY(20px);
}

.service-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s, transform 0.6s, background 0.4s;
}

.service-card:hover {
  background: var(--bg-elevated);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card:hover::before {
  width: 100%;
}

.service-card__index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  letter-spacing: 0.08em;
}

.service-card__icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 20px;
  opacity: 0.85;
}

.service-card__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  margin-bottom: 12px;
  line-height: 1.3;
}

.service-card__desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.service-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service-card__tags li {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  letter-spacing: 0.02em;
  transition: border-color 0.3s, color 0.3s;
}

.service-card:hover .service-card__tags li {
  border-color: var(--accent-dim);
  color: var(--text-secondary);
}

/* ============ ABOUT ============ */
.about {
  padding: var(--section-pad) clamp(20px, 4vw, 48px);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.about__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.about__bio {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

.about__bio a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.3s;
}

.about__bio a:hover {
  border-color: var(--accent);
}

.about__stack {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
}

.about__stack-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.about__stack-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stack-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: baseline;
}

.stack-item:last-child {
  border-bottom: none;
}

.stack-item__category {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.stack-item__techs {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ============ ENGAGEMENT ============ */
.engagement {
  padding: var(--section-pad) clamp(20px, 4vw, 48px);
}

.engagement__inner {
  max-width: var(--container);
  margin: 0 auto;
}

.engagement__steps {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 48px;
}

.engagement__step {
  flex: 1;
  padding: 36px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  position: relative;
}

.engagement__step:first-child {
  border-radius: 8px 0 0 8px;
}

.engagement__step:last-child {
  border-radius: 0 8px 8px 0;
}

.engagement__step-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: 16px;
  line-height: 1;
}

.engagement__step h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.engagement__step p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.engagement__step-connector {
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.engagement__step-connector::before {
  content: '';
  width: 100%;
  height: 1px;
  background: var(--accent);
  opacity: 0.4;
}

.engagement__step-connector::after {
  content: '';
  position: absolute;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  transform: rotate(45deg);
  opacity: 0.4;
}

/* ============ CONTACT ============ */
.contact {
  padding: var(--section-pad) clamp(20px, 4vw, 48px);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.contact__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.contact__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 16px;
}

.contact__sub {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.contact__email {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--accent);
  padding: 12px 0;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.3s;
  margin-bottom: 24px;
}

.contact__email:hover {
  border-color: var(--accent);
}

.contact__social {
  display: flex;
  gap: 16px;
}

.contact__social a {
  color: var(--text-muted);
  transition: color 0.3s, transform 0.2s;
}

.contact__social a:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Form */
.contact__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.contact__submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 14px 28px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  align-self: flex-start;
  letter-spacing: 0.02em;
}

.contact__submit:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

.contact__submit:active {
  transform: translateY(0);
}

/* ============ FOOTER ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px clamp(20px, 4vw, 48px);
}

.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}

.footer__copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============ ANIMATIONS ============ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ============ SCROLL REVEAL ============ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .about__inner {
    grid-template-columns: 1fr;
  }

  .contact__inner {
    grid-template-columns: 1fr;
  }

  .engagement__steps {
    flex-direction: column;
  }

  .engagement__step:first-child {
    border-radius: 8px 8px 0 0;
  }

  .engagement__step:last-child {
    border-radius: 0 0 8px 8px;
  }

  .engagement__step-connector {
    width: 100%;
    height: 32px;
  }

  .engagement__step-connector::before {
    width: 1px;
    height: 100%;
  }

  .engagement__step-connector::after {
    right: auto;
    bottom: 0;
    top: auto;
    transform: rotate(135deg);
  }

  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics__inner {
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
  }

  .metrics__divider {
    display: none;
  }

  .metrics__item {
    min-width: 140px;
  }
}

@media (max-width: 640px) {
  .services__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .nav__links a:not(.nav__cta) {
    display: none;
  }

  .hero__terminal {
    display: none;
  }

  .hero__sub {
    margin-bottom: 0;
  }

  .stack-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ============ SELECTION ============ */
::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
