/* Kamin AI site styles.
   Three colours only: Falu red, black and white, in two themes: dark (white on black, the default)
   and light (black on white), chosen by data-theme on <body>. Use the --fg/--bg tokens rather than
   --white/--black so both themes work; --white is only for text on a red fill.
   Greys are the foreground colour at reduced opacity.
   Red on black is low-contrast, so red is only used for fills, rules and highlights, never for text. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-var.woff2") format("woff2");
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #801818;
  --black: #0a0a0a;
  --white: #ffffff;

  /* Dark theme (default): white on black. */
  --bg: var(--black);
  --fg: var(--white);
  --muted: rgb(255 255 255 / 0.62);
  --rule: rgb(255 255 255 / 0.14);
  --hover: rgb(255 255 255 / 0.03);
  --tint: rgb(128 24 24 / 0.16);
  --header-bg: rgb(10 10 10 / 0.88);
  --dot: rgb(255 255 255 / 0.32);

  --max: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --header: 76px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Light theme: the same design with black and white swapped. Greys become black at reduced opacity. */
[data-theme="light"] {
  --bg: var(--white);
  --fg: var(--black);
  --muted: rgb(10 10 10 / 0.64);
  --rule: rgb(10 10 10 / 0.14);
  --hover: rgb(10 10 10 / 0.03);
  --tint: rgb(128 24 24 / 0.07);
  --header-bg: rgb(255 255 255 / 0.88);
  --dot: rgb(10 10 10 / 0.34);
}

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

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 16px); -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--red); color: var(--white); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
em { font-style: normal; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.prompt::before { content: "$ "; color: var(--fg); }

.skip { position: absolute; left: -9999px; top: 12px; z-index: 100; background: var(--fg); color: var(--bg); padding: 8px 14px; }
.skip:focus { left: var(--gutter); }

h1, h2, h3 { font-weight: 500; letter-spacing: -0.025em; line-height: 1.05; }
h2 { font-size: clamp(30px, 4vw, 52px); }
h3 { font-size: 22px; letter-spacing: -0.01em; line-height: 1.25; }

.cursor {
  display: inline-block; width: .5em; height: .9em;
  background: var(--red); vertical-align: -0.06em; margin-left: .12em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

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

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header); }
.brand img { display: block; height: 48px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 28px; font-family: var(--mono); font-size: 13px; }
.site-nav > a { color: var(--muted); transition: color .15s; }
.site-nav > a::before { content: "/"; color: var(--red); margin-right: 2px; }
.site-nav > a:hover { color: var(--fg); }
.site-nav > a[aria-current="page"] { color: var(--fg); }
.site-nav > a[aria-current="page"]::before { color: var(--fg); }

.lang { display: flex; font-family: var(--mono); font-size: 13px; }
.lang a { border: 1px solid var(--rule); color: var(--muted); padding: 4px 9px; transition: color .15s; }
.lang a + a { border-left: 0; }
.lang a:hover { color: var(--fg); }
.lang a[aria-current="true"] { background: var(--red); border-color: var(--red); color: var(--white); }

.menu-toggle {
  display: none; background: none; border: 1px solid var(--rule); color: var(--fg);
  font: 13px var(--mono); padding: 8px 14px; cursor: pointer;
}
.menu-toggle::after { content: " +"; }
.nav-open .menu-toggle::after { content: " ×"; }

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

.ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 44px; }
.btn {
  display: inline-block; font-family: var(--mono); font-size: 14px; padding: 14px 22px;
  border: 1px solid var(--fg); transition: background .15s, color .15s, border-color .15s;
}
.btn.primary { background: var(--fg); color: var(--bg); }
.btn:hover { background: var(--red); border-color: var(--red); color: var(--white); }

.textlink {
  font-family: var(--mono); font-size: 14px;
  border-bottom: 2px solid var(--red); padding: 2px 0;
  transition: background .15s;
}
.textlink:hover { background: var(--red); color: var(--white); }
.more { margin-top: 32px; }

.mail {
  display: inline-flex; align-items: center; margin-top: 40px;
  font-family: var(--mono); font-size: clamp(22px, 4.6vw, 60px); letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.mail .cursor { width: .55em; }
.mail:hover { background: var(--red); color: var(--white); }

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

.hero { border-bottom: 1px solid var(--rule); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px); align-items: center;
  padding-top: clamp(72px, 11vw, 144px); padding-bottom: clamp(72px, 11vw, 144px);
}
.hero h1 { font-size: clamp(40px, 5.8vw, 84px); line-height: 1.02; letter-spacing: -0.03em; margin-top: 24px; }
/* Let the cursor overhang the line end instead of wrapping onto a line of its own. */
.hero h1 .cursor { margin-right: -0.62em; }
.lead { margin-top: 32px; max-width: 46ch; font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); font-weight: 300; }
.hero-fig canvas {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.readout { margin-top: 12px; text-align: right; }

/* ---------- Inner page hero ---------- */

.page-hero { border-bottom: 1px solid var(--rule); }
.page-hero .wrap { padding-top: clamp(64px, 9vw, 128px); padding-bottom: clamp(56px, 8vw, 104px); }
.page-hero h1 { font-size: clamp(36px, 5vw, 68px); max-width: 18ch; margin-top: 20px; letter-spacing: -0.03em; }

/* ---------- Sections ---------- */

section { padding: clamp(64px, 9vw, 120px) 0; border-bottom: 1px solid var(--rule); }
.head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 48px; }
.sub { color: var(--muted); max-width: 54ch; margin: -24px 0 40px; }
.body { font-size: clamp(18px, 1.8vw, 21px); color: var(--muted); font-weight: 300; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); align-items: end; }

