:root {
  --void: #0A1614;
  --field: #10221E;
  --signal: #2CE8A5;
  --signal-dim: rgba(44, 232, 165, 0.35);
  --white: #F2F5F3;
  --grey: #8A9E97;
  --line: rgba(242, 245, 243, 0.10);

  --display: 'Chakra Petch', system-ui, sans-serif;
  --body: 'Libre Franklin', system-ui, sans-serif;
  --gutter: clamp(16px, 3.9vw, 56px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--void);
  color: var(--white);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--signal); color: var(--void); }

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

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

/* ================= Viewport one: hero ================= */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "head    head"
    "copy    ."
    "caption chevron";
  padding: clamp(20px, 2.8vw, 40px) var(--gutter);
  overflow: hidden;
}

.head {
  grid-area: head;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: block; line-height: 0; }
.brand img { display: block; height: 48px; width: auto; }

.lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 13px var(--display);
  letter-spacing: 0.14em;
  color: var(--grey);
}

.lang button {
  letter-spacing: inherit;
  color: var(--grey);
  background: none;
  border: 0;
  padding: 10px 4px;
  cursor: pointer;
}

.lang button[aria-pressed="true"] { color: var(--white); }
.lang button:hover { color: var(--signal); }

/* The live geometry: right 55%, full height, behind the header */

.knot {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 55%;
  z-index: 0;
  background: radial-gradient(closest-side at 50% 52%, var(--field), var(--void));
}

.knot canvas { display: block; width: 100%; height: 100%; }

.knot-fallback {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46%;
  opacity: 0.6;
}

.knot.is-live .knot-fallback { display: none; }

.copy {
  grid-area: copy;
  position: relative;
  z-index: 1;
  align-self: center;
  container-type: inline-size;
  padding-block: 32px;
}

.statement {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, min(11.8cqi, 12vh), 6rem);
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--white);
}

.statement span { display: block; }

/* longest line per em: "A FINISHED PART." 8.24, "UNA PIEZA TERMINADA." 11.2 */
html[lang="es"] .statement { font-size: clamp(1.5rem, min(8.7cqi, 12vh), 4.5rem); }

.sentence {
  margin: clamp(22px, 3.4vh, 36px) 0 0;
  max-width: 44ch;
  font-size: 20px;
  line-height: 1.5;
  color: var(--grey);
}

.cta {
  display: inline-grid;
  place-items: center;
  width: 240px;
  height: 60px;
  margin-top: clamp(28px, 4.4vh, 44px);
  font: 600 16px var(--display);
  letter-spacing: 0.08em;
  color: var(--void);
  background: var(--signal);
  text-decoration: none;
  outline: 1px solid transparent;
  outline-offset: 4px;
  transition: filter 150ms ease, outline-color 150ms ease;
}

.cta:hover { filter: brightness(1.08); outline-color: var(--signal); }
.cta:focus-visible { outline: 1px solid var(--signal); outline-offset: 4px; filter: brightness(1.08); }

.caption {
  grid-area: caption;
  position: relative;
  z-index: 1;
  align-self: end;
  margin: 0;
  font-size: 12px;
  color: var(--grey);
}

.chevron {
  grid-area: chevron;
  position: relative;
  z-index: 1;
  justify-self: end;
  align-self: end;
  color: var(--signal-dim);
  animation: nudge 3s ease-in-out infinite;
}

@keyframes nudge {
  0%, 70%, 100% { transform: translateY(0); opacity: 1; }
  82% { transform: translateY(5px); opacity: 0.5; }
}

/* Load sequence: 400ms per element, 80ms apart */
.rise { animation: rise 400ms var(--ease-out) both; animation-delay: calc(var(--i) * 80ms); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ================= Viewport two: drop zone ================= */

.send {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--field);
}

.send-title {
  margin: 0;
  padding: clamp(32px, 5.5vh, 56px) var(--gutter) 0;
  text-align: center;
  font: 600 14px var(--display);
  letter-spacing: 0.28em;
  color: var(--grey);
}

.drop {
  align-self: center;
  justify-self: center;
  width: 70vw;
  padding-block: clamp(20px, 3.5vh, 36px);
}

.zone {
  position: relative;
  min-height: 60vh;
  min-height: 60svh;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(44, 232, 165, 0.4);
  border-radius: 4px;
  background: rgba(44, 232, 165, 0.03);
  animation: pulse 4s ease-in-out infinite alternate;
  transition: background-color 150ms ease;
}

@keyframes pulse {
  from { border-color: rgba(44, 232, 165, 0.4); }
  to   { border-color: rgba(44, 232, 165, 0.55); }
}

.zone.is-over {
  animation: none;
  border-style: solid;
  border-color: var(--signal);
  background: rgba(44, 232, 165, 0.10);
}

