/* DreamValley Trade Solutions — app layer
 * Sits on top of styles.css. Adds: full-viewport page rendering,
 * mobile-first overrides, real navigation feedback, auth flashes,
 * sticky CTA bar, and a few first-paint polish items.
 */

/* ── boot splash (hidden once React mounts) ──────────────────── */
#boot-splash {
  position: fixed; inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle at 14% -10%, rgba(197, 80, 62, 0.14), transparent 40%),
    radial-gradient(circle at 86% -14%, rgba(45, 74, 31, 0.14), transparent 42%),
    var(--paper, #F5F0E8);
  color: var(--ink, #1A1A1A);
  z-index: 9999;
  transition: opacity 0.45s cubic-bezier(.2,.8,.2,1), visibility 0.45s cubic-bezier(.2,.8,.2,1);
  font-family: "Inter", system-ui, sans-serif;
  gap: 14px;
}
#boot-splash.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-mark {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.02em;
}
.boot-sub {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted, #6B6B6B);
}
.boot-spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(26, 26, 26, 0.12);
  border-top-color: var(--terracotta, #C5503E);
  box-shadow: 0 0 0 6px rgba(255,255,255,0.12);
  animation: boot-spin 0.9s linear infinite;
  margin-top: 8px;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ── full-viewport app shell ─────────────────────────────────── */
html, body { margin: 0; padding: 0; background: var(--paper, #F5F0E8); }
body { font-family: "Inter", system-ui, sans-serif; }
#root { min-height: 100vh; min-height: 100dvh; }

/* The .page wrapper inside each component was designed for an 880px
 * artboard. Let it grow to fill the viewport now. */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto !important;
  overflow: visible !important;
  animation: dvt-page-in 0.42s cubic-bezier(.2,.8,.2,1) both;
}
.page-scroll {
  overflow: visible !important;
  height: auto !important;
}
.page-scroll.hide-scroll::-webkit-scrollbar { display: none; }
.page-scroll.hide-scroll { scrollbar-width: none; }

/* ── nav: make links actually navigate ───────────────────────── */
.nav .nav-link,
.nav .brand,
.nav .btn-call {
  cursor: pointer;
}
.nav .nav-link[href]:focus-visible,
a[href]:focus-visible,
button:focus-visible {
  outline: 2px solid var(--terracotta, #C5503E);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── flash messages ──────────────────────────────────────────── */
.dvt-flash {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: color-mix(in oklab, var(--ink, #1A1A1A) 88%, #000);
  color: var(--paper, #F5F0E8);
  padding: 12px 18px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 18px 34px rgba(0,0,0,0.28);
  backdrop-filter: blur(8px);
  z-index: 8000;
  animation: dvt-flash-in 0.25s cubic-bezier(.2,.7,.2,1);
  max-width: 90vw;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dvt-flash[data-kind="error"]   { background: #8B2E22; }
.dvt-flash[data-kind="success"] { background: #2D4A1F; }
@keyframes dvt-flash-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── 404 page ────────────────────────────────────────────────── */
.dvt-404 {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 20px;
  background: var(--paper, #F5F0E8);
}
.dvt-404 .codex {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted, #6B6B6B);
}
.dvt-404 h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(40px, 7vw, 72px);
  letter-spacing: -0.02em;
  margin: 14px 0 14px;
  text-wrap: balance;
}
.dvt-404 p {
  max-width: 540px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft, #3F3F3F);
}
.dvt-404 .actions {
  display: inline-flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
  justify-content: center;
}
.dvt-404 .actions .btn { min-width: 170px; }

/* ── desktop pages on small screens: graceful single-column ──── */
@media (max-width: 760px) {
  /* The pages were authored with `style={{ gridTemplateColumns: '...' }}`
   * (inline), so we can't override the grid columns directly. Instead,
   * we collapse every grid section to a single column at narrow widths
   * by retargeting display. This is a v1 compromise — every page also
   * has a dedicated mobile variant served by the router below 720px. */
  .page > * { padding-left: 4vw !important; padding-right: 4vw !important; }
  .page section,
  .page header,
  .page footer { padding-left: 0 !important; padding-right: 0 !important; }
}

/* ── auth-page polish (login form actually works) ────────────── */
.dvt-auth-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}
.dvt-auth-form label {
  display: grid;
  gap: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted, #6B6B6B);
}
.dvt-auth-form input[type="email"],
.dvt-auth-form input[type="text"],
.dvt-auth-form input[type="tel"],
.dvt-auth-form textarea {
  font-family: "Inter", sans-serif;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--divider-strong, rgba(26,26,26,0.18));
  border-radius: 4px;
  background: var(--paper-form, #FFFFFF);
  color: var(--ink, #1A1A1A);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.dvt-auth-form input:focus,
.dvt-auth-form textarea:focus {
  outline: none;
  border-color: var(--terracotta, #C5503E);
  box-shadow: 0 0 0 3px var(--terracotta-soft, rgba(197,80,62,0.08));
}
.dvt-auth-form button[type="submit"] {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 13px 22px;
  background: var(--olive, #2D4A1F);
  color: var(--paper, #F5F0E8);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(.2,.8,.2,1), transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 16px 28px -18px rgba(26,26,26,0.45);
}
.dvt-auth-form button[type="submit"]:hover {
  background: var(--olive-hover, #1F3415);
  transform: translateY(-1px);
  box-shadow: 0 20px 34px -18px rgba(26,26,26,0.5);
}
.dvt-auth-form button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── mobile frame for phone-sized routes ─────────────────────── */
.dvt-mobile-host {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100vw;
  overflow-x: hidden;
}
.dvt-mobile-host .page,
.dvt-mobile-host .mobile-page,
.dvt-mobile-host [class*="mobile-"] {
  width: 100%;
  max-width: 100vw;
}

/* When desktop pages are forced onto a phone, tighten the body */
@media (max-width: 480px) {
  h1, .display { word-break: break-word; }
}

/* ── print: hide nav, footer, and all interactive chrome ─────── */
@media print {
  body { background: white; }
  .nav, .foot, .dvt-flash, #boot-splash, .dvt-skip-link { display: none !important; }
  .page { background: white; }
}

@keyframes dvt-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #boot-splash,
  .page,
  .dvt-flash,
  .dvt-auth-form button[type="submit"] {
    animation: none !important;
    transition: none !important;
  }
}

/* ── skip link for keyboard users ────────────────────────────── */
.dvt-skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}
.dvt-skip-link:focus {
  left: 12px;
  top: 12px;
  padding: 10px 14px;
  background: var(--ink, #1A1A1A);
  color: var(--paper, #F5F0E8);
  border-radius: 4px;
  z-index: 10000;
  font-size: 13px;
}
