/* ==========================================================================
   Nexis Studio
   Aesthetic: an instrument, not a brochure. Drafting-paper ground, ink type,
   one red marker used the way red pencil is used on a technical drawing.
   Separation comes from tone (panels lifted off the ground), not from rules.
   ========================================================================== */

:root {
  /* Surface */
  --paper:      #e8ebe8;   /* cool drafting ground — deliberately not cream   */
  --paper-deep: #e0e4e0;   /* alternating band                                */
  --panel:      #fbfcfb;   /* lifted plane                                    */

  /* Ink */
  --ink:        #14181a;   /* 15.3:1 on paper                                 */
  --muted:      #54605c;   /*  5.4:1 on paper                                 */
  --line:       #c7cdc7;
  --line-soft:  #d7dbd7;
  --line-2:     #a7afa7;   /* hover / emphasis edge */

  /* The marker. Used sparingly: ticks, brackets, one underline.              */
  --marker:     #b52d24;   /*  5.2:1 on paper                                 */

  /* Type */
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", "SF Mono",
          "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --gutter: 24px;
  --wrap: 1180px;
  --band: clamp(66px, 8vw, 112px);
  --radius: 3px;          /* crisp, machined — not soft                       */
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  /* Graph paper. Two gradients, no image request, effectively free to paint. */
  background-image:
    linear-gradient(to right,  rgba(20,24,26,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20,24,26,.035) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Type scale ─────────────────────────────────────────────────────────── */

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.022em; line-height: 1.12; }

h1 {
  font-size: clamp(2.35rem, 5.4vw, 4.1rem);
  letter-spacing: -.038em;
  line-height: 1.03;
}

h2 { font-size: clamp(1.65rem, 3.1vw, 2.35rem); letter-spacing: -.028em; }
h3 { font-size: 1.2rem; letter-spacing: -.015em; }

p { margin: 0; }

/* Mono is the connective tissue: every label, every number. */
.eyebrow, .keyline, .plate dt, .rail__readout, .footer-meta, .case__kicker {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--muted);
}

.eyebrow .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--marker);
}

.eyebrow .tick {
  width: 22px; height: 2px;
  background: var(--marker);
}

.lede {
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  color: var(--muted);
  max-width: 54ch;
}

/* ── Shell ──────────────────────────────────────────────────────────────── */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { left: 12px; top: 12px; }

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

/* ── Signature: the caliper rail ────────────────────────────────────────────
   Ruler ticks down the left edge. The red bracket's HEIGHT is the share of the
   document currently on screen; its position is where in the document you are.
   A scroll indicator rendered as a measurement.                              */

.rail {
  position: fixed;
  left: 28px;
  top: 88px;      /* clears the sticky header */
  bottom: 48px;
  width: 34px;
  z-index: 50;
  pointer-events: none;
  display: none;
}

.rail__scale {
  position: absolute;
  inset: 0 auto 0 0;
  width: 11px;
  /* Minor tick every 12px, major every 60px — a real ruler's cadence. */
  background-image:
    repeating-linear-gradient(to bottom,
      var(--line) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(to bottom,
      rgba(20,24,26,.42) 0 1px, transparent 1px 60px);
  background-size: 6px 100%, 11px 100%;
  background-repeat: no-repeat;
  background-position: 0 0, 0 0;
}

.rail__caliper {
  position: absolute;
  left: 0;
  width: 22px;
  /* Set from JS. Fallbacks keep it sensible before the first frame. */
  top: var(--rail-top, 0%);
  height: var(--rail-size, 18%);
  min-height: 26px;
  border-top: 2px solid var(--marker);
  border-bottom: 2px solid var(--marker);
  border-left: 2px solid var(--marker);
}

/* Hidden at rest. On a page that has not been scrolled, a bare "0.00" floating
   near the top reads as leftover debug output; it only makes sense next to a
   bracket that is visibly moving. Fades in on the first scroll. */
.rail__readout {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  color: var(--marker);
  font-size: .625rem;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .3s ease;
}
.rail__caliper.is-moved .rail__readout { opacity: 1; }

/* Only shown once the centred column leaves enough margin for it. */
@media (min-width: 1300px) { .rail { display: block; } }

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232,235,232,.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.wordmark__mark { flex: none; }
.wordmark__text {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.01em;
}
.wordmark__sub {
  color: var(--muted);
  font-weight: 400;
  margin-left: .45em;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: 12px 14px;
  color: var(--muted);
  font-size: .9375rem;
  text-decoration: none;
  transition: color .18s ease;
}
.site-nav a:hover { color: var(--ink); }

@media (max-width: 900px) { .site-nav { display: none; } }

/* ── Language switcher ──────────────────────────────────────────────────────
   Real links to the sibling pages, so crawlers follow them and the hreflang
   cluster has a matching path through the markup. */

.langs {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--panel);
}

