/* Restock Pilot - Stocky Data Rescue (Phase 0)
   Cream background, navy ink, green accent, orange for urgency.
   Serif system headings, sans system body. No framework, no external deps.
   Animations: subtle and professional. Max 0.4s, soft easing,
   fully disabled under prefers-reduced-motion. */

:root {
  --cream: #FAF8F4;
  --navy: #16324F;
  --green: #2E7D5B;
  --green-hover: #246348;
  --orange: #E36414;
  --orange-hover: #C9540C;
  --white: #FFFFFF;
  --line: #E7E1D8;
  --muted: #5c6b74;
  --ok: #147a4a;
  --err: #b42318;

  --shadow: 0 6px 22px rgba(22, 50, 79, 0.10);
  --shadow-lift: 0 10px 26px rgba(22, 50, 79, 0.14);
  --radius: 12px;
  --max: 700px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1); /* soft ease-out */

  --serif: Georgia, "Times New Roman", "Times", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--navy);
  /* Perceptible vertical wash (still soft): cream top -> warm sand bottom. */
  background: linear-gradient(180deg, #FDFCF9 0%, #EFEAE0 100%) fixed;
  min-height: 100vh;
  line-height: 1.55;
}

/* Signature accent bar pinned to the very top edge. */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(90deg, var(--green) 0%, var(--orange) 100%);
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 20px 56px;
  position: relative;
}

/* Dotted grid texture: spans the top region and fades out below the dropzone. */
.wrap::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: 0; left: 0; right: 0;
  height: 700px;
  background-image: radial-gradient(rgba(22, 50, 79, 0.06) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%);
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 34px; position: relative; }

/* Diffuse halos behind the badge + title: a soft light felt at first glance
   (green warmth, fainter orange offset to the right). */
.hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  pointer-events: none;
  left: 50%;
  top: -100px;
  width: 85%;
  height: 440px;
  transform: translateX(-50%);
  background:
    radial-gradient(52% 55% at 45% 42%, rgba(46, 125, 91, 0.14), transparent 70%),
    radial-gradient(48% 52% at 80% 38%, rgba(227, 100, 20, 0.07), transparent 72%);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange);
  color: var(--white);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 7px 14px;
  border-radius: 999px;
  margin: 0 0 22px;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--white);
}
.badge-count { font-weight: 700; }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  color: var(--navy);
}

.subtitle {
  font-size: 1.08rem;
  color: var(--muted);
  margin: 0 auto;
  max-width: 540px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 24px;
}

/* Conversion card floats a touch more on the warmer ground. */
.card:not(.email-card) {
  box-shadow: 0 16px 38px rgba(22, 50, 79, 0.14);
}

h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 10px;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--green);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--green);
  background: #fff;
  transition: border-color .2s var(--ease), background .2s var(--ease),
              transform .2s var(--ease), box-shadow .2s var(--ease);
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
  border-style: solid;
  background: #F1F8F3;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.file-icon {
  width: 40px; height: 40px;
  color: var(--green);
  margin-bottom: 10px;
}
.dropzone-main { font-weight: 600; color: var(--navy); margin: 0 0 4px; }
.dropzone-sub { color: var(--muted); margin: 0; font-size: .95rem; }
.link { color: var(--green); text-decoration: underline; }

/* Trust line */
.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  font-size: .84rem;
  color: var(--muted);
}
.lock-icon { width: 15px; height: 15px; flex: none; }

