/* ==========================================================================
   Korteks — data, analysis and delivery for regulated business
   Design tokens, layout spine, components.
   ========================================================================== */

:root {
  /* Colour */
  --ink:        #0C1A1B;
  --ink-2:      #12292A;
  --paper:      #FFFFFF;
  --paper-2:    #F4F6F5;
  --slate:      #5A6B6C;
  --line:       #DDE2E0;
  --line-dark:  rgba(255, 255, 255, 0.18);
  --accent:     #8F5308;  /* bronze — text-safe on white */
  --flare:      #E9A63C;  /* amber — dark grounds and non-text marks */

  /* Type */
  --display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body:    "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Space */
  --pad:  24px;
  --wrap: 1180px;
  --rail: 0px;          /* left gutter for the spine; set at wide widths */
  --band: clamp(72px, 9vw, 128px);
}

@media (min-width: 1040px) {
  :root { --rail: 150px; --pad: 40px; }
}

/* --------------------------------------------------------------- reset -- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure, figcaption { margin: 0; }
a { color: inherit; }

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 0.75rem;
  z-index: 100;
}
.skip:focus { left: 0; }

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

/* ---------------------------------------------------------------- type -- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 5.8vw, 4.6rem);
  line-height: 1.01;
  letter-spacing: -0.038em;
}

h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.85rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: clamp(1.2rem, 1.6vw, 1.45rem);
  letter-spacing: -0.018em;
  line-height: 1.22;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  font-weight: 400;
  color: #33474A;
  max-width: 34em;
}
.band--ink .lead { color: rgba(255, 255, 255, 0.76); }
h1 + .lead, h2 + .lead { margin-top: 26px; }

.mono {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.measure { max-width: 38em; }

/* -------------------------------------------------------------- layout -- */

.wrap {
  width: min(var(--wrap), 100% - (2 * var(--pad)));
  margin-inline: auto;
  position: relative;
  padding-left: var(--rail);
}

.band { padding-block: var(--band); }
.band--paper2 { background: var(--paper-2); }
.band--ink    { background: var(--ink); color: var(--paper); }
.band--tight  { padding-block: clamp(52px, 6vw, 84px); }
.band--divide { border-top: 1px solid var(--line-dark); }

/* The spine: each band draws its own segment; stacked bands form one line. */
.band > .wrap::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.band--ink > .wrap::before { background: var(--line-dark); }

@media (max-width: 1039px) {
  .band > .wrap::before { display: none; }
}

/* Node marker + margin label */
.node {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--slate);
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.node::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  flex: none;
}
.band--ink .node { color: rgba(255, 255, 255, 0.62); }
.band--ink .node::before { background: var(--flare); }

@media (min-width: 1040px) {
  .node {
    position: absolute;
    left: -3px;          /* centres the 7px marker on the hairline */
    top: 0;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
  }
  .node span { transform: translateY(-1px); }
}

/* ------------------------------------------------------------ nav bar -- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  width: min(var(--wrap), 100% - (2 * var(--pad)));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  text-decoration: none;
  margin-right: auto;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.brand__tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--slate);
  padding-block: 6px;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav__links a:hover { color: var(--ink); border-bottom-color: var(--flare); }
.nav__links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 1099px) {
  .brand__tag { display: none; }
}

@media (min-width: 900px) and (max-width: 1099px) {
  .nav__links { gap: 18px; }
  .nav__links .btn { padding: 12px 16px; }
}

@media (max-width: 899px) {
  .nav__toggle { display: block; }
  .nav__links {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--pad) 20px;
  }
  .nav__links[data-open="true"] { display: flex; }
  .nav__links a { padding-block: 14px; border-bottom: 1px solid var(--line); }
  .nav__links .btn { margin-top: 14px; text-align: center; }
}

/* -------------------------------------------------------------- button -- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }

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

.band--ink .btn {
  background: var(--flare);
  border-color: var(--flare);
  color: var(--ink);
}
.band--ink .btn:hover { background: var(--paper); border-color: var(--paper); }

.band--ink .btn--ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line-dark);
}
.band--ink .btn--ghost:hover { color: var(--flare); border-color: var(--flare); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* ---------------------------------------------------------------- hero -- */

.hero { padding-block: clamp(56px, 7vw, 104px) clamp(64px, 8vw, 112px); }

.hero__grid {
  display: grid;
  gap: clamp(40px, 5vw, 64px);
}
@media (min-width: 1000px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: end;   /* panel sits on the same baseline as the buttons */
  }
}

.hero p.lead { margin-top: 26px; }

/* Lineage panel */
.lineage {
  background: var(--ink);
  padding: 18px;
  max-width: 620px;   /* keeps the diagram at a readable scale when stacked */
}
.lineage__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--line-dark);
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.lineage__head span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; }
.lineage__head .live { color: var(--flare); }

