/* ============================================================
   CodeSuture Studios — Design System
   Dark, technical, premium. One accent ("suture thread").
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Surface ramp */
  --bg:          #090B0F;
  --bg-2:        #0C0F14;
  --surface:     #12161C;
  --surface-2:   #171C24;
  --surface-3:   #1E2530;

  /* Lines */
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text:   #ECEFF3;
  --muted:  #9BA4B0;
  --faint:  #6B7682;

  /* Accent — "thread" */
  --thread:      #3FD6BE;
  --thread-soft: rgba(63, 214, 190, 0.14);
  --thread-line: rgba(63, 214, 190, 0.45);
  --thread-glow: rgba(63, 214, 190, 0.25);

  /* Typography */
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Metrics */
  --maxw: 1180px;
  --radius: 14px;
  --radius-lg: 20px;
  --gap: clamp(1rem, 2.5vw, 2rem);
  --section-y: clamp(4.5rem, 9vw, 8rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle engineered grid backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(63,214,190,0.07), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(90,120,255,0.05), transparent 55%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
  pointer-events: none;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--thread);
  color: #04110e;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2rem);
}
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--thread);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--thread-line);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  max-width: 20ch;
}
.section-lead {
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  max-width: 56ch;
  margin-top: 0.75rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--thread);
  color: #04110e;
  box-shadow: 0 8px 30px -10px var(--thread-glow);
}
.btn--primary:hover { box-shadow: 0 12px 38px -8px var(--thread-glow); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { border-color: var(--thread-line); background: var(--thread-soft); }

.btn--block { width: 100%; justify-content: center; }
.btn .arr { transition: transform 0.25s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.site-header.is-stuck {
  background: rgba(9, 11, 15, 0.78);
  border-bottom-color: var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 70px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.08rem;
}
.brand .brand-mark { width: 30px; height: 30px; flex: none; }
.brand b { color: var(--text); font-weight: 600; }
.brand span { color: var(--thread); }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.9rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }

.nav-cta { display: flex; align-items: center; gap: 0.75rem; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  color: var(--text);
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .nav-links, .nav-cta .btn { display: none; }
  .nav-toggle { display: inline-flex; }
  .mobile-nav.is-open { display: block; }
}

.mobile-nav {
  display: none;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 11, 15, 0.96);
  backdrop-filter: blur(10px);
}
.mobile-nav ul { list-style: none; margin: 0; padding: 0.5rem 0 1.25rem; }
.mobile-nav a {
  display: block;
  padding: 0.85rem clamp(1.1rem, 4vw, 2rem);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-head);
}
.mobile-nav a:hover { color: var(--text); background: var(--surface); }
.mobile-nav .btn { margin: 1rem clamp(1.1rem, 4vw, 2rem) 0; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(3.5rem, 8vw, 7rem) clamp(3rem, 7vw, 6rem); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.3rem);
  line-height: 1.02;
  margin-bottom: 1.1rem;
}
.hero h1 .line2 { color: var(--thread); display: block; }
.hero-lead {
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  max-width: 50ch;
  margin-bottom: 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.hero-meta {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  color: var(--faint);
  font-size: 0.9rem;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero-meta span::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--thread); box-shadow: 0 0 10px var(--thread-glow);
}
.hero-visual { position: relative; }
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 460px; margin-inline: auto; }
}

/* ---------- Cards / grids ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 2.5vw, 2rem);
  position: relative;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 24px 50px -30px rgba(0,0,0,0.9);
}
.card h3 { font-size: 1.22rem; }
.card p { color: var(--muted); margin: 0; font-size: 0.97rem; }

.card-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--thread-soft);
  border: 1px solid var(--thread-line);
  margin-bottom: 1.1rem;
}
.card-icon svg { width: 22px; height: 22px; stroke: var(--thread); }

.grid {
  display: grid;
  gap: var(--gap);
  margin-top: clamp(2rem, 4vw, 3rem);
}
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }

/* "What we build" — make the first card span wide on large screens */
.build-grid { grid-template-columns: repeat(6, 1fr); }
.build-grid .card { grid-column: span 2; }
.build-grid .card:nth-child(1),
.build-grid .card:nth-child(2) { grid-column: span 3; }
@media (max-width: 900px) {
  .build-grid { grid-template-columns: repeat(2, 1fr); }
  .build-grid .card, .build-grid .card:nth-child(1), .build-grid .card:nth-child(2) { grid-column: span 1; }
}
@media (max-width: 620px) { .build-grid { grid-template-columns: 1fr; } }

/* ---------- Section head layout ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.section-head .section-lead { margin-top: 0.5rem; }

/* ---------- Selected work / case studies ---------- */
.work-note {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--faint);
  border: 1px dashed var(--border-strong);
  padding: 0.3rem 0.7rem; border-radius: 999px;
  margin-top: 1rem;
}
.case {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}
.case-media {
  aspect-ratio: 16 / 10;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 10px, transparent 10px 20px),
    linear-gradient(135deg, var(--surface-2), var(--bg-2));
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--faint);
  border: 1px solid var(--border);
  margin-bottom: 1.3rem;
  position: relative;
}
.case-media .ph {
  font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.case-media .ph svg { width: 26px; height: 26px; stroke: var(--faint); opacity: 0.7; }
.case h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.case .case-sub { color: var(--muted); margin: 0 0 1.2rem; }

.case-detail { display: grid; gap: 0.9rem; }
.case-row { display: grid; grid-template-columns: 90px 1fr; gap: 0.9rem; align-items: start; }
.case-row dt {
  font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--thread); padding-top: 0.15rem;
}
.case-row dd { margin: 0; color: var(--muted); font-size: 0.95rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--font-head); font-size: 0.75rem;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); padding: 0.2rem 0.6rem; border-radius: 6px;
}
@media (max-width: 560px) { .case-row { grid-template-columns: 1fr; gap: 0.2rem; } }

