/* Public Unlock PDF tool (/unlock-pdf).
 *
 * Built on theme-dark.css and auth.css (aurora backdrop, turning card edge,
 * gold button, ghost buttons, --auth-* tokens), like /short-link and
 * /loan-emi-calculator; this file adds the hero, the tool card (steps, drop
 * zone, file row, password step, success state) and the content sections.
 *
 * Layout, mobile first: heading and intro, then the tool, then the content.
 * From 1024px the tool sits in its own column beside the heading.
 *
 * Motion (transform and opacity only, nothing under prefers-reduced-motion):
 * floating sheets in the hero, a sliding progress bar while working, the lock
 * opening on success, and the scroll reveal of the content (start states only
 * after unlock-pdf.js marks <html> with `up-reveal`). The heading and the
 * intro never animate in.
 */

.up-body {
  --up-max: clamp(64rem, 50rem + 24vw, 84rem);
  --up-surface: rgba(17, 18, 24, 0.82);
  --up-raised: rgba(255, 255, 255, 0.035);
  --up-accent: #a98bff;
  --up-touch: 44px;
}

.up-body .auth-card__glow {
  animation-duration: 12s;
}

.up-main {
  display: block;
  padding-bottom: clamp(3rem, 2rem + 4vw, 6rem);
  overflow-x: clip;
}

.up-container {
  width: 100%;
  max-width: calc(var(--up-max) + 2 * var(--site-header-gutter));
  margin-inline: auto;
  padding-inline: var(--site-header-gutter);
}

/* ----------------------------------------------------------------- Hero */

.up-hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(1.5rem, 1rem + 3vw, 4.5rem) clamp(2rem, 1.5rem + 3vw, 5rem);
  overflow: hidden;
}

.up-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 2vw, 3rem);
  align-items: center;
}

@media (min-width: 1024px) {
  .up-hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, clamp(26rem, 22rem + 10vw, 36rem));
    column-gap: clamp(2.5rem, 1rem + 4vw, 6rem);
  }
}

.up-hero__copy {
  display: grid;
  justify-items: start;
  gap: clamp(0.8rem, 0.6rem + 0.6vw, 1.3rem);
  min-width: 0;
}

.up-breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
}

.up-breadcrumb__list li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--auth-line-strong);
}

.up-breadcrumb__list a {
  color: var(--auth-muted);
  text-decoration: none;
}

.up-breadcrumb__list a:hover {
  color: var(--auth-gold);
}

.up-hero__title {
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 1.4rem + 3.6vw, 4.6rem);
  font-weight: var(--font-weight-brand);
  line-height: 1.02;
  letter-spacing: -0.035em;
  background: linear-gradient(100deg, var(--auth-text) 25%, var(--auth-gold-strong) 70%, var(--up-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.up-hero__lead {
  max-width: 38em;
  color: var(--auth-muted);
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.22rem);
  line-height: 1.65;
}

.up-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.up-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--auth-line);
  border-radius: var(--radius-pill);
  background-color: var(--up-raised);
  color: var(--auth-text);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-medium);
}

.up-chip__icon {
  width: 1rem;
  height: 1rem;
  color: var(--auth-gold);
}

/* Decorative floating sheets. */
.up-motif {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.up-motif__sheet {
  position: absolute;
  width: clamp(4rem, 7vw, 6.5rem);
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 46%, rgba(235, 196, 42, 0.55) 0 6%, transparent 7%),
    linear-gradient(rgba(255, 255, 255, 0.12) 0 0) 22% 20% / 56% 4% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.08) 0 0) 22% 70% / 56% 4% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.08) 0 0) 22% 80% / 40% 4% no-repeat,
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
  opacity: 0.6;
}

.up-motif__sheet--1 { top: 12%; left: 46%; transform: rotate(-12deg); }
.up-motif__sheet--2 { bottom: 8%; left: 4%; transform: rotate(10deg) scale(0.8); }
.up-motif__sheet--3 { top: 6%; right: 3%; transform: rotate(16deg) scale(0.7); }

