/* Affari v2 — "set document" system. See docs/DESIGN-PLAN.md */

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

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
}

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

a {
  color: var(--navy);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--copper);
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 var(--s4);
}

h1 { font-size: var(--text-display-xl); }
h2 { font-size: var(--text-display); }
h3 { font-size: var(--text-display-sm); }

p {
  margin: 0 0 var(--s3);
}

.wrap {
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.measure {
  max-width: var(--measure);
}

.section {
  padding-block: var(--s7);
  border-top: 1px solid var(--line);
}

.section--ink {
  background: var(--ink);
  color: var(--paper-on-ink);
  border-top: 0;
}

.section--ink h2,
.section--ink h3 {
  color: var(--paper-on-ink);
}

.section--ink p {
  color: var(--muted-on-ink);
}

.section--dim {
  background: var(--paper-dim);
}

/* Mono eyebrow: `01 — The process` */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
  margin: 0 0 var(--s3);
  display: block;
}

.section--ink .eyebrow {
  color: #d98d5a;
}

@media (max-width: 480px) {
  .hero-v2 .eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
  }
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 300;
}

.skip-link:focus {
  left: 0;
  color: var(--paper);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--solid {
  background: var(--navy);
  color: #fff;
}

.btn--solid:hover {
  background: var(--ink);
  color: #fff;
}

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

.btn--ghost:hover {
  border-color: var(--copper);
  color: var(--copper);
}

.section--ink .btn--solid {
  background: var(--paper);
  color: var(--ink);
}

.section--ink .btn--solid:hover {
  background: #fff;
  color: var(--navy);
}

.section--ink .btn--ghost {
  border-color: var(--paper-on-ink);
  color: var(--paper-on-ink);
}

.section--ink .btn--ghost:hover {
  border-color: #d98d5a;
  color: #d98d5a;
}

/* ---------- Header ---------- */

.hd {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.hd__in {
  max-width: var(--content);
  margin-inline: auto;
  padding: 0.9rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.hd__logo img {
  display: block;
  width: 178px;
  height: 57px;
}

.hd__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.hd__list {
  display: flex;
  align-items: center;
  gap: var(--s4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.hd__link,
.hd__toggle {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hd__link:hover,
.hd__toggle:hover {
  color: var(--copper);
}

.hd__caret {
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px);
}

.drop {
  position: relative;
}

.drop__menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  min-width: 240px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(22, 24, 47, 0.14);
  padding: var(--s2);
  display: none;
}

.drop__menu.is-open {
  display: block;
}

.drop__menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
}

.drop__menu a:hover {
  background: var(--paper-dim);
  color: var(--navy);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  margin: 6px 0;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }

  .hd__nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 20px 40px rgba(22, 24, 47, 0.12);
    flex-direction: column;
    align-items: stretch;
    padding: var(--s4);
    display: none;
  }

  .hd__nav.is-open {
    display: flex;
  }

  .hd__list {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s2);
  }

  .drop__menu {
    position: static;
    box-shadow: none;
    border: 0;
    border-left: 2px solid var(--line);
    border-radius: 0;
    padding-left: var(--s3);
    min-width: 0;
  }

  .hd__logo img {
    width: 150px;
    height: 48px;
  }
}

/* ---------- Hero ---------- */

.hero-v2 {
  padding-block: var(--s7) var(--s6);
}

.hero-v2__grid {
  display: grid;
  gap: var(--s6);
  align-items: start;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

@media (max-width: 920px) {
  .hero-v2__grid {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }
}

.hero-v2 h1 {
  margin-bottom: var(--s4);
}

.hero-v2__lead {
  font-size: var(--text-lg);
  color: var(--muted);
  max-width: var(--measure);
}

.hero-v2__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s4);
}

/* The Deed — LICENSE.txt card (signature element) */
.deed {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 60px rgba(22, 24, 47, 0.22);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow: hidden;
}

.deed__tab {
  display: inline-block;
  color: var(--paper-on-ink);
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  padding: 0.8rem 1.25rem 0.65rem;
  border-bottom: 2px solid var(--copper);
}

.deed__body {
  padding: var(--s4);
  border-top: 1px solid var(--line-on-ink);
  margin: 0;
}

.deed__row {
  display: grid;
  grid-template-columns: 9.5ch 1fr;
  gap: var(--s3);
  padding: 0.45rem 0;
}

.deed__row + .deed__row {
  border-top: 1px dashed rgba(246, 243, 236, 0.12);
}

.deed__k {
  color: var(--deed-label);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  padding-top: 0.1rem;
}

.deed__v {
  color: var(--deed-value);
  font-weight: 500;
}

.deed__v--plain {
  color: var(--paper-on-ink);
  font-weight: 400;
}

