/* ==========================================================================
   Biriai — base, layout and shared components
   Depends on tokens.css
   ========================================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" on;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ol, ul, figure, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--c-blue); color: var(--c-white); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 100;
  background: var(--c-white); color: var(--c-navy); padding: 10px 16px; border-radius: var(--r-sm);
  font-weight: 500; transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-4); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(72px, 9vw, 128px); }
.section--white { background: var(--surface); }
.section--dark { background: var(--dark-bg); color: var(--dark-text); }
.section + .section--white, .section--white + .section { border-top: 1px solid var(--line-soft); }

.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5) var(--space-8); align-items: end; margin-bottom: clamp(40px, 5vw, 64px);
}
.section-head__lead { color: var(--text-muted); font-size: var(--fs-lead); max-width: 52ch; }
.section--dark .section-head__lead { color: var(--dark-muted); }
@media (max-width: 860px) { .section-head { grid-template-columns: 1fr; } }

/* ---------- Type ---------- */
.t-display { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: var(--tr-display); font-weight: 600; text-wrap: balance; }
.t-h1 { font-size: var(--fs-h1); line-height: 1.06; letter-spacing: -0.03em; font-weight: 600; text-wrap: balance; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); letter-spacing: var(--tr-heading); font-weight: 600; text-wrap: balance; }
.t-h3 { font-size: var(--fs-h3); line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }
.t-lead { font-size: var(--fs-lead); line-height: 1.55; }
.t-label { font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.005em; }
.t-caption { font-size: var(--fs-caption); line-height: 1.5; color: var(--text-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Icons ---------- */
.icon { display: inline-block; width: 24px; height: 24px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon--sm { width: 18px; height: 18px; }
.icon--lg { width: 32px; height: 32px; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--text); --btn-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg); box-shadow: inset 0 0 0 1px var(--btn-line);
  font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.005em; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--btn-line), var(--focus-ring); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn--primary { --btn-bg: var(--c-blue); --btn-fg: var(--c-white); }
.btn--primary:hover { --btn-bg: var(--c-blue-strong); }
.btn--secondary { --btn-bg: var(--c-white); --btn-fg: var(--c-navy); --btn-line: var(--line); }
.btn--secondary:hover { --btn-line: var(--c-navy); }
.btn--light { --btn-bg: var(--c-offwhite); --btn-fg: var(--c-navy); }
.btn--light:hover { --btn-bg: var(--c-white); }
.btn--ghost { --btn-fg: var(--dark-text); --btn-line: rgba(203, 213, 225, 0.32); }
.btn--ghost:hover { --btn-line: rgba(203, 213, 225, 0.7); --btn-bg: rgba(255, 255, 255, 0.04); }
.btn--sm { height: 36px; padding: 0 14px; font-size: var(--fs-label); gap: 8px; }
.btn--sm .icon { width: 16px; height: 16px; }
.btn--icon { width: 36px; padding: 0; }

/* ---------- Text link ---------- */
.link { color: var(--c-blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(6, 104, 225, 0.35); transition: text-decoration-color var(--dur-fast) var(--ease); }
.link:hover { text-decoration-color: currentColor; }
.section--dark .link, .hero .link { color: var(--dark-text); text-decoration-color: rgba(245, 247, 250, 0.35); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--c-blue-tint); color: var(--c-blue);
}
.badge--neutral { background: var(--c-offwhite); color: var(--c-slate); box-shadow: inset 0 0 0 1px var(--line); }
.badge--dark { background: var(--c-oxford); color: var(--c-platinum); box-shadow: inset 0 0 0 1px var(--dark-line); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: clamp(22px, 2.4vw, 30px); }
.card--outline { background: transparent; border-color: var(--line); }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 8px; }
.field__label { font-size: var(--fs-label); font-weight: 500; color: var(--text); }
.input {
  height: 48px; width: 100%; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--c-white); color: var(--text); font: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: #8391A5; }
