/* Löydä juristi — tyylit mitattu esikuvasta (app.loydaasianajaja.fi).
   Fontti: Nunito Sans (vapaa, OFL) Museo Sansin korvikkeena — lähin geometris-humanisti.
   Kaikki mitat getBoundingClientRect + computed-tyyleistä, tavoite ≤2px poikkeama. */

@font-face {
  font-family: "LJ Sans";
  font-style: normal; font-weight: 300;
  src: url("../fonts/NunitoSans-300.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LJ Sans";
  font-style: normal; font-weight: 400;
  src: url("../fonts/NunitoSans-400.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "LJ Sans";
  font-style: normal; font-weight: 700;
  src: url("../fonts/NunitoSans-700.woff2") format("woff2");
  font-display: swap;
}

:root {
  --lj-navy: #2d3752;        /* rgb(45,55,82) */
  --lj-text: #212529;        /* rgb(33,37,41) */
  --lj-muted: #5b6472;
  --lj-radius: 9.6px;
  --lj-maxw: 1140px;
}

.lj-root, .lj-root * { box-sizing: border-box; }
.lj-root {
  font-family: "LJ Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 24px;
  color: var(--lj-text);
  background: #fff;
}
body { margin: 0; background: #fff; }

.lj-container { max-width: var(--lj-maxw); margin: 0 auto; padding: 0 15px; }

/* ---- Ohut yläpalkki ---- */
.lj-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 30px 0 0; gap: 16px;
}
.lj-topbar-left { display: flex; align-items: center; gap: 16px; }
.lj-logo { width: 56px; height: 56px; object-fit: contain; display: block; }
.lj-back-link { color: var(--lj-navy); text-decoration: none; font-weight: 400; font-size: 16px; }
.lj-back-link:hover { text-decoration: underline; }

/* ---- Otsikko + johdanto ---- */
.lj-title {
  text-align: center; font-weight: 700; font-size: 40px; line-height: 48px;
  color: var(--lj-text); margin: 44px 0 20px;
}
.lj-intro { margin: 36px 0 0; font-weight: 300; }
/* hidden-attribuutti voittaa display-säännöt (esim. .lj-pager flex). */
.lj-root [hidden] { display: none !important; }

/* ---- Painikkeet ---- */
.lj-btn {
  font-family: inherit; font-weight: 700; font-size: 16px; line-height: 24px;
  color: var(--lj-navy); background: transparent;
  border: 1px solid var(--lj-navy); border-radius: var(--lj-radius);
  cursor: pointer; transition: background .15s, color .15s;
}
.lj-btn:hover { background: rgba(45,55,82,.07); }

/* Osaamisalue on lomakkeen kenttä, joka paljastuu Palvelut-valinnasta. */
.lj-field.lj-area-reveal { display: none; }
.lj-field.lj-area-reveal.is-open { display: flex; }

/* ---- Hakulomake (2 saraketta) ---- */
.lj-form { display: grid; grid-template-columns: 1fr 1fr; gap: 30px 30px; margin: 20px 0 30px; }
.lj-field { display: flex; flex-direction: column; }
.lj-field > label { font-weight: 700; font-size: 17px; line-height: 22px; margin-bottom: 8px; color: var(--lj-text); }

/* Select tyylitellään esikuvan react-selectin näköiseksi: navy reunus, neliökulmat,
   40px korkeus, chevron + pystyviiva oikealla. */
.lj-select-wrap { position: relative; }
.lj-field select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: inherit; font-size: 14px; font-weight: 300; color: var(--lj-navy);
  height: 40px; width: 100%; padding: 0 42px 0 10px;
  border: 1px solid var(--lj-navy); border-radius: 0; background: #fff; cursor: pointer;
}
.lj-select-wrap::after {
  content: ""; position: absolute; top: 0; right: 32px; height: 100%;
  width: 1px; background: #cfd3dc; pointer-events: none;
}
.lj-select-wrap::before {
  content: ""; position: absolute; top: 50%; right: 12px; width: 9px; height: 9px;
  margin-top: -6px; border-right: 2px solid #9aa0ab; border-bottom: 2px solid #9aa0ab;
  transform: rotate(45deg); pointer-events: none;
}

.lj-field input[type=text] {
  font-family: inherit; font-size: 14px; font-weight: 300; color: var(--lj-navy);
  height: 40px; width: 100%; padding: 0 10px;
  border: 1px solid var(--lj-navy); border-radius: 0; background: #fff;
}

.lj-radios { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.lj-radios .lj-radio { display: flex; align-items: center; gap: 8px; font-weight: 300; font-size: 16px; }


.lj-actions { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.lj-actions .lj-btn { padding: 8px 28px; }

/* ---- Tulososio ---- */
.lj-results-help { font-size: 15px; color: var(--lj-muted); margin: 0 0 8px; }
.lj-empty { font-weight: 400; font-size: 16px; margin: 8px 0 16px; color: var(--lj-text); }

@media (max-width: 760px) { .lj-form { grid-template-columns: 1fr; } }

/* Tuloslista vie koko leveyden (1140px): 3 saraketta leveällä, vähemmän kapealla. */
.lj-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 32px; }
@media (max-width: 900px) { .lj-list { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .lj-list { grid-template-columns: 1fr; } }
.lj-card { display: flex; gap: 14px; padding: 10px 4px; cursor: pointer; align-items: flex-start; }
.lj-card:hover .lj-card-name { text-decoration: underline; }
.lj-card-pic {
  width: 63px; height: 63px; border-radius: 50%; object-fit: contain;
  background: #fff; flex: 0 0 63px; padding: 0; border: 1px solid #e6e8ec;
}
.lj-card-info { display: flex; flex-direction: column; line-height: 24px; }
.lj-card-name { font-weight: 700; font-size: 16px; line-height: 24px; color: var(--lj-text); }
.lj-card-title { font-weight: 300; font-size: 16px; line-height: 24px; color: var(--lj-text); }
.lj-card-office { font-weight: 300; font-size: 16px; line-height: 24px; color: var(--lj-text); }

/* ---- Sivutus ---- */
.lj-pager { display: flex; align-items: center; gap: 8px; justify-content: flex-start; margin: 24px 0 10px; flex-wrap: wrap; }
.lj-pager button {
  min-width: 29px; height: 42px; padding: 8px 9.6px;
  border: 1px solid var(--lj-navy); background: #fff; color: var(--lj-navy);
  border-radius: 9.6px; cursor: pointer; font-family: inherit; font-size: 16px; font-weight: 700; line-height: 24px;
}
.lj-pager button.is-nav { color: var(--lj-navy); }
.lj-pager button:disabled { opacity: .35; cursor: default; }
.lj-pager button.is-active { background: var(--lj-navy); color: #fff; border-color: var(--lj-navy); }
.lj-pager .lj-pager-total { color: var(--lj-text); margin: 0 8px; font-weight: 300; }

/* ---- Footer (tummansininen) ---- */
.lj-footer { background: var(--lj-navy); color: #fff; margin-top: 48px; padding: 48px 0 0; }
.lj-footer a { color: #fff; }
.lj-footer-grid { display: grid; grid-template-columns: 150px 1fr 1fr 1fr; gap: 30px; align-items: start; }
@media (max-width: 760px) { .lj-footer-grid { grid-template-columns: 1fr 1fr; } }
.lj-footer-logo { width: 110px; height: 110px; object-fit: contain; }
.lj-footer h4 { font-weight: 700; font-size: 16px; margin: 0 0 14px; color: #fff; }
.lj-footer-contact p { margin: 0 0 2px; font-weight: 300; }
/* Pitkä sähköpostiosoite ei saa leventää sivua kapealla näytöllä (390 px). */
.lj-footer-contact a { overflow-wrap: anywhere; }
.lj-footer-links a { display: block; text-decoration: underline; margin-bottom: 12px; font-weight: 700; }
.lj-social { display: flex; gap: 12px; margin-top: 4px; }
.lj-social a { display: inline-flex; }
.lj-social svg { width: 28px; height: 28px; fill: #fff; }
.lj-footer-bottom {
  border-top: 1px solid rgba(255,255,255,.25);
  margin-top: 36px; padding: 18px 0 28px;
  font-size: 14px; display: flex; gap: 22px; flex-wrap: wrap; font-weight: 300;
}
.lj-footer-bottom a { text-decoration: underline; }

/* ---- Details-näkymä (koko sivun korvaus) ---- */
#lj-view-list.is-hidden { display: none; }
.lj-detail { display: none; }
.lj-detail.is-open { display: block; }
.lj-detail-head { display: flex; gap: 28px; align-items: flex-start; margin-top: 16px; }
.lj-detail-pic { width: 150px; height: 150px; border-radius: 4px; object-fit: contain; background: #f1f2f4; padding: 8px; flex: 0 0 150px; }
.lj-detail-name { font-weight: 700; font-size: 40px; line-height: 48px; margin: 0; color: var(--lj-text); }
.lj-detail-sub { font-weight: 700; color: var(--lj-navy); margin: 2px 0 16px; }
.lj-detail-section { margin: 0 0 14px; }
.lj-detail-section .lj-detail-label { font-weight: 700; }
/* Viranomaisille (vain Tommi): 1. kohta jää otsikkoriville, loput 14 omalle rivilleen tähän. */
.lj-detail-group-rest { display: block; margin-top: 4px; }
.lj-detail-office-name { font-weight: 700; font-size: 28px; margin: 6px 0; }

/* ---- Mobiili (≤560 px, 16.10.): tiiviimmät välit, jotta 1.–2. juristi näkyy ilman vieritystä
   myös selaimen palkkien kanssa (iPhone 13 390x664, Pixel 5 393x727). Kentät ja tekstit ennallaan;
   kosketuskohteet ≥44 px, kenttien fontti 16 px (iOS ei zoomaa). Työpöytä ei muutu. ---- */
@media (max-width: 560px) {
  .lj-title { margin: 12px 0 8px; }
  .lj-form { gap: 10px; margin: 8px 0 8px; }
  .lj-field > label { margin-bottom: 4px; }
  .lj-field select, .lj-field input[type=text] { height: 44px; font-size: 16px; }
  .lj-actions { margin-top: 0; }
  .lj-actions .lj-btn { flex: 1 1 0; min-height: 44px; padding: 8px 10px; }
  .lj-results-help { line-height: 20px; margin: 0 0 4px; }
  .lj-pager button { height: 44px; min-width: 44px; }
}

/* ---- Tulostus (selaimen oma tulostus) ---- */
@media print {
  .lj-topbar, .lj-form, .lj-intro,
  .lj-pager, .lj-footer, .lj-results-help { display: none !important; }
  .lj-list { grid-template-columns: 1fr; }
}
