/* Design tokens (responsive scaling) */
:root {
  /* Global UI scaling: approximate browser 80% zoom effect */
  --ui-scale: 0.9;
  --font-size-base: calc(16px * var(--ui-scale));
  --font-size-search-title-min: 1.2rem;
  --font-size-search-title-max: 1.8rem;
  --font-size-nav-link-min: 1.1rem;
  --font-size-nav-link-max: 1.5rem;
  --font-size-card-title-min: 1rem;
  --font-size-card-title-max: 1.4rem;
  /* Home and Help: locked shell height = 1 viewport */
  --app-height: 100vh;
  /* Search page: max visible height of the scrollable table area (was written as 150hv → 150vh) */
  --search-table-shell-max-h: 150vh;
  /* Narrow viewports: horizontal-scroll floor (rem); tune if columns feel tight */
  --search-scheme-a-main-min: 52rem;
  --search-scheme-a-sub-min: 46rem;
  --search-scheme-a-main-min-phone: 62rem;
  --search-scheme-a-sub-min-phone: 54rem;
  /* Tag columns: cap cell height; extra tags scroll inside the cell */
  --search-tag-cell-max-h: 7.5rem;
  /* Phone tag fold count (first N visible, rest behind "+ more") → Programmes/web/static/js/main.js SEARCH_TAG_COLLAPSE_MAX_VISIBLE */
  --nav-h: calc(10vh * var(--ui-scale));
  /* Footer spacing (tune these): */
  --footer-padding-x: clamp(0.5rem, 2vw, 1.25rem);
  --footer-inline-gap: clamp(0.75rem, 2.5vw, 1.75rem); /* between copyright text and logo group */
  --footer-logo-gap: clamp(0.75rem, 3vw, 2.25rem); /* between the two logos */
  /* Search strip: same corner radius on outer card, gradient frame, and button */
  --search-ui-radius: 2rem;
  /* Gradient ring thickness around the typing field (nested radius = outer − pad) */
  --search-frame-pad: 0.55rem;
  --search-input-radius: max(0.28rem, calc(var(--search-ui-radius) - var(--search-frame-pad)));
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

html {
  font-size: var(--font-size-base);
}

/* Locked 1 viewport shell: Home and Help use an internally scrollable content area. */
html.page-home,
html.page-help {
  height: var(--app-height);
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

body.page-home,
body.page-help {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.page-search {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}


.navbar {
    width: 100%;
    flex: 0 0 auto;
    background-color: #000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.3);
    z-index: 999;
}

.logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    width: 24%;
    height: 100%;
    padding-left: 1.25rem;
}


.top-logo-main {
  width: 80%;
  max-width: 12rem;
  height: auto;
  object-fit: contain;
}

.navbar .menu {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-right: 1%;
}

.nav-toggle {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 0.55rem;
    background: transparent;
    padding: 0.4rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.24rem;
}

.nav-toggle__bar {
    display: block;
    width: 1.25rem;
    height: 2px;
    background-color: #ffffff;
    border-radius: 999px;
}

.nav-toggle:hover {
    border-color: rgba(255, 255, 255, 0.72);
}

.nav-toggle:focus-visible {
    outline: 2px solid rgba(0, 191, 255, 0.9);
    outline-offset: 2px;
}
.navbar .menu a {
  color: white;
  text-decoration: none;
  font-size: clamp(var(--font-size-nav-link-min), 0.9vw + 0.85rem, var(--font-size-nav-link-max));
  font-weight: bold;
  transition: all 0.3s ease;
}

.navbar .menu a:hover {
  color: #00bfff;
}
.main-content{
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    background-image: url('../fig/Background.png');
    background-position: center;
    background-repeat: repeat;
    background-color: rgb(112, 112, 105);
    background-blend-mode: overlay;
    transition: background-color 1s ease-in-out;
}

body.page-home .main-content,
body.page-help .main-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    /* Home only: no texture image — match statistic / welcome panel */
    background-image: none;
    background-color: #faf9f5;
    background-blend-mode: normal;
    background-repeat: no-repeat;
}

/* Home: split leftover vertical space 40% / 60% (top / bottom) ≈ 10% shift up from center */
body.page-home .main-content::before,
body.page-home .main-content::after {
    content: "";
    flex: 4 1 0;
    min-height: 0;
}

body.page-home .main-content::after {
    flex: 6 1 0;
}

body.page-search .main-content {
    flex: 0 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: visible;
    background-image: none;
    /* Deeper warm greige: same hue family as table (#faf9f5) and header strip (rgb(184,179,153)) */
    background-color: #6a6356;
    background-blend-mode: normal;
    background-repeat: no-repeat;
}

.searchbar  {
    flex-shrink: 0;
    margin-top: 3vh;
    background-color: #faf9f5;
    color: black;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 10px;
    height: auto;
    min-height: clamp(9.8rem, calc(14vh * var(--ui-scale)), 12rem);
    width: 60%;
    border-radius: var(--search-ui-radius);
    box-shadow: 10px 10px 10px rgba(168, 168, 170, 0.5);
    border: 3px solid #f2f3f7;
    transition: box-shadow 1s ease-in-out, border 1s ease-in-out;
}

.searchbar:hover {
    box-shadow: 0 0 50px rgba(255, 255, 200, 0.6), 0 0 30px rgba(255, 255, 200, 0.8);
    border: 3px solid rgb(216, 217, 218);
}

.searchbar h1 {
  font-size: clamp(var(--font-size-search-title-min), 2vw + 0.5rem, var(--font-size-search-title-max));
  margin: 2rem 0 1.15rem;
  text-align: center;
}

#search-block{
    display: flex;
    align-items: center;
    width: 40%;
    height: auto;
    min-height: 2.8rem;
}
#search-example{
    width: 60%;
    height: auto;
    margin-top: 0.75rem;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.InputContainer {
  width: 80%;
  height: auto;
  min-height: 2.8rem;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  padding: var(--search-frame-pad);
  background: linear-gradient(to bottom, rgb(247, 149, 31,0.5), rgb(17, 118, 189,0.5));
  border-radius: var(--search-ui-radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.075);
}
.input {
  width: 100%;
  height: 100%;
  min-height: 2rem;
  box-sizing: border-box;
  border: none;
  outline: none;
  caret-color: rgb(255, 81, 0);
  background-color: rgb(255, 255, 255);
  border-radius: var(--search-input-radius);
  padding-left: 12px;
  letter-spacing: 0.8px;
  color: rgb(19, 19, 19);
  font-size: 13.4px;
  line-height: 1.2;
}

