@import url("../fonts/fonts.css");

/* ============================================================ tokens */

:root {
  /* sampled from assets/brand/Curve.png and Poly Line.png */
  --ink:        #0D151A;
  --ink-soft:   #162126;
  --paper:      #E0FFB8;
  --surface:    #D8F5AE;
  --mint:       #D6DCDC;
  --mint-dim:   #93A3A6;
  --muted:      #55646A;
  --border:     #D2D9D8;
  --border-dark:#243238;
  --accent:     #365C65;
  --accent-lift:#2B4C54;
  --accent-on-dark: #7FA8B0;

  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 8px;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px; --s11: 176px;

  --container: 1280px;
  --gutter: clamp(20px, 4vw, 48px);
  --rail: clamp(68px, 9vw, 136px);

  --fs-display: clamp(2.6rem, 1.7rem + 4.0vw, 5rem);
  --fs-h2:      clamp(2rem, 1.35rem + 2.5vw, 3.25rem);
  --fs-h3:      clamp(1.2rem, 1.06rem + 0.6vw, 1.55rem);
  --fs-lead:    clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-body:    1rem;
  --fs-sm:      0.875rem;
  --fs-label:   0.75rem;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --t: 150ms var(--ease);
}

/* ============================================================ base */

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

/* smooth in-page scrolling for anchor links (nav, hero, footer): this is
   navigation feedback, not a content entrance animation, so it sits outside
   the two-idea motion budget. Turned off below under reduced motion. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* anchor targets clear the sticky header instead of landing underneath it */
:where(h1, h2, h3, section, article)[id] { scroll-margin-top: 92px; }

@media (max-width: 860px) {
  :where(h1, h2, h3, section, article)[id] { scroll-margin-top: 16px; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: "Outfit", system-ui, sans-serif;
  font-weight: 250;
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.06;
  text-wrap: balance;
}

h1 { font-size: var(--fs-display); letter-spacing: -0.035em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 300; line-height: 1.2; letter-spacing: -0.015em; }

p { margin: 0 0 var(--s4); max-width: 64ch; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: inherit; }

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

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

.dark :focus-visible { outline-color: var(--accent-on-dark); }

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

.skip {
  position: absolute; left: var(--s4); top: -100px; z-index: 100;
  background: var(--ink); color: var(--mint);
  padding: var(--s3) var(--s5); border-radius: var(--r-md);
  font-size: var(--fs-sm); text-decoration: none;
  transition: top var(--t);
}
.skip:focus { top: var(--s4); }

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

/* ============================================================ layout */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.band { position: relative; }

.dark {
  background: var(--ink);
  color: var(--mint);
}
.dark h1, .dark h2, .dark h3 { color: var(--mint); }
.dark p { color: var(--mint-dim); }

/* the brand grain, lifted from the Poly Line poster */
.grain::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the teal sweep, also from the poster */
.sweep::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 92% -10%, rgba(206,217,214,0.26) 0%, rgba(206,217,214,0.10) 26%, rgba(46,90,98,0.22) 46%, rgba(13,21,26,0) 72%);
}

.band > .wrap { position: relative; z-index: 1; }

/* ---- the weft: hairlines that draw in once, motion idea 1 of 2 */

/* the rule keeps its full box so IntersectionObserver can see it;
   only the inner line is scaled, otherwise a scaleX(0) target has zero
   area and never reports as intersecting */
.weft {
  position: relative;
  height: 1px;
  overflow: hidden;
}
.weft::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--border);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 700ms var(--ease);
}
.dark .weft::after { background: var(--border-dark); }
.weft.is-drawn::after { transform: scaleX(1); }
.no-js .weft::after, .weft.is-static::after { transform: scaleX(1); transition: none; }

/* ---- the warp: index rail */

.rail-row {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 var(--s5);
  align-items: start;
}

