/* Infeus: layout and components. Colors come from tokens.css only. */

/* ---- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.theme-light,
.theme-paper,
.theme-dark,
.theme-accent {
  background: var(--bg);
  color: var(--fg);
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: var(--orange); color: var(--black); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 100;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--orange);
  color: var(--black);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

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

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

/* ---- Type ---------------------------------------------------------------- */

.h1,
.h2 {
  font-weight: 700;
  font-stretch: var(--stretch-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.h1 { font-size: var(--text-hero); line-height: 0.98; }
.h2 { font-size: var(--text-2xl); line-height: 1.02; }

.h3 {
  font-size: var(--text-xl);
  font-weight: 650;
  font-stretch: 106%;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.lead {
  max-width: 38rem;
  color: var(--fg-muted);
  font-size: var(--text-lg);
  line-height: 1.55;
  text-wrap: pretty;
}

/* Small mono captions for data labels (stack groups, contact details) */
.stack-row dt,
.contact-details dt,
.lifecycle-label {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-stretch: 90%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Buttons and links --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: none;
  font: 600 var(--text-base) / 1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { border-color: var(--line); color: var(--fg); }
.btn--ghost:hover { border-color: var(--fg); }
.btn--small { min-height: 2.5rem; padding: 0.55rem 1.1rem; font-size: var(--text-sm); }

.arrow { display: inline-block; transition: transform 0.25s var(--ease-out); }
a:hover > .arrow { transform: translateX(4px); }
a:hover > .arrow--down { transform: translateY(3px); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
}
.text-link:hover { color: var(--accent-hover); }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  height: 100%;
}

.brand { display: inline-flex; color: var(--fg); }
.brand svg { width: auto; height: 1.6rem; fill: currentColor; }

.nav { display: flex; align-items: center; gap: clamp(1.25rem, 2.5vw, 2.25rem); }
.nav a:not(.btn) {
  color: var(--fg-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color 0.2s;
}
.nav a:not(.btn):hover,
.nav a[aria-current="true"] { color: var(--fg); }
.nav .btn { min-height: 2.5rem; padding: 0.6rem 1.15rem; font-size: var(--text-sm); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: 500 var(--text-sm) / 1 var(--font-sans);
  cursor: pointer;
}
.menu-toggle__icon { position: relative; width: 1.4rem; height: 0.7rem; }
.menu-toggle__icon::before,
.menu-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.menu-toggle__icon::before { top: 0; }
.menu-toggle__icon::after { top: calc(100% - 2px); }
.menu-toggle[aria-expanded="true"] .menu-toggle__icon::before { top: calc(50% - 1px); transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__icon::after { top: calc(50% - 1px); transform: rotate(-45deg); }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }

  .nav {
    position: fixed;
    inset: var(--header-height) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--gutter) 2rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity 0.25s, transform 0.25s var(--ease-out), visibility 0.25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav a:not(.btn) {
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--fg);
    font-size: var(--text-xl);
    font-stretch: var(--stretch-display);
    font-weight: 600;
  }
  .nav .btn { margin-top: 1.5rem; min-height: 3.25rem; font-size: var(--text-base); }
}

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

.hero {
  position: relative;
  display: flex;
  align-items: center;
  padding-block: clamp(3rem, 8svh, 6rem) clamp(3.5rem, 10svh, 7rem);
  overflow: hidden;
}
@media (min-width: 701px) {
  .hero { min-height: calc(100svh - var(--header-height)); }
}
.hero > .container { position: relative; z-index: 1; }
.hero .h1 { max-width: 11.5ch; font-size: min(var(--text-hero), 11svh); }  /* fits short laptop screens */
.hero .lead { max-width: 36rem; margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.25rem); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
  margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
}

/* The logo mark, drawn large as outlines to the right of the headline.
   Starts at 70% of the container width and bleeds off the edge. */
.hero-art {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: calc(max(0px, (100% - var(--max-width)) / 2) + var(--gutter) + 0.7 * (min(100%, var(--max-width)) - 2 * var(--gutter)));
  width: clamp(40rem, 62vw, 60rem);
  color: var(--accent);
  pointer-events: none;
  translate: 0 -58%;
  --stroke: 0.22;
}
.hero-art path {
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.4s var(--ease-out) 0.3s forwards;
}
.hero-art .hero-art__dot { animation-duration: 1.2s; }
.hero-art .hero-art__fill {
  fill: currentColor;
  stroke: none;
  opacity: 0;
  animation: fade-in 0.8s var(--ease-out) 1.4s forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

/* Narrower screens: the headline takes the full width, so the drawing moves
   behind it as a faint outline without the filled dot */
@media (max-width: 1000px) {
  .hero-art { left: auto; right: -35vw; top: auto; bottom: 8%; width: 110vw; opacity: 0.45; translate: none; }
  .hero-art .hero-art__fill { display: none; }
}
@media (max-width: 700px) {
  .hero-art { right: -40vw; top: 2.5rem; bottom: auto; width: 140vw; --stroke: 0.3; }
}

/* Hero entrance */
.hero-enter { animation: rise 0.9s var(--ease-out) both; }
.hero-enter:nth-child(2) { animation-delay: 0.08s; }
.hero-enter:nth-child(3) { animation-delay: 0.16s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(1.25rem); }
  to { opacity: 1; transform: none; }
}

/* ---- Section layouts ----------------------------------------------------- */

/* Heading on the left, supporting text on the right */
.split {
  display: grid;
  gap: 1.5rem clamp(2rem, 6vw, 6rem);
}
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
  .split--end { align-items: end; }
}

