.lookup {
  --paper: #fffdfa;
  --rule: #dfd2ca;
  --red: #81202b;
}
.lookup .crumb { margin-bottom: 12px }
.lookup-search {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(270px, 1fr);
  column-gap: clamp(32px, 5vw, 72px);
  align-items: center;
  overflow: hidden;
  border: 1px solid #81323a;
  border-radius: 18px;
  background: #79212b;
  color: white;
}
.lookup-inputs { padding: 28px 0 28px 30px }
.lookup-inputs h1 {
  margin-bottom: 16px;
  color: #fff9f4;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 660;
  letter-spacing: -.035em;
}
.lookup-inputs .search-box { max-width: none; background: white }
.hero-body,.lookup-inputs { container-type:inline-size }
@container (max-width: 30rem) {
  #search-form { display:grid;grid-template-columns:auto minmax(0,1fr);padding:8px;gap:6px 8px }
  #search-form > .primary { grid-column:1/-1;min-height:44px;white-space:normal }
  #search-form > input { width:100% }
}
.lookup-inputs:not(:has(+ .lookup-jumps)) { grid-column: 1/-1; padding-right: 30px }
.lookup-jumps { padding: 4px 28px 4px 24px; border-left: 1px solid #ae6269; margin-block: 20px }
.lookup-jumps h2 { color: #ffe4ce; font-size: 14px; font-weight: 600; letter-spacing: 0; margin-bottom: 4px }
.lookup-jumps button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; min-height: 42px; padding: 6px 0;
  border: 0; background: transparent; color: white;
  text-align: left; font-size: 14px;
}
.lookup-jumps button + button { border-top: 1px solid #a34f58 }
.lookup-jumps button span { flex: 1 }
.lookup-jumps button svg:last-child { transform: rotate(90deg) }
.lookup-jumps strong { font-size: 18px; font-variant-numeric: tabular-nums }
.lookup-jumps button:hover span { text-decoration: underline; text-underline-offset: 3px }
.lookup-jumps :focus-visible { outline-color: #ffdf9c }
.lookup-scope {
  grid-column: 1/-1; display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; background: var(--paper); color: var(--ink);
}
.lookup-scope > span { color: var(--muted); font-size: 13px; font-weight: 600 }
.lookup-scope div, .lookup-guide-links, .lookup-pages div { display: flex; flex-wrap: wrap; gap: 6px }
.scope-choice {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px;
  padding: 6px 11px; border: 1px solid #e6dcd4; border-radius: 7px;
  font-size: 13px; font-weight: 550;
}
.scope-choice:hover { background: #f9efea }
.scope-choice[aria-current] { border-color: var(--red); background: var(--red); color: white }
.lookup section[tabindex] { scroll-margin-block: 16px }
.lookup section[tabindex]:focus-visible { outline: 2px solid #95551a; outline-offset: 4px }
#local-results, #form-results, .lookup #official-results, .lookup > .empty { margin-top: 28px }
#form-results h2 { font-size: 20px; margin-bottom: 12px }
.lookup-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px }
.lookup-emblem { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 11px; background: #f2dfd6; color: #822632 }
.portal-emblem { background: #e6ecea; color: #31574f }
.lookup-heading h2 { font-size: clamp(20px, 2vw, 25px); letter-spacing: -.035em }
.lookup-heading p { color: var(--muted); font-size: 14px; margin-top: 3px }
.result-count {
  margin-left: auto; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 6px;
  color: #5d4844; background: #fffaf5; font-size: 13px; font-weight: 590; white-space: nowrap;
}
.lookup-guides { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,305px),1fr)); gap: 14px }
.lookup-guide {
  display: flex; flex-direction: column; padding: 16px 20px 10px;
  border: 1px solid var(--rule); border-radius: 13px; background: var(--paper);
}
.lookup-guide-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; font-weight: 550 }
.lookup-guide-top .glyph { width: 34px; height: 34px; border-radius: 8px }
.lookup-guide-top .glyph svg { width: 19px; height: 19px }
.lookup-guide-top .save { margin-left: auto; width: 42px; height: 42px }
.lookup-guide h3 { margin-top: 8px; font-size: clamp(17px, 1.45vw, 20px); letter-spacing: -.025em; color: var(--deep); line-height: 1.4 }
.lookup-guide h3 a:hover, .lookup-guide-links a:hover { text-decoration: underline; text-underline-offset: 3px }
.lookup-guide p { margin: 5px 0 14px; color: var(--muted); font-size: 14px }
.lookup-guide-links { align-items: center; margin-top: auto; border-top: 1px solid var(--rule); gap: 4px 16px }
.lookup-guide-links a { display: inline-flex; gap: 7px; align-items: center; min-height: 40px; color: var(--muted); font-size: 13px; font-weight: 560 }
.lookup-guide-links a:first-child { color: var(--red); font-weight: 650; margin-right: auto }
.portal-tools { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px }
.portal-tools .catalog-filter { display: grid; gap: 4px; max-width: 100%; font-size: 13px; font-weight: 620; color: #554340 }
.portal-tools select {
  width: 100%; min-width: 160px; max-width: 330px; height: 44px; border: 1px solid #bdaba3;
  padding: 6px 12px; border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink);
}
.lookup-reset { min-height: 44px; display: inline-flex; align-items: center; gap: 5px; color: var(--red); font-size: 13px; text-decoration: underline }
.lookup .directory-block { border: 1px solid #cad6d0; border-radius: 13px; background: var(--paper); margin-bottom: 12px }
.lookup .directory-band,.lookup .directory-row {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(285px,40%); gap: 28px; padding: 13px 20px; align-items: center;
}
.lookup .directory-band { background: #e7ede9; border-bottom: 1px solid #cad6d0 }
.lookup .directory-band h3 { color: #264b42; font-size: 16px }
.lookup .directory-band > span { color: #425e54; font-size: 12px; font-weight: 620 }
.lookup .directory-row { padding-block: 10px }
.lookup .directory-row + .directory-row { border-color: #e6ded9 }
.lookup .directory-row:hover { background: #fbf5f0 }
.lookup .procedure-name { line-height: 1.48; font-size: 15px; font-weight: 570; color: #342b2c }
.lookup .office-links { gap: 6px }
.lookup .office-link {
  display: inline-flex; justify-content: space-between; gap: 8px; min-height: 44px; max-width: 100%;
  padding: 5px 10px; line-height: 1.3; border: 1px solid #cdbcb3; background: white; border-radius: 7px;
}
.registration-note { margin: 0 0 12px; font-size: 13px; color: var(--muted) }
.office-link strong { font-size: 13px; font-weight: 620 }
.lookup .office-link[data-office=commune] { background: #eef5f0; color: #28533f; border-color: #b8cfbd }
.lookup .office-link[data-office=province] { background: #eff4f8; color: #284f68; border-color: #bccedc }
.lookup .office-link[data-office=central] { background: #f5f0f8; color: #5b4169; border-color: #d3c4da }
.lookup .office-link:hover, .lookup .office-link:focus-visible { border-color: currentColor }
.lookup-pages, .lookup-pages a { display: flex; align-items: center }
.lookup-pages { justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted) }
.lookup-pages a { min-height: 44px; gap: 6px; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 12px; background: var(--paper); color: var(--red); font-weight: 600 }
@media(max-width:820px) {
  .lookup-search { grid-template-columns: minmax(0,1.4fr) minmax(230px,1fr); column-gap: 16px }
  .lookup-inputs { padding-left: 20px }
  .lookup-jumps { padding: 0 16px }
  .lookup-scope { padding: 12px 16px; gap: 8px }
  .lookup .directory-band,.lookup .directory-row { grid-template-columns:minmax(0,1fr) minmax(220px,40%); gap: 12px; padding-inline: 14px }
}
@media(max-width:620px) {
  .lookup-search { display: flex; flex-direction: column; align-items: stretch; border-radius: 12px }
  .lookup-inputs,.lookup-inputs:not(:has(+ .lookup-jumps)) { padding: 18px 14px 12px }
  .lookup-inputs h1 { margin-bottom: 12px }
  .lookup-jumps { margin: 0 14px 10px; padding: 0; border: 0 }
  .lookup-jumps h2 { display: none }
  .lookup-jumps button { min-height: 44px }
  .lookup-scope { display: block; padding: 12px }
  .lookup-scope > span { display: block; margin-bottom: 6px }
  .scope-choice { min-height: 44px }
  .lookup-heading { position: relative; align-items: start; gap: 8px; flex-wrap: wrap }
  .lookup-heading > div { flex: 1; min-width: 0 }
  .lookup-emblem { width: 32px; height: 32px; border-radius: 8px }
  .lookup-emblem svg { width: 18px; height: 18px }
  .lookup-heading h2 { font-size: 19px }
  .result-count { padding: 2px 6px; font-size: 11px }
  .lookup-guides { grid-template-columns: minmax(0,1fr); gap: 10px }
  .lookup-guide { padding: 12px 14px 4px }
  .lookup-guide-links a { min-height: 44px }
  .portal-tools { gap: 8px }
  .portal-tools .catalog-filter { flex: 1 1 160px }
  .portal-tools select { min-width: 0; max-width: none }
  .lookup .directory-band,.lookup .directory-row { display: block; padding: 12px 14px }
  .lookup .directory-band > span { display: none }
  .lookup .office-links { margin-top: 8px }
}

.procedure-reader .reader { border-top: 3px solid #81202b }
.portal-reader .reader { border-top-color: #426457 }
.procedure-reader .reader h1 { font: 650 clamp(27px,3.1vw,41px)/1.22 Inter,sans-serif; letter-spacing: -.035em }
.portal-reader .overline { color: #31584a }
.portal-reader .reader-actions .portal-open { background: #31564b; color: white; border-color: #31564b; font-weight: 620; min-height: 44px }
.portal-reader .reader-actions .portal-open:hover { background: #24453c }
@media print { .procedure-reader .reader { border-top: 0 } }