/* the index rail as an oversized type moment, not a caption: the number is
   a graphic mark that anchors the row, so it is set in the display face at
   a scale that competes with the heading rather than hiding beside it */
.rail-num {
  font-family: "Outfit", sans-serif;
  font-size: clamp(2.5rem, 1.9rem + 2.3vw, 4rem);
  font-weight: 200;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--accent);
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.dark .rail-num { color: var(--accent-on-dark); opacity: 0.55; }

.label {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s5);
}
.dark .label { color: var(--accent-on-dark); }

.lead { font-size: var(--fs-lead); color: var(--muted); line-height: 1.55; }
.dark .lead { color: var(--mint-dim); }

/* ============================================================ buttons and links */

.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-sm); font-weight: 500; letter-spacing: 0.01em;
  padding: 13px 22px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t), border-color var(--t), color var(--t), transform var(--t);
}
.btn svg { width: 14px; height: 14px; transition: transform var(--t); }
.btn:hover svg { transform: translateX(3px); }

.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: var(--accent-lift); }
.btn-primary:active { transform: translateY(1px); }

.dark .btn-primary { background: var(--mint); color: var(--ink); }
.dark .btn-primary:hover { background: var(--paper); }

.btn-ghost { border-color: var(--border); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.dark .btn-ghost { border-color: var(--border-dark); color: var(--mint); }
.dark .btn-ghost:hover { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }

.tlink {
  color: var(--accent); text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size var(--t), color var(--t);
}
.tlink:hover { background-size: 0% 1px; }
.dark .tlink { color: var(--accent-on-dark); background-image: linear-gradient(var(--accent-on-dark), var(--accent-on-dark)); }

/* ============================================================ header */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(13, 21, 26, 0.92);
  border-bottom: 1px solid var(--border-dark);
  color: var(--mint);
}
@supports (backdrop-filter: blur(6px)) {
  .site-header { backdrop-filter: blur(8px); }
}

.header-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s5);
  height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--mint); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: "Outfit", sans-serif; font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; }

.nav { display: flex; align-items: center; gap: var(--s6); }
.nav a {
  font-size: var(--fs-sm); text-decoration: none; color: var(--mint-dim);
  transition: color var(--t);
}
.nav a:hover { color: var(--mint); }

.header-cta { padding: 9px 16px; font-size: var(--fs-sm); }

/* below 860px the nav moves to its own row under the logo, so every link
   stays reachable without a JS drawer. The header stops being sticky there
   so the taller header does not eat the viewport. */
@media (max-width: 860px) {
  .site-header { position: static; }
  .header-in {
    height: auto;
    flex-wrap: wrap;
    padding-block: 12px;
    gap: 4px var(--s4);
  }
  .brand { order: 1; }
  .header-cta { order: 2; }
  .nav {
    order: 3;
    width: 100%;
    gap: var(--s5);
    border-top: 1px solid var(--border-dark);
    margin-top: 4px;
  }
  .nav a { padding-block: 12px; }
}

/* ============================================================ hero */

.hero { padding-block: clamp(var(--s8), 7vw, var(--s10)) clamp(var(--s8), 7vw, var(--s9)); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(var(--s7), 6vw, var(--s9));
  align-items: center;
}

.hero h1 { margin-bottom: var(--s6); max-width: 14ch; }
.hero .lead { max-width: 52ch; margin-bottom: var(--s7); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

.mark-stage {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  display: grid;
  place-items: center;
}
.mark-static { width: 72%; height: auto; color: var(--mint); opacity: 0.92; }
.mark-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* the flat mark is taken out of the DOM by the script as soon as the first
   WebGL frame is on screen. No transition is involved, because a transition
   that is frozen (a background tab, for one) would leave both marks visible. */
.mark-stage.is-3d .mark-static { display: none; }

/* on narrow screens the headline leads. The mark drops below the text and
   gets small: the header already carries it, so a full-width logo above the
   headline would just push the message off the first screen. */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s7); }
  .mark-stage { max-width: 168px; margin-inline: 0; }
  .hero h1 { max-width: 100%; }
}

