/* ==========================================================================
   Motos Guzmán — La Orden de Trabajo (demo conceptual Ingresify)
   ========================================================================== */

:root {
  --paper: #F1EBDD;
  --paper-2: #E7DDC6;
  --ink: #221F1A;
  --ink-soft: #4A443B;
  --stamp-ink: #B23A22;
  --stamp-ink-light: #C4886F;
  --steel: #6E7074;
  --steel-dark: #43454A;
  --line: rgba(34, 31, 26, 0.14);

  --font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --motion-fast: .25s;
  --motion-base: .5s;
  --motion-slow: .9s;
  --ease-stamp: cubic-bezier(.34,1.56,.64,1);
  --ease-settle: cubic-bezier(.16,1,.3,1);

  --side-pad: 18px;
  --header-h: 56px;
}

@media (min-width: 640px) {
  :root { --side-pad: 32px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--ink);
  color: var(--paper);
  padding: 13px 16px;
  z-index: 1000;
  transition: top var(--motion-fast) ease;
  text-decoration: none;
  font-size: .85rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 40;
  background: rgba(241, 235, 221, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--side-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .01em;
}
.header-cta {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--ink);
  padding: 8px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
}
.header-cta:hover { background: var(--ink); color: var(--paper); }

/* ---------- Scenes / layout scaffold ---------- */
main { padding-top: var(--header-h); }

.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px var(--side-pad);
}

.scene--apertura { min-height: 100vh; min-height: 100dvh; overflow: hidden; }
.scene--field { background: var(--paper); }
.scene--institutional { background: var(--paper-2); }
.scene--note { min-height: 70vh; }
.scene--closing { padding-bottom: 96px; }

/* ---------- Workbench (desktop spatial scene) ---------- */
.workbench { position: absolute; inset: 0; display: none; }

.tool { position: absolute; color: var(--steel); opacity: .35; width: 120px; }
.tool--wrench { top: 12%; left: 6%; width: 160px; transform: rotate(-18deg); }
.tool--gauge  { bottom: 10%; right: 8%; width: 130px; }
.tool--bolt   { top: 20%; right: 14%; width: 80px; }

/* ---------- Sheet (Signature Device) ---------- */
.sheet {
  position: relative;
  z-index: 2;
  width: min(640px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(34,31,26,.14);
  padding: 40px 28px;
  transform: rotate(-.6deg);
}

.sheet__tag {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 2px;
}

.sheet__kicker {
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.sheet__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: .96;
  letter-spacing: -.01em;
  margin-bottom: 28px;
  overflow-wrap: anywhere;
}

.sheet__meta { display: grid; gap: 14px; }
.sheet__meta-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.sheet__meta-row dt {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.sheet__meta-row dd { margin: 0; font-size: .95rem; }

/* ---------- Field (Scene 02 / 03 / 05) ---------- */
.field {
  position: relative;
  width: min(680px, 100%);
}

.field__label {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.field__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 5.4vw, 2.6rem);
  line-height: 1.12;
  max-width: 22ch;
}

.field--institutional .field__value { max-width: 26ch; }

.field__source, .field__note {
  font-size: .82rem;
  color: var(--ink-soft);
  margin-top: 18px;
  max-width: 42ch;
}

/* ---------- Stamps ---------- */
.stamp {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  margin-top: 22px;
  color: var(--stamp-ink);
  text-decoration: none;
}
.stamp__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
}
.stamp--confirm .stamp__shape { fill: rgba(178,58,34,.06); stroke: none; }
.stamp__text {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: center;
  transform: rotate(-6deg);
  padding: 0 8px;
  line-height: 1.25;
}

.stamp--official {
  width: 150px;
  height: 150px;
  transform: rotate(3deg);
}
.stamp--official .stamp__text { transform: rotate(3deg); font-size: .82rem; }

.stamp--pending {
  width: 220px;
  height: 100px;
  color: var(--stamp-ink-light);
  transform: rotate(-2deg);
}
.stamp--pending .stamp__text {
  transform: rotate(-2deg);
  font-size: .8rem;
}