#searchButton {
    margin-left: 5%;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 22%;
    min-width: 5.25rem;
    max-width: 7rem;
    align-self: stretch;
    min-height: 2.8rem;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.16rem 0.32rem;
    font-family: "Roboto", sans-serif;
    border-radius: var(--search-ui-radius);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.07);
    background: linear-gradient(180deg, #fffefb 0%, #f3f1eb 100%);
    color: #1a1a1a;
    box-shadow: none;
    font-size: clamp(0.76rem, 0.85vh + 0.55rem, 0.9rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.1;
    transition:
        color 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        transform 0.25s ease;
}

#searchButton .search-button__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

#searchButton .search-button__icon {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    opacity: 0.88;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#searchButton .search-button__label {
    display: block;
}

#searchButton:hover {
    background: hsl(33, 89%, 53%);
    color: #ffffff;
    border-color: rgba(247, 149, 31, 0.55);
    box-shadow: none;
    transform: translateY(-2px);
}

#searchButton:hover .search-button__icon {
    opacity: 1;
    transform: scale(1.06);
}

#searchButton:active {
    transform: translateY(0);
}

#searchButton:focus-visible {
    outline: 2px solid hsl(33, 89%, 48%);
    outline-offset: 2px;
}

.statistic {
    /* Home hero column: logo strip, search, and welcome share one width. */
    --home-content-width: min(1120px, 90vw);
    /* Logo ↔ hairline: gap = image bottom to line; bottom = line inset from box bottom */
    --home-logo-to-hairline-gap: 1rem;
    --home-logo-hairline-bottom: 0.35rem;
    margin-top: 0;
    background-color: #faf9f5;
    color: black;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    padding: 1.2vh 0 1.8vh;
    border-radius: 0;
    box-shadow: none;
}