/* ============================================================ services */

.services { padding-block: clamp(var(--s8), 8vw, var(--s10)); }

.section-head { margin-bottom: clamp(var(--s7), 6vw, var(--s9)); }
.section-head h2 { max-width: 20ch; margin-bottom: var(--s5); }

.service { padding-block: clamp(var(--s6), 4vw, var(--s8)); }
.service h3 { margin-bottom: var(--s4); }
.service p { color: var(--muted); }
.dark .service p { color: var(--mint-dim); }

.service-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s5) var(--s7); }

.service-tags {
  list-style: none; margin: var(--s4) 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  font-size: var(--fs-sm); color: var(--muted);
}
.service-tags li { display: flex; align-items: center; gap: var(--s2); }
.service-tags li::before {
  content: ""; width: 10px; height: 1px; background: var(--accent); flex: none;
}

@media (max-width: 760px) {
  .service-body { grid-template-columns: 1fr; gap: var(--s4); }
  .rail-row { grid-template-columns: 1fr; gap: var(--s3); }
  .rail-num { font-size: 2.25rem; margin-bottom: -0.2em; }
}

/* ============================================================ selected work

   Client names are withheld at each business's own request, so this shows
   the systems themselves instead of a logo wall: four real projects, one
   custom icon each, drawn in the site's own tokens rather than a screenshot
   that would give the client away. */

.work { padding-block: clamp(var(--s8), 8vw, var(--s10)); }
.work .section-head h2 { max-width: 30ch; }

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s6);
}

.work-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: var(--s6);
}

.work-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  color: var(--accent);
  margin-bottom: var(--s5);
}
.work-icon svg { width: 100%; height: 100%; }

.work-card .label { margin: 0; }
.work-card h3 { font-size: var(--fs-h3); margin: var(--s2) 0 0; }
.work-card p { color: var(--muted); font-size: var(--fs-sm); margin: var(--s3) 0 0; }
.work-card .service-tags { margin-top: var(--s4); }

.section-note { margin-top: var(--s7); color: var(--muted); font-size: var(--fs-sm); max-width: 62ch; }

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

/* ============================================================ process */

.process { padding-block: clamp(var(--s8), 8vw, var(--s10)); }
.process .section-head h2 { max-width: 18ch; }

.steps { display: grid; gap: 0; }
.step { padding-block: clamp(var(--s6), 4vw, var(--s7)); }
.step-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s4) var(--s7); }
.step h3 { max-width: 24ch; }
.step p { max-width: 60ch; }

@media (max-width: 860px) {
  .step-body { grid-template-columns: 1fr; gap: var(--s3); }
}

/* ============================================================ enquiry */

.enquiry { padding-block: clamp(var(--s8), 7vw, var(--s9)); }
.enquiry-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(var(--s7), 5vw, var(--s9));
  align-items: start;
}
.enquiry h2 { margin-bottom: var(--s5); max-width: 14ch; }

.contact-list { list-style: none; padding: 0; margin: var(--s6) 0 0; font-size: var(--fs-sm); }
.contact-list li { padding-block: var(--s2); color: var(--muted); }
.contact-list strong { display: block; font-weight: 500; color: var(--ink); font-size: var(--fs-label); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 2px; }

