/* Smiley Robot: one-column page. The hero is the wordmark and copy on the left and the isometric
   mascot on the right. Four colour themes; js/theme.js names them and switches between them. */

/* ---------- fonts (self-hosted, SIL Open Font License; see fonts/) ---------- */
@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/montserrat.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(../fonts/jetbrains-mono.woff2) format("woff2");
}

/* ---------- tokens ---------- */
:root {
  --display: Montserrat, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
/* Each theme is a class, so it can sit on <html> to theme the page and on a swatch to show itself. */
.t-blue {
  --bg: #A8C3FF; --card: #BDD2FF; --ink: #0E1530; --muted: #26345F;
  --accent: #1F3AE0; --accentInk: #FFFFFF;
  --line: rgba(14,21,48,.16); --dot: rgba(14,21,48,.10);
  --cubeTop: #FFFFFF; --cubeL: #0E1530; --cubeR: #2B3A73; --cubeFace: #A8C3FF; --cubeStroke: #0E1530;
  color-scheme: light;
}
.t-midnight {
  --bg: #0F1A3D; --card: #18265A; --ink: #E8EDFF; --muted: #A9B6E2;
  --accent: #7B93FF; --accentInk: #0B1330;
  --line: rgba(232,237,255,.15); --dot: rgba(232,237,255,.08);
  --cubeTop: #E8EDFF; --cubeL: #7B93FF; --cubeR: #4460D9; --cubeFace: #0F1A3D; --cubeStroke: #0F1A3D;
  color-scheme: dark;
}
.t-charcoal, .t-yellow {
  --bg: #1C1C20; --card: #25252A; --ink: #F4F1EA; --muted: #B8B3A9;
  --accent: #FF5B23; --accentInk: #1C1C20;
  --line: rgba(244,241,234,.14); --dot: rgba(244,241,234,.07);
  --cubeTop: #F4F1EA; --cubeL: #FF5B23; --cubeR: #C4471C; --cubeFace: #1C1C20; --cubeStroke: #1C1C20;
  color-scheme: dark;
}
.t-yellow { --accent: #FFD23F; --cubeL: #FFD23F; --cubeR: #C9A21E; }

/* ---------- base ---------- */
html, body { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
.page {
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.6px);
  background-size: 18px 18px;
}
a { color: var(--ink); }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
/* a theme swap changes every colour at once; where supported, a short cross-fade smooths it */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: ease-out; }

/* ---------- SVG paint, from the theme ---------- */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.f-ink { fill: var(--ink); }
.f-accent { fill: var(--accent); }
.f-cube-top { fill: var(--cubeTop); }
.f-cube-l { fill: var(--cubeL); }
.f-cube-r { fill: var(--cubeR); }
.f-cube-face { fill: var(--cubeFace); }
.f-cube-stroke { fill: var(--cubeStroke); }
.s-ink { stroke: var(--ink); }
.s-accent { stroke: var(--accent); }
.s-cube-top { stroke: var(--cubeTop); }
.s-cube-face { stroke: var(--cubeFace); }
.s-cube-stroke { stroke: var(--cubeStroke); }

/* ---------- shared pieces ---------- */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding-left: max(20px, min(5vw, 64px), env(safe-area-inset-left, 0px));
  padding-right: max(20px, min(5vw, 64px), env(safe-area-inset-right, 0px));
}
.mono { font-family: var(--mono); }
.note { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.eyebrow { font-family: var(--mono); font-size: 14px; color: var(--accent); letter-spacing: .04em; }
.h2 { font-weight: 800; font-size: clamp(32px, 4.4vw, 56px); letter-spacing: -.02em; line-height: 1; }
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, 14px); min-width: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: transform .25s cubic-bezier(.3,1.6,.5,1);
}
.btn:hover { transform: translateY(-3px); }
.btn-primary, .btn-primary:hover { background: var(--accent); color: var(--accentInk); }
.btn-ghost { border: 1.5px solid var(--ink); }
.btn-inverse, .btn-inverse:hover {
  min-height: 56px; padding: 0 28px; font-weight: 800; font-size: 17px;
  background: var(--accentInk); color: var(--accent);
}

/* the two offerings' marks: three chevrons for Automation, two rings for Business */
.chev { animation: chevIn .55s cubic-bezier(.3,1.6,.5,1) .5s both; }
.chev:nth-child(2) { animation-delay: .7s; }
.chev:nth-child(3) { animation-delay: .9s; }
.ring { transform-box: fill-box; transform-origin: center; animation: ringIn .75s cubic-bezier(.3,1.6,.5,1) .6s both; }