/* Ownership banner — loudest line after the h1 */
.own {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-block: var(--s5);
  margin-top: var(--s6);
}

.own p {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-display);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

.own p em {
  font-style: normal;
  color: var(--copper);
}

/* ---------- Lifecycle strip ---------- */

.stages {
  counter-reset: stage;
  list-style: none;
  margin: var(--s5) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stages li {
  counter-increment: stage;
  padding: var(--s4);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.stages li:nth-child(4n) {
  border-right: 0;
}

.stages li:nth-child(n + 5) {
  border-bottom: 0;
}

.stages li::before {
  content: counter(stage, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--copper);
  letter-spacing: 0.1em;
  margin-bottom: var(--s2);
}

.stages b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  display: block;
}

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

  .stages li:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .stages li:nth-child(2n) {
    border-right: 0;
  }

  .stages li:nth-child(n + 5) {
    border-bottom: 1px solid var(--line);
  }

  .stages li:nth-child(n + 7) {
    border-bottom: 0;
  }
}

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

  .stages li,
  .stages li:nth-child(2n),
  .stages li:nth-child(4n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stages li:last-child {
    border-bottom: 0;
  }
}

/* ---------- Flagship case study (ink section) ---------- */

.flag__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s6);
  align-items: center;
}

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

.flag__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-on-ink);
  border-radius: var(--radius);
}

.flag__stats li {
  padding: var(--s4);
  display: flex;
  align-items: baseline;
  gap: var(--s3);
}

.flag__stats li + li {
  border-top: 1px solid var(--line-on-ink);
}

.flag__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  color: var(--paper-on-ink);
  min-width: 4.5ch;
}

.flag__stats p {
  margin: 0;
  font-size: var(--text-sm);
}

/* ---------- Cards (solutions overview) ---------- */

.sol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s4);
  margin-top: var(--s5);
}

.sol {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.sol h3 {
  font-size: 1.25rem;
  margin: 0;
}

.sol p {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 0;
  flex: 1;
}

.sol a {
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
}

.sol a::after {
  content: " →";
}

.sol--lead {
  border-color: var(--navy);
  border-width: 1.5px;
}

/* ---------- Heritage / About ---------- */

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

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

/* ---------- CTA band ---------- */

.cta-v2 {
  text-align: center;
}

.cta-v2 p {
  max-width: 36rem;
  margin-inline: auto;
}

.cta-v2 .btn {
  margin-top: var(--s4);
}

/* ---------- Team ---------- */

.team-v2 {
  display: grid;
  gap: var(--s5);
}

.tm {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--s4);
  align-items: start;
  padding: var(--s4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 52rem;
}

.tm img {
  border-radius: var(--radius);
  width: 127px;
  height: 118px;
  object-fit: cover;
}

.tm p:last-child {
  margin-bottom: 0;
}

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

/* ---------- Capability table ---------- */

.cmp-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  margin-top: var(--s5);
}

.cmp {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.cmp th,
.cmp td {
  padding: 0.8rem 1rem;
  text-align: left;
  vertical-align: top;
}

.cmp thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.cmp tbody th {
  font-weight: 500;
}

.cmp tbody tr + tr th,
.cmp tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.cmp thead th:nth-child(n + 2),
.cmp td {
  text-align: center;
  min-width: 9rem;
}

.cmp__yes {
  color: var(--copper);
  font-weight: 600;
}

.cmp__no {
  color: var(--muted);
}

.cmp__note {
  color: var(--copper);
}

/* ---------- Forms ---------- */

.form-field label {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  margin-bottom: 0.35rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: var(--focus-ring);
  outline-offset: 1px;
}

.form-field textarea {
  min-height: 140px;
  resize: vertical;
}

.form-status {
  margin-top: var(--s3);
  font-weight: 600;
}

.form-status--success {
  color: #1a7f37;
}

.form-status--error {
  color: #b42318;
}

/* ---------- Footer ---------- */

.ft {
  border-top: 1px solid var(--line);
  padding-block: var(--s6) var(--s5);
  font-size: var(--text-sm);
}

.ft__grid {
  display: grid;
  gap: var(--s5);
  grid-template-columns: 2fr 1fr 1fr;
}

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

.ft__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--navy);
  text-decoration: none;
}

.ft__tag {
  color: var(--muted);
  max-width: 24rem;
}

.ft h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s3);
}

.ft ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ft li {
  margin-bottom: 0.45rem;
}

.ft a {
  color: var(--ink);
  text-decoration: none;
}

.ft a:hover {
  color: var(--copper);
  text-decoration: underline;
}

.ft__bottom {
  margin-top: var(--s5);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-xs);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
}

/* ---------- 404 ---------- */

.error-v2 {
  text-align: center;
  padding-block: var(--s7);
}