@media (max-width: 1023.98px) {
  .up-motif__sheet--1 { display: none; }
}

/* ------------------------------------------------------------ Tool card */

.up-card {
  position: relative;
  min-width: 0;
  padding: 1px;
  overflow: hidden;
  border-radius: var(--auth-radius);
  background: var(--auth-line);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.up-card__body {
  position: relative;
  display: grid;
  gap: clamp(1rem, 0.8rem + 0.6vw, 1.35rem);
  padding: clamp(1.25rem, 0.9rem + 1.6vw, 2.5rem);
  border-radius: calc(var(--auth-radius) - 1px);
  background-color: var(--auth-card-solid);
}

.up-card__title {
  font-family: var(--font-brand);
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.8rem);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
}

/* Step indicator. */
.up-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.up-steps__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--auth-line);
  border-radius: var(--radius-pill);
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  transition: color var(--transition-normal), border-color var(--transition-normal),
    background-color var(--transition-normal);
}

.up-steps__item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.up-steps__dot {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.06);
}

.up-steps__item.is-current {
  border-color: rgba(235, 196, 42, 0.5);
  background-color: var(--auth-gold-soft);
  color: var(--auth-text);
}

.up-steps__item.is-current .up-steps__dot {
  background-color: var(--auth-gold);
  color: var(--color-brand-contrast);
}

.up-steps__item.is-done {
  color: var(--auth-success);
}

.up-steps__item.is-done .up-steps__dot {
  background-color: rgba(94, 224, 160, 0.18);
}

/* Phones: the current step takes the spare width, the others show their number. */
@media (max-width: 479.98px) {
  .up-steps {
    display: flex;
  }

  .up-steps__item {
    flex: 0 0 auto;
    justify-content: center;
  }

  .up-steps__item.is-current {
    flex: 1 1 auto;
  }

  .up-steps__item:not(.is-current) span:last-child {
    display: none;
  }
}

.up-fallback,
.up-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(124, 156, 255, 0.35);
  border-radius: var(--auth-radius-sm);
  background-color: rgba(124, 156, 255, 0.1);
  color: var(--auth-text);
  font-size: var(--auth-fs-small);
  line-height: 1.55;
}

.up-fallback[hidden],
.up-notice[hidden],
.up-tool[hidden],
.up-stage[hidden],
.up-file[hidden],
.up-working[hidden],
.up-error[hidden] {
  display: none;
}

.up-fallback__icon,
.up-notice__icon {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
  color: #9db4ff;
}

.up-tool {
  display: grid;
  gap: 1rem;
}

.up-stage {
  display: grid;
  gap: 0.9rem;
}

/* Drop zone: the label of a visually hidden, still focusable file input. */
.up-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: clamp(1.6rem, 1.2rem + 2vw, 2.75rem) 1rem;
  border: 2px dashed rgba(235, 196, 42, 0.4);
  border-radius: var(--auth-radius);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(235, 196, 42, 0.1), transparent 70%),
    var(--up-raised);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-normal), background-color var(--transition-normal),
    transform var(--transition-normal);
}

.up-drop:hover,
.up-drop.is-dragging {
  border-color: var(--auth-gold);
  background-color: rgba(235, 196, 42, 0.06);
}

.up-drop.is-dragging {
  transform: scale(1.01);
}

.up-drop:focus-within {
  outline: 2px solid var(--auth-gold);
  outline-offset: 3px;
}

.up-drop__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.up-drop__icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--auth-gold-strong), var(--auth-gold));
  box-shadow: 0 14px 34px -14px var(--auth-gold-glow);
}