.cursor { animation: cur 1.1s steps(1, end) infinite; }
.cursor-accent { color: var(--accent); }

/* ---------- header ---------- */
.site-head {
  padding-block: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px clamp(14px, 3vw, 28px);
}
.site-head .left { display: flex; align-items: center; gap: clamp(12px, 3vw, 32px); min-width: 0; }
.logo, .logo:hover { display: flex; align-items: center; flex: none; text-decoration: none; color: var(--ink); }
.logo svg { width: 40px; height: 40px; }
.nav { display: flex; align-items: center; gap: clamp(10px, 2.6vw, 28px); min-width: 0; }
.nav a { font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 34px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.theme-btn[hidden] { display: none; }
.theme-btn > span { display: inline-flex; }
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.swatch + .swatch { margin-left: -4px; }

@media (max-width: 480px) {
  .nav { gap: 9px; }
  .nav a { font-size: 12px; }
  .logo svg { width: 30px; height: 30px; }
  .theme-btn { padding: 0 6px; }
}
@media (max-width: 380px) {
  .site-head .left { gap: 10px; }
  .nav { gap: 7px; }
  .nav a { font-size: 11px; }
  .logo svg { width: 26px; height: 26px; }
}
@media (max-width: 340px) { .site-head { flex-wrap: wrap; } }
@media (max-width: 600px) {
  /* on phones the switcher shows only the current theme's dot */
  .theme-btn { width: 34px; padding: 0; }
  .swatch { display: none; width: 16px; height: 16px; }
  .swatch.is-current { display: block; margin-left: 0; }
}

/* ---------- hero ---------- */
/* Exactly one screen tall: the headline at the top, the call-to-action row at the bottom of the fold,
   and the space between them stretches. js/site.js measures --headH and --textH. */
.hero {
  --pad: clamp(12px, 3.5svh, 56px);
  --gap: clamp(14px, 3svh, 48px);
  min-height: calc(100svh - var(--headH, 74px) - 2 * var(--pad));
  padding-block: var(--pad);
  display: flex;
  align-items: stretch;
  gap: var(--gap) 48px;
}
.hero-text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: clamp(12px, 2.6svh, 28px); }
.hero-text > * { animation: rise .8s cubic-bezier(.3,1.5,.5,1) both; }
.hero-text > :nth-child(2) { animation-delay: .08s; }
.hero-text > :nth-child(3) { animation-delay: .16s; }
.hero-text > :nth-child(4) { animation-delay: .3s; }
.hero-text > :nth-child(5) { animation-delay: .38s; }

.wordmark { font-size: clamp(48px, min(10.5vw, 14svh), 132px); line-height: .92; color: var(--ink); }
.wordmark-top { font-weight: 800; letter-spacing: -.025em; }
.wordmark-bottom { white-space: nowrap; font-weight: 500; }
.wordmark-o { width: .899em; height: .971em; vertical-align: baseline; margin: 0 .01em; overflow: visible; }
.hero-h1 { font-size: clamp(20px, min(2.56vw, 3.8svh), 32px); font-weight: 600; letter-spacing: .01em; line-height: 1.1; }