.langs a {
  display: block;
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  border-radius: 2px;
  transition: color .18s ease, background-color .18s ease;
}
.langs a:hover { color: var(--ink); }
.langs a[aria-current="true"] { background: var(--ink); color: var(--paper); }

/* Below this the wordmark subtitle is dropped so the header still fits. */
@media (max-width: 420px) {
  .wordmark__sub { display: none; }
  .langs a { padding: 6px 6px; }
}

/* ── Buttons and links ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 24px;
  min-height: 48px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .78125rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn--sm { padding: 11px 18px; min-height: 42px; font-size: .71875rem; }

.btn--solid {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}
.btn--solid:hover { background: var(--marker); border-color: var(--marker); }
.btn--solid:focus-visible { outline-color: var(--ink); }

.btn--line {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--line:hover { border-color: var(--ink); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding-bottom: 3px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: .78125rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color .18s ease, border-color .18s ease;
}
.link-arrow:hover { color: var(--marker); border-bottom-color: var(--marker); }
.link-arrow svg { transition: transform .18s ease; }
.link-arrow:hover svg { transform: translateX(3px); }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero { padding: clamp(52px, 7vw, 92px) 0 clamp(56px, 7vw, 96px); }

.hero-grid {
  display: grid;
  gap: clamp(40px, 5vw, 72px);
  align-items: start;
}
@media (min-width: 940px) {
  .hero-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .82fr); }
}

/* The one place the marker touches the headline — redlining a drawing.
   Block + fit-content so the rule sits under the whole clause and never
   breaks mid-phrase, where it would read as a link underline. */
.h1-mark {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: .42em;
  font-size: .44em;
  letter-spacing: -.018em;
  line-height: 1.25;
  background-image: linear-gradient(var(--marker), var(--marker));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 3px;
  padding-bottom: .18em;
}
.js .h1-mark { background-size: 0 3px; }
.js .reveal.is-in .h1-mark,
.js .h1-mark.is-drawn {
  background-size: 100% 3px;
  transition: background-size .7s cubic-bezier(.22,.61,.36,1) .35s;
}

.lede { margin-top: 26px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 38px;
}

/* ── Plates: the spec-sheet component ───────────────────────────────────── */

.plate {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px 8px;
}

.plate--hero { padding-top: 30px; }

.regmark {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--line);
}

/* A grid on the <dl> itself, so rows can sit three-up without nesting a second
   <div> inside the first — only one level of div grouping is valid in a <dl>. */
.plate__rows {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.plate__row {
  grid-column: 1 / -1;
  padding: 0 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
}
.plate__row:last-child { border-bottom: 0; }

/* Padding rather than a column gap keeps the rule continuous across the three. */
.plate__row--third { grid-column: auto; padding-right: 14px; }

.plate dt { color: var(--muted); margin: 0 0 6px; }
.plate dd { margin: 0; font-size: .9375rem; }

.figure {
  display: inline-block;
  font-family: var(--mono);
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.figure--sm { font-size: 1.65rem; }
.figure__plus { color: var(--marker); }

/* ── Bands ──────────────────────────────────────────────────────────────── */

.band { padding: var(--band) 0; border-top: 1px solid var(--line); }
.band--alt { background: var(--paper-deep); }

/* Sized in rem, not ch: `ch` here would resolve against the body font rather
   than the h2 inside, and clamp the headings to about half this width. */
.band-head { margin-bottom: clamp(40px, 5vw, 64px); max-width: 34rem; }

/* ── Service cards ──────────────────────────────────────────────────────── */

.cards {
  display: grid;
  gap: 20px;
}
@media (min-width: 780px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 30px 34px;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--ink); transform: translateY(-2px); }

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

/* Keylines label the cards. They are not a sequence, so they are not numbered. */
.keyline {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  background: var(--paper);
}

.card__mark { color: var(--ink); flex: none; }

.card h3 { margin-bottom: 12px; }
.card p { color: var(--muted); font-size: .96875rem; }

/* ── Case studies ───────────────────────────────────────────────────────── */

.case {
  display: grid;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(30px, 4vw, 44px) 0 0;
  border-top: 1px solid var(--line);
  margin-top: clamp(30px, 4vw, 44px);
}
.case:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

@media (min-width: 900px) {
  .case { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); align-items: start; }
}

