/* BhuBharati Explorer — pattadar lookup page */

.finder-main {
  width: var(--content-width);
  margin: 0 auto;
  padding: 1.4rem 0 4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Page title ───────────────────────────────────────────────────────── */

.finder-hero {
  padding: 0 0.2rem;
}

.finder-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.finder-eyebrow span {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-dark);
}

.finder-hero h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  margin: 0.25rem 0 0.4rem;
}

.finder-hero p:last-child {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* ── Progress rail ────────────────────────────────────────────────────── */

.finder-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.finder-steps li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.2rem;
  border-top: 2px solid var(--line);
  color: var(--ink-faint);
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.finder-steps li span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.finder-steps li small {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finder-steps li.is-done {
  border-color: var(--brand-light);
  color: var(--ink-soft);
}

.finder-steps li.is-done span {
  background: var(--brand-tint);
  color: var(--brand-dark);
}

.finder-steps li.is-active {
  border-color: var(--accent-dark);
  color: var(--ink);
}

.finder-steps li.is-active span {
  background: var(--brand);
  color: #fff;
}

/* ── Panels ───────────────────────────────────────────────────────────── */

.finder-panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  min-height: 73vh;
}

.finder-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.finder-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.finder-lead {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 0 0 1.1rem;
  max-width: 56ch;
}

.stage-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.1rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--brand-light);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--brand-dark);
}

.loaded-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--brand-tint);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin: 0 0 1.1rem;
}

.loaded-note b {
  color: var(--brand-dark);
}

/* Step one, laid out like the name step: the three selects and the button
   share a line, and give it up together when the width runs out. Labels are
   display: contents so their label / select / help parts land on the grid's
   three rows and every control lines up. */
#stage-location .location-form {
  display: block;
  margin-bottom: 0;
}

.location-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  grid-template-rows: auto auto auto;
  grid-auto-flow: column;
  gap: 0.4rem 1rem;
  align-items: center;
}

#stage-location .location-form label {
  display: contents;
}

#load-button {
  grid-row: 2;
  height: 2.85rem;
  white-space: nowrap;
}

#load-hint {
  margin: 0.6rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* Selects still side by side, button on its own line under them. */
@media (max-width: 1100px) {
  .location-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #load-button {
    grid-row: 4;
    grid-column: 1 / -1;
    justify-content: center;
    margin-top: 0.6rem;
  }
}

/* One column: everything stacks, in DOM order. */
@media (max-width: 780px) {
  .location-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-flow: row;
  }

  #load-button {
    grid-row: auto;
    grid-column: auto;
    width: 100%;
  }
}

/* Long-form panels stay readable even though the shell is full width. */
#stage-person .finder-lead,
#stage-location .finder-lead,
.finder-hero p:last-child {
  max-width: 62ch;
}

/* ── Loading card ─────────────────────────────────────────────────────── */

.loading-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem 1.5rem;
  text-align: center;
  min-height: 73vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.loading-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.loading-place-line {
  font-weight: 500 !important;
  color: var(--ink) !important;
}

.loading-sub {
  margin-top: 0.3rem !important;
  font-size: 0.78rem !important;
  color: var(--ink-faint) !important;
  max-width: 44ch;
  margin-inline: auto !important;
}

.loading-orbit {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.loading-orbit i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--brand-light);
  animation: finder-pulse 1.1s ease-in-out infinite;
}

.loading-orbit i:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-orbit i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes finder-pulse {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.loading-track {
  position: relative;
  /* Its only child is absolutely positioned, so as a flex item this would
     otherwise shrink to zero width. */
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin: 1.1rem auto 0.7rem;
  max-width: 320px;
}

.loading-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-light), var(--accent-dark));
  animation: finder-sweep 1.6s ease-in-out infinite;
}

@keyframes finder-sweep {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

.loading-meta {
  font-size: 0.78rem !important;
  color: var(--ink-faint) !important;
  margin-bottom: 1.1rem !important;
  max-width: 46ch;
}

@media (prefers-reduced-motion: reduce) {
  .loading-orbit i,
  .loading-track span {
    animation: none;
  }
  .loading-track span {
    left: 0;
    width: 100%;
    opacity: 0.5;
  }
}

/* ── Name form ────────────────────────────────────────────────────────── */

.person-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Fields sit side by side while each keeps a usable width, and wrap onto
   their own lines the moment they cannot. */
.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.8rem;
}

.person-field {
  flex: 1 1 17rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.person-field > span:first-child {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.person-field > span:first-child i {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-faint);
}

#search-button {
  flex: 0 0 auto;
  height: 2.85rem;
  padding-inline: 1.6rem;
}

.person-note {
  font-size: 0.75rem;
  color: var(--ink-faint);
  max-width: 70ch;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 0.8rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.input-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.input-shell svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.input-shell input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0.7rem 0;
}

.input-shell input:focus {
  outline: none;
}

.person-field.is-invalid .input-shell {
  border-color: var(--danger);
  background: var(--danger-tint);
}

/* Once the fields have wrapped, a lone button on its own line looks
   stranded — give it the full width instead. */