/* Home: statistic height follows content; vertical offset via main-content flex spacers */
body.page-home .statistic,
body.page-help .statistic {
    flex: 0 1 auto;
    align-self: stretch;
    min-height: 0;
}

body.page-help .statistic--help {
    padding: clamp(1.75rem, 5vh, 3.25rem) 0;
}

.help-page {
    width: min(1120px, 90vw);
    margin: 0 auto;
    box-sizing: border-box;
}

.help-page__title {
    margin: 0 0 clamp(1.25rem, 3vh, 2rem);
    color: #171717;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.1;
    text-align: center;
}

.help-card-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 2.5vw, 2rem);
}

.help-card {
    min-width: 0;
    padding: clamp(1.4rem, 3vw, 2.4rem);
    scroll-margin-top: 1.5rem;
    border: 1px solid rgba(17, 118, 189, 0.14);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 30px rgba(36, 32, 24, 0.08);
}

.help-card h2 {
    margin: 0 0 1rem;
    color: #1176bd;
    font-size: clamp(1.45rem, 2.2vw, 2rem);
    line-height: 1.2;
}

.help-card > p {
    margin: 0;
    color: #292929;
    font-size: 1rem;
    line-height: 1.7;
}

.help-card > p + p {
    margin-top: 1rem;
}

.help-card__intro {
    max-width: 75ch;
}

.help-card__lead {
    font-size: 1.08rem !important;
    font-weight: 600;
}

.classification-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    margin-top: 1.5rem;
    align-items: start;
}

.classification-group {
    min-width: 0;
    padding: clamp(1.1rem, 2vw, 1.5rem);
    border: 1px solid rgba(247, 149, 31, 0.24);
    border-radius: 0.85rem;
    background: #fffdf9;
    box-shadow: 0 5px 16px rgba(36, 32, 24, 0.045);
}

.classification-group h3 {
    margin: 0;
    color: #222222;
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    line-height: 1.35;
}

.classification-subcategory {
    min-width: 0;
    margin-top: 1.15rem;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(17, 118, 189, 0.12);
}

.classification-subcategory h4 {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin: 0;
    color: #3a352e;
    font-size: 0.98rem;
    line-height: 1.45;
}

.classification-subcategory__code {
    flex: 0 0 auto;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
    background: rgba(17, 118, 189, 0.1);
    color: #0d5f9a;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
}

.classification-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.classification-examples li {
    min-width: 0;
    max-width: 100%;
}