.section-intro { margin-bottom: clamp(2.5rem, 1.5rem + 4vw, 5rem); }

/* ---- Services ------------------------------------------------------------ */

/* SaaS lifecycle figure, drawn like the ribbon in the logo. The first version
   sits on the low bar, launch is a 45° step and later requests sit on the
   longer, higher bar. The step SVG has a fixed pixel size (94 x 72, bar 10),
   so the angle stays 45° at any width. */
.lifecycle {
  --rise: 72px;
  --step: 94px;
  --bar: 10px;
  display: grid;
  grid-template-columns: minmax(0, 4fr) var(--step) minmax(0, 7fr);
  grid-template-rows: auto var(--rise) auto;
  margin: clamp(3rem, 2rem + 4vw, 5.5rem) 0 0;
}

.lifecycle-label { align-self: end; padding-bottom: 0.9rem; }
.lifecycle-label--first { grid-column: 1; grid-row: 2; padding-bottom: calc(var(--bar) + 0.9rem); }
.lifecycle-label--after { grid-column: 3; grid-row: 1; }

.lifecycle-list {
  display: grid;
  align-content: start;
  gap: 0.6rem 2rem;
  padding-top: 1.5rem;
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.35;
}
.lifecycle-list--first { grid-column: 1; grid-row: 3; padding-right: 2rem; }
.lifecycle-list--after {
  grid-column: 3;
  grid-row: 2 / 4;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: calc(var(--bar) + 1.5rem);
}

.lifecycle-low,
.lifecycle-high { height: var(--bar); }
.lifecycle-low {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  border-radius: var(--bar) 0 0 var(--bar);
  background: var(--fg);
}
.lifecycle-high {
  grid-column: 3;
  grid-row: 2;
  align-self: start;
  border-radius: 0 var(--bar) var(--bar) 0;
  background: var(--accent);
}
.lifecycle-step { position: relative; grid-column: 2; grid-row: 2; }
.lifecycle-step svg { width: var(--step); height: var(--rise); overflow: visible; }
.lifecycle-step path { fill: none; stroke: var(--accent); stroke-width: 10; }

/* The dot floats above the low bar, just before the step, as in the logo */
.lifecycle-dot {
  position: absolute;
  left: -1.5rem;
  bottom: calc(var(--bar) + 0.75rem);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
}

/* Phones: first version, then the step as a divider, then the rest */
@media (max-width: 759px) {
  .lifecycle {
    grid-template-columns: minmax(0, 1fr) var(--step) minmax(0, 1.25fr);
    grid-template-rows: auto auto var(--rise) auto auto;
  }
  .lifecycle-label--first { grid-column: 1 / -1; grid-row: 1; padding-bottom: 0; }
  .lifecycle-dot { left: -1.25rem; width: 1.25rem; height: 1.25rem; }
  .lifecycle-list--first { grid-column: 1 / -1; grid-row: 2; padding: 1rem 0 2rem; }
  .lifecycle-low,
  .lifecycle-step,
  .lifecycle-high { grid-row: 3; }
  .lifecycle-label--after { grid-column: 1 / -1; grid-row: 4; padding: 1.75rem 0 0; }
  .lifecycle-list--after { grid-column: 1 / -1; grid-row: 5; grid-template-columns: 1fr; padding-top: 1rem; }
}

