/* =========================================================
   Abbysoft — Systems Atelier
   Palette: ink navy + warm parchment + brass accent
   Type: Fraunces (display) / Inter (body) / IBM Plex Mono (labels)
   ========================================================= */

:root {
  --ink: #10182b;
  --ink-2: #182240;
  --parchment: #f7f2e6;
  --parchment-2: #efe6d2;
  --brass: #b8874c;
  --brass-light: #d7ab74;
  --brass-dark: #8c6432;
  --slate: #545f74;
  --slate-light: #8a93a6;
  --rule: #d9cfb8;
  --rule-dark: #2b3554;
  --error: #a5402b;
  --error-bg: #fbeae5;
  --success-ink: #33532f;
  --success-bg: #eaf1e6;

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

section[id] { scroll-margin-top: 88px; }

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 0.5em; font-weight: 500; }
p { margin: 0 0 1em; }
a { color: inherit; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-light);
  margin: 0 0 1em;
}
.eyebrow-dark { color: var(--brass-dark); }

.section-title {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.75rem);
  color: var(--ink);
}
.section-title--light { color: var(--parchment); }

.section-lead {
  max-width: 620px;
  color: var(--slate);
  font-size: 1.05rem;
}
.section-lead--light { color: var(--slate-light); }

/* subtle paper grain, cheap and cheerful */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- signature motif: drafting corner / registration marks ---------- */
.corner-mark {
  position: absolute;
  width: 34px; height: 34px;
  border-color: var(--brass);
  pointer-events: none;
  opacity: 0.75;
}
.corner-mark--tl { top: 28px; left: 24px; border-top: 1.5px solid var(--brass); border-left: 1.5px solid var(--brass); }
.corner-mark--br { bottom: 28px; right: 24px; border-bottom: 1.5px solid var(--brass); border-right: 1.5px solid var(--brass); }
.corner-mark.small { width: 18px; height: 18px; top: 16px; left: 16px; bottom: auto; right: auto; }
.contact-panel .corner-mark--br.small { top: auto; left: auto; bottom: 16px; right: 16px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 242, 230, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; padding-bottom: 16px;
}
.wordmark { text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }
.wordmark-main { font-family: var(--font-display); font-style: italic; font-size: 1.4rem; color: var(--ink); }
.wordmark-tag { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass-dark); }

.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { text-decoration: none; font-size: 0.95rem; color: var(--ink); }
.site-nav a.nav-cta {
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em;
  border: 1px solid var(--ink); padding: 8px 16px; border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}
.site-nav a.nav-cta:hover { background: var(--ink); color: var(--parchment); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); display: block; }
.mobile-nav { display: none; flex-direction: column; padding: 8px 24px 20px; border-top: 1px solid var(--rule); }
.mobile-nav a { padding: 10px 0; text-decoration: none; color: var(--ink); font-size: 1rem; border-bottom: 1px solid var(--rule); }
.mobile-nav a:last-child { border-bottom: none; }

@media (max-width: 780px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .mobile-nav.open { display: flex; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.03em;
  padding: 13px 24px; border-radius: 2px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brass); color: var(--ink); border-color: var(--brass); }
.btn-primary:hover { background: var(--brass-light); }
.btn-ghost { background: transparent; color: var(--parchment); border-color: rgba(247,242,230,0.4); }
.btn-ghost:hover { border-color: var(--parchment); }
.hero .btn-ghost { color: var(--parchment); }
.contact .btn-primary { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  background: radial-gradient(ellipse at 20% 0%, var(--ink-2), var(--ink) 65%);
  color: var(--parchment);
  padding: 96px 0 88px;
  overflow: hidden;
}
.hero-grid {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center;
}
.hero-headline {
  font-size: clamp(2.4rem, 1.7rem + 3.2vw, 4rem);
  line-height: 1.05;
  color: var(--parchment);
  margin-bottom: 0.4em;
}
.hero-headline em { font-style: italic; color: var(--brass-light); }
.hero-sub { color: #c7cbd8; font-size: 1.1rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin: 28px 0 44px; }

.hero-stats { list-style: none; display: flex; gap: 32px; padding: 0; margin: 0; border-top: 1px solid rgba(247,242,230,0.15); padding-top: 24px; }
.hero-stats li { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: var(--font-display); font-style: italic; font-size: 1.6rem; color: var(--brass-light); }
.stat-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; color: #9aa1b4; line-height: 1.4; }

/* signature visual: blueprint schematic */
.hero-visual { position: relative; }
.schematic { width: 100%; height: auto; }
.schematic-grid path { stroke: rgba(215,171,116,0.14); stroke-width: 1; }
.schematic-lines path {
  stroke: var(--brass-light);
  stroke-dasharray: 5 5;
  opacity: 0.85;
}
.node-shape {
  fill: rgba(183,135,76,0.08);
  stroke: var(--brass-light);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.node-api { fill: none; }
.node-dot { fill: var(--brass-light); stroke: none; }
.reg-marks path { stroke: rgba(215,171,116,0.5); fill: none; }

.schematic-lines path,
.node-shape {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draft-in 2.6s ease-out forwards;
}
.schematic-lines path { animation-delay: 0.1s; }
.node-shape { animation-delay: 0.5s; }
@keyframes draft-in { to { stroke-dashoffset: 0; } }

/* ---------- services ---------- */
.services { padding: 100px 0; position: relative; }
.service-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); margin-top: 48px;
}
.service-card {
  position: relative; background: var(--parchment); padding: 36px 30px 32px;
}
.service-icon { width: 40px; height: 40px; color: var(--brass); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 20px; }
.service-card h3 { font-size: 1.15rem; margin-bottom: 0.5em; }
.service-card p { color: var(--slate); font-size: 0.95rem; margin: 0; }