.classification-example {
    display: inline-flex;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.36rem 0.68rem;
    border: 1px solid rgba(17, 118, 189, 0.25);
    border-radius: 999px;
    background: #ffffff;
    color: #1176bd;
    font-size: 0.86rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.classification-example:hover {
    border-color: rgba(247, 149, 31, 0.72);
    color: #0d5f9a;
    box-shadow: 0 4px 12px rgba(247, 149, 31, 0.14);
    transform: translateY(-1px);
}

.classification-example:focus-visible,
a.contribute-email:focus-visible {
    outline: 2px solid #f7951f;
    outline-offset: 3px;
}

a.contribute-email {
    color: #1176bd;
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

a.contribute-email:hover {
    color: #0d5f9a;
}

.home-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin: 1vh 0 1.4vh;
    padding: 0.78rem 1.85rem 0.78rem 1.5rem;
    border-radius: 9999px;
    background: linear-gradient(180deg, #fffefb 0%, #f3f1eb 100%);
    color: #1a1a1a;
    text-decoration: none;
    letter-spacing: 0.01em;
    font-size: clamp(1.06rem, 1.15vw + 0.86rem, 1.28rem);
    font-weight: 500;
    font-family: "Roboto", sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 4px 14px rgba(0, 0, 0, 0.07);
    transition:
        color 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.25s ease;
}

.home-search-form {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    width: var(--home-content-width);
    margin: 1vh auto 1.4vh;
    box-sizing: border-box;
}

.home-search-form__input {
    flex: 1 1 auto;
    width: auto;
    min-width: 14rem;
    height: 2.95rem;
    padding: 0 0.95rem;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    background-color: rgba(255, 255, 255, 0.95);
    color: #2c2b28;
    font-size: 0.98rem;
    font-family: "Roboto", sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.home-search-form__input::placeholder {
    color: #6f675d;
}

.home-search-form__input:focus {
    outline: none;
    border-color: hsl(33, 89%, 48%);
    box-shadow:
        0 0 0 2px rgba(247, 149, 31, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.06);
}

.home-search-button__icon {
    flex-shrink: 0;
    width: 1.12em;
    height: 1.12em;
    opacity: 0.88;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.home-search-button:hover {
    background: hsl(33, 89%, 53%);
    color: #ffffff;
    border-color: rgba(247, 149, 31, 0.55);
    box-shadow:
        0 2px 6px rgba(247, 149, 31, 0.28),
        0 10px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.home-search-button:hover .home-search-button__icon {
    opacity: 1;
    transform: scale(1.06);
}

.home-search-button:active {
    transform: translateY(0);
}

.home-search-button:focus-visible {
    outline: 2px solid hsl(33, 89%, 48%);
    outline-offset: 3px;
}


/* flap logo — depth + brand-tint hairline (no backdrop halo) */
.flip-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    width: var(--home-content-width);
    box-sizing: border-box;
    height: auto;
    margin-top: 1vh;
    margin-bottom: 0.75vh;
    padding: 0 0 calc(var(--home-logo-hairline-bottom) + var(--home-logo-to-hairline-gap));
}

/* Ambient brand halo behind logo (hover); reads stronger than img-only drop-shadow */
.flip-container::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 38%;
    width: min(95%, 28rem);
    height: min(70vw, 16rem);
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: radial-gradient(
        ellipse 52% 48% at 50% 50%,
        rgba(247, 149, 31, 0.21) 0%,
        rgba(247, 149, 31, 0.07) 42%,
        rgba(17, 118, 189, 0.06) 58%,
        transparent 72%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
}

.flip-container:hover::before {
    opacity: 1;
}

.flip-container::after {
    content: "";
    position: absolute;
    z-index: 0;
    left: 10%;
    right: 10%;
    bottom: var(--home-logo-hairline-bottom);
    height: 1px;
    pointer-events: none;
    border-radius: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 0, 0, 0.24) 14%,
        rgba(247, 149, 31, 0.78) 47%,
        rgba(17, 118, 189, 0.68) 53%,
        rgba(0, 0, 0, 0.24) 86%,
        transparent 100%
    );
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.14),
        0 2px 8px rgba(247, 149, 31, 0.16);
    opacity: 1;
    transition: box-shadow 0.5s ease;
}

.flip-container:hover::after {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.34),
        0 5px 20px rgba(0, 0, 0, 0.13),
        0 3px 13px rgba(247, 149, 31, 0.27),
        0 5px 22px rgba(17, 118, 189, 0.1);
}

.home-static-logo {
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.65))
        drop-shadow(0 14px 28px rgba(0, 0, 0, 0.07))
        drop-shadow(0 4px 10px rgba(0, 0, 0, 0.04));
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.45s ease;
}

.flip-container:hover .home-static-logo {
    transform: translateY(-3px);
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.55))
        drop-shadow(0 22px 40px rgba(0, 0, 0, 0.09))
        drop-shadow(0 0 16px rgba(247, 149, 31, 0.22))
        drop-shadow(0 0 34px rgba(247, 149, 31, 0.11))
        drop-shadow(0 0 26px rgba(17, 118, 189, 0.07))
        drop-shadow(0 8px 16px rgba(247, 149, 31, 0.1));
}

@media (prefers-reduced-motion: reduce) {
    .home-static-logo {
        transition: none;
    }

    .flip-container::before {
        transition: none;
        opacity: 0;
    }

    .flip-container:hover::before {
        opacity: 0;
    }

    .flip-container::after {
        transition: none;
    }

    .flip-container:hover::after {
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.3),
            0 4px 16px rgba(0, 0, 0, 0.14),
            0 2px 8px rgba(247, 149, 31, 0.16);
    }

    .flip-container:hover .home-static-logo {
        transform: none;
        filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.65))
            drop-shadow(0 14px 28px rgba(0, 0, 0, 0.07))
            drop-shadow(0 4px 10px rgba(0, 0, 0, 0.04));
    }
}



