/* =====================================================================
   Focol.io - contribute (v2 skin)
   Layers on top of styles-v2.css, which supplies the fonts, the :root
   tokens, .nav / .lang / .btn / .ambient and the base body rules.
   Only what is specific to this page lives here: the upload panel, the
   form, the dropzone and the progress bar.

   NOTE: contribute.focol.io is its own deploy, so styles-v2.css is a
   COPY, refreshed by tools/build-v2-pages.js. Do not hand-edit it here.
   ===================================================================== */

:root {
  --danger: #ff6b84;
  --ok: #7cfd9a;
  --warn: var(--amber);
}

body { padding-bottom: 2.5rem; }

/* ------------------------------------------------------------------ *
   Panel
 * ------------------------------------------------------------------ */

/* not .wrap: styles-v2.css already owns that class as a wide container */
.contrib-panel {
  position: relative;
  z-index: 1;
  isolation: isolate;
  max-width: 46rem;
  margin: 1.5rem auto 0;
  padding: 2.2rem 1.25rem 3.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
}

/* Blur on a pseudo, not the panel: backdrop-filter on an ancestor
   blanks the Turnstile iframe in Chrome / Safari. */
.contrib-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
}

.brand-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.7rem;
  text-align: center;
}

.brand-head img {
  height: 64px;
  width: auto;
  filter: drop-shadow(0 12px 40px var(--accent-glow, rgba(77, 138, 240, 0.35)));
}

.brand-logo-link {
  display: inline-flex;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.brand-logo-link:hover { transform: translateY(-1px); filter: brightness(1.06); }

.brand {
  width: 100%;
  margin: 0.1rem 0 0.55rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  text-align: center;
  color: var(--faint);
}

.brand-title {
  margin: 0;
  font-size: clamp(1.15rem, 3.8vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.contrib-panel h1 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0 0 0.3rem;
  letter-spacing: -0.02em;
}

.sub { margin: 0 0 1.5rem; font-size: 0.95rem; color: var(--muted); }

/* ------------------------------------------------------------------ *
   Form
 * ------------------------------------------------------------------ */

.form-grid { margin-bottom: 1.1rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
}

.form-row-full { grid-template-columns: 1fr; margin-bottom: 0; }

.form-cell label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
}

.form-cell input[type="email"],
.form-cell input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-cell input::placeholder { color: var(--faint); }

.form-cell input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77, 138, 240, 0.18);
}

.hint { margin: 0.35rem 0 0; font-size: 0.84rem; color: var(--muted); }
.form-grid-hint { margin: 0 0 0.85rem; }

/* ------------------------------------------------------------------ *
   Dropzone
 * ------------------------------------------------------------------ */

#zone {
  padding: 2rem 1.25rem;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--glass);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#zone:hover,
#zone.dragover {
  border-color: var(--blue);
  background: rgba(77, 138, 240, 0.14);
}

#zone p { margin: 0.35rem 0; }
#fileInput { display: none; }

/* ------------------------------------------------------------------ *
   Buttons: same pill as the rest of the site, full width here
 * ------------------------------------------------------------------ */

button.primary {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1.35rem;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #8eb6f8;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button.primary:hover:not(:disabled) {
  background: rgba(77, 138, 240, 0.1);
  border-color: #6ea0f5;
  color: #b7d0fb;
  transform: none;
  box-shadow: none;
}

button.primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

#btnUpload { width: calc(100% - 2.5rem); margin-left: auto; margin-right: auto; }

/* ------------------------------------------------------------------ *
   Consent
 * ------------------------------------------------------------------ */

.consent-panel {
  margin: 1.15rem 0 1rem;
  padding: 0.95rem 1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.consent-panel-title {
  margin: 0 0 0.65rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.legal { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0 0 0.85rem; }
.legal:last-child { margin-bottom: 0.15rem; }
.legal input { margin-top: 0.35rem; flex-shrink: 0; accent-color: var(--blue); }
.legal label { font-size: 0.9rem; color: var(--muted); }

.legal-optional {
  padding-left: 0.85rem;
  margin-left: 0.15rem;
  border-left: 2px solid rgba(77, 138, 240, 0.4);
}

.legal-optional label {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--fg);
}

.turnstile-wrap {
  margin-top: 1rem;
  position: relative;
  z-index: 2;
  transform: translateZ(0);
}
#turnstileWidget {
  min-width: 300px;
  min-height: 65px;
}
#turnstileWidget iframe {
  max-width: none;
}
.turnstile-wrap .hint { margin-top: 0.45rem; }

/* ------------------------------------------------------------------ *
   Status & progress
 * ------------------------------------------------------------------ */

#status { margin-top: 1.35rem; min-height: 1.35rem; font-size: 0.92rem; }
#status.error { color: var(--danger); }
#status.ok { color: var(--ok); }
#status.warn { color: var(--warn); }

#barOuter {
  display: none;
  margin-top: 0.75rem;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

#barInner { height: 100%; width: 0%; background: var(--grad); transition: width 0.1s linear; }

code.key {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--muted);
}

.muted-box {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------ *
   Mini footer
 * ------------------------------------------------------------------ */

.site-footer-mini {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin: 1.25rem auto 0;
  padding: 0 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--faint);
}

.site-footer-mini a { color: var(--muted); text-decoration: none; }
.site-footer-mini a:hover { color: var(--teal); }

/* ------------------------------------------------------------------ *
   RTL: the pack ships Arabic, so the panel has to mirror
 * ------------------------------------------------------------------ */

html[dir="rtl"] .contrib-panel { direction: rtl; text-align: right; }
html[dir="rtl"] #zone { text-align: center; }
html[dir="rtl"] .legal { flex-direction: row-reverse; }

/* ------------------------------------------------------------------ */

@media (max-width: 700px) {
  .contrib-panel {
    max-width: calc(100% - 1.5rem);
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    padding: 1.4rem 0.9rem 2.2rem;
  }
  .brand-head img { height: 56px; }
  .brand-title { font-size: 1rem; letter-spacing: 0.1em; }
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}
