/* ============================================================
   Codenest — Engineering Aesthetic
   True dark theme · mono headings · snappy (<300ms) transitions
   ============================================================ */

:root {
  --bg: #0a0e14;
  --bg-alt: #0d1219;
  --surface: #101623;
  --surface-hi: #141c2b;
  --border: #1d2735;
  --border-hi: #2f3f55;
  --text: #e8eef6;
  --muted: #96a5b8;
  --faint: #7b8a9e;
  --accent: #3ce6c8;
  --accent-dim: rgba(60, 230, 200, 0.12);
  --accent-ink: #03110d;
  --amber: #f0b429;
  --green: #43d675;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-fast: 150ms cubic-bezier(0.2, 0, 0.2, 1);
  --t-med: 220ms cubic-bezier(0.2, 0, 0.2, 1);
  --radius: 10px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, .mono { font-family: var(--mono); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  font-family: var(--mono);
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo .tld { color: var(--faint); font-weight: 400; }
.logo .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  transition: color var(--t-fast);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.btn-primary,
.nav-links a.btn-primary:hover { color: var(--accent-ink); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 7px 12px;
  cursor: pointer;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
  white-space: normal;
  text-align: left;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: #5cf0d6;
  box-shadow: 0 0 24px rgba(60, 230, 200, 0.28);
}

.btn-ghost {
  border-color: var(--border-hi);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 9px 16px; font-size: 0.82rem; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 55% at 72% 42%, rgba(60, 230, 200, 0.07), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
}

.hero-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-visual canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 260ms ease;
}
.hero-visual canvas.on { opacity: 1; }
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(10, 14, 20, 0.72) 34%, rgba(10, 14, 20, 0.12) 62%, rgba(10, 14, 20, 0.3) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 108px 0 96px;
  max-width: 720px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin: 0 0 20px;
}
.eyebrow .path { color: var(--faint); }

.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  font-weight: 700;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .sub {
  font-size: 1.13rem;
  color: var(--muted);
  max-width: 58ch;
  margin: 0 0 34px;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.hero-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  margin: 0;
}
.hero-note .ok { color: var(--green); }

.stack-strip {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 16px 0;
  background: rgba(10, 14, 20, 0.6);
}
.stack-strip ul {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 34px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.stack-strip li::before { content: "▸ "; color: var(--accent); }

/* ---------- Sections ---------- */

section { padding: 88px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
}
.section-label::before { content: "// "; color: var(--faint); }

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 14px;
}

.section-intro {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 48px;
}

/* ---------- Work / Project showcase ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-color var(--t-med), transform var(--t-med), box-shadow var(--t-med);
}
.project:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 6px;
}
.project-name {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0;
}
.project-role {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-hi);
  color: var(--muted);
}
.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-live { color: var(--green); border-color: rgba(67, 214, 117, 0.35); background: rgba(67, 214, 117, 0.07); }
.badge-test { color: var(--amber); border-color: rgba(240, 180, 41, 0.35); background: rgba(240, 180, 41, 0.07); }

.project p { color: var(--muted); margin: 0 0 18px; }

.cap-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--muted);
  font-size: 0.94rem;
}
.cap-list li { padding-left: 22px; position: relative; }
.cap-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}
.cap-list strong { color: var(--text); font-weight: 600; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.chip {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 4px 10px;
  border-radius: 5px;
}

/* ---------- Services ---------- */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.service {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  transition: border-color var(--t-med), transform var(--t-med);
}
.service:hover { border-color: var(--accent); transform: translateY(-3px); }

.service-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-dim);
  border: 1px solid rgba(60, 230, 200, 0.25);
  margin-bottom: 20px;
}
.service-icon svg { display: block; }

.service h3 { font-size: 1.05rem; margin: 0 0 12px; letter-spacing: -0.01em; }

.service ul {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.94rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.service li { padding-left: 20px; position: relative; }
.service li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Why ---------- */

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.why-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  transition: border-color var(--t-med);
}
.why-card:hover { border-color: var(--border-hi); }
.why-card h3 { font-size: 1.15rem; margin: 0 0 12px; }
.why-card h3::before { content: "01 "; color: var(--faint); font-size: 0.85em; }
.why-card:nth-child(2) h3::before { content: "02 "; }
.why-card:nth-child(3) h3::before { content: "03 "; }
.why-card:nth-child(4) h3::before { content: "04 "; }
.why-card p { color: var(--muted); margin: 0; }

.why-foot {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
}
.why-foot .ok { color: var(--green); }

/* ---------- CTA ---------- */

.cta-section {
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 65% at 50% 110%, rgba(60, 230, 200, 0.1), transparent 70%),
    var(--bg);
}
.cta-section .section-title { font-size: clamp(1.7rem, 3.4vw, 2.5rem); max-width: 22ch; margin: 0 auto 16px; }
.cta-section .section-intro { margin: 0 auto 36px; }
.cta-alt {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--faint);
}

/* ---------- Project enquiry form ---------- */

.project-form {
  max-width: 660px;
  margin: 0 auto;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.field .req { color: var(--accent); }
.field .opt { color: var(--faint); letter-spacing: 0; }
.field input,
.field select,
.field textarea {
  font-family: var(--sans);
  font-size: 1rem; /* ≥16px prevents iOS zoom-on-focus */
  color: var(--text);
  background: #0b1018;
  border: 1px solid var(--border-hi);
  border-radius: 7px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { resize: vertical; min-height: 96px; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.field select:invalid { color: var(--muted); }
.field input::placeholder,
.field textarea::placeholder { color: var(--faint); opacity: 1; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.project-form .btn { width: 100%; justify-content: center; text-align: center; }
.form-note {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
  margin: 0;
  text-align: center;
}
.form-note:empty { display: none; }
.form-note.sent { color: var(--green); }
.form-note.error { color: var(--amber); }

/* Honeypot — visually removed, invisible to real users */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 640px) {
  .project-form { grid-template-columns: 1fr; padding: 24px; }
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 44px 0;
  font-size: 0.88rem;
  color: var(--faint);
}
.footer-cols {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.footer-brand { font-family: var(--mono); color: var(--muted); }
.footer-brand .tag { display: block; color: var(--faint); font-size: 0.78rem; margin-top: 6px; }
.footer-links {
  display: flex;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-legal { width: 100%; margin-top: 18px; font-size: 0.78rem; font-family: var(--mono); }

/* ---------- Legal pages ---------- */

.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}
.legal h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.legal h2 { font-size: 1.15rem; margin-top: 40px; }
.legal p, .legal li { color: var(--muted); }
.legal .updated { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); }

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 240ms cubic-bezier(0.2, 0, 0.2, 1), transform 240ms cubic-bezier(0.2, 0, 0.2, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .work-grid, .services-grid, .why-grid { grid-template-columns: 1fr; }
  .hero-inner { padding: 76px 0 72px; }
  section { padding: 64px 0; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links li { padding: 10px 0; }
  .hero-visual::after {
    background: linear-gradient(180deg, rgba(10, 14, 20, 0.6) 0%, rgba(10, 14, 20, 0.82) 100%);
  }
}

/* Reveals must never hide content in non-scrolling contexts */
@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Reduced motion ---------- */

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