.statistic-welcome {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: var(--home-content-width);
    max-width: none;
    margin-inline: auto;
    padding: clamp(1rem, 2.2vw, 1.65rem) clamp(1rem, 2.8vw, 1.75rem);
    height: auto;
    box-sizing: border-box;
    gap: 1rem;
    background: rgba(255, 253, 251, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.07);
}

.statistic-welcome > h1 {
    margin: 0;
    font-size: clamp(1.85rem, 1.4vw + 1.2rem, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.12;
    color: #111;
    text-align: center;
    text-wrap: balance;
}

.statistic-welcome > p {
    margin: 0;
    font-size: clamp(1.02rem, 0.55vw + 0.92rem, 1.2rem);
    line-height: 1.72;
    color: #2e2e2e;
    text-align: left;
}

body.page-home .statistic-welcome > p {
    text-align: center;
    text-wrap: balance;
}

.statistic-welcome-cards-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.statistic-welcome-card-container {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.45rem, 2vw, 1.5rem);
    align-items: stretch;
}
.statistic-welcome-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    box-sizing: border-box;
    padding: 1rem clamp(0.35rem, 1.8vw, 1rem) 1.1rem;
    background: rgb(255, 253, 251);
    transition: background 0.25s ease, box-shadow 0.25s ease, border-radius 0.2s ease;
    border-radius: 10px;
    font-weight: 700;
    text-align: center;
}

.statistic-welcome-card:hover {
    border-radius: 12px;
    background: rgb(248, 236, 220);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.statistic-welcome-card__label {
    margin: 0;
    max-width: 100%;
    font-size: clamp(var(--font-size-card-title-min), 1vw + 0.6rem, var(--font-size-card-title-max));
    font-weight: 700;
    color: #2e2e2e;
    line-height: 1.2;
    overflow-wrap: break-word;
    hyphens: auto;
}

.statistic-welcome-card__value {
    margin: 0;
    max-width: 100%;
    font-size: clamp(1.05rem, 1.6vw + 0.75rem, 1.85rem);
    font-weight: 900;
    color: #111;
    line-height: 1.1;
}

.statistic-welcome-claim {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: clamp(1rem, 3vw, 2rem);
    width: 100%;
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.statistic-welcome-claim .cite,
.statistic-welcome-claim .claimer {
    flex: 1 1 12rem;
    min-width: min(100%, 12rem);
}

.statistic-welcome-claim .claimer {
    text-align: right;
}

.statistic-welcome-claim h3 {
    margin: 0 0 0.35rem;
    font-size: clamp(1rem, 0.4vw + 0.9rem, 1.15rem);
    font-weight: 700;
    color: #111;
}

.statistic-welcome-claim p {
    margin: 0;
    font-size: clamp(0.9rem, 0.35vw + 0.82rem, 1rem);
    line-height: 1.55;
    color: #444;
}

.footer {
    flex: 0 0 auto;
    background-color: black;
    color: white;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    height: var(--nav-h);
    min-height: var(--nav-h);
    max-height: var(--nav-h);
    padding: 0 var(--footer-padding-x);
    width: 100%;
    border-top: 3px solid grey;
    z-index: 998;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    gap: var(--footer-inline-gap);
    overflow: hidden;

}

.footer-logo-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--footer-logo-gap);
    flex: 0 0 auto;
    min-width: 0;
    max-width: min(62vw, 34rem);
}

.logo-footer {
    width: auto;
    height: auto;
    max-height: calc(var(--nav-h) * 0.92);
    max-width: min(34vw, 14rem);
    object-fit: contain;
}
#footer-logo {
    width: auto;
    height: auto;
    max-height: calc(var(--nav-h) * 0.92);
    max-width: min(38vw, 16rem);
    object-fit: contain;
}

.rights {
    flex: 0 1 auto;
    min-width: 0;
    text-align: left;
    margin: 0;
    font-size: clamp(0.65rem, 1.6vh, 0.8rem);
    line-height: 1.15;
    white-space: nowrap;
    max-width: min(42vw, 22rem);
}



main.table{
  width: 90vw;
  display: flex;
  flex-direction: column;
  background-color: #faf9f5;
  box-shadow: 0 8px 16px black;
  border-radius: 30px;
}

