/* ==========================================================================
   NearHands — design tokens
   Direction: Kerala roadside signboard × village work-register ledger.
   Bold flat signboard colour, hand-painted confidence, but structured
   like a ledger book: tabs, ruled lines, stamped "registered" marks.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --paper: #F2ECDD;
  --paper-dim: #E8E0CB;
  --ink: #262019;
  --ink-soft: #5B5342;
  --teal: #0F5257;
  --teal-dark: #0A3A3E;
  --mustard: #E8A33D;
  --red: #C1443A;
  --line: rgba(38, 32, 25, 0.18);
  --line-strong: rgba(38, 32, 25, 0.35);

  --display: 'Archivo Black', 'Arial Black', sans-serif;
  --body: 'Work Sans', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 3px;
  --shadow-card: 4px 4px 0 rgba(38, 32, 25, 0.14);
  --shadow-card-hover: 6px 6px 0 rgba(38, 32, 25, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 2.6em;
  background-attachment: local;
}

a { color: inherit; }

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- layout shell ---------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header / signboard ---------- */

.site-header {
  background: var(--teal);
  color: var(--paper);
  border-bottom: 6px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}

.brand-mark {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-tag {
  font-family: var(--body);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  white-space: nowrap;
}

@media (max-width: 780px) {
  .brand-tag { display: none; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  border: 2px solid var(--ink, #1a1a1a);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang-btn {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink, #1a1a1a);
  white-space: nowrap;
}

.lang-btn.active {
  background: var(--ink, #1a1a1a);
  color: var(--paper, #fff);
}

@media (max-width: 560px) {
  .site-nav { flex-wrap: wrap; justify-content: flex-end; }
}

.btn {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--mustard);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink-soft);
}
.btn-primary:hover { box-shadow: 4px 4px 0 var(--ink-soft); }

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper);
}
.btn-ghost:hover { background: rgba(242,236,221,0.12); }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */

.hero {
  border-bottom: 6px solid var(--ink);
  background:
    repeating-linear-gradient(135deg, rgba(38,32,25,0.035) 0 2px, transparent 2px 14px);
}

.hero .wrap {
  padding: 46px 20px 34px;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 14px;
  color: var(--ink);
}

.hero h1 span {
  color: var(--red);
}

.hero p.lede {
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 26px;
}

/* search / filter panel — styled like a ledger index card */

.finder {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.finder-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

input, select, textarea {
  font-family: var(--body);
  font-size: 1rem;
  padding: 10px 12px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
}

/* trade tabs — ledger divider look */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.tab {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 7px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--paper-dim);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.12s ease, color 0.12s ease;
}
.tab:hover { background: var(--mustard); }
.tab[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------- directory grid ---------- */

.directory {
  padding: 34px 0 70px;
}

.directory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.directory-head h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 0;
}

.result-count {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

/* worker card — registration-slip aesthetic */

.card {
  position: relative;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 16px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-card-hover); transform: translate(-1px, -1px); }

.card::before {
  /* perforation dots along the top, like a tear-off slip */
  content: "";
  position: absolute;
  top: -2px; left: 14px; right: 14px;
  height: 2px;
  background-image: radial-gradient(circle, var(--ink) 1.2px, transparent 1.2px);
  background-size: 10px 2px;
  opacity: 0.35;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-name {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 2px;
  line-height: 1.2;
}

.card-trade {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stamp {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--teal);
  border: 1.5px solid var(--teal);
  border-radius: 999px;
  padding: 3px 8px;
  transform: rotate(-6deg);
  white-space: nowrap;
  text-transform: uppercase;
}

.card-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 10px 0;
  min-height: 2.6em;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  border-top: 1px dashed var(--line-strong);
  padding-top: 10px;
  margin-top: 8px;
}

.card-meta .rate {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--red);
}

.card-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.card-actions .btn { flex: 1; justify-content: center; padding: 8px 10px; font-size: 0.85rem; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-state h3 { font-family: var(--display); color: var(--ink); }

/* ---------- registration form page ---------- */

.form-page { padding: 40px 0 80px; }

.form-page h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  margin: 0 0 8px;
}

.form-page .lede { color: var(--ink-soft); max-width: 60ch; margin: 0 0 30px; }

.ledger-form {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px;
  max-width: 640px;
}

.ledger-form .field { margin-bottom: 18px; }

.ledger-form .two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 520px) {
  .ledger-form .two-col { grid-template-columns: 1fr; }
}

.hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.radio-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--body);
  font-size: 0.92rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.radio-row input[type="radio"] { width: auto; padding: 0; }

.form-submit {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.form-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.success-banner {
  display: none;
  background: var(--teal);
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 24px;
  font-weight: 600;
}
.success-banner.show { display: block; }
.success-banner .stamp-big {
  font-family: var(--display);
  font-size: 1rem;
  color: var(--mustard);
  display: block;
  margin-bottom: 4px;
}

/* ---------- ratings ---------- */

.card-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
}
.stars { color: var(--mustard); letter-spacing: 1px; }
.stars-empty { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }
.rating-count { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(38, 32, 25, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }

.modal-card {
  position: relative;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  padding: 26px;
  max-width: 420px;
  width: 100%;
}
.modal-card h3 { font-family: var(--display); margin: 0 0 16px; font-size: 1.1rem; }

.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
}

.star-picker { display: flex; gap: 4px; }
.star-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--mustard);
  cursor: pointer;
  padding: 0 2px;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 6px solid var(--ink);
  background: var(--ink);
  color: var(--paper-dim);
  padding: 26px 0;
  font-size: 0.85rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer a { text-decoration: underline; }

/* ---------- misc ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; }
  .finder-row { flex-direction: column; }
}