.case h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
/* Margin lives on the container, not the links — otherwise a wrapped second row
   gets the row gap *and* each link's own top margin, doubling the space. */
.case__links { display: flex; flex-wrap: wrap; gap: 14px 26px; margin-top: 26px; }
.case__links .link-arrow { margin-top: 0; }
.case__kicker { color: var(--muted); margin: 10px 0 18px; }
.case__body > p:not(.case__kicker) { color: var(--muted); max-width: 52ch; }

/* ── Process ────────────────────────────────────────────────────────────── */

.steps {
  display: grid;
  gap: clamp(30px, 4vw, 44px);
}
@media (min-width: 820px) { .steps { grid-template-columns: repeat(3, 1fr); } }

/* A measured division: full-width hairline, with a short marker segment at the
   origin. Keeps the red to a tick rather than three heavy rules. */
.step { position: relative; padding-top: 22px; border-top: 1px solid var(--line); }
.step::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 38px;
  height: 3px;
  background: var(--marker);
}
.step h3 { margin-bottom: 12px; }
.step p { color: var(--muted); font-size: .96875rem; }

/* ── Contact ────────────────────────────────────────────────────────────── */

.band--contact { background: var(--paper-deep); }

.contact-grid {
  display: grid;
  gap: clamp(40px, 5vw, 64px);
  align-items: start;
}
@media (min-width: 900px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, .92fr); }
}

.contact-copy > * { max-width: 34rem; }
.contact-copy h2 { margin-bottom: 22px; }

.mailto {
  display: inline-block;
  margin: 40px 0 26px;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 3.2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid var(--marker);
  padding-bottom: 4px;
  overflow-wrap: anywhere;
  transition: color .18s ease;
}
.mailto:hover { color: var(--marker); }

.contact-note { color: var(--muted); font-size: .9375rem; }

/* ── Form ───────────────────────────────────────────────────────────────────
   Fields read as fields on the plate: same panel, same crisp corner, mono
   label. No placeholder text — every field keeps a real, permanent label. */

.form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 32px);
}

.form__row { margin-bottom: 20px; }

.form label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}

.form input,
.form textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: border-color .18s ease, background-color .18s ease;
}
.form textarea { resize: vertical; min-height: 132px; }

.form input:hover,
.form textarea:hover { border-color: var(--line-2); }

.form input:focus,
.form textarea:focus {
  border-color: var(--ink);
  background: var(--panel);
  outline: 2px solid var(--marker);
  outline-offset: 1px;
}

/* Invalid only after the browser has actually validated on submit, so the form
   is not shouting at someone who has simply not finished typing yet. */
.form.is-validated input:invalid,
.form.is-validated textarea:invalid { border-color: var(--marker); }

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
}

.form button[type="submit"] { border: 1px solid var(--ink); }
.form button[disabled] { opacity: .55; cursor: progress; }

.form__status {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .06em;
  color: var(--muted);
  min-height: 1.2em;
}
.form__status--ok { color: var(--ink); }
.form__status--error { color: var(--marker); }

.form__note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: .8125rem;
  line-height: 1.55;
  color: var(--muted);
}
.form__note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.form__note a:hover { color: var(--ink); }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
}
.footer-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .875rem;
  margin-right: auto;
}
.footer-meta { color: var(--muted); }
.footer-meta a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.footer-meta a:hover { color: var(--ink); }

/* ── Reveal ─────────────────────────────────────────────────────────────────
   Gated behind .js so the page is fully visible with scripting disabled.
   Transform + opacity only — nothing here can shift layout.                  */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease var(--d, 0ms),
              transform .55s cubic-bezier(.22,.61,.36,1) var(--d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .h1-mark { background-size: 100% 3px; transition: none; }
  .card:hover { transform: none; }
  .link-arrow:hover svg { transform: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Printing a spec sheet should look like one. */
@media print {
  .rail, .site-header .btn, .site-nav { display: none; }
  body { background: #fff; }
  .js .reveal { opacity: 1; transform: none; }
}