/* Search page: natural document height; table area grows with page scroll */
body.page-search main.table {
  flex: 0 1 auto;
  min-height: 0;
  min-width: 0; /* flex child: allow shrink so inner scroll works */
  height: auto;
  overflow: visible;
  margin-top: 3vh;
  margin-bottom: 2%;
  max-width: 100%;
  box-sizing: border-box;
}
.header{
    width: 100%;
    flex: 0 0 auto;
    min-height: 5rem;
    background-color: rgb(184, 179, 153);
    padding: 0.45rem 40px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20% minmax(0, 1fr);
    align-items: center;
    column-gap: 1.25rem;
    border-top-right-radius: 30px ;
    border-top-left-radius: 30px ;
    border-bottom: 3px solid rgba(0, 0, 0, 0.69);
    font-size: 1.25rem;


}

.search-header__keyword {
    justify-self: start;
    min-width: 0;
    margin: 0;
    font-size: 1.15em;
    line-height: 1.25;
}

.dataset-switch {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: center;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 4px;
    border: 1px solid rgba(202, 151, 85, 0.58);
    border-radius: 999px;
    background: linear-gradient(135deg, #2f2923 0%, #463a2f 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 5px 14px rgba(57, 43, 31, 0.3);
}

.dataset-switch__option {
    min-width: 4.6rem;
    padding: 0.52rem 1.05rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #eadfce;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.dataset-switch__option:hover:not(.is-active) {
    background: rgba(218, 171, 95, 0.18);
    color: #fffaf2;
}

.dataset-switch__option.is-active {
    background: linear-gradient(135deg, #b76e32 0%, #d8a24a 100%);
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 4px 12px rgba(161, 96, 42, 0.4);
}

.dataset-switch__option:focus-visible {
    outline: 3px solid rgba(247, 149, 31, 0.55);
    outline-offset: 2px;
}

.right-content {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 5px;
}
.hidden { display: none; }

.shell{
  flex: 1 1 auto;
  min-height: 0;
  width:95%;
  background-color: #fffbff;
  margin: 8px auto;
  border-radius: 20px;
  overflow: auto;
}

body.page-search main.table .shell {
  max-height: var(--search-table-shell-max-h);
  min-width: 0; /* scheme A: let flex parent shrink so overflow-x scrolls inside .shell */
}

/* Scheme A hint: shown only on narrow viewports (see max-width: 1024px block). */
.search-table-scroll-hint {
  display: none;
}



table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}
th, td {
    width: auto;
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
    cursor:pointer;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

td a {
    word-break: break-word;
    overflow-wrap: anywhere;
}

thead th {
  position: sticky;
  top: 0;
  left: 0;
  background-color: #d5d1de;
  z-index: 1;
}

.tag-filter,
.bool-filter,
.num-sort {
    display: block;
    margin-top: 6px;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


tbody tr {
  transition: background-color 0.5s ease-in-out;
}

tbody tr:hover {
  background-color: #f8f4e9 !important;
}



#rowsSelect {
    font-size: 16px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    color: #333;
}

.expand-btn {
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.expand-btn--expand {
    background-color: #1f6fb2;
    color: #ffffff;
    border-color: #1a5f98;
}

.expand-btn--expand:hover {
    background-color: #185d93;
}

.expand-btn--collapse {
    background-color: #efe9dc;
    color: #4a4439;
    border-color: #d7cbb4;
}

.expand-btn--collapse:hover {
    background-color: #e3dbc9;
}

.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #666;
    vertical-align: middle;
}

.status-ok {
    background-color: #2ecc71;
}

.status-bad {
    background-color: #e74c3c;
}

.status-unknown {
    background-color: #f1c40f;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    margin: 2px 6px 2px 0;
    padding: 2px 8px;
    line-height: 1.3;
    border-radius: 999px;
    border: 1px solid #d9ccb3;
    background: #f8f1e3;
    color: #5a4f3b;
    font-size: 12px;
}

.num-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.empty-value {
    color: #8d8474;
    font-style: italic;
}

/* Responsive layout adjustments */
@media (max-width: 1024px) {
  .searchbar {
    width: 80%;
  }

  #search-block {
    width: 85%;
    flex-wrap: wrap;
  }

  /* Scheme A (search): table wider than viewport scrolls inside .shell, not clipped by body */
  main.table {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    min-width: 0;
  }

  body.page-search .shell {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  body.page-search .shell > table {
    min-width: max(100%, var(--search-scheme-a-main-min));
  }

  body.page-search thead th {
    left: auto;
  }

  body.page-search tr.sub-row > td > table {
    min-width: max(100%, var(--search-scheme-a-sub-min));
  }

  .search-table-scroll-hint {
    display: block;
    margin: 0;
    padding: 0.4rem 0.75rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: center;
    color: #6a5f4d;
    background: linear-gradient(180deg, #f7f2e8 0%, #fffbff 100%);
    border-bottom: 1px solid #e8dcc7;
  }

  #searchButton {
    width: 28%;
    min-width: 5.5rem;
    max-width: 8rem;
  }

  #search-example {
    width: 70%;
  }

  .footer {
    height: var(--nav-h);
    min-height: var(--nav-h);
    max-height: var(--nav-h);
    padding: 0 var(--footer-padding-x);
    gap: var(--footer-inline-gap);
  }

  .rights {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  :root {
    --footer-padding-x: 0.5rem;
    --footer-inline-gap: 0.35rem;
    --footer-logo-gap: clamp(0.4rem, 2.5vw, 1rem);
  }

  body {
    align-items: stretch;
  }

  .help-page {
    width: min(100% - 1.5rem, 1120px);
  }

  .help-page__title {
    text-align: left;
  }

  .help-card {
    padding: 1.2rem;
  }

  .classification-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .navbar {
    position: relative;
    flex-wrap: nowrap;
    height: var(--nav-h);
    padding: 0 10px;
  }

  .logo {
    width: auto;
    max-width: 72%;
    padding-left: 0.5rem;
  }

  .top-logo-main {
    width: auto;
    max-width: min(56vw, 11rem);
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .navbar .menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0.55rem;
    z-index: 1001;
    width: min(74vw, 17rem);
    margin-right: 0;
    padding: 0.4rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background-color: rgba(0, 0, 0, 0.94);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
  }

  .navbar .menu.is-open {
    display: flex;
  }

  .navbar .menu a {
    display: block;
    padding: 0.55rem 0.7rem;
    border-radius: 0.45rem;
    font-size: clamp(0.95rem, 3.1vw, 1.08rem);
  }

  .navbar .menu a:hover {
    background-color: rgba(0, 191, 255, 0.14);
  }

  .navbar .menu a:active {
    background-color: rgba(0, 191, 255, 0.22);
  }

  .searchbar {
    width: 90%;
    height: auto;
    padding: 8px 14px;
    border-radius: var(--search-ui-radius);
  }

  #search-block {
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .InputContainer {
    width: 100%;
    height: auto;
  }

  .input {
    width: 100%;
    height: 34px;
    font-size: 14px;
  }

  #searchButton {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 2.45rem;
    margin-left: 0;
    margin-top: 4px;
    padding: 0.3rem 0.48rem;
  }

  #searchButton .search-button__icon {
    width: 1.05rem;
    height: 1.05rem;
  }

  #search-example {
    width: 100%;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.85rem;
  }

  .statistic-welcome-card-container {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.35rem, 1.8vw, 0.85rem);
  }

  .statistic-welcome-card {
    padding: 0.75rem clamp(0.25rem, 1.2vw, 0.55rem) 0.85rem;
    gap: 0.35rem;
  }

  .statistic-welcome-card__label {
    font-size: clamp(0.78rem, 2.2vw + 0.45rem, var(--font-size-card-title-max));
  }

  .statistic-welcome-card__value {
    font-size: clamp(1rem, 2.8vw + 0.55rem, 1.45rem);
  }

  main.table {
    /* 100% of parent avoids vw + scrollbar overflow; stretch fills .main-content */
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    min-width: 0;
    border-radius: 0;
    margin-top: 2vh;
  }

  /* Scheme A: wider floor on phones (see :root --search-scheme-a-*-phone) */
  body.page-search .shell > table {
    min-width: max(100%, var(--search-scheme-a-main-min-phone));
  }

  body.page-search tr.sub-row > td > table {
    min-width: max(100%, var(--search-scheme-a-sub-min-phone));
  }

  /* Tag fold (phone only): .tag-item--folded is toggled by main.js (SEARCH_TAG_COLLAPSE_MAX_VISIBLE). */
  body.page-search td.tag-cell.tag-cell--tags-collapsed:not(.tag-cell--tags-expanded) .tag-item.tag-item--folded {
    display: none !important;
  }

  body.page-search .tag-cell__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.45rem;
    padding: 0.28rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    border-radius: 999px;
    border: 1px solid #c4b59f;
    background: #f3eadd;
    color: #4a4033;
  }

  body.page-search .tag-cell__more:hover {
    background: #e8dbcb;
  }

  .header {
    padding: 0.45rem 16px;
    font-size: 16px;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px 8px;
  }

  .search-header__default {
    display: none;
  }

  .right-content {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    flex-wrap: wrap;
  }

  .shell {
    width: 100%;
    border-radius: 0;
  }

  .footer {
    height: var(--nav-h);
    min-height: var(--nav-h);
    max-height: var(--nav-h);
    padding: 0 var(--footer-padding-x);
    gap: var(--footer-inline-gap);
  }

  .footer-logo-row {
    max-width: min(58vw, 100%);
  }

  .footer .logo-footer,
  .footer #footer-logo {
    max-height: calc(var(--nav-h) * 0.88);
    max-width: min(40vw, 12rem);
  }

  .rights {
    font-size: clamp(0.6rem, 1.4vh, 0.75rem);
    white-space: normal;
    max-width: 42vw;
  }

  .home-search-form {
    width: min(92vw, 30rem);
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .home-search-form__input {
    width: 100%;
    min-width: 0;
  }

  .home-search-form .home-search-button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .input {
    font-size: 12px;
  }

  #searchButton {
    min-height: 2.35rem;
    padding: 0.28rem 0.4rem;
    font-size: clamp(0.74rem, 2.6vw + 0.55rem, 0.88rem);
  }

  .rights {
    font-size: 0.7rem;
  }
}

