/* This file was modified using AI tooling (pi coding agent). */

/* Brand fallback fonts (Google Fonts, SIL OFL; see /fonts/*-OFL.txt) */
@font-face {
  font-family: "Bitter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Bitter-VariableFont_wght.ttf") format("truetype");
}

@font-face {
  font-family: "Bitter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Bitter-Italic-VariableFont_wght.ttf") format("truetype");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/PlusJakartaSans-VariableFont_wght.ttf") format("truetype");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/PlusJakartaSans-Italic-VariableFont_wght.ttf")
    format("truetype");
}

/* Vertex brand colors (Vertex Brand Style Guidelines v1.0) */
:root {
  /* Primary palette */
  --crimson-violet: #3e002a;
  --mauve-magic: #e156ff;
  --light-cyan: #c4f5ed;
  /* Secondary palette */
  --teal: #0b7f75;
  --dark-teal: #073034;
  /* Tertiary palette (accents, use intentionally) */
  --lime-wash: #deff89;
  --golden-wheat: #d1bd65;
  --canyon-rose: #f68b7d;
  /* Neutrals */
  --neutral-800: #2b2b2b;
  --neutral-600: #5f5f5f;
  --neutral-400: #a3a3a3;
  --neutral-300: #d9d6d8;
  --neutral-100: #f7f5f6;
  --white: #ffffff;

  /* Typography: brand fonts, then Google, then system alternatives */
  --font-primary: "Kyoto", "PP Kyoto", "Bitter", Georgia, serif;
  --font-secondary: "Sharp Sans", "Plus Jakarta Sans", Arial, sans-serif;

  --page-width: 1368px;

  /* pagefind UI adjustments */
  --pf-image-width: 32px;
  --pf-image-height: 24px;
}

/* Base */
html {
  font-size: 16px;
  line-height: 1.6;
  font-family: var(--font-secondary);
  color: var(--neutral-800);
  background: var(--neutral-100);
}

h1,
h2,
h3 {
  font-family: var(--font-primary);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Site header */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 200;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: var(--white);
  color: var(--crimson-violet);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  background: var(--crimson-violet);
  color: var(--white);
  font-size: 0.875rem;

  .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--page-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
  }

  .top {
    height: 3.5rem;
  }

  .bottom {
    height: 2.75rem;
  }

  .logo {
    display: flex;
    align-items: center;

    img {
      width: auto;
      height: 1.75rem;
    }
  }

  .nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: -0.6rem;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    padding: 0 0.6rem;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--white);
    font-weight: 500;
    text-decoration: none;

    &:hover,
    &[aria-current="page"] {
      background: rgba(255, 255, 255, 0.12);
      color: var(--white);
    }

    &:focus-visible {
      outline: none;
      border-color: var(--mauve-magic);
      box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
    }
  }

  .nav-icon {
    width: 1em;
    height: 1em;
  }

  .search {
    display: flex;
    align-items: center;
    min-width: 15rem;

    pagefind-modal-trigger {
      display: block;
      width: 100%;
    }
  }

  @media (max-width: 640px) {
    .container {
      padding: 0 1rem;
    }

    .search {
      min-width: 0;
    }
  }
}

main {
  flex: 1 0 auto;
  width: 100%;
  box-sizing: border-box;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.site-footer {
  background: var(--crimson-violet);
  color: var(--white);
  font-size: 0.875rem;

  .container {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 1rem 1.5rem;
  }

  p {
    margin: 0;
  }
}

/* Typography */
main header {
  margin: 0 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--crimson-violet);
  display: flex;
  justify-content: space-between;
  width: 100%;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--crimson-violet);
  padding: 0;
  margin: 0;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--crimson-violet);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--neutral-300);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal);
  margin: 1.25rem 0 0.5rem;
}

p {
  margin: 0.5rem 0;
}

a {
  color: var(--teal);
  text-decoration: underline;
}

a:hover {
  color: var(--dark-teal);
}

/* Breadcrumbs */
nav.breadcrumbs,
nav.context-breadcrumbs {
  font-size: 0.85rem;
  color: var(--neutral-600);
  margin-bottom: 0.4rem;
}

nav.breadcrumbs {
  margin-bottom: 0.2rem;
}

nav.breadcrumbs span,
nav.context-breadcrumbs span {
  color: var(--neutral-800);
  font-weight: 500;
}

nav.context-breadcrumbs {
  margin-bottom: 0.75rem;
}

.caret {
  margin: 0 0.4em;
  color: var(--neutral-400);
  font-weight: 400;
  user-select: none;
}

code.xpath {
  flex-grow: 1;
  border: none;
}

div.xpath-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.35rem 0.6rem;
  word-break: break-all;
  border: 1px solid var(--neutral-300);
  border-radius: 6px;
}

.copy-to-clipboard {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  justify-self: end;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--crimson-violet);
  cursor: pointer;
}

