/* ========== NLAB Connect — styles.css ========== */

:root {
  --color-bg: #ffffff;
  --color-bg-soft: #f7f8fb;
  --color-text: #0f172a;
  --color-text-soft: #475569;
  --color-muted: #94a3b8;
  --color-border: #e2e8f0;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-accent: #0ea5e9;
  --color-error: #dc2626;
  --color-success: #16a34a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, 0.15);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1120px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--color-text);
}
.brand img { height: 28px; width: auto; display: block; }
.brand-name { font-size: 1.05rem; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-link {
  color: var(--color-text-soft);
  font-size: 0.95rem;
  font-weight: 500;
}
.header-link:hover { color: var(--color-text); text-decoration: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-muted);
  border-left: 1px solid var(--color-border);
  padding-left: 16px;
}
.lang-switch a { color: var(--color-muted); }
.lang-switch a.active { color: var(--color-text); font-weight: 600; }
.lang-switch .sep { color: var(--color-border); }

/* ===== Hero ===== */
.hero {
  padding: 80px 0 60px;
  background: linear-gradient(180deg, var(--color-bg-soft) 0%, var(--color-bg) 100%);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  margin: 0 auto 16px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  border-radius: 999px;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--color-text-soft);
  margin: 0 0 28px;
}

/* Il·lustració de comunitat al hero */
.hero-illustration {
  margin: 8px auto 0;
  max-width: 720px;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  animation: heroFadeIn 0.8s ease 0.15s forwards;
}
.hero-illustration img,
.hero-illustration svg {
  display: block;
  width: 100%;
  height: auto;
}
@keyframes heroFadeIn {
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 540px) {
  .hero-illustration { max-width: 100%; }
}

/* ===== Form section ===== */
.contact-section {
  padding: 40px 0 100px;
}
.form-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}
.form-card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.form-card .subtitle {
  color: var(--color-text-soft);
  margin: 0 0 28px;
  font-size: 0.98rem;
}

.field-group {
  margin-bottom: 16px;
}
.field-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}
.field-group label .req { color: var(--color-error); }

.field-group input,
.field-group textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-group input:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Estat invàlid (camp required buit, email mal format, etc.) */
.field-group input:user-invalid,
.field-group textarea:user-invalid {
  border-color: var(--color-error);
}
.field-group input:user-invalid:focus,
.field-group textarea:user-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
}

.divider {
  margin: 24px 0 18px;
  padding-top: 22px;
  border-top: 1px dashed var(--color-border);
}
.divider h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-soft);
  margin: 0 0 14px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  margin-top: 8px;
}
.btn-submit:hover { background: var(--color-primary-hover); }
.btn-submit:active { transform: translateY(1px); }
.btn-submit:disabled { background: var(--color-muted); cursor: not-allowed; }

/* Spinner al botó */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-footer {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.5;
}

/* Cloudflare Turnstile widget */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 6px;
}

/* Feedback inline (error en mig del formulari) */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  margin-bottom: 16px;
  display: none;
  animation: slideDown 0.25s ease;
}
.alert.show { display: block; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Success state ===== */
.form-wrapper {
  position: relative;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.form-wrapper.hiding {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.success-state {
  display: none;
  text-align: center;
  padding: 12px 8px 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}
.success-state.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.success-icon::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: #d1fae5;
  opacity: 0;
  z-index: -1;
  animation: pulseRing 1.4s ease-out 0.2s 1;
}
@keyframes pulseRing {
  0%   { opacity: 0.6; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(1.4); }
}

.success-icon svg {
  width: 36px;
  height: 36px;
  stroke: #16a34a;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.5s ease-out 0.3s forwards;
}
@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.success-state h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.success-state p {
  color: var(--color-text-soft);
  margin: 0 auto 28px;
  max-width: 420px;
  line-height: 1.55;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.94rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-muted);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.88rem;
}
.site-footer a { color: var(--color-text-soft); }
.site-footer .footer-links { margin-top: 6px; }
.site-footer .footer-links a { margin: 0 8px; }