.subsection-title { margin: clamp(4rem, 3rem + 4vw, 6.5rem) 0 1.5rem; }

/* Service cards: title and a short text under a strong top rule */
.card-grid {
  display: grid;
  gap: 0 clamp(1.5rem, 3vw, 3rem);
}
@media (min-width: 700px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.service { padding-block: 1.5rem 1.75rem; border-top: 2px solid var(--fg); }
.service-title {
  font-size: var(--text-xl);
  font-weight: 650;
  font-stretch: 106%;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.service p { max-width: 36rem; margin-top: 0.85rem; color: var(--fg-muted); }

/* ---- How we work --------------------------------------------------------- */

.principles {
  display: grid;
  gap: 0 clamp(1.5rem, 4vw, 4rem);
}
@media (min-width: 760px) { .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .principles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.principle { padding-block: 1.5rem 2.25rem; border-top: 1px solid var(--line); }
.principle p { max-width: 32rem; margin-top: 0.75rem; color: var(--fg-muted); }

/* ---- Stack --------------------------------------------------------------- */

.stack { border-bottom: 1px solid var(--line); }
.stack-row {
  display: grid;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
}
@media (min-width: 760px) {
  .stack-row { grid-template-columns: 12rem minmax(0, 1fr); align-items: baseline; padding-block: 1.6rem; }
}
.stack-row dd ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0;
  font-size: var(--text-xl);
  font-stretch: 104%;
  font-weight: 500;
  line-height: 1.35;
}
.stack-row dd li:not(:last-child)::after {
  content: "/";
  margin-inline: 0.6em;
  color: var(--accent);
  font-weight: 400;
}

/* ---- Clients ------------------------------------------------------------- */

.clients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
@media (min-width: 760px) { .clients { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.clients li {
  display: grid;
  place-items: center;
  min-height: clamp(7.5rem, 5rem + 8vw, 11rem);
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* Logos are single-color masks: the color is whatever --fg is */
.client-logo {
  display: block;
  width: calc(var(--w) * var(--logo-scale, 1));
  max-width: 100%;
  aspect-ratio: var(--ratio);
  background-color: var(--fg);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}
@media (max-width: 500px) { .clients { --logo-scale: 0.78; } }

.client-logo--paladino    { --w: 132px; --ratio: 2.76; --src: url("../assets/clients/paladino.png"); }
.client-logo--baker-tilly { --w: 137px; --ratio: 3.77; --src: url("../assets/clients/baker-tilly.png"); }
.client-logo--veles       { --w: 124px; --ratio: 2.60; --src: url("../assets/clients/veles.png"); }
.client-logo--additiv     { --w: 142px; --ratio: 4.08; --src: url("../assets/clients/additiv.png"); }
.client-logo--manusigna   { --w: 176px; --ratio: 6.03; --src: url("../assets/clients/manusigna.svg"); }
.client-logo--tivenu      { --w: 138px; --ratio: 3.83; --src: url("../assets/clients/tivenu.svg"); }

/* Industries: one card per industry, on the section's raised surface color */
.industries { margin-top: clamp(3.5rem, 2.5rem + 4vw, 6rem); }
.industry-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (min-width: 560px) { .industry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .industry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.industry {
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  border-radius: var(--radius);
  background: var(--surface);
}
.industry-title {
  font-size: var(--text-lg);
  font-weight: 650;
  font-stretch: 106%;
  line-height: 1.25;
}
.industry p { margin-top: 0.6rem; color: var(--fg-muted); }

/* Small drawings, one per industry, in the logo's shapes: bars with round
   ends, dots and 45° lines. One orange element each. */
.industry-art { display: block; width: 160px; height: 72px; margin-bottom: 1.25rem; color: var(--fg); overflow: visible; }
.industry-art .ig-line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.industry-art .ig-fill { fill: currentColor; }
.industry-art .ig-soft { fill: var(--line); }
.industry-art .ig-accent { fill: var(--accent); }
.industry-art .ig-knock { fill: var(--surface); }

/* ---- Contact ------------------------------------------------------------- */

.contact .h2 { max-width: 14ch; }
.contact .lead { margin-top: 1.5rem; }
.contact-actions { margin-top: clamp(2rem, 1.5rem + 2vw, 2.75rem); }

.contact-details > div { padding-block: 1rem 1.25rem; border-top: 1px solid var(--line); }
.contact-details > div:last-child { border-bottom: 1px solid var(--line); }
.contact-details dd {
  margin-top: 0.4rem;
  font-size: var(--text-lg);
  line-height: 1.45;
}
.contact-details a { text-decoration: none; }
.contact-details a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

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

.site-footer { padding-block: 2.5rem; }
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
}
.footer-legal { color: var(--fg-muted); font-size: var(--text-sm); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: var(--text-sm); }
.footer-links a,
.footer-links .link-button {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover,
.footer-links .link-button:hover { color: var(--fg); }

/* ---- Cookie consent (built by consent.js) -------------------------------- */

.consent {
  position: fixed;
  z-index: 90;
  right: var(--gutter);
  bottom: var(--gutter);
  width: min(26rem, calc(100% - 2 * var(--gutter)));
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1rem 3rem color-mix(in srgb, var(--black) 30%, transparent);
}
.consent[hidden] { display: none; }
.consent h2 { font-size: var(--text-base); font-weight: 600; }
.consent p { margin-top: 0.5rem; color: var(--fg-muted); font-size: var(--text-sm); line-height: 1.5; }
.consent p a { color: var(--fg); }
.consent-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.consent-actions .btn { flex: 1; }

/* ---- Legal pages --------------------------------------------------------- */

.legal { padding-block: clamp(3rem, 2rem + 4vw, 6rem) var(--section-space); }
.legal .h1 { max-width: 16ch; font-size: var(--text-2xl); line-height: 1.02; }
.legal .lead { margin-top: 1.5rem; }

.prose { max-width: 44rem; margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); }
.prose h2 {
  margin-top: 2.75rem;
  font-size: var(--text-xl);
  font-stretch: 106%;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.prose h3 { margin-top: 1.75rem; font-size: var(--text-lg); font-weight: 600; }
.prose p,
.prose ul,
.prose .table-wrap { margin-top: 1rem; }
.prose ul { padding-left: 1.25rem; list-style: disc; }
.prose li + li { margin-top: 0.4rem; }
.prose a { text-decoration: underline; text-underline-offset: 0.2em; }
.prose a:hover { color: var(--accent-hover); }

.table-wrap { overflow-x: auto; }
.prose table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: var(--text-sm); }
.prose th,
.prose td { padding: 0.65rem 1rem 0.65rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; }
.prose code { font-family: var(--font-mono); font-size: 0.85em; font-stretch: 90%; }

/* ---- Scroll reveal (enabled by main.js) ---------------------------------- */

.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(1.25rem);
  transition: opacity var(--duration) var(--ease-out), transform var(--duration) var(--ease-out);
}
.js-reveal [data-reveal].is-visible { opacity: 1; transform: none; }

/* The lifecycle ribbon draws itself: low bar, dot, step, then the long bar */
.js-reveal .lifecycle .lifecycle-low,
.js-reveal .lifecycle .lifecycle-high {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s var(--ease-out) 0.15s;
}
.js-reveal .lifecycle .lifecycle-high { transition-duration: 1s; transition-delay: 0.95s; }
.js-reveal .lifecycle .lifecycle-dot { scale: 0; transition: scale 0.35s var(--ease-out) 0.55s; }
.js-reveal .lifecycle .lifecycle-step path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.3s linear 0.7s;
}
.js-reveal .lifecycle.is-visible .lifecycle-low,
.js-reveal .lifecycle.is-visible .lifecycle-high { clip-path: inset(0); }
.js-reveal .lifecycle.is-visible .lifecycle-dot { scale: 1; }
.js-reveal .lifecycle.is-visible .lifecycle-step path { stroke-dashoffset: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  .hero-art path { stroke-dashoffset: 0; }
  .hero-art .hero-art__fill { opacity: 1; }
}
