/* ==========================================================================
   Farka Labs — site styles
   Brand: Forge orange #F26B3A, Graphite #433A34, Sand #FFF4EE, Glow #FFA27A,
   Ash #6E625B. Headlines: Saira SemiBold (112.5% width). Body: IBM Plex Sans.
   Labels and code: JetBrains Mono.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Saira";
  src: url("assets/fonts/saira-headline.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 600; /* brand uses Regular; range kept for code emphasis */
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --orange: #F26B3A;
  --graphite: #433A34;
  --white: #FFFFFF;
  --glow: #FFA27A;
  --sand: #FFF4EE;
  --ash: #6E625B;
  --black: #000000;

  --orange-deep: #D95A2B;                 /* hover state for orange buttons */
  --line: rgba(67, 58, 52, 0.14);         /* hairlines on light backgrounds */
  --line-dark: rgba(255, 255, 255, 0.12); /* hairlines on dark backgrounds */
  --surface-dark: rgba(255, 255, 255, 0.06);
  --text-on-dark-muted: rgba(255, 255, 255, 0.72);

  --font-head: "Saira", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 600; line-height: 1.1; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -100px;
  padding: 10px 14px; background: var(--graphite); color: var(--white);
  border-radius: var(--radius-sm); z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Type helpers ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--orange);
  margin: 0 0 14px;
}

h1 { font-size: clamp(2.75rem, 6.5vw, 4.5rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h3 { font-size: 1.25rem; line-height: 1.25; }

.lede {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  max-width: 34em;
  color: var(--text-on-dark-muted);
  margin: 20px 0 32px;
}

.section-intro {
  font-size: 1.0625rem;
  color: var(--ash);
  max-width: 40em;
  margin: 16px 0 0;
}

.text-link {
  display: inline-block;
  font-weight: 600;
  color: var(--orange);
  text-decoration: none;
  margin-top: 6px;
}
.text-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 600 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-deep); }

.btn-ghost-dark { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, 0.28); }
.btn-ghost-dark:hover { border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.05); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 200ms var(--ease);
}
.site-header.is-scrolled { box-shadow: 0 8px 24px -16px rgba(67, 58, 52, 0.35); }

.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; padding: 8px 0; }
.brand img { width: 164px; height: auto; }

.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav ul { display: flex; gap: 26px; }
.site-nav a:not(.btn) {
  font-weight: 500; text-decoration: none; color: var(--graphite);
  padding: 8px 0; position: relative;
}
.site-nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px;
  background: var(--orange); transform: scaleX(0); transform-origin: left;
  transition: transform 180ms var(--ease);
}
.site-nav a:not(.btn):hover::after { transform: scaleX(1); }
.btn-nav { min-height: 42px; padding: 10px 18px; font-size: 0.9375rem; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -8px;
  border: 0; background: transparent; cursor: pointer; border-radius: var(--radius-sm);
  position: relative;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  position: absolute; left: 10px; width: 24px; height: 2px;
  background: var(--graphite); border-radius: 2px;
  transition: transform 200ms var(--ease), top 200ms var(--ease), opacity 200ms var(--ease);
}
.nav-toggle-bar { top: 21px; }
.nav-toggle-bar::before { content: ""; left: 0; top: -7px; }
.nav-toggle-bar::after { content: ""; left: 0; top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--graphite); color: var(--white);
  padding: clamp(64px, 11vw, 136px) 0;
}
.hero-mark {
  position: absolute; top: -8%; right: -6%;
  width: clamp(360px, 48vw, 760px); height: auto;
  fill: var(--glow); opacity: 0.07; pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero .eyebrow { color: var(--glow); }
.hero h1 { color: var(--white); }

.code-card {
  margin: 0;
  background: var(--surface-dark);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 28px);
  overflow-x: auto;
}
.code-card pre { margin: 0; font-family: var(--font-mono); font-size: clamp(0.8125rem, 1.15vw, 0.9375rem); line-height: 1.7; color: var(--white); }
.code-card code { font-family: inherit; }
.code-card .k { color: var(--orange); }
.code-card .s { color: var(--glow); }
.code-card .c { color: rgba(255, 255, 255, 0.45); }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section-white { background: var(--white); }
.section-sand { background: var(--sand); }
.section-dark { background: var(--graphite); color: var(--white); }
.section-dark .eyebrow { color: var(--glow); }

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 56px); }

/* Services */
.service-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.service {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
}
.service:hover { border-color: var(--orange); transform: translateY(-2px); }
.service .dia { width: 28px; height: 28px; fill: var(--orange); margin-bottom: 18px; }
.service h3 { margin-bottom: 8px; }
.service p { margin: 0; color: var(--ash); font-size: 0.9875rem; }

/* Products */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.product {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px 28px;
  display: flex; flex-direction: column;
}
.product-next { background: transparent; border-style: dashed; }
.product h3 { font-size: 1.6rem; margin-bottom: 10px; }
.product p { color: var(--ash); flex: 1; }
.product-meta { display: flex; gap: 8px; margin-bottom: 18px; }
.tag {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 400;
  color: var(--ash); background: var(--sand); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; line-height: 1.3;
}
.tag-live { color: var(--orange); border-color: rgba(242, 107, 58, 0.35); background: var(--white); }
.product-next .tag { background: var(--white); }