.form { display: grid; gap: var(--s5); }
.field { display: grid; gap: var(--s2); }
.field > label { font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.req { color: var(--accent); }

input[type="text"], input[type="email"], textarea {
  font: inherit;
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  width: 100%;
  transition: border-color var(--t), background-color var(--t);
}
input:hover, textarea:hover { border-color: #B9C4C3; }
input:focus, textarea:focus { border-color: var(--accent); outline-offset: 1px; }
textarea { min-height: 148px; resize: vertical; }

.fieldset-reset { border: 0; padding: 0; margin: 0; min-width: 0; }
.legend { margin: 0 0 var(--s2); padding: 0; }

.checks { display: flex; flex-wrap: wrap; gap: var(--s2); }
.check { position: relative; }
.check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check span {
  display: block;
  font-size: var(--fs-sm);
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--muted);
  transition: border-color var(--t), color var(--t), background-color var(--t);
}
.check input:hover + span { border-color: #B9C4C3; }
.check input:checked + span { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-note { font-size: var(--fs-sm); color: var(--muted); }
.form-status { font-size: var(--fs-sm); min-height: 1.5em; }
.form-status:empty { min-height: 0; margin: calc(var(--s5) * -1) 0 0; }
.form-status[data-state="error"] { color: #8A2F2F; }
.form-status[data-state="ok"] { color: var(--accent); }

.error-msg { font-size: var(--fs-sm); color: #8A2F2F; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #8A2F2F; }

@media (max-width: 860px) {
  .enquiry-grid { grid-template-columns: 1fr; gap: var(--s7); }
}

/* ============================================================ footer */

.site-footer { background: var(--ink); color: var(--mint-dim); padding-block: var(--s8) var(--s6); }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--s7);
  padding-bottom: var(--s7);
}
.footer-grid h2 { font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-on-dark); font-family: "Inter Tight", sans-serif; margin-bottom: var(--s4); }
.footer-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); display: grid; gap: var(--s3); }
.footer-list a { color: var(--mint-dim); text-decoration: none; transition: color var(--t); }
.footer-list a:hover { color: var(--mint); }
.footer-note { font-size: var(--fs-sm); max-width: 38ch; margin-top: var(--s4); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); justify-content: space-between;
  padding-top: var(--s5); font-size: var(--fs-sm);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--s6); }
}

/* ============================================================ legal pages */

.doc { padding-block: var(--s8) var(--s10); }
.doc-head { margin-bottom: var(--s7); }
.doc-head h1 { font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem); margin-bottom: var(--s4); }
.doc-meta { font-size: var(--fs-sm); color: var(--muted); }

.doc-body { max-width: 68ch; }
.doc-body h2 {
  font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.65rem);
  margin: var(--s8) 0 var(--s4);
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}
.doc-body h3 { font-size: 1.1rem; margin: var(--s6) 0 var(--s3); }
.doc-body p, .doc-body li { color: var(--muted); }
.doc-body ul { padding-left: 1.1em; margin: 0 0 var(--s4); }
.doc-body li { margin-bottom: var(--s2); }
.doc-body table { width: 100%; border-collapse: collapse; margin: 0 0 var(--s5); font-size: var(--fs-sm); }
.doc-body th, .doc-body td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.doc-body th { color: var(--ink); font-weight: 500; font-size: var(--fs-label); letter-spacing: 0.08em; text-transform: uppercase; }
.doc-body td { color: var(--muted); }

.ph {
  background: var(--surface);
  border-bottom: 1px solid var(--accent);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: var(--r-sm);
  font-size: 0.95em;
}

.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: var(--s5);
  margin-bottom: var(--s7);
  font-size: var(--fs-sm);
  color: var(--muted);
  background: var(--surface);
}

.toc { list-style: none; padding: 0; margin: 0 0 var(--s7); columns: 2; column-gap: var(--s7); font-size: var(--fs-sm); }
.toc li { margin-bottom: var(--s2); break-inside: avoid; }
@media (max-width: 620px) { .toc { columns: 1; } }

/* ============================================================ 404 */

.notfound { min-height: 68vh; display: grid; align-content: center; padding-block: var(--s9); }
.notfound h1 { margin-bottom: var(--s5); max-width: 16ch; }
.notfound .lead { margin-bottom: var(--s7); }

/* ============================================================ motion */

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

@media print {
  .site-header, .site-footer, .hero-actions, .form { display: none; }
  body { background: #fff; color: #000; }
}