.stamp--cta {
  width: 220px;
  height: 92px;
  cursor: pointer;
  min-height: 44px;
}
.stamp--cta .stamp__text { transform: rotate(0); font-size: .82rem; line-height: 1.2; }
.stamp--cta:hover .stamp__shape,
.stamp--cta:focus-visible .stamp__shape { fill: rgba(178,58,34,.08); }

/* ---------- Note (Scene 04) ---------- */
.note {
  position: relative;
  width: min(520px, 100%);
  background: #fff8ec;
  border: 1px solid var(--line);
  padding: 26px 24px;
  box-shadow: 0 10px 24px rgba(34,31,26,.10);
  transform: rotate(1.2deg);
}
.note__label {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.note__text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 3.6vw, 1.4rem);
  line-height: 1.3;
  margin-bottom: 14px;
}
.note__source { font-size: .8rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px var(--side-pad) 40px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.site-footer p {
  max-width: 720px;
  margin: 0 auto;
  font-size: .74rem;
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- Mobile sticky CTA ---------- */
.mobile-cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 10px var(--side-pad);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--ink);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform var(--motion-base) var(--ease-settle), visibility 0s linear var(--motion-base);
}
.mobile-cta-bar.is-visible {
  transform: translateY(0);
  visibility: visible;
  transition: transform var(--motion-base) var(--ease-settle), visibility 0s linear 0s;
}
.mobile-cta-bar[hidden] { display: block; }
.mobile-cta-bar a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  color: var(--paper);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

@media (min-width: 1024px) {
  .mobile-cta-bar { display: none; }
}

/* ---------- Reveal mechanics (fallback, no GSAP required) ---------- */
[data-reveal-text] {
  clip-path: inset(0 100% 0 0);
}
[data-reveal-text].is-revealed {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--motion-slow) var(--ease-settle);
}

[data-stamp] {
  opacity: 0;
  transform: scale(1.5) rotate(var(--stamp-rot, -6deg));
}
[data-stamp].is-stamped {
  opacity: 1;
  transform: scale(1) rotate(var(--stamp-rot, -6deg));
  transition: opacity var(--motion-base) var(--ease-stamp),
              transform var(--motion-base) var(--ease-stamp);
}

[data-note] {
  opacity: 0;
  transform: translateX(24px) rotate(1.2deg);
}
[data-note].is-revealed {
  opacity: 1;
  transform: translateX(0) rotate(1.2deg);
  transition: opacity var(--motion-base) var(--ease-settle),
              transform var(--motion-base) var(--ease-settle);
}

[data-typewriter] {
  display: inline-block;
  clip-path: inset(0 100% 0 0);
}
[data-typewriter].is-typed {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--motion-slow) steps(14, end);
}

/* No-JS: everything must already be visible */
.no-js [data-reveal-text],
.no-js [data-stamp],
.no-js [data-note] {
  opacity: 1 !important;
  transform: none !important;
  clip-path: none !important;
}
.no-js [data-typewriter] { clip-path: none !important; }

/* ---------- Desktop enhancement: spatial workbench ---------- */
@media (min-width: 1024px) {
  .workbench {
    display: block;
    perspective: 1400px;
  }
  .workbench__layer {
    position: absolute;
    inset: -10%;
    transform-style: preserve-3d;
  }
  .workbench__layer--bg {
    background:
      radial-gradient(120% 90% at 30% 20%, rgba(110,112,116,.10), transparent 60%),
      repeating-linear-gradient(115deg, rgba(34,31,26,.03) 0 2px, transparent 2px 26px);
    transform: translateZ(-260px) scale(1.28);
  }
  .workbench__layer--tools { transform: translateZ(-120px) scale(1.12); }

  .sheet { width: min(720px, 60vw); padding: 56px 48px; }
  .sheet__title { font-size: clamp(3.2rem, 6vw, 5.4rem); }

  .field__value { font-size: clamp(2.2rem, 4vw, 3.2rem); }

  .scene--field, .scene--institutional, .scene--closing {
    justify-content: flex-start;
    padding-left: max(var(--side-pad), calc(50vw - 640px));
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal-text],
  [data-stamp],
  [data-note],
  [data-typewriter] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    max-width: 100% !important;
    transition: none !important;
    white-space: normal;
  }
  .workbench__layer { transform: none !important; }
}
