/* Newton Farm Guest Wifi portal
   Palette pulled from the shield logo: charcoal, cream, sky, leaf, grass. */

:root {
  --ink: #2c2e2e;            /* charcoal — animals + banner + border */
  --ink-soft: #6a6c6e;
  --cream: #f3eed6;          /* "NEWTON FARM" wordmark */
  --surface: #ffffff;
  --surface-soft: #fbf9f0;
  --sky: #a8d2e6;            /* logo sky */
  --grass: #a4c47a;          /* logo hill */
  --leaf: #5e8f3f;           /* logo tree */
  --leaf-dark: #4a7531;
  --error: #b3361b;
  --radius-card: 24px;
  --radius-input: 12px;
  --shadow-card: 0 24px 64px -20px rgba(44, 46, 46, 0.28),
                 0 2px 6px rgba(44, 46, 46, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg,
      var(--sky) 0%,
      #cde3d6 48%,
      var(--grass) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body {
  display: grid;
  place-items: center;
  padding: 28px 16px 40px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 28px 26px 22px;
  box-shadow: var(--shadow-card);
}

.brand { text-align: center; margin-bottom: 22px; }

.logo {
  width: 116px;
  height: auto;
  margin: 0 auto 14px;
  display: block;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}

.lede {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

input[type="email"] {
  width: 100%;
  font-size: 16px; /* 16px stops iOS zoom on focus */
  padding: 14px 16px;
  border-radius: var(--radius-input);
  border: 1.5px solid #e6e3d8;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: inherit;
  transition: border-color 120ms, background-color 120ms, box-shadow 120ms;
}

input[type="email"]::placeholder { color: #aaa49a; }

input[type="email"]:focus {
  outline: none;
  border-color: var(--leaf);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(94, 143, 63, 0.14);
}

input[type="email"]:invalid:not(:placeholder-shown) { border-color: var(--error); }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.5;
  user-select: none;
  padding: 4px 0;
}

.consent input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--leaf);
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  cursor: pointer;
}

.consent a {
  color: var(--leaf-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.primary {
  position: relative;
  background: var(--leaf);
  color: #ffffff;
  border: none;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: inherit;
  transition: background-color 140ms, transform 80ms, opacity 140ms,
              box-shadow 140ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  margin-top: 2px;
  box-shadow: 0 8px 18px -8px rgba(94, 143, 63, 0.55);
}

.primary:hover:not(:disabled) { background: var(--leaf-dark); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled {
  background: #d8d6cf;
  cursor: not-allowed;
  box-shadow: none;
  color: #ffffff;
}

.primary .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.primary[data-state="loading"] .label { opacity: 0.7; }
.primary[data-state="loading"] .spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  margin: -8px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--error);
}

.status {
  margin: 4px 0 0;
  min-height: 20px;
  font-size: 13.5px;
  color: var(--leaf-dark);
  text-align: center;
}

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

.foot {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.foot p { margin: 2px 0; }
.foot a { color: var(--ink-soft); text-decoration: underline; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Success page */
body.success .card { text-align: center; }
body.success .logo { width: 84px; margin-bottom: 14px; }
body.success .icon-tick {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--leaf);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 32px;
  box-shadow: 0 8px 22px -10px rgba(94, 143, 63, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .primary .spinner { animation: none; }
  .primary, input[type="email"] { transition: none; }
}
