/* ============================================================================
   IntellAgent - styles.css
   Tokens are lifted verbatim from DESIGN.md (google-labs-code/design.md format).
   Strict monochrome, brutalist-lite: pure-black canvas, uppercase IBM Plex Mono
   display, light IBM Plex Sans body, square corners, generous whitespace.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* colors */
  --background: #000000;
  --surface:    #FFFFFF;
  --primary:    #FFFFFF;
  --ink-on-dark:  #F2F2F2;
  --ink-on-light: #262626;
  --muted:      #919191;
  --accent:     #0B5FD8; /* opt-in only; unused in the canonical monochrome build */
  --ring:       var(--primary);

  /* type */
  --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* spacing scale (4px-based) */
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  --maxw: 34rem;        /* 544px content measure */
  --input-h: 3rem;      /* 48px touch target */

  /* motion */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, p { margin: 0; }
html, body { min-height: 100%; }
[hidden] { display: none !important; } /* beats class rules like .form{display:flex} */

body {
  background: var(--background);
  color: var(--ink-on-dark);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  min-height: 100vh;
  min-height: 100svh; /* avoids mobile browser-chrome jump */
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 4vh, 2rem) clamp(1.5rem, 5vw, 2rem);
}

/* --- animated background -------------------------------------------------- */
/* WebGL dither field (bg.js) sits behind everything; scrim darkens the centre
   so text stays readable; content is lifted above both. Solid black fallback. */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  background: var(--background);
}
.bg-scrim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(135% 110% at 50% 50%,
    rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.38) 50%, rgba(0, 0, 0, 0) 100%);
}
.header, .main { position: relative; z-index: 1; }

/* --- header / wordmark ---------------------------------------------------- */
.header {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}
.wordmark {
  display: inline-block;
  font-family: var(--mono);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  line-height: 1;
  color: var(--primary);
}

/* --- main column ---------------------------------------------------------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-block: clamp(2rem, 6vh, 4rem);
}

.eyebrow {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  margin-bottom: clamp(1rem, 2.5vh, 1.5rem);
}

.headline {
  font-family: var(--mono);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  line-height: 1.02;
  color: var(--primary);
  margin-bottom: clamp(1rem, 3vh, 1.5rem);
}

.lead {
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: var(--ink-on-dark);
  max-width: 32rem;
  margin-bottom: clamp(2rem, 5vh, 3rem);
}
.lead em { font-style: normal; color: var(--primary); }

/* --- form ----------------------------------------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.field { display: flex; flex-direction: column; gap: var(--space-xs); }

label {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}
.req { color: var(--ink-on-dark); }

input[type="text"],
input[type="email"] {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--ink-on-dark);
  caret-color: var(--ink-on-dark);
  background: var(--ink-on-light);
  border: 1px solid transparent;
  border-radius: 0;
  height: var(--input-h);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  outline: none;
  transition: box-shadow 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
input::placeholder { color: #8a8a8a; opacity: 1; } /* dimmer than input text */