/* ---------- Process ---------- */
.process {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  margin-top: clamp(2rem, 4vw, 3rem);
}
.step { position: relative; padding-top: 2.4rem; }
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute; top: 0; left: 0;
  font-family: var(--font-head); font-size: 0.95rem; font-weight: 600;
  color: var(--thread);
  padding-bottom: 0.4rem;
}
.step::after {
  content: ""; position: absolute; top: 1.95rem; left: 2.6rem; right: -0.6rem;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--thread-line) 0 6px, transparent 6px 12px);
  opacity: 0.6;
}
.step:last-child::after { display: none; }
.step h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.step p { color: var(--muted); font-size: 0.92rem; margin: 0; }
@media (max-width: 900px) {
  .process { grid-template-columns: repeat(2, 1fr); }
  .step::after { display: none; }
}
@media (max-width: 480px) { .process { grid-template-columns: 1fr; } }

/* ---------- Feature / partner banner ---------- */
.banner {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 3.5rem);
  background:
    radial-gradient(600px 300px at 90% 0%, var(--thread-soft), transparent 70%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  overflow: hidden;
}
.banner h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); max-width: 22ch; }
.banner p { color: var(--muted); max-width: 54ch; }
.banner .pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0; }
.pill {
  font-family: var(--font-head); font-size: 0.82rem;
  color: var(--muted); border: 1px solid var(--border-strong);
  padding: 0.35rem 0.8rem; border-radius: 999px;
}

/* ---------- Technology ---------- */
.tech-list { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.8rem; }
.tech-chip {
  font-family: var(--font-head); font-size: 0.9rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); padding: 0.5rem 1rem; border-radius: 10px;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.tech-chip:hover { border-color: var(--thread-line); color: var(--thread); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem,5vw,4rem); align-items: center; }
.about-points { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1rem; }
.about-points li { display: flex; gap: 0.8rem; color: var(--muted); }
.about-points svg { width: 20px; height: 20px; stroke: var(--thread); flex: none; margin-top: 3px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 3.5rem); }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-channels { display: grid; gap: 1rem; margin-top: 2rem; }
.channel {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.channel:hover { border-color: var(--thread-line); transform: translateY(-2px); }
.channel .ic {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--thread-soft); border: 1px solid var(--thread-line);
}
.channel .ic svg { width: 20px; height: 20px; stroke: var(--thread); }
.channel .label { font-size: 0.78rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; }
.channel .val { color: var(--text); font-family: var(--font-head); }

.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.45rem; }
.field label { font-size: 0.85rem; color: var(--muted); font-family: var(--font-head); }
.field label .req { color: var(--thread); }
.field input, .field select, .field textarea {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.8rem 0.95rem;
  font: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--thread-line);
  box-shadow: 0 0 0 3px var(--thread-soft);
  outline: none;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.form-note { font-size: 0.82rem; color: var(--faint); }
.form-status { font-size: 0.9rem; min-height: 1.2em; }
.form-status.ok { color: var(--thread); }
.form-status.err { color: #ff8585; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: clamp(2.5rem, 5vw, 4rem) 2rem;
  background: var(--bg-2);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}
.footer-grid p { color: var(--muted); max-width: 40ch; font-size: 0.95rem; }
.footer-col h4 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--faint); margin-bottom: 1rem; font-weight: 600;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { color: var(--muted); font-size: 0.95rem; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--faint); font-size: 0.86rem;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Page hero (sub pages) ---------- */
.page-hero { padding-block: clamp(3.5rem, 7vw, 6rem) clamp(2rem, 4vw, 3rem); }
.page-hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); max-width: 18ch; }
.page-hero p { color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.2rem); max-width: 56ch; }
.breadcrumb { color: var(--faint); font-size: 0.85rem; margin-bottom: 1.2rem; font-family: var(--font-head); }
.breadcrumb a:hover { color: var(--text); }

/* Disclosure note (academic integrity, etc.) */
.note-block {
  border: 1px solid var(--border);
  border-left: 3px solid var(--thread);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.3rem 1.5rem;
  color: var(--muted);
}
.note-block strong { color: var(--text); }

/* Checklist items */
.check-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.check-list li { display: flex; gap: 0.75rem; color: var(--muted); }
.check-list svg { width: 20px; height: 20px; stroke: var(--thread); flex: none; margin-top: 3px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  .stitch-draw { stroke-dashoffset: 0 !important; animation: none !important; }
  * { animation-duration: 0.001ms !important; }
}

/* Stagger helper */
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }

/* ---------- Hero stitch SVG animation ---------- */
.stitch-draw {
  stroke-dasharray: 8 8;
  animation: stitch-move 2.4s linear infinite;
}
@keyframes stitch-move { to { stroke-dashoffset: -32; } }

.node-pulse { transform-origin: center; animation: node-pulse 3s var(--ease) infinite; }
.node-pulse:nth-of-type(2) { animation-delay: 0.6s; }
.node-pulse:nth-of-type(3) { animation-delay: 1.2s; }
.node-pulse:nth-of-type(4) { animation-delay: 1.8s; }
@keyframes node-pulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.4; }
}