.up-drop__icon svg {
  width: 2.2rem;
  height: 2.2rem;
  fill: none;
  stroke: var(--color-brand-contrast);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.up-drop__title {
  color: var(--auth-text);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  font-weight: var(--font-weight-semibold);
}

.up-drop__button {
  display: inline-block;
  min-height: var(--up-touch);
  padding: 0.65rem 1.2rem;
  border: 1px solid var(--auth-gold);
  border-radius: var(--radius-pill);
  color: var(--auth-gold);
  line-height: 1.3;
}

/* On phones the zone is simply a big "Choose PDF" button. */
@media (hover: none) and (pointer: coarse) {
  .up-drop__fine {
    display: none;
  }
}

.up-drop__hint {
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
}

.up-error {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--auth-error);
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-medium);
  line-height: 1.45;
}

.up-error__icon {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
}

/* The chosen file. */
.up-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  background-color: var(--up-raised);
}

.up-file__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  background-color: rgba(255, 128, 128, 0.14);
  color: #ff9b9b;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
}

.up-file__meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

/* Long names are cut with an ellipsis; the full name is in the tooltip. */
.up-file__name {
  overflow: hidden;
  color: var(--auth-text);
  font-weight: var(--font-weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-file__size {
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
}

.up-file__remove[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 419.98px) {
  .up-file__remove span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

/* Working indicator: a light sliding along a track. */
.up-working {
  display: grid;
  gap: 0.5rem;
}

.up-working__bar {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.07);
}

.up-working__bar span {
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--auth-gold), var(--up-accent), transparent);
}

.up-working__text {
  color: var(--auth-muted);
  font-size: var(--auth-fs-small);
}

/* Password field. */
.up-field {
  display: grid;
  gap: 0.45rem;
}

.up-field__label {
  font-size: var(--auth-fs-small);
  font-weight: var(--font-weight-semibold);
}

.up-field__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.up-field__control {
  width: 100%;
  min-height: var(--auth-control);
  padding: 0 3.4rem 0 1rem;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  background-color: var(--auth-field);
  color: var(--auth-text);
  font: inherit;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.up-field__control:focus {
  outline: none;
  border-color: var(--auth-gold);
  box-shadow: 0 0 0 4px var(--auth-gold-soft);
}

.up-field__control:disabled {
  opacity: 0.6;
}

.up-field.is-invalid .up-field__control {
  border-color: var(--auth-error);
  background-color: var(--auth-error-soft);
}

.up-field__toggle {
  position: absolute;
  right: 0.3rem;
  display: inline-grid;
  place-items: center;
  width: var(--up-touch);
  height: var(--up-touch);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
}

.up-field__toggle:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--auth-text);
}

.up-field__toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

.up-field__toggle-hide,
.up-field__toggle[aria-pressed="true"] .up-field__toggle-show {
  display: none;
}

.up-field__toggle[aria-pressed="true"] .up-field__toggle-hide {
  display: inline;
}

.up-unlock[disabled] {
  opacity: 0.75;
  pointer-events: none;
}

/* Success. */
.up-done {
  justify-items: center;
  text-align: center;
}

.up-lock {
  width: 5.5rem;
  height: 5.5rem;
  overflow: visible;
}

.up-lock__body {
  fill: rgba(94, 224, 160, 0.16);
  stroke: var(--auth-success);
  stroke-width: 3;
}

.up-lock__shackle {
  fill: none;
  stroke: var(--auth-success);
  stroke-width: 4;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: 100% 100%;
  /* Open: the shackle lifted and swung out. */
  transform: translateY(-5px) rotate(-28deg);
}

.up-lock__hole {
  fill: var(--auth-success);
  opacity: 0;
}

.up-lock__check {
  transform-box: fill-box;
  transform-origin: center;
  fill: none;
  stroke: var(--auth-success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.up-done__title {
  font-family: var(--font-brand);
  font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.65rem);
  font-weight: var(--font-weight-bold);
}

.up-done__title:focus {
  outline: none;
}

.up-done__text {
  max-width: 30em;
  color: var(--auth-muted);
  font-size: var(--auth-fs-small);
}

.up-download {
  text-decoration: none;
}

.up-download__icon {
  width: 1.2rem;
  height: 1.2rem;
}

.up-again {
  justify-content: center;
}

/* Privacy notes under the tool. */
.up-privacy {
  display: grid;
  gap: 0.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-line);
}