@media (max-width: 700px) {
  #search-button {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.person-error {
  margin: 0;
  font-size: 0.8rem;
  color: var(--danger);
}

/* ── Matches ──────────────────────────────────────────────────────────── */

.count-chip {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.4rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
}

.match-place-line {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0 0 1rem;
}

.match-band {
  margin-bottom: 1.3rem;
}

.match-band:last-child {
  margin-bottom: 0;
}

.band-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line-soft);
}

.band-heading strong {
  font-size: 0.82rem;
  color: var(--ink);
}

.band-heading small {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.55rem;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.match-card:hover {
  border-color: var(--brand);
  background: var(--paper);
}

.match-card:active {
  transform: scale(0.995);
}

.match-band.is-close .match-card {
  border-left: 3px solid var(--accent-dark);
}

.match-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.match-name {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.match-relation {
  font-size: 0.8rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.match-relation b {
  font-weight: 500;
  color: var(--ink);
}

.match-chip {
  align-self: flex-start;
  margin-top: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.match-arrow {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.no-matches {
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.no-matches h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.no-matches p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  max-width: 46ch;
  margin-inline: auto;
}

/* ── Detail ───────────────────────────────────────────────────────────── */

#stage-detail h2 {
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.detail-relation {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.35rem 0 0;
  overflow-wrap: anywhere;
}

.detail-place {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: 0.2rem 0 0;
}

.detail-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.1rem 0 1.3rem;
}

.detail-totals article {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.7rem;
}

.detail-totals span {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  font-weight: 700;
}

.detail-totals strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-dark);
  margin-top: 0.15rem;
}

.land-rows {
  scroll-margin-top: 1rem;
}

.land-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
}

.land-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.land-table th {
  position: sticky;
  top: 0;
  background: var(--brand-tint);
  text-align: left;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  font-weight: 700;
  white-space: nowrap;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.land-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  vertical-align: top;
}

.land-table tbody tr:last-child td {
  border-bottom: none;
}

.land-table tbody tr:hover td {
  background: var(--paper);
}

.land-action {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.row-view {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--brand-dark);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.row-view:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.land-table td:first-child,
.land-table td:nth-child(2),
.land-table td:nth-child(3) {
  white-space: nowrap;
  font-weight: 500;
}

/* ── Table folds into cards where the width runs out ─────────────────── */

@media (max-width: 900px) {
  .land-table-wrap {
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .land-table,
  .land-table tbody,
  .land-table tr,
  .land-table td {
    display: block;
    width: auto;
  }

  .land-table thead {
    display: none;
  }

  .land-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 0.8rem;
  }

  .land-table tbody tr:last-child {
    margin-bottom: 0;
  }

  /* styles.css turns any narrow table into cards for the explorer; these
     reset the parts of that treatment this table does not want. */
  .land-table td {
    grid-column: auto;
    padding: 0.5rem 0.7rem;
    border: none;
    text-align: left;
    box-shadow:
      inset -1px 0 0 var(--line-soft),
      inset 0 -1px 0 var(--line-soft);
  }

  .land-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    font-weight: 700;
    margin-bottom: 0.1rem;
  }

  /* The action closes the card, full width, with its label hidden. */
  .land-table td.land-action {
    grid-column: 1 / -1;
    text-align: left;
    box-shadow: none;
  }

  .land-table td.land-action::before {
    display: none;
  }

  .row-view {
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.7rem;
  }

  /* Survey number heads the card, the way the table heads the page. */
  .land-table td:first-child {
    grid-column: 1 / -1;
    background: var(--brand-tint);
    box-shadow: inset 0 -1px 0 var(--line-soft);
  }

  .land-table td:first-child::before {
    color: var(--brand-dark);
  }

  .land-table tbody tr:hover td {
    background: none;
  }

  .land-table tbody tr:hover td:first-child {
    background: var(--brand-tint);
  }
}

/* ── Mobile ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .finder-main {
    width: 100%;
    padding: 0.9rem 0.7rem 3rem;
    gap: 0.7rem;
  }

  .finder-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.finder-eyebrow span {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-dark);
}

.finder-hero h1 {
    font-size: 1.45rem;
  }

  .finder-hero p:last-child {
    font-size: 0.82rem;
  }


  .finder-steps li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.4rem 0.15rem;
  }

  .finder-steps li small {
    font-size: 0.65rem;
  }

  .finder-panel {
    padding: 1.05rem 0.9rem 1.2rem;
  }

  .finder-panel h1 {
    font-size: 1.25rem;
  }

  .finder-panel h2 {
    font-size: 1.1rem;
  }

  .finder-lead {
    font-size: 0.82rem;
    margin-bottom: 0.9rem;
  }

  .loading-card {
    padding: 1.5rem 1rem;
  }

  .match-card {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.7rem 0.75rem;
    gap: 0.5rem;
  }

  .match-name {
    font-size: 0.88rem;
  }

  .match-relation {
    font-size: 0.75rem;
  }

  .detail-totals {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .detail-totals article {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
  }

  .detail-totals strong {
    margin-top: 0;
    font-size: 0.9rem;
  }


  #stage-detail h2 {
    font-size: 1.12rem;
  }
}
