/*
 * Shared foundation for the chooser and all three directions:
 * reset, accessibility helpers and the compact demo bar.
 * Each direction owns its own typography, colour and layout.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ol,
ul,
dl,
dd,
figure,
blockquote,
fieldset {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

fieldset {
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus, #1a56db);
  outline-offset: 3px;
}

main:focus {
  outline: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  background: #111317;
  color: #fff;
  font: 600 0.9375rem/1.2 "Segoe UI", system-ui, -apple-system, sans-serif;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- Demo bar: compact navigation between directions ---------- */

.demo-bar {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgba(20, 24, 31, 0.1);
  background: rgba(252, 252, 251, 0.94);
  color: #23262c;
  font: 500 0.8125rem/1 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  letter-spacing: 0;
}

.demo-bar__inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.5rem;
  max-width: 1440px;
  min-height: 44px;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 3vw, 2.5rem);
}

.demo-bar a {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 0 0.6rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.demo-bar a:hover {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.demo-bar__list {
  display: flex;
  align-items: stretch;
}

.demo-bar__list a {
  position: relative;
  color: #4a4f58;
}

.demo-bar__list a[aria-current="page"] {
  color: #0d0f12;
  font-weight: 700;
}

.demo-bar__list a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0.6rem;
  bottom: 0;
  left: 0.6rem;
  height: 2px;
  background: currentColor;
}

.demo-bar__n {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid rgba(20, 24, 31, 0.22);
  border-radius: 50%;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.demo-bar__list a[aria-current="page"] .demo-bar__n {
  border-color: currentColor;
}

.demo-bar__orig {
  color: #4a4f58 !important;
}

.demo-bar__ext {
  font-size: 0.75em;
}

@media (max-width: 899px) {
  .demo-bar__note {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 619px) {
  .demo-bar__home-text,
  .demo-bar__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .demo-bar a {
    padding: 0 0.45rem;
  }

  .demo-bar__home {
    min-width: 44px;
    justify-content: center;
  }

  .demo-bar__list a {
    min-width: 40px;
    justify-content: center;
  }
}

@media (max-width: 359px) {
  .demo-bar__inner {
    gap: 0.25rem;
  }

  .demo-bar a {
    padding: 0 0.35rem;
  }

  .demo-bar__list a {
    min-width: 36px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