/* Service rows (home) */
.rows { border-top: 1px solid var(--rule); }
.row {
  display: grid; grid-template-columns: 80px 1fr 1.3fr 32px; gap: 24px; align-items: baseline;
  padding: 28px 0; border-bottom: 1px solid var(--rule); transition: background .15s;
}
.row p { color: var(--muted); font-size: 16px; }
.row .arrow { text-align: right; transition: transform .2s, color .2s; }
.row:hover { background: var(--hover); }
.row:hover .arrow { color: var(--fg); transform: translateX(4px); }

/* Product tiles (home) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.tile { background: var(--bg); padding: 32px; display: flex; flex-direction: column; gap: 18px; min-height: 260px; transition: background .2s; }
.tile:hover { background: var(--tint); }
.tile .top { display: flex; justify-content: space-between; }
.tile h3 { font-size: clamp(28px, 3vw, 38px); letter-spacing: -0.02em; margin-top: 40px; }
.tile p { color: var(--muted); }
.tile .domain { color: var(--fg); margin-top: auto; }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--fg); margin-right: 8px; vertical-align: 1px; }

/* Pipeline of steps (home approach, services formats) */
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); }
.stage { padding: 24px 24px 24px 0; }
.stage + .stage { padding-left: 24px; border-left: 1px solid var(--rule); }
.stage .mono { display: block; margin-bottom: 14px; }
.stage h3 { margin-bottom: 8px; }
.stage p { color: var(--muted); font-size: 15px; }

/* Detail blocks (services, products) */
.detail { display: grid; grid-template-columns: 1fr 1.3fr; gap: var(--gutter); padding: 56px 0; border-top: 1px solid var(--rule); }
.detail:first-child { border-top: 0; padding-top: 0; }
.detail:last-child { padding-bottom: 0; }
.detail h2 { font-size: clamp(28px, 3.4vw, 42px); margin-top: 12px; }
.detail .tagline { color: var(--muted); margin-top: 16px; max-width: 34ch; }
.detail .more { margin-top: 24px; }
.list-title { margin-top: 32px; }
.list { margin-top: 12px; }
.list li { position: relative; padding: 12px 0 12px 24px; border-top: 1px solid var(--rule); }
.list li:last-child { border-bottom: 1px solid var(--rule); }
.list li::before { content: ""; position: absolute; left: 0; top: 22px; width: 8px; height: 8px; background: var(--red); }

/* Cards (principles, why we build products) */
.cards { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.cards.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--bg); padding: 32px; }
.card .mono { display: block; margin-bottom: 20px; }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 16px; }

/* Team */
.team { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter); }
.member .photo {
  aspect-ratio: 1; border: 1px solid var(--rule); margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center;
}
.member .role { margin: 6px 0 12px; }
.member p:last-child { color: var(--muted); font-size: 15px; }

.address { font-size: 15px; line-height: 1.8; color: var(--fg); }

/* Contact */
.cta p { color: var(--muted); margin-top: 16px; font-size: 18px; }
.cta h2 { margin-top: 20px; }
.cta { border-bottom: 0; }
.page-contact section { border-bottom: 0; }
.page-contact .split { align-items: start; }
.split .reply { margin: 24px 0 0; }
.facts { display: grid; gap: 8px; align-self: start; }
.facts dt { margin-top: 16px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { font-size: 18px; }

/* 404 */
.notfound .wrap { padding-top: clamp(80px, 12vw, 160px); padding-bottom: clamp(80px, 12vw, 160px); }
.notfound .code { font-size: 15px; }
.notfound h1 { font-size: clamp(40px, 6vw, 80px); margin-top: 24px; }
.notfound-sv { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--rule); }
.notfound-sv h2 { font-size: clamp(24px, 3vw, 36px); }
.notfound-sv .lead { margin-top: 16px; }

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

.site-footer { border-top: 1px solid var(--rule); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--gutter); padding-top: 56px; padding-bottom: 48px; }
.footer-brand img { display: block; height: 40px; width: auto; }
.footer-brand p { color: var(--muted); margin-top: 16px; max-width: 32ch; font-size: 15px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.footer-col .mono { margin-bottom: 4px; }
.footer-col a { color: var(--muted); transition: color .15s; }
.footer-col a:hover { color: var(--fg); }
.footer-col span { color: var(--muted); }
.footer-bottom { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 24px; padding-bottom: 32px; }
.footer-bottom::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); border-top: 1px solid var(--rule); }

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .hero-grid, .split, .detail, .tiles, .footer-grid { grid-template-columns: 1fr; }
  .hero-fig canvas { aspect-ratio: 16 / 9; }
  .row { grid-template-columns: 48px 1fr 24px; }
  .row p { grid-column: 2; grid-row: 2; }
  .row .arrow { grid-column: 3; grid-row: 1; }
  .pipe, .cards.cols-2 { grid-template-columns: 1fr 1fr; }
  .stage:nth-child(3) { border-left: 0; padding-left: 0; }
  .cards.cols-3, .team { grid-template-columns: 1fr; }
  .team .photo { max-width: 240px; }
  .split { align-items: start; }

  /* Collapsible menu (only when JavaScript is running; otherwise the links simply wrap). */
  .js .menu-toggle { display: block; }
  .js .site-nav {
    display: none; position: absolute; top: var(--header); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: 8px var(--gutter) 24px;
  }
  .js .nav-open .site-nav { display: flex; }
  .js .site-nav > a { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
  .js .site-nav .lang { margin-top: 20px; }
  html:not(.js) .site-header .wrap { height: auto; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
  html:not(.js) .site-nav { flex-wrap: wrap; gap: 12px 20px; }
}

@media (max-width: 520px) {
  .pipe, .cards.cols-2 { grid-template-columns: 1fr; }
  .stage, .stage + .stage { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

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