/* keep autofill on-brand (dark field, light text) instead of browser white/yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--ink-on-dark) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--ink-on-light) inset !important;
  box-shadow: 0 0 0 1000px var(--ink-on-light) inset !important;
  caret-color: var(--ink-on-dark);
  border: 1px solid transparent !important;
  transition: background-color 600000s 0s, color 600000s 0s;
}
input:autofill,
textarea:autofill {
  -webkit-text-fill-color: var(--ink-on-dark);
  box-shadow: 0 0 0 1000px var(--ink-on-light) inset;
}

input:focus-visible {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
input[aria-invalid="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

textarea {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--ink-on-dark);
  caret-color: var(--ink-on-dark);
  background: var(--ink-on-light);
  border: 1px solid transparent;
  border-radius: 0;
  width: 100%;
  min-height: 3.5rem;
  padding: var(--space-sm) var(--space-md);
  outline: none;
  resize: vertical;
  transition: box-shadow 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
textarea::placeholder { color: #8a8a8a; opacity: 1; }
textarea:focus-visible { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }

.field-error {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-on-dark);
  min-height: 0;
}
.field-error:empty { display: none; }
.field-error::before { content: "- "; color: var(--muted); }

/* --- segmented single-select (interest) ---------------------------------- */
.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;
}
.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg legend {
  font-family: var(--mono); font-weight: 400; text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 0.8125rem; line-height: 1.5;
  color: var(--muted); padding: 0; margin-bottom: var(--space-xs);
}
.opt { color: var(--muted); opacity: 0.85; }
.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
.seg-grid label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--mono); font-weight: 400; text-transform: uppercase;
  letter-spacing: 0.04em; font-size: 0.6875rem; line-height: 1.1;
  color: var(--ink-on-dark); background: var(--ink-on-light);
  min-height: 2.75rem; padding: 0.5rem 0.35rem; cursor: pointer; user-select: none;
  transition: background-color 130ms var(--ease-out), color 130ms var(--ease-out);
}
@media (hover: hover) { .seg-grid label:hover { background: #333333; } }
.seg-grid input:checked + label { background: var(--surface); color: var(--ink-on-light); }
.seg-grid input:focus-visible + label {
  position: relative; z-index: 1;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* --- CTA ------------------------------------------------------------------ */
.cta {
  align-self: flex-start;
  margin-top: var(--space-xs);
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--ink-on-light);
  background: var(--surface);
  border: 1px solid var(--surface);
  border-radius: 0;
  /* optical: a hair less top than bottom so caps sit centered */
  padding: 0.85rem var(--space-lg) 0.95rem;
  min-height: 2.75rem; /* 44px hit target */
  cursor: pointer;
  transition: background-color 150ms var(--ease-out),
              color 150ms var(--ease-out),
              border-color 150ms var(--ease-out),
              transform 80ms var(--ease-out);
}
@media (hover: hover) {
  .cta:hover:not(:disabled) {
    background: var(--background);
    color: var(--primary);
    border-color: var(--primary);
  }
}
.cta:active:not(:disabled) { transform: translateY(1px); }
.cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.cta:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- form-level error ----------------------------------------------------- */
.form-error {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-on-dark);
  border-left: 2px solid var(--primary);
  padding: var(--space-sm) var(--space-md);
}
.form-error[hidden] { display: none; }

/* --- reassurance ---------------------------------------------------------- */
.reassure {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
  margin-top: var(--space-lg);
}

/* --- success modal (native <dialog>) -------------------------------------- */
.modal {
  margin: auto;                 /* center in the viewport */
  width: calc(100% - 3rem);
  max-width: 30rem;
  padding: clamp(2rem, 5vw, 3rem);
  background: #0a0a0a;
  color: var(--ink-on-dark);
  border: 1px solid var(--surface);
  border-radius: 0;
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.modal__title {
  font-family: var(--mono);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.05;
  color: var(--primary);
  margin: 0 0 var(--space-sm);
}
.modal__body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1.125rem;
  line-height: 1.4;
  color: var(--ink-on-dark);
  margin: 0 0 var(--space-xl);
}
.modal__ok {
  font-family: var(--mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.875rem;
  line-height: 1;
  color: var(--ink-on-light);
  background: var(--surface);
  border: 1px solid var(--surface);
  border-radius: 0;
  padding: 0.8rem var(--space-xl) 0.9rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out),
              border-color 150ms var(--ease-out), transform 80ms var(--ease-out);
}
@media (hover: hover) {
  .modal__ok:hover { background: var(--background); color: var(--primary); border-color: var(--primary); }
}
.modal__ok:active { transform: translateY(1px); }
.modal__ok:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 4px var(--ring);
}
@media (prefers-reduced-motion: no-preference) {
  .modal[open] { animation: modalIn 220ms var(--ease-out); }
  .modal[open]::backdrop { animation: modalFade 220ms var(--ease-out); }
  @keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
  @keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
}

/* --- honeypot (off-screen, not display:none, so bots still fill it) ------- */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* --- entrance reveal (text only; the form stays instantly usable) --------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: reveal 550ms var(--ease-out) forwards;
    animation-delay: var(--delay, 0ms);
  }
  @keyframes reveal { to { opacity: 1; transform: none; } }
}

/* --- responsive ----------------------------------------------------------- */
@media (min-width: 1024px) {
  .main { padding-block: clamp(3rem, 8vh, 4rem); }
}