/* Inline code */
code {
  font-size: 0.875em;
  background: var(--neutral-100);
  border: 1px solid var(--neutral-300);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  color: var(--crimson-violet);
}

/* Code block */
pre {
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.875rem;
}

/* Example snippet (generated, see transformations/snippets.py) */
.snippet {
  margin-top: 1rem;
}

.snippet pre {
  margin-bottom: 0.25rem;
}

.snippet em {
  font-size: 1rem;
  color: var(--crimson-violet);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--white);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1rem;
}

thead {
  background: var(--crimson-violet);
  color: var(--white);
}

thead th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

tbody tr {
  border-bottom: 1px solid var(--neutral-100);
}

table.striped tbody tr:nth-child(even) {
  background-color: var(--neutral-100);
}

tbody tr:last-child {
  border-bottom: none;
}

table.hoverable tbody tr:hover {
  background: var(--light-cyan);
  transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

tbody td {
  padding: 0.55rem 1rem;
  vertical-align: top;
}

tbody td:first-child {
  white-space: nowrap;
}

/* info-table: two-column key/value, no header */
table.info-table {
  margin-top: 0;
}

table.info-table td:first-child {
  width: 140px;
  color: var(--neutral-600);
}

/* template-params: equals-sign middle column */
table.template-params td:nth-child(2) {
  width: 2rem;
  text-align: center;
  color: var(--neutral-400);
}

/* Sections */
section {
  margin-top: 2rem;
}

section.description,
section.children,
section.details,
section.rules {
  background: var(--white);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

section h2 {
  margin-top: 0;
  border-bottom-color: var(--neutral-100);
}

/* Table inside a section should skip extra shadow */
section table {
  box-shadow: none;
  border: 1px solid var(--neutral-100);
}

/* Table blocks (raw HTML tables from markdown) */
div.table-block {
  overflow-x: auto;
  margin: 0.75rem 0;
}

div.table-block table {
  min-width: 400px;
}

/* Download button */
.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--white);
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  color: var(--crimson-violet);
  text-decoration: none;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.download-button:hover {
  border-color: var(--dark-teal);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  color: var(--dark-teal);
  text-decoration: none;
}

.download-button-icon {
  flex-shrink: 0;
  color: var(--dark-teal);
}

.download-button span {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.download-button strong {
  font-size: 0.95rem;
  font-weight: 600;
}

.download-button small {
  font-size: 0.8rem;
  color: var(--neutral-600);
}

/* Front page */
.front-header {
  margin-bottom: 1.75rem;
}

.front-lead {
  margin: 0.35rem 0 0;
  color: var(--neutral-600);
  font-size: 1rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  color: var(--crimson-violet);
  text-decoration: none;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;

  span {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
  }

  strong {
    font-weight: 600;
  }

  small {
    font-size: 0.8rem;
    color: var(--neutral-600);
  }

  &:hover {
    border-color: var(--teal);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: var(--crimson-violet);
    transform: translateY(-1px);
  }

  &:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
  }
}

.quick-link-icon {
  flex-shrink: 0;
  box-sizing: content-box;
  padding: 0.5rem;
  border-radius: 8px;
  background: var(--light-cyan);
  color: var(--dark-teal);
}

.countries {
  margin-top: 0;

  h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0;
  }

  .count {
    font-family: var(--font-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--neutral-300);
    color: var(--neutral-800);
  }
}

.country-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.country-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

.country-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-secondary);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--crimson-violet);
}

.doc-type-label {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--neutral-600);
}

.spec-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.spec-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--teal);
  border-radius: 4px;
  background: var(--neutral-100);
  color: var(--teal);
  text-decoration: none;
  transition: background 0.15s ease;

  strong {
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-word;
    text-decoration: underline;
  }

  .link-description {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--neutral-800);
  }

  &:hover {
    background: var(--light-cyan);
    color: var(--dark-teal);
  }

  &:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
  }
}

/* Status markers */
.hidden-marker {
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--golden-wheat);
  color: var(--neutral-800);
  border-radius: 3px;
  padding: 0.1em 0.45em;
  vertical-align: middle;
  margin-left: 0.4rem;
}

span.removed {
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--neutral-300);
  color: var(--neutral-600);
  border-radius: 3px;
  padding: 0.1em 0.45em;
  margin-left: 0.3rem;
}

.hidden {
  display: none;
}

s a {
  color: var(--neutral-400);
}