/* The canvas sits behind the diagram and shares its coordinate space. */
.lineage__stage { position: relative; }
.lineage__flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  --dot-raw: #8C9C99;   /* a record as it arrives */
  --dot-clean: #E9A63C; /* the same record once the controls have cleared it */
}
.lineage svg { position: relative; width: 100%; height: auto; }
.lineage text { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; fill: #C3D0CC; }
.lineage .cap { font-size: 10px; letter-spacing: 0.16em; fill: rgba(255, 255, 255, 0.45); }
.lineage .cap--hub { fill: var(--flare); }
/* Opaque so travelling records pass behind the labels, not across them */
.lineage .n-box { fill: var(--ink); stroke: rgba(255, 255, 255, 0.24); }
.lineage .hub-box { fill: rgba(233, 166, 60, 0.07); stroke: var(--flare); }
.lineage .wire { fill: none; stroke: rgba(255, 255, 255, 0.24); stroke-width: 1; }

.lineage__foot {
  border-top: 1px solid var(--line-dark);
  margin-top: 10px;
  padding-top: 12px;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------- cards -- */

.section-head { max-width: 44em; margin-bottom: clamp(40px, 4.5vw, 64px); }
.section-head p { margin-top: 18px; color: var(--slate); }
.band--ink .section-head p { color: rgba(255, 255, 255, 0.72); }

.grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}
@media (min-width: 700px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 700px)  { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--paper);
  padding: 30px 26px 34px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 0.18s ease;
}
.band--paper2 .card { background: var(--paper-2); }
.card:hover { background: #F7F9F8; }
.band--paper2 .card:hover { background: var(--paper); }

.card__k {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.card p { color: var(--slate); font-size: 1rem; }
.card__list { display: grid; gap: 8px; margin-top: auto; padding-top: 8px; }
.card__list li {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #2C4143;
  padding-left: 16px;
  position: relative;
}
.card__list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.62em;
  width: 7px; height: 1px;
  background: var(--accent);
}

/* -------------------------------------------------------------- detail -- */

.detail {
  display: grid;
  gap: clamp(26px, 3.5vw, 56px);
}
@media (min-width: 900px) {
  .detail { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); }
  .detail__aside {
    position: sticky;
    top: 104px;
    align-self: start;
  }
}
.detail__aside h3 { margin-bottom: 14px; }
.detail__aside p { color: var(--slate); }

/* In-page index that rides along in the sticky column */
.jump { margin-top: 30px; border-top: 1px solid var(--line); }
.jump a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  text-decoration: none;
  transition: color 0.15s ease;
}
.jump a::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  background: transparent;
}
.jump a:hover { color: var(--ink); }
.jump a[aria-current="location"] { color: var(--accent); }
.jump a[aria-current="location"]::before { background: var(--accent); }
.detail__aside .mono { color: var(--accent); display: block; margin-bottom: 16px; }
.detail__body p { color: #2C4143; }

.spec {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: grid;
  gap: 12px;
}
.spec div {
  display: grid;
  gap: 4px 20px;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.5;
}
@media (min-width: 560px) { .spec div { grid-template-columns: 140px 1fr; } }
.spec dt, .spec .k {
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--slate);
}
.spec .v { color: var(--ink); }

/* ----------------------------------------------------------- sequence -- */

.steps { display: grid; gap: 1px; background: var(--line-dark); }
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--ink); padding: 32px 26px 36px; }
.step__n {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--flare);
  display: block;
  margin-bottom: 18px;
}
.step h3 { margin-bottom: 12px; }
.step p { color: rgba(255, 255, 255, 0.72); font-size: 1rem; }
.step__out {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-dark);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

/* --------------------------------------------------------------- notes -- */

.rules { border-top: 1px solid var(--line); margin-top: 40px; }
.rules li {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  display: grid;
  gap: 6px 28px;
}
@media (min-width: 760px) { .rules li { grid-template-columns: 210px 1fr; align-items: baseline; } }
.rules .k {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}
.rules .v { color: #2C4143; }

/* ------------------------------------------------------------- contact -- */

.contact__grid { display: grid; gap: clamp(30px, 4vw, 60px); }
@media (min-width: 900px) { .contact__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }

.contact__lines { display: grid; gap: 18px; align-content: start; }
.contact__lines a,
.contact__place {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  letter-spacing: -0.01em;
  text-decoration: none;
  border-bottom: 1px solid var(--line-dark);
  padding-bottom: 8px;
  transition: color 0.15s ease, border-color 0.15s ease;
  overflow-wrap: anywhere;
}
.contact__place { border-bottom-color: transparent; margin: 0; }
.contact__lines a:hover { color: var(--flare); border-color: var(--flare); }
.contact__lines .mono { color: rgba(255, 255, 255, 0.5); }

/* -------------------------------------------------------------- footer -- */

.foot {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.62);
  border-top: 1px solid var(--line-dark);
  padding-block: 44px 40px;
}
.foot__inner {
  width: min(var(--wrap), 100% - (2 * var(--pad)));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 26px 40px;
  align-items: baseline;
}
.foot .brand { color: var(--paper); margin-right: auto; }
.foot__links { display: flex; flex-wrap: wrap; gap: 22px; }
.foot a {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.15s ease;
}
.foot a:hover { color: var(--flare); }
.foot__legal {
  width: min(var(--wrap), 100% - (2 * var(--pad)));
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line-dark);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

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

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