.up-privacy__note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--auth-text);
  font-size: var(--auth-fs-small);
  line-height: 1.5;
}

.up-privacy__icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  color: var(--auth-success);
}

.up-privacy__fine {
  color: var(--auth-subtle);
  font-size: var(--font-size-xs);
}

/* -------------------------------------------------------------- Content */

.up-content {
  display: grid;
  gap: clamp(2rem, 1.5rem + 2vw, 3.5rem);
}

.up-section {
  max-width: 58rem;
  color: var(--auth-muted);
  line-height: 1.7;
}

.up-section__title {
  margin-bottom: 0.75rem;
  color: var(--auth-text);
  font-family: var(--font-brand);
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 2.1rem);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.up-how {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .up-how {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.up-how__step {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.4rem;
  padding: clamp(1.1rem, 0.9rem + 0.8vw, 1.6rem);
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  background-color: var(--up-surface);
  font-size: var(--auth-fs-small);
}

.up-how__number {
  position: absolute;
  top: 0.4rem;
  right: 0.9rem;
  color: rgba(255, 255, 255, 0.07);
  font-family: var(--font-brand);
  font-size: 3rem;
  line-height: 1;
}

.up-how__title {
  color: var(--auth-text);
  font-size: 1.05rem;
  font-weight: var(--font-weight-semibold);
}

.up-faq {
  max-width: none;
}

.up-faq__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
}

@media (min-width: 900px) {
  .up-faq__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.up-faq__item {
  padding: clamp(1rem, 0.85rem + 0.6vw, 1.5rem);
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  background-color: var(--up-surface);
}

.up-faq__question {
  margin-bottom: 0.4rem;
  color: var(--auth-text);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  font-weight: var(--font-weight-semibold);
}

.up-faq__answer {
  font-size: var(--auth-fs-small);
}

.up-contact {
  margin-top: 1rem;
  font-size: var(--auth-fs-small);
}

.up-contact a {
  color: var(--auth-gold);
}

/* --------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: no-preference) {
  .up-motif__sheet {
    animation: up-float 9s ease-in-out infinite alternate;
  }

  .up-motif__sheet--2 { animation-delay: -3s; }
  .up-motif__sheet--3 { animation-delay: -6s; }

  .up-hero.is-offscreen .up-motif__sheet {
    animation-play-state: paused;
  }

  .up-working__bar span {
    animation: up-slide 1.3s ease-in-out infinite;
  }

  .up-done:not([hidden]) .up-lock__shackle {
    animation: up-unlock 900ms var(--auth-ease) both;
  }

  .up-done:not([hidden]) .up-lock__check {
    animation: up-pop 500ms 600ms var(--auth-ease) both;
  }

  .up-done:not([hidden]) .up-lock {
    animation: up-pop 500ms var(--auth-ease) both;
  }

  .up-how__step,
  .up-faq__item {
    transition: transform var(--transition-normal), border-color var(--transition-normal);
  }

  .up-how__step:hover,
  .up-faq__item:hover {
    transform: translateY(-2px);
    border-color: var(--auth-line-strong);
  }

  .up-reveal [data-reveal] {
    transition: opacity 650ms var(--auth-ease), transform 650ms var(--auth-ease);
  }

  .up-reveal [data-reveal]:not(.is-revealed) {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-aurora,
  .auth-card__glow {
    animation: none;
  }
}

/* The individual transforms of the sheets are kept and a drift added on top. */
@keyframes up-float {
  from { translate: 0 0; }
  to { translate: 0 -14px; }
}

@keyframes up-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

/* Closed -> open: the shackle drops in, then lifts and swings out. */
@keyframes up-unlock {
  0% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(1px) rotate(0deg); }
  100% { transform: translateY(-5px) rotate(-28deg); }
}

@keyframes up-pop {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
