/* Cosmos IT — shared stylesheet for both design options.
   The variant is chosen per page with <html data-variant="a"> or "b".
   Fonts are declared in fonts.css (self-hosted). No external requests. */

/* ---------- Tokens ---------- */
:root {
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
  --measure: 40rem;
  --color-error: #a3261e;
}

html[data-variant="a"] {
  --font-heading: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --color-bg: #F3F5F7;
  --color-surface: #FFFFFF;
  --color-text: #172130;
  --color-muted: #4F5B69;
  --color-accent: #0B3D91;
  --color-accent-hover: #082E6E;
  --color-line: #D5DBE3;
  --color-line-strong: #B4BDC9;
  --radius: 4px;
  --heading-tracking: 0;
}

html[data-variant="b"] {
  --font-heading: "Sora", "Segoe UI", system-ui, sans-serif;
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #121417;
  --color-muted: #555B66;
  --color-accent: #1F3A93;
  --color-accent-hover: #172C73;
  --color-line: #DDE0E6;
  --color-line-strong: #BFC5CF;
  --orbit-stroke: #C7CFDD;
  --radius: 10px;
  --heading-tracking: -0.02em;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  letter-spacing: var(--heading-tracking);
  line-height: 1.15;
  margin: 0 0 var(--space-2);
  font-weight: 600;
  color: var(--color-text);
}

p {
  margin: 0 0 var(--space-2);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

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

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

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -10000px;
  top: 8px;
  background: var(--color-surface);
  color: var(--color-accent);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
}

.skip:focus {
  left: 8px;
  z-index: 10;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--color-line);
  background: var(--color-bg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 72px;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: var(--heading-tracking);
}

.brand:hover {
  color: var(--color-text);
}

.brand .logo {
  display: block;
  height: 48px;
  width: auto;
}

@media (max-width: 599px) {
  .brand .logo {
    height: 40px;
  }
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.975rem;
}

.nav a:hover {
  color: var(--color-accent);
}

.nav .lang {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  font-size: 0.925rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

@media (max-width: 719px) {
  html.js .nav-toggle {
    display: inline-flex;
  }

  html.js .site-header:not(.nav-open) .nav {
    display: none;
  }

  .nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0 1rem;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.btn-quiet {
  background: transparent;
  border-color: var(--color-line-strong);
  color: var(--color-text);
}

.btn-quiet:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-6) 0 var(--space-5);
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  max-width: 20ch;
  margin-bottom: var(--space-3);
}

.hero .lede {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--color-muted);
  max-width: var(--measure);
  margin-bottom: var(--space-4);
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Option A: proof strip under the hero */
.proof {
  margin-top: var(--space-5);
  border-top: 3px solid var(--color-accent);
  padding-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.proof-item {
  flex: 1 1 240px;
  max-width: 24rem;
  margin: 0;
}

.proof-item strong {
  display: block;
  font-weight: 600;
  color: var(--color-text);
}

.proof-item span {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* Option B: hero with orbit diagram */
html[data-variant="b"] .hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--space-5);
  align-items: center;
}

@media (max-width: 899px) {
  html[data-variant="b"] .hero .wrap {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* Under 600px the node labels would render at ~7px; the four services follow directly below, so the diagram steps aside. */
@media (max-width: 599px) {
  .orbit {
    display: none;
  }
}

.orbit svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.orbit .ring {
  fill: none;
  stroke: var(--orbit-stroke);
  stroke-width: 1.5;
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
  animation: orbit-draw 900ms ease-out forwards;
}

.orbit .ring-2 {
  animation-delay: 120ms;
}

.orbit .core circle {
  fill: var(--color-accent);
}

.orbit .core text {
  fill: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
  text-anchor: middle;
}

.orbit .node {
  opacity: 0;
  animation: node-in 500ms ease-out forwards;
  cursor: pointer;
  text-decoration: none;
}

.orbit .n1 { animation-delay: 420ms; }
.orbit .n2 { animation-delay: 520ms; }
.orbit .n3 { animation-delay: 620ms; }
.orbit .n4 { animation-delay: 720ms; }

.orbit .node circle {
  fill: var(--color-surface);
  stroke: var(--color-accent);
  stroke-width: 1.5;
  transition: fill 150ms ease;
}

.orbit .node text {
  fill: var(--color-text);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  text-anchor: middle;
  transition: fill 150ms ease;
}

.orbit .node:hover circle,
.orbit .node:focus-visible circle {
  fill: var(--color-accent);
}

.orbit .node:hover text,
.orbit .node:focus-visible text {
  fill: #fff;
}

.orbit .node:focus-visible {
  outline: none;
}

@keyframes orbit-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes node-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .orbit .ring,
  .orbit .node {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }

  .btn,
  .orbit .node circle,
  .orbit .node text {
    transition: none;
  }
}

/* ---------- Sections ---------- */
.section {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-line);
}