.input:hover { border-color: #AEB9C9; }
.input:focus, .input.is-focus { outline: none; border-color: var(--c-blue); box-shadow: var(--focus-ring); }
.field__hint { font-size: var(--fs-caption); color: var(--text-muted); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  color: var(--dark-text);
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), backdrop-filter var(--dur) var(--ease);
}
.site-header.is-scrolled { background: rgba(7, 26, 43, 0.94); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px); box-shadow: 0 1px 0 var(--dark-line); }
.site-header__inner { height: 100%; display: flex; align-items: center; gap: var(--space-6); }
.brand-mark { display: inline-flex; align-items: center; height: 40px; margin-left: -2px; }
.brand-mark img { height: 26px; width: auto; }
.site-nav { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
.site-nav__link {
  position: relative; padding: 8px 12px; border-radius: var(--r-pill); font-size: var(--fs-label); font-weight: 500;
  color: var(--dark-muted); transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.site-nav__link:hover { color: var(--dark-text); background: rgba(255, 255, 255, 0.05); }
.site-nav__link[aria-current="page"] { color: var(--dark-text); }
.site-nav__link[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--c-sky); }
.site-header__actions { display: flex; align-items: center; gap: var(--space-3); }

.menu-toggle { display: none; width: 40px; height: 40px; border-radius: var(--r-pill); align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--dark-line); }
.menu-toggle .icon { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-header__cta { display: none; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto; margin: 0; padding: var(--space-3) var(--gutter) var(--space-5);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--c-navy); box-shadow: 0 1px 0 var(--dark-line), 0 24px 40px -20px rgba(0, 0, 0, 0.5);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .site-nav__link { padding: 14px 4px; border-radius: 0; font-size: 1.0625rem; border-bottom: 1px solid var(--dark-line); }
  .site-nav__link:hover { background: none; }
  .site-nav__link[aria-current="page"]::after { left: auto; right: 4px; top: 50%; bottom: auto; margin: -2px 0 0; }
  .site-nav__mobile-cta { display: inline-flex; margin-top: var(--space-5); }
  .site-header.menu-open { background: var(--c-navy); }
  .site-header__actions { margin-left: auto; }
}
@media (min-width: 861px) { .site-nav__mobile-cta { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--dark-bg); color: var(--dark-text); padding-top: calc(var(--header-h) + clamp(48px, 7vw, 96px)); padding-bottom: clamp(72px, 9vw, 120px); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(40px, 6vw, 80px); align-items: center; }
.hero__title { max-width: 12ch; }
.hero__lead { margin-top: var(--space-5); color: var(--dark-muted); max-width: 48ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.hero__note { margin-top: var(--space-5); font-size: var(--fs-label); color: rgba(203, 213, 225, 0.78); }
@media (max-width: 960px) { .hero__grid { grid-template-columns: 1fr; } .hero__title { max-width: 16ch; } }

/* ---------- Agent panel (hero visual) ---------- */
.agent-panel {
  position: relative; background: var(--dark-surface); border-radius: var(--r-xl); padding: clamp(20px, 2.4vw, 28px);
  box-shadow: inset 0 0 0 1px var(--dark-line), 0 40px 80px -40px rgba(0, 0, 0, 0.6);
}
.agent-panel__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.agent-panel__kicker { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-caption); color: var(--dark-muted); }
.agent-panel__live { width: 7px; height: 7px; border-radius: 50%; background: var(--c-sky); box-shadow: 0 0 0 0 rgba(110, 168, 245, 0.5); animation: live 2.4s var(--ease) infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(110, 168, 245, 0.45); } 70%, 100% { box-shadow: 0 0 0 8px rgba(110, 168, 245, 0); } }
.agent-panel__task { margin-top: 6px; font-size: 1.0625rem; line-height: 1.4; font-weight: 500; color: var(--dark-text); min-height: 2.8em; }
.agent-panel__steps { display: flex; gap: 6px; padding-top: 6px; }
.agent-panel__steps span { width: 18px; height: 3px; border-radius: 2px; background: rgba(203, 213, 225, 0.2); transition: background-color var(--dur) var(--ease); }
.agent-panel__steps span.is-on { background: var(--c-sky); }