p.small {
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 640px) {
  main {
    padding: 1rem 1rem 3rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  tbody td:first-child {
    white-space: normal;
  }
}

.context-page-header .page-id {
  color: var(--crimson-violet);
  font-weight: bold;
  font-size: 1rem;

  display: flex;
  align-items: center;
  gap: 0.5rem;

  .fi {
    font-size: 1.5rem;
  }
}

[x-cloak] {
  display: none !important;
}

/* From https://css-tricks.com/pure-css-tabs-with-details-grid-and-subgrid/ */
.tabs {
  .grid {
    display: grid;
    /* the --num-tabs variable is passed in via the jinja2 templates as a style= property on the .tabs element */
    grid-template-columns: repeat(var(--num-tabs), minmax(0, 1fr));
    grid-template-rows: auto 1fr;
    column-gap: 0.25rem;
  }

  details {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 1 / span 2;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;
  }

  summary {
    /* the --n variable is the index of the tab in the list, passed in via the jinja2 element via a style= property */
    grid-column: var(--n) / span 1;
    grid-row: 1;
    z-index: 1;
    list-style: none;
    padding: 0.6rem 1.25rem;
    margin-bottom: -1px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--neutral-600);
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    user-select: none;
    transition:
      color 0.15s ease,
      background 0.15s ease,
      border-color 0.15s ease;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  summary:hover {
    color: var(--dark-teal);
    background: var(--white);
  }

  summary:focus-visible {
    outline: 2px solid var(--dark-teal);
    outline-offset: -2px;
  }

  details[open] > summary {
    color: var(--crimson-violet);
    font-weight: 600;
    background: var(--white);
    border-color: var(--neutral-300);
    border-bottom-color: var(--dark-teal);
  }

  details[open]::details-content {
    z-index: 1;
  }

  details::details-content {
    grid-row: 2;
    grid-column: 1 / -1;
    background: var(--white);
    border-top: 1px solid var(--neutral-300);
    border-radius: 0 8px 8px 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  }

  details:not([open])::details-content {
    display: none;
  }

  @media screen and (width < 40em) {
    .grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      row-gap: 0.25rem;
    }

    summary {
      padding: 0.5rem;
      text-align: center;
      white-space: normal;
    }

    details::details-content {
      padding: 0.75rem;
    }
  }
}

.usage-label {
  font-weight: 400;
  padding: 0.125rem 0.25rem;
  border: 1px solid var(--neutral-400);
  border-radius: 4px;
}

.tooltip {
  position: relative;
  cursor: help;
}

.tooltip[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: 0.75rem;
  transform: translateY(-50%);
  padding: 0.25em 0.5em;
  background: var(--neutral-800);
  color: var(--white);
  font-size: 0.8em;
  white-space: nowrap;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 20;
}

.tooltip[data-tooltip]:hover::after,
.tooltip[data-tooltip]:focus::after {
  opacity: 1;
}

/*
 * Sticky sidebar layout, shared by the introduction page (markdown [TOC]
 * renders as `.introduction > .toc`) and any page using the generic classes:
 *
 *   <div class="sidebar-layout">
 *     <nav class="sidebar"><ul><li><span class="sidebar-label">..</span><ul>..</ul></li></ul></nav>
 *     ...content...
 *   </div>
 *
 * Entries without a URL should be rendered as `.sidebar-label` instead of `<a>`.
 */
:is(.sidebar-layout, .introduction) {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  column-gap: 3rem;
  align-items: start;
}

.sidebar-layout > :not(.sidebar),
.introduction > :not(.toc) {
  grid-column: 2;
}

:is(.sidebar-layout > .sidebar, .introduction > .toc) {
  grid-column: 1;
  /* span all content rows so the sidebar can stick while scrolling */
  grid-row: 1 / span 1000;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1rem 1rem 1rem 0;
  border-right: 1px solid var(--neutral-300);
  font-family: var(--font-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

:is(.sidebar, .introduction > .toc) ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

:is(.sidebar, .introduction > .toc) ul ul {
  padding-left: 0.875rem;
  border-left: 1px solid var(--neutral-300);
  margin: 0.25rem 0 0.25rem 0.25rem;
}

:is(.sidebar, .introduction > .toc) li {
  margin: 0.25rem 0;
}

:is(.sidebar, .introduction > .toc) :is(a, .sidebar-label) {
  display: block;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  color: var(--neutral-800);
  text-decoration: none;
}

/* Non-link group headings (e.g. country, document type) */
.sidebar .sidebar-label {
  font-weight: 600;
}

:is(.sidebar, .introduction > .toc) a:hover,
:is(.sidebar, .introduction > .toc) a:focus-visible {
  background: var(--neutral-100);
  color: var(--teal);
}

:is(.sidebar, .introduction > .toc) a[aria-current="page"] {
  color: var(--teal);
  font-weight: 600;
}

/* Offset anchor targets so headings aren't flush with the viewport edge */
:is(.sidebar-layout, .introduction) :is(h1, h2, h3, h4, h5, h6)[id] {
  scroll-margin-top: 1rem;
}

@media (max-width: 900px) {
  :is(.sidebar-layout, .introduction) {
    display: block;
  }

  :is(.sidebar-layout > .sidebar, .introduction > .toc) {
    position: static;
    max-height: none;
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--neutral-300);
    border-radius: 6px;
    background: var(--neutral-100);
  }
}
