/* UNITH brand tokens (from the UNITH brand palette). Swap these to rebrand. */
:root {
  --blue: #4b8ef5;          /* UNITH blue: focus rings, glow */
  --blue-lite: #ebf2ff;
  --blue-mid: #9dc0f7;
  --navy: #1e2d4d;
  --ink: #0f172a;
  --text: #111827;
  --muted: #6b7280;
  --border: #e4e7ec;
  --field: #f7f8fa;
  --bg: #ffffff;
  /* Button fill: a darker UNITH blue so white text meets WCAG AA (4.5:1). */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #ffffff;
  --ring: rgba(37, 99, 235, 0.18);
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --error: #b42318;
  --error-bg: #fef3f2;
  --warn: #8a5a00;
  --warn-bg: #fff8e6;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------------------------------------------------------- layout */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar { padding: 20px 16px 0; }
.logo-link { display: inline-block; border-radius: 6px; }
.logo { display: block; width: 32px; height: 40px; }

.content {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 16px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Light-blue frame around the form (tablet and up). It starts as four corner
   brackets and the lines grow towards each other as the form is filled in.
   --p (0..1) is set by index.js; at 1 the border is closed. Registering --p
   lets it transition; browsers without @property simply jump between steps. */
@property --p {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
.frame { position: relative; }
@media (min-width: 640px) {
  .content { max-width: 600px; padding: 40px 24px 72px; }
  .frame {
    --p: 0;
    --c: var(--blue-mid);  /* line colour (UNITH light blue) */
    --l: 36px;             /* corner arm length at 0% */
    --t: 3px;              /* line thickness */
    --h: calc(var(--l) + (50% - var(--l)) * var(--p));  /* current arm length */
    padding: 48px 44px;
    background:
      linear-gradient(var(--c), var(--c)) top left / var(--h) var(--t),
      linear-gradient(var(--c), var(--c)) top left / var(--t) var(--h),
      linear-gradient(var(--c), var(--c)) top right / var(--h) var(--t),
      linear-gradient(var(--c), var(--c)) top right / var(--t) var(--h),
      linear-gradient(var(--c), var(--c)) bottom left / var(--h) var(--t),
      linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--h),
      linear-gradient(var(--c), var(--c)) bottom right / var(--h) var(--t),
      linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--h),
      radial-gradient(120% 90% at 0% 0%, rgba(235, 242, 255, 0.9) 0%, rgba(235, 242, 255, 0) 55%);
    background-repeat: no-repeat;
    border-radius: 4px;
    transition: --p 0.7s var(--ease), box-shadow 0.6s var(--ease);
  }
  /* Closed frame: a soft light-blue halo. */
  .frame.is-complete { box-shadow: 0 0 0 6px rgba(157, 192, 247, 0.18), 0 18px 40px rgba(37, 99, 235, 0.08); }
}
@media (prefers-reduced-motion: reduce) {
  .frame { transition: none; }
}

/* Brand panel: desktop only. */
.art { display: none; }

@media (min-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
  .topbar { padding: 32px 40px 0; }
  .content { padding: 24px 32px 72px; }

  .art {
    position: sticky;
    top: 0;
    height: 100vh;
    display: block;
    padding: 16px 16px 16px 0;
  }
  .art::before {
    content: "";
    position: absolute;
    inset: 16px 16px 16px 0;
    border-radius: 24px;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Crect width='3' height='3' fill='white' fill-opacity='.13'/%3E%3C/svg%3E"),
      radial-gradient(120% 80% at 100% 0%, rgba(75, 142, 245, 0.75) 0%, rgba(75, 142, 245, 0) 60%),
      linear-gradient(165deg, #2563eb 0%, #1d3f99 45%, var(--navy) 100%);
  }
  .art-mark {
    position: absolute;
    right: 12%;
    top: 50%;
    width: auto;
    height: 52%;
    transform: translateY(-55%);
    filter: brightness(0) invert(1);
    opacity: 0.12;
    pointer-events: none;
  }
  .art-line {
    position: absolute;
    left: 56px;
    right: 48px;
    bottom: 56px;
    margin: 0;
    color: #fff;
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.02em;
  }
}

/* ------------------------------------------------------------ typography */

h1 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  outline: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin: 0 0 16px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--accent-hover);
  background: var(--blue-lite);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Three squares, echoing the dots of the Ü mark. */
.eyebrow::before {
  content: "";
  width: 14px;
  height: 4px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 5px 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 10px 0 / 4px 4px no-repeat;
}

.sub { color: var(--muted); margin: 0 0 32px; font-size: 17px; }
.sub strong { color: var(--text); font-weight: 600; word-break: break-all; }
.hint { color: var(--muted); font-size: 14px; margin: -12px 0 24px; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

/* ----------------------------------------------------------------- form */

section { display: flex; flex-direction: column; }

.field { margin-bottom: 18px; }

label {
  display: block;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.opt { color: var(--muted); font-weight: 400; }

input[type="email"],
input[type="text"] {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
input[type="email"]::placeholder { color: #9aa3b2; }
input[type="email"]:hover,
input[type="text"]:hover { border-color: #cfd5de; }
input[type="email"]:focus,
input[type="text"]:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; gap: 0; } }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 0;
}
.consent input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.consent label { margin: 0; font-size: 15px; font-weight: 400; color: var(--muted); cursor: pointer; }

/* reCAPTCHA "I'm not a robot" box. Google renders it as a fixed 304x78 iframe;
   the min-height keeps the layout still while it loads. On the narrowest
   phones it is scaled down so it never overflows the 16px gutter. */
.captcha { margin: 18px 0 0; min-height: 78px; }
.captcha[hidden] { display: none; }
@media (max-width: 340px) {
  /* Scale Google's inner box: .captcha itself runs the "rise" animation,
     which would override a transform set on it. */
  .captcha { min-height: 70px; }
  .captcha > div { transform: scale(0.9); transform-origin: 0 0; }
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* -------------------------------------------------------------- buttons */

button, .button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  margin-top: 24px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
button:hover, .button:hover {
  color: var(--accent-text);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: progress; box-shadow: none; }

button.secondary, .button.secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
button.secondary:hover, .button.secondary:hover {
  color: var(--text);
  background: var(--field);
  border-color: #cfd5de;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* ------------------------------------------------------- status visuals */

.msg { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg--error { color: var(--error); background: var(--error-bg); }
.msg--warn { color: var(--warn); background: var(--warn-bg); }

.badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border-radius: 14px;
  color: var(--accent);
  background: var(--blue-lite);
}
.badge--ok { color: var(--ok); background: var(--ok-bg); }
.badge--error { color: var(--error); background: var(--error-bg); }

.spinner {
  width: 40px;
  height: 40px;
  margin-bottom: 24px;
  border: 3px solid var(--blue-lite);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Content rises in each time a view is shown. Motion only, no fade: if the
   animation never runs (background tab, throttled renderer) text stays visible. */
section:not([hidden]) > *,
#signup-form > * {
  animation: rise 0.45s var(--ease) both;
}
section > :nth-child(2), #signup-form > :nth-child(1) { animation-delay: 0.04s; }
section > :nth-child(3), #signup-form > :nth-child(2) { animation-delay: 0.08s; }
section > :nth-child(4), #signup-form > :nth-child(3) { animation-delay: 0.12s; }
section > :nth-child(5), #signup-form > :nth-child(4) { animation-delay: 0.16s; }
#signup-form > :nth-child(5) { animation-delay: 0.2s; }
#signup-form > :nth-child(6) { animation-delay: 0.24s; }
#signup-form > :nth-child(n + 7) { animation: none; }
.spinner { animation: spin 0.8s linear infinite !important; }
@keyframes rise {
  from { transform: translateY(8px); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  section:not([hidden]) > *, #signup-form > * { animation: none; }
  .spinner { animation-duration: 2.4s !important; }
  button, .button { transition: none; }
}

[hidden] { display: none !important; }

.noscript { color: var(--error); }

/* Short desktop screens (e.g. 1280x720 laptops): keep the whole form above the fold. */
@media (min-width: 960px) and (max-height: 860px) {
  .topbar { position: absolute; top: 0; left: 0; padding: 24px 32px 0; }
  .content { padding: 72px 32px 24px; }
  .frame { padding: 32px 40px; }
  h1 { font-size: 32px; }
  .eyebrow { margin-bottom: 12px; }
  .sub { margin-bottom: 20px; font-size: 16px; }
  .field { margin-bottom: 12px; }
  input[type="email"], input[type="text"] { height: 46px; }
  button, .button { height: 50px; margin-top: 20px; }
}