.agent-graph { width: 100%; height: auto; margin: var(--space-4) 0 var(--space-2); overflow: visible; }
.agent-graph .edge { stroke: rgba(203, 213, 225, 0.2); stroke-width: 1.5; fill: none; }
.agent-graph .edge--peer { stroke-dasharray: 2 6; stroke-linecap: round; }
.agent-graph .edge.is-active { stroke: rgba(110, 168, 245, 0.75); }
.agent-graph .node { fill: var(--c-navy); stroke: rgba(203, 213, 225, 0.4); stroke-width: 1.5; transition: fill var(--dur) var(--ease), stroke var(--dur) var(--ease); }
.agent-graph .node--core { fill: var(--c-blue); stroke: none; }
.agent-graph .node.is-active, .agent-graph .node.is-done { fill: var(--c-blue); stroke: var(--c-blue); }
.agent-graph .halo { fill: none; stroke: var(--c-sky); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.agent-graph .halo.is-active { animation: halo 1.4s var(--ease) infinite; }
@keyframes halo { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.agent-graph .label { fill: var(--dark-muted); font-size: 12px; font-weight: 500; font-family: var(--font-sans); }
.agent-graph .label--core { fill: var(--dark-text); }
.agent-graph .pulse { fill: var(--c-sky); opacity: 0; }

.agent-log { display: grid; gap: 10px; margin-top: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--dark-line); }
.agent-log li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.9375rem; line-height: 1.45; color: var(--dark-muted); opacity: 0.32; transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease); min-height: 1.45em; }
.agent-log li.is-active, .agent-log li.is-done { opacity: 1; }
.agent-log li.is-done { color: var(--dark-text); }
.agent-log strong { font-weight: 600; color: var(--dark-text); }
.agent-log__status { position: relative; flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(203, 213, 225, 0.35); color: var(--c-white); }
.agent-log__status svg { position: absolute; inset: 3px; width: 12px; height: 12px; opacity: 0; }
.is-active > .agent-log__status { box-shadow: inset 0 0 0 1.5px var(--c-sky); border-top-color: transparent; animation: spin 0.9s linear infinite; background: conic-gradient(from 0deg, transparent 0 70%, rgba(110, 168, 245, 0.9) 70% 100%); -webkit-mask: radial-gradient(circle, transparent 6.5px, #000 7px); mask: radial-gradient(circle, transparent 6.5px, #000 7px); }
.is-done > .agent-log__status { background: var(--c-blue); box-shadow: none; }
.is-done > .agent-log__status svg { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.agent-log__result { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--dark-line); }
.agent-log__result .badge { margin-right: 4px; }

/* ---------- Services ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 20px); }
.service { display: flex; flex-direction: column; gap: var(--space-3); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.service:hover { border-color: var(--line); box-shadow: var(--shadow-2); }
.icon-tile { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md); background: var(--c-blue-tint); color: var(--c-blue); margin-bottom: var(--space-3); }
.icon-tile .icon { width: 22px; height: 22px; }
.service__text { color: var(--text-muted); }
@media (max-width: 1024px) { .services { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .services { grid-template-columns: 1fr; } }

/* ---------- Process ---------- */
.process { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); counter-reset: step; }
.process::before { content: ""; position: absolute; left: 7px; right: 0; top: 7px; height: 1px; background: var(--line); }
.process__step { position: relative; padding-top: var(--space-7); }
.process__step::before { content: ""; position: absolute; left: 0; top: 0; width: 15px; height: 15px; border-radius: 50%; background: var(--c-white); box-shadow: inset 0 0 0 1.5px var(--c-blue); }
.process__step:first-child::before { background: var(--c-blue); }
.process__num { font-size: var(--fs-label); font-weight: 600; color: var(--c-blue); font-variant-numeric: tabular-nums; }
.process__title { margin-top: var(--space-2); }
.process__text { margin-top: var(--space-3); color: var(--text-muted); }
@media (max-width: 960px) {
  .process { grid-template-columns: 1fr 1fr; row-gap: var(--space-7); }
  .process::before { display: none; }
}
@media (max-width: 560px) {
  .process { grid-template-columns: 1fr; gap: 0; }
  .process::before { display: block; left: 7px; right: auto; top: 8px; bottom: 8px; width: 1px; height: auto; }
  .process__step { padding: 0 0 var(--space-6) var(--space-7); }
}

.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); margin-top: clamp(56px, 7vw, 96px); padding-top: var(--space-7); border-top: 1px solid var(--line-soft); }
.principle { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: start; }
.principle .icon { color: var(--c-blue); margin-top: 2px; }
.principle__title { font-weight: 600; }
.principle__text { margin-top: 4px; color: var(--text-muted); }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; gap: var(--space-5); } }

/* ---------- Contact ---------- */
.contact__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: end; }
.contact__lead { margin-top: var(--space-5); color: var(--dark-muted); max-width: 44ch; }
.contact__card { background: var(--dark-surface); border-radius: var(--r-xl); padding: clamp(24px, 3vw, 36px); box-shadow: inset 0 0 0 1px var(--dark-line); }
.contact__label { color: var(--dark-muted); }
.contact__email { display: inline-block; margin-top: var(--space-2); font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; color: var(--dark-text); word-break: break-word; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size var(--dur) var(--ease); }
.contact__email:hover { background-size: 100% 1px; }
.contact__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr; gap: var(--space-7); } }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark-bg); color: var(--dark-muted); border-top: 1px solid var(--dark-line); padding-block: var(--space-6); font-size: var(--fs-label); }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-6); }
.site-footer__logo img { height: 22px; width: auto; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-left: auto; }
.site-footer__links a:hover { color: var(--dark-text); }

/* ---------- Copy feedback / toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 16px);
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: var(--r-pill);
  background: var(--c-navy); color: var(--c-offwhite); font-size: var(--fs-label); font-weight: 500; box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { width: 18px; height: 18px; color: var(--c-sky); }

/* ---------- Reveal (single, page-load only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(12px); animation: reveal 0.9s var(--ease) forwards; }
  .reveal--2 { animation-delay: 0.08s; }
  .reveal--3 { animation-delay: 0.16s; }
  .reveal--4 { animation-delay: 0.28s; }
  @keyframes reveal { to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
