/* Layout and colours related to web-heraldika: paper background, Cormorant
   Garamond for text and headings, Source Sans 3 for labels. The accent is
   the linden green of the ZREČR logo; the shield red is a secondary colour. */
:root {
  --paper: #fcfbf8;
  --ivory: #f5f1e8;
  --ink: #191815;
  --muted: #635f56;
  --line: #d8d5ce;
  /* Cards, form fields and the empty-result box stand out on the paper. */
  --surface: #fff;
  --on-accent: #fff;
  --accent: #0b6b12;
  --accent-deep: #14501c;
  --shield-red: #b3121b;
  --measure: 72rem;
}

*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif), Georgia, serif;
  font-size: 20px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding-block: 2.5rem 4rem;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

h1,
h2 {
  font-weight: 500;
  line-height: 1.1;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  margin-bottom: 0.75rem;
}

p + p {
  margin-top: 1em;
}

.container {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans), sans-serif;
  font-size: 1rem;
}

.skip-link:focus {
  top: 1rem;
  color: var(--paper);
}

/* Header */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 150px;
  mix-blend-mode: multiply;
}

.brand-name {
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 500;
  line-height: 1.15;
  max-width: 18ch;
}

/* Main navigation: plain links that wrap at phone width */
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.6rem;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-family: var(--font-sans), sans-serif;
  font-size: 1.05rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent-deep);
  border-bottom-color: var(--line);
}

.site-nav a[aria-current] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Information pages: section navigation beside (or above) the text */
.page-layout {
  display: grid;
  gap: 2rem;
}

.section-nav ul {
  list-style: none;
  border-left: 1px solid var(--line);
}

.section-nav a {
  display: block;
  margin-left: -1px;
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 3px solid transparent;
  color: var(--muted);
  font-family: var(--font-sans), sans-serif;
  font-size: 1rem;
  line-height: 1.35;
  text-decoration: none;
}

.section-nav a:hover {
  color: var(--accent-deep);
}

.section-nav a[aria-current="page"] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.prose {
  max-width: 46rem;
  min-width: 0;
}

.prose > * + * {
  margin-top: 1rem;
}

.prose > h2 {
  margin-top: 2.5rem;
}

.prose > h3 {
  margin-top: 1.75rem;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.25;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li + li,
.prose li > ul {
  margin-top: 0.3rem;
}

.prose .documents {
  list-style: none;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: var(--ivory);
  font-family: var(--font-sans), sans-serif;
  font-size: 1rem;
}

.prose .page-image {
  margin-inline: 0;
}

.prose .page-image img {
  border: 1px solid var(--line);
}

.not-found {
  max-width: 46rem;
}

@media (min-width: 56rem) {
  .page-layout.with-section-nav {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 3rem;
  }

  .section-nav {
    padding-top: 0.75rem;
  }
}

/* Register grid (homepage, works without JavaScript) */
.intro {
  max-width: 46rem;
  margin-bottom: 2.5rem;
}

.intro p {
  color: var(--muted);
}

.count,
.facts dt,
.number {
  font-family: var(--font-sans), sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.count {
  margin-bottom: 1rem;
}

/* Register search and filters (shown by src/scripts/register.js) */
[hidden] {
  display: none !important;
}

.register-search {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--ivory);
  font-family: var(--font-sans), sans-serif;
}

.register-search .field-query {
  grid-column: 1 / -1;
}

.register-search label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.register-search input,
.register-search select,
.no-results button {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--muted);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.register-search :focus-visible,
.no-results button:focus-visible {
  outline-offset: 1px;
}

.no-results {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.no-results p {
  margin-bottom: 0.75rem;
}

.no-results button {
  width: auto;
  padding-inline: 1rem;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-sans), sans-serif;
  cursor: pointer;
}

.no-results button:hover {
  background: var(--accent-deep);
}

.erb-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 1.25rem;
}

.card a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 0.75rem 0.75rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  line-height: 1.3;
}

.card a:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.card-image {
  position: relative;
  aspect-ratio: 1;
  margin-bottom: 0.5rem;
  background: var(--ivory);
}

.card-image > * {
  position: absolute;
  inset: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card .number {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

/* Neutral placeholder for a missing erb image: an empty shield outline. */
.erb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  min-height: 12rem;
  padding: 1rem;
  background: var(--ivory);
  color: var(--muted);
  font-family: var(--font-sans), sans-serif;
  font-size: 0.85rem;
  text-align: center;
}

.erb-placeholder::before {
  content: "";
  width: 4.5rem;
  aspect-ratio: 5 / 6;
  background: var(--line);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

/* Detail of a Registrovaný erb */
.erb-detail {
  max-width: 46rem;
}

.erb-figure {
  max-width: 32rem;
  margin-block: 1.5rem;
  background: var(--ivory);
}

.erb-figure img {
  margin-inline: auto;
}

.erb-figure .erb-placeholder {
  aspect-ratio: 3 / 2;
}

.facts {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  margin-block: 1.5rem 2.5rem;
}

.facts > div {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.facts dd {
  font-variant-numeric: lining-nums;
}

.back {
  margin-top: 2rem;
}

.blason {
  padding: 1.25rem 1.5rem;
  background: var(--ivory);
  border-left: 3px solid var(--shield-red);
}

.blason h2,
.other-erby h2 {
  font-size: 1.6rem;
}

.other-erby {
  margin-top: 2.5rem;
}

.other-erby ul {
  padding-left: 1.25rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--ivory);
  font-family: var(--font-sans), sans-serif;
  font-size: 1rem;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding-block: 1.75rem;
}

.footer-row p {
  margin: 0;
}

.footer-name {
  flex-basis: 100%;
  font-family: var(--font-serif), Georgia, serif;
  font-size: 1.25rem;
}

@media (max-width: 40rem) {
  body {
    font-size: 18px;
  }

  .brand img {
    width: 96px;
  }

  .site-nav ul {
    column-gap: 0.75rem;
  }

  .site-nav a {
    font-size: 0.9rem;
  }

  .facts > div {
    grid-template-columns: 1fr;
  }

  .erb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .card a {
    padding: 0.5rem 0.5rem 0.75rem;
    font-size: 1rem;
  }

  .erb-placeholder {
    min-height: 0;
  }
}