/* Process */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; }
.step { position: relative; padding-top: 22px; }
.step::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--line);
}
.step::after {
  content: ""; position: absolute; top: 0; left: 0; width: 56px; height: 2px;
  background: var(--orange);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange); color: var(--white);
  font: 600 0.875rem/1 var(--font-body);
  margin-bottom: 16px;
}
.step h3 { font-size: 1.375rem; margin-bottom: 8px; }
.step p { margin: 0; color: var(--ash); }

/* About */
.about-inner { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.about-text { color: var(--text-on-dark-muted); font-size: 1.0625rem; max-width: 36em; margin-top: 20px; }
.about-text + .about-text { margin-top: 0; }
.about-text em { color: var(--white); font-style: italic; }

.facts { margin: 0; border-top: 1px solid var(--line-dark); }
.fact {
  display: grid; grid-template-columns: 110px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line-dark);
}
.fact dt { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--glow); padding-top: 2px; }
.fact dd { margin: 0; font-weight: 500; }
.fact a { color: var(--white); }

/* Contact */
.section-contact {
  position: relative; overflow: hidden;
  background-color: var(--sand);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-6 -6 112 112' width='112' height='112'><g fill='%23F26B3A' fill-opacity='0.055'><path d='M39.44 4.1L0.1 50L39.44 95.9L48.56 88.1L15.9 50L48.56 11.9Z'/><path d='M51.44 11.9L84.1 50L51.44 88.1L60.56 95.9L99.9 50L60.56 4.1Z'/></g></svg>");
  background-repeat: repeat;
  background-size: 112px 112px;
}
.contact-inner {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: start;
}
.contact-lead { font-family: var(--font-head); font-weight: 600; font-size: 1.375rem; color: var(--orange); margin: 10px 0 14px; }
.contact-copy p:not(.eyebrow):not(.contact-lead) { color: var(--ash); max-width: 32em; }
.contact-email { margin-top: 28px; }
.contact-label { display: block; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ash); margin-bottom: 4px; }
.contact-email a { font-weight: 600; color: var(--graphite); text-decoration: none; font-size: 1.125rem; }
.contact-email a:hover { color: var(--orange); }

.contact-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 36px);
}
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 600; font-size: 0.9375rem; }
.req { color: var(--orange); }
.opt { font-weight: 400; color: var(--ash); font-size: 0.8125rem; margin-left: 4px; }

.field input, .field select, .field textarea {
  width: 100%;
  font: 400 1rem/1.4 var(--font-body);
  color: var(--graphite);
  background: var(--white);
  border: 1px solid rgba(67, 58, 52, 0.28);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.field textarea { resize: vertical; min-height: 140px; }
.field select {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%23433A34' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input::placeholder, .field textarea::placeholder { color: rgba(110, 98, 91, 0.7); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.22);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #C8431A; }

.form-error {
  margin: -6px 0 16px; padding: 10px 14px;
  background: rgba(242, 107, 58, 0.1); border: 1px solid rgba(242, 107, 58, 0.4);
  border-radius: var(--radius-sm); font-size: 0.9375rem;
}
.form-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.form-note { margin: 0; font-size: 0.8125rem; color: var(--ash); }

.form-success {
  text-align: left;
  padding: 8px 0;
}
.form-success .dia { width: 36px; height: 36px; fill: var(--orange); margin-bottom: 16px; }
.form-success h3 { font-size: 1.5rem; margin-bottom: 8px; }
.form-success p { color: var(--ash); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--graphite); color: var(--white); padding: 56px 0 28px; }
.footer-inner {
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 32px; align-items: start;
  padding-bottom: 32px; border-bottom: 1px solid var(--line-dark);
}
.footer-brand img { width: 150px; height: auto; }
.footer-tag { font-family: var(--font-head); font-weight: 600; color: var(--glow); margin: 16px 0 0; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-nav a, .footer-contact a { color: var(--text-on-dark-muted); text-decoration: none; font-size: 0.9375rem; }
.footer-nav a:hover, .footer-contact a:hover { color: var(--white); text-decoration: underline; }
.footer-contact a { font-family: var(--font-mono); font-size: 0.875rem; }
.footer-legal { padding-top: 22px; }
.footer-legal p { margin: 0; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.55); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .service-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 899px) {
  .hero-inner { grid-template-columns: 1fr; }
  .code-card { max-width: 560px; }
  .about-inner, .contact-inner { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 859px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 32px -20px rgba(67, 58, 52, 0.4);
    padding: 8px var(--gutter) 20px;
    flex-direction: column; align-items: stretch; gap: 8px;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a:not(.btn) { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.0625rem; }
  .site-nav a:not(.btn)::after { display: none; }
  .btn-nav { margin-top: 12px; min-height: 48px; }
}

@media (max-width: 639px) {
  :root { --header-h: 64px; }
  .brand img { width: 136px; }
  .service-grid, .product-grid, .steps { grid-template-columns: 1fr; }
  .steps { gap: 24px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .actions .btn { flex: 1 1 auto; }
  .fact { grid-template-columns: 92px 1fr; }
  .hero-mark { top: auto; bottom: -30%; right: -30%; width: 110vw; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