.file-name {
  margin: 16px 0 0;
  font-size: .92rem;
  color: var(--navy);
  font-weight: 600;
  word-break: break-all;
  text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 9px;
  padding: 13px 22px;
  cursor: pointer;
  transition: background .18s var(--ease), opacity .18s var(--ease),
              transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn-convert {
  background: var(--green);
  color: var(--white);
  width: 100%;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn-convert:hover:not(:disabled) {
  background: var(--green-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(46, 125, 91, 0.28);
}
.btn-convert:disabled { opacity: .5; cursor: not-allowed; } /* stays green, never gray */
.btn-convert.is-loading { opacity: .85; cursor: progress; }

.btn-notify {
  background: var(--orange);
  color: var(--white);
}
.btn-notify:hover {
  background: var(--orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(227, 100, 20, 0.30);
}

/* Spinner (shown in loading state) */
.spinner { width: 18px; height: 18px; display: none; }
.btn-convert.is-loading .spinner { display: inline-block; }

/* ---------- Email / navy section ---------- */
.email-card {
  /* Internal depth: lighter navy up-center fading to base navy at the edges. */
  background: radial-gradient(120% 90% at 50% 0%, #1d3d5f 0%, var(--navy) 68%);
  border-color: var(--navy);
  color: var(--white);
}
.email-card h2 { color: var(--white); }
.email-lead { color: #c9d5df; margin: 0 0 18px; }

.features { list-style: none; margin: 0 0 22px; padding: 0; }
.features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  color: #eef3f7;
  font-size: .98rem;
}
.features svg {
  width: 22px; height: 22px; flex: none;
  color: #6fd39f; /* light green on navy */
  margin-top: 1px;
}

.notify-form { display: flex; gap: 10px; flex-wrap: wrap; }
.notify-form input[type="email"] {
  flex: 1 1 220px;
  font: inherit;
  font-family: var(--sans);
  padding: 13px 14px;
  border: 1px solid #33506b;
  border-radius: 9px;
  background: #0f2338;
  color: var(--white);
}
.notify-form input[type="email"]::placeholder { color: #7f93a4; }
.notify-form input[type="email"]:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

/* Honeypot - hidden from real users */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Results ---------- */
.result { margin: 16px 0 0; font-size: .95rem; }
.result.ok { color: var(--ok); }
.result.err { color: var(--err); }
.email-card .result.ok { color: #6fd39f; }
.email-card .result.err { color: #ffb4a6; }

/* Success state (logic wired in Bloc 0.2) */
.success { display: flex; align-items: center; gap: 12px; }
.success-check { width: 26px; height: 26px; flex: none; color: var(--green); }
.success-check path { stroke-dasharray: 22; stroke-dashoffset: 0; }
.success-text { margin: 0; color: var(--navy); }
.download-zone { margin-top: 16px; }
.download-zone .btn-convert { margin-top: 0; }
.download-hint { font-size: .82rem; color: var(--muted); margin: 10px 0 0; text-align: center; }
.found-headers { margin: 8px 0 0; font-size: .9rem; color: var(--navy); }
.result code {
  background: rgba(22, 50, 79, 0.07);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: .85em;
  word-break: break-word;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: .84rem;
  margin-top: 38px;
  line-height: 1.5;
}
.footer p { margin: 6px 0; }
.footer a { color: var(--green); }
.fineprint { color: #9aa6ad; font-size: .8rem; }

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .wrap { padding: 32px 16px 44px; }
  .card { padding: 20px; }
  .dropzone { padding: 30px 14px; }
  .notify-form { flex-direction: column; }
  .btn-notify { width: 100%; }
  h1 { font-size: clamp(2rem, 10vw, 2.6rem); }
}

/* =========================================================
   ANIMATIONS — enabled only when motion is welcome
   ========================================================= */
@keyframes enterUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .3; }
}
@keyframes iconPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes drawCheck {
  from { stroke-dashoffset: 22; }
  to   { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  /* 1. Staggered page entrance (runs once on load) */
  .hero .badge   { animation: enterUp .4s var(--ease) both;         }
  .hero h1       { animation: enterUp .4s var(--ease) .08s both;    }
  .hero .subtitle{ animation: enterUp .4s var(--ease) .16s both;    }
  .card:not(.email-card) { animation: enterUp .4s var(--ease) .24s both; }
  .email-card    { animation: enterUp .4s var(--ease) .32s both;    }

  /* 2. Discreet urgency pulse (opacity only) */
  .badge-dot { animation: dotPulse 2s ease-in-out infinite; }

  /* 4. File icon pop + filename fade */
  .file-icon.pop { animation: iconPop .3s var(--ease); }
  .file-name.fade-in { animation: fadeIn .3s var(--ease); }

  /* 5. Convert spinner */
  .btn-convert.is-loading .spinner { animation: spin .7s linear infinite; }

  /* 6. Success check draw + download zone fade */
  .success-check path { stroke-dashoffset: 22; animation: drawCheck .3s .05s var(--ease) forwards; }
  .download-zone { animation: fadeInUp .3s var(--ease) both; }
}

/* Honor the explicit request to disable everything */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