.motifs { display: flex; flex-direction: column; gap: clamp(10px, 2svh, 18px); margin-top: auto; padding-top: clamp(12px, 3svh, 40px); }
.motif { display: flex; align-items: center; gap: 18px; }
.motif-ic { flex: none; width: 64px; height: 42px; }
.motif .stack { --stack-gap: 4px; }
.motif-title { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-art { flex: 1 1 300px; min-width: 0; display: flex; justify-content: center; align-items: center; }
/* the mascot's height is what has to fit; its art is 64 x 95 */
.hero-mascot {
  --mh: min(500px, calc(100svh - var(--headH, 74px) - 2 * var(--pad)));
  width: min(100%, calc(var(--mh) * 64 / 95));
}
.mascot { display: block; width: 100%; height: auto; overflow: visible; }
.robot-in { transform-box: fill-box; transform-origin: 50% 100%; animation: robotIn .9s cubic-bezier(.3,1.7,.5,1) .25s both; }
.bob { animation: bob 4.2s ease-in-out 1.2s infinite; }
.shadow { transform-box: fill-box; transform-origin: center; animation: shadow 4.2s ease-in-out 1.2s infinite; }
[data-blink] rect { transform-box: fill-box; transform-origin: center; }

/* the game (js/game.js) mounts into this slot and highlights the crank's peg */
.play-mascot { display: block; position: relative; width: 100%; padding: 0; margin: 0; }
[data-ooo-peg] { transition: stroke-width .2s; }
.ooo-hot [data-ooo-peg] { stroke-width: 5.6; }

/* stacked: headline at the top, the robot in the space below it, then the two lines and the buttons */
@media (max-width: 900px) {
  .hero { flex-direction: column; --gap: clamp(10px, 1.8svh, 20px); }
  .hero-text { display: contents; }
  .hero-text > * { order: 1; }
  .hero-art { order: 2; flex: 1 1 auto; }
  .hero-text > .motifs { order: 3; margin-top: 0; padding-top: 0; }
  .hero-text > .hero-cta { order: 4; }
  .hero-mascot { --mh: clamp(150px, calc(100svh - var(--headH, 74px) - var(--textH, 560px) - 2 * var(--pad) - 5 * var(--gap)), 440px); }
}
/* phones: the text and buttons fill the first screen, buttons at its foot; the robot waits just below the fold */
@media (max-width: 600px) {
  .hero { --pad: clamp(8px, 2svh, 24px); --gap: clamp(9px, 1.6svh, 18px); --foot: clamp(24px, 4.5svh, 44px); min-height: 0; }
  .hero-text { display: flex; flex-direction: column; gap: clamp(10px, 1.7svh, 18px); min-height: calc(100svh - var(--headH, 74px) - var(--pad) - var(--foot)); }
  .hero-text > .motifs { margin-top: auto; padding-top: 16px; }
  .hero-art { order: 5; flex: none; margin-top: calc(var(--foot) + 24px); }
  .hero-mascot { --mh: 440px; }
  .motifs { gap: 12px; }
  .motif { flex-direction: column; align-items: flex-start; gap: 4px; }
  .motif-ic { width: 36px; height: 24px; }
  .hero .btn { min-height: 48px; }
}

/* ---------- sections ---------- */
.section {
  padding-block: clamp(56px, 8vw, 104px);
  display: flex;
  flex-direction: column;
  gap: 40px;
  border-top: 1.5px solid var(--line);
}
.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--col, 340px)), 1fr)); }

.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 28px;
  padding: clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.card-ic { width: 96px; height: 64px; }
.card .stack { --stack-gap: 8px; }
.card h3 { font-weight: 800; font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -.01em; }
.card p { font-weight: 500; font-size: 17px; line-height: 1.6; color: var(--muted); }
.card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; font-weight: 600; font-size: 16px; }
.card li { display: flex; gap: 12px; align-items: baseline; }
.card li::before { content: ">"; font-family: var(--mono); color: var(--accent); }

.steps { --col: 230px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 3px solid var(--ink); }
.step:last-child { border-top-color: var(--accent); }
.step .n { font-family: var(--mono); font-size: 14px; color: var(--accent); }
.step .t { font-weight: 800; font-size: 22px; }
.step .d { font-weight: 500; font-size: 16px; line-height: 1.55; color: var(--muted); }

.contact { padding-block: 0 clamp(56px, 8vw, 104px); }
.contact-box {
  background: var(--accent);
  color: var(--accentInk);
  border-radius: 32px;
  padding: clamp(32px, 5vw, 64px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px 48px;
}
.contact-box > svg { flex: none; width: 120px; height: 120px; color: var(--accentInk); }
.contact-box .stack { flex: 1 1 360px; }
.contact-box h2 { font-weight: 800; font-size: clamp(28px, 3.6vw, 46px); letter-spacing: -.02em; line-height: 1.05; }
.contact-box p { font-weight: 500; font-size: 18px; line-height: 1.55; }
.contact-email { font-family: var(--mono); font-size: 15px; user-select: all; }

.site-foot {
  padding-block: 28px 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1.5px solid var(--line);
}
.site-foot .brand { display: flex; align-items: center; gap: 10px; }
.site-foot .name { font-weight: 800; font-size: 15px; letter-spacing: .06em; }

/* ---------- motion ---------- */
@keyframes chevIn { 0% { opacity: 0; transform: translateX(-6px); } 100% { opacity: 1; transform: none; } }
@keyframes ringIn { 0% { opacity: 0; transform: translateX(-10px); } 100% { opacity: 1; transform: none; } }
@keyframes rise { 0% { opacity: 0; transform: translateY(18px); } 100% { opacity: 1; transform: none; } }
@keyframes robotIn {
  0% { opacity: 0; transform: translateY(-40px) scale(.9); }
  60% { opacity: 1; transform: translateY(0) scale(1.04, .94); }
  80% { transform: translateY(-4px) scale(.98, 1.03); }
  100% { opacity: 1; transform: none; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes shadow { 0%, 100% { transform: scale(1); opacity: .16; } 50% { transform: scale(.88); opacity: .1; } }
@keyframes cur { 0% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .page, .page * { animation: none !important; transition: none !important; }
}