/* Small visual polish for search result table */
body.page-search .shell {
  border: 1px solid #ece7dc;
}

body.page-search th,
body.page-search td {
  border: none;
  border-bottom: 1px solid #eee7da;
  padding: 12px 10px;
  line-height: 1.45;
  cursor: pointer;
}

/* Many tags: limit row height; scroll inside cell (tune --search-tag-cell-max-h in :root) */
body.page-search td.tag-cell {
  vertical-align: top;
  max-height: var(--search-tag-cell-max-h);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 79, 59, 0.35) transparent;
}

body.page-search td.tag-cell .tag-item {
  margin: 2px 5px 2px 0;
}

body.page-search td.tag-cell::-webkit-scrollbar {
  width: 6px;
}

body.page-search td.tag-cell::-webkit-scrollbar-thumb {
  background: rgba(90, 79, 59, 0.35);
  border-radius: 999px;
}

body.page-search thead th {
  background-color: #f3efe6;
  border-bottom: 1px solid #ddd4c3;
}

body.page-search tbody tr:nth-child(odd) {
  background: #fffdf9;
}

body.page-search tbody tr:nth-child(even) {
  background: #fcf8f0;
}

body.page-search tbody tr:hover {
  background-color: #f6efe2 !important;
}

/* Expanded sub-table: embedded card style */
body.page-search tr.sub-row > td {
  background: #f2ede2;
  border-bottom: none;
  padding: 14px 18px 18px;
}

body.page-search tr.sub-row > td > table {
  width: 100%;
  border: 1px solid #d8ceb9;
  border-radius: 14px;
  overflow: hidden;
  background: #fffaf0;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.12),
    inset 4px 0 0 #c89b4f;
  border-collapse: separate;
  border-spacing: 0;
}

body.page-search tr.sub-row > td > table th {
  background: #e8dec8;
  border-bottom: 1px solid #cfc1a4;
  font-weight: 600;
}

body.page-search tr.sub-row > td > table td {
  background: #fffaf0;
  border-bottom: 1px solid #e8dcc7;
}

body.page-search tr.sub-row > td > table tr:last-child td {
  border-bottom: none;
}

body.page-search tr.sub-row:hover {
  background: #f2ede2 !important;
}