@media (max-width: 900px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .service-grid { grid-template-columns: 1fr; }
}

/* ---------- process ---------- */
.process {
  position: relative;
  background: var(--ink);
  padding: 100px 0 110px;
}
.process-steps {
  list-style: none; margin: 56px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 28px;
  position: relative;
}
.process-steps::before {
  content: ""; position: absolute; top: 22px; left: 0; right: 0; height: 1px;
  background-image: linear-gradient(to right, var(--brass-dark) 0 6px, transparent 6px 12px);
  background-size: 12px 1px; opacity: 0.6;
}
.process-step { position: relative; }
.step-num { display: block; font-family: var(--font-display); font-style: italic; font-size: 1.7rem; color: var(--brass-light); background: var(--ink); position: relative; z-index: 1; padding-right: 12px; margin-bottom: 12px; }
.process-step h3 { color: var(--parchment); font-size: 1.05rem; }
.process-step p { color: var(--slate-light); font-size: 0.9rem; }

@media (max-width: 900px) {
  .process-steps { grid-template-columns: 1fr 1fr; }
  .process-steps::before { display: none; }
}
@media (max-width: 560px) {
  .process-steps { grid-template-columns: 1fr; }
}

/* ---------- contact ---------- */
.contact { padding: 100px 0 120px; }
.contact-grid {
  display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 56px; align-items: start;
}
.contact-mark { width: 100px; color: var(--brass); margin-top: 32px; opacity: 0.8; }
.contact-mark svg { fill: none; stroke: currentColor; stroke-width: 1.2; width: 100%; height: auto; }

.contact-panel {
  position: relative; background: #fffdf8; border: 1px solid var(--rule);
  padding: 40px; border-radius: 2px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--slate); margin-bottom: 8px; }
.req { color: var(--brass-dark); }

.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--rule); border-radius: 2px;
  background: #fff; font-family: var(--font-body); font-size: 0.95rem; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184,135,76,0.15);
}
.field textarea { resize: vertical; min-height: 100px; }

.hp-wrap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-footer { display: flex; align-items: center; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.form-note { font-size: 0.8rem; color: var(--slate-light); margin: 0; }

.spinner { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 40; stroke-dashoffset: 0; animation: spin 0.8s linear infinite; }
.htmx-indicator { opacity: 0; transition: opacity 0.15s; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

#submit-btn:disabled { opacity: 0.7; cursor: progress; }

#form-status:empty { display: none; }
#form-status {
  margin-top: 20px; padding: 14px 16px; border-radius: 2px; font-size: 0.92rem;
}
#form-status .status-success { color: var(--success-ink); background: var(--success-bg); border: 1px solid #cfe0c8; padding: 14px 16px; border-radius: 2px; }
#form-status .status-error { color: var(--error); background: var(--error-bg); border: 1px solid #f0cec4; padding: 14px 16px; border-radius: 2px; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 380px; margin: 0 auto; order: -1; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-panel { padding: 28px 22px; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 72px 0 56px; }
  .services, .process, .contact { padding: 64px 0; }
  .hero-stats { gap: 20px; }
}

/* ---------- footer ---------- */
.site-footer { background: var(--ink); border-top: 1px solid var(--rule-dark); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--slate-light); }