.zone.is-filled:not(.is-over) { animation: none; }

.zone-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 150ms ease;
}

/* dimmer than the drag-over border so focus and drag never look alike */
.zone-idle:focus-visible { outline: 2px solid var(--signal-dim); outline-offset: -10px; }
.zone.is-leaving .zone-idle { opacity: 0; }

.doc-icon { display: block; color: var(--signal); margin-bottom: 26px; }

.zone-title {
  font: 600 32px/1.15 var(--display);
  letter-spacing: 0.02em;
  color: var(--white);
  text-wrap: balance;
}

.t-drag { display: none; }
.zone.is-over .t-idle { display: none; }
.zone.is-over .t-drag { display: inline; }

.zone-hint {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--grey);
  text-wrap: balance;
}

.zone-error {
  margin-top: 14px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--white);
  border: 1px solid var(--signal-dim);
}

/* Form state */

.zone-form {
  width: 100%;
  max-width: 520px;
  padding: clamp(28px, 4vh, 44px) clamp(20px, 3vw, 32px);
  animation: slide-up 250ms var(--ease-out) both;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

#drawing-form { display: grid; gap: 16px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  min-width: 0;
}

.check { flex: none; color: var(--signal); }

.file-name {
  font-size: 20px;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.field {
  display: grid;
  gap: 8px;
  font: 600 11px var(--display);
  letter-spacing: 0.2em;
  color: var(--grey);
}

.field input {
  height: 52px;
  padding: 0 16px;
  font: 400 16px var(--body);
  letter-spacing: 0;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.field input:focus { outline: none; border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.field input[aria-invalid="true"] { border-color: var(--white); }
.field:has(input[aria-invalid="true"]) { color: var(--white); }

.send-btn {
  height: 56px;
  width: 100%;
  margin-top: 8px;
  font: 600 16px var(--display);
  letter-spacing: 0.08em;
  color: var(--void);
  background: var(--signal);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  outline: 1px solid transparent;
  outline-offset: 4px;
  transition: filter 150ms ease, outline-color 150ms ease;
}

.send-btn:hover { filter: brightness(1.08); outline-color: var(--signal); }
.send-btn:focus-visible { outline: 1px solid var(--signal); outline-offset: 4px; }
.send-btn[disabled] { opacity: 0.6; cursor: progress; }

.form-note { margin: -2px 0 0; font-size: 13px; color: var(--grey); }
.form-error { margin: 0; font-size: 13px; color: var(--white); }

.done { display: grid; gap: 10px; justify-items: start; }
.done-title { margin: 0; font: 600 24px var(--display); letter-spacing: 0.08em; color: var(--signal); }
.done-title:focus { outline: none; }
.done-line { margin: 0 0 8px; font-size: 16px; color: var(--grey); }

.text-link {
  padding: 6px 0;
  font-size: 14px;
  color: var(--grey);
  background: none;
  border: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
  cursor: pointer;
}

.text-link:hover { color: var(--white); text-decoration-color: var(--grey); }

.describe { margin-top: 14px; }

/* Footer strip */

.strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 var(--gutter);
  background: var(--void);
  font-size: 13px;
  color: var(--grey);
}

.strip-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 600 12px var(--display);
  letter-spacing: 0.14em;
}

.strip-brand img { display: block; width: 24px; height: 24px; }
.strip-mail { color: inherit; text-decoration: none; }
.strip-mail:hover { color: var(--white); }
.strip-place { justify-self: end; }

/* ================= Mobile ================= */

@media (max-width: 899px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "head"
      "knot"
      "copy"
      "caption";
  }

  .brand img { height: 40px; }

  .knot {
    grid-area: knot;
    position: relative;
    width: auto;
    height: 45vh;
    height: 45svh;
    margin-inline: calc(var(--gutter) * -1);
  }

  .copy { padding-block: 8px 24px; }
  .statement { font-size: clamp(1.9rem, 11.8cqi, 3.5rem); }
  html[lang="es"] .statement { font-size: clamp(1.5rem, 8.7cqi, 2.6rem); }
  .sentence { font-size: 18px; }
  .cta { width: 100%; }

  .chevron { position: absolute; right: var(--gutter); bottom: clamp(20px, 2.8vw, 40px); }

  .drop { width: auto; margin-inline: var(--gutter); justify-self: stretch; }
  .zone { min-height: max(320px, 50svh); }
  .zone-title { font-size: 26px; }

  .strip {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 8px;
    padding-block: 20px;
  }

  .strip-place { justify-self: start; }
}

@media (max-width: 480px) {
  .brand img { height: 34px; }
}

/* ================= Reduced motion ================= */

@media (prefers-reduced-motion: reduce) {
  .rise, .chevron, .zone, .zone-form { animation: none; }
  .zone-idle, .cta, .send-btn { transition: none; }
}