.section h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.section-head {
  margin-bottom: var(--space-4);
}

.section-head .intro {
  color: var(--color-muted);
  font-size: 1.1rem;
  max-width: var(--measure);
  margin-bottom: 0;
}

/* What we do: title left, text right */
.services {
  border-top: 1px solid var(--color-line);
}

.service {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-2) var(--space-5);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-line);
  scroll-margin-top: var(--space-3);
}

.service h3 {
  font-size: 1.3rem;
  margin: 0;
}

.service p {
  margin-bottom: var(--space-1);
}

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

.stack {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.stack span {
  color: var(--color-accent);
  font-weight: 500;
  margin-right: 0.35rem;
}

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

/* Selected work: stacked panels */
.work {
  display: grid;
  gap: var(--space-2);
}

.work-item {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

html[data-variant="a"] .work-item {
  border-left: 3px solid var(--color-accent);
}

.work-item .sector {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.work-item h3 {
  font-size: 1.45rem;
  margin-bottom: 0.6rem;
}

.work-item h3 a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--color-line-strong);
}

.work-item h3 a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.work-item p {
  max-width: 62ch;
}

.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: var(--space-2);
}

.highlights li + li::before {
  content: "\00B7";
  color: var(--color-muted);
  margin-right: 0.6rem;
}

/* Before Cosmos IT: compact history list */
.before {
  border-top: 1px solid var(--color-line);
  font-size: 0.95rem;
}

.before-item {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-1) var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-line);
}

.before-item .sector {
  color: var(--color-muted);
  margin: 0 0 0.15rem;
}

.before-item h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
}

.before-item p {
  margin: 0;
}

.before-item .highlights {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

@media (max-width: 719px) {
  .before-item {
    grid-template-columns: 1fr;
  }
}

/* About */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: var(--space-4) var(--space-6);
}

.about .lead {
  font-size: 1.2rem;
  line-height: 1.5;
}

.principles p {
  padding-left: var(--space-2);
  border-left: 2px solid var(--color-line-strong);
  margin-bottom: var(--space-3);
}

.principles p strong {
  display: block;
  font-weight: 600;
}

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

/* Contact */
.contact {
  max-width: 40rem;
}

.form {
  position: relative;
}

.field {
  margin-bottom: var(--space-2);
}

.field label {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.field label small {
  color: var(--color-muted);
  font-weight: 400;
}

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  min-height: 48px;
}

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

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: var(--space-2);
}

.status {
  display: none;
  margin: var(--space-2) 0 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--color-accent);
  background: var(--color-surface);
}

#sent-ok:target,
#sent-error:target,
.status.is-visible {
  display: block;
}

#sent-error {
  border-left-color: var(--color-error);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-line);
  padding: var(--space-3) 0 var(--space-4);
  color: var(--color-muted);
  font-size: 0.9rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

.footer-links li + li::before {
  content: "|";
  color: var(--color-line-strong);
  margin-right: 0.75rem;
}

.footer-links a {
  color: var(--color-muted);
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* ---------- Legal / prose pages ---------- */
.legal {
  padding: var(--space-5) 24px var(--space-6);
  max-width: calc(70ch + 48px);
}

.legal h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
}

.legal .updated {
  color: var(--color-muted);
  margin-bottom: var(--space-4);
}

.legal h2 {
  font-size: 1.35rem;
  margin-top: var(--space-4);
}

.legal ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: var(--space-2);
}

.legal li {
  margin-bottom: 0.35rem;
}

/* 404 */
.notfound {
  padding: var(--space-6) 24px;
  max-width: 60ch;
}

.notfound h1 {
  font-size: 2rem;
}

.notfound + .notfound {
  border-top: 1px solid var(--color-line);
  padding-top: var(--space-5);
}

/* ---------- Responsive type ---------- */
@media (min-width: 720px) {
  body {
    font-size: 1.0625rem;
  }
}

@media (max-width: 719px) {
  .hero {
    padding: var(--space-4) 0;
  }

  .section {
    padding: var(--space-4) 0;
  }

  .work-item {
    padding: var(--space-3);
  }
}
