/* Reset + base — logical properties throughout so `dir="rtl"` mirrors the
   entire layout automatically instead of needing separate RTL overrides. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  /* Sticks the footer to the true viewport bottom on short-content pages
     (e.g. an empty listings grid) instead of leaving a gap of --bg below
     it — #main is the only flex child that grows. */
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

#main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

#main > * {
  flex-shrink: 0;
}

#site-header,
#site-footer {
  flex-shrink: 0;
}

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

h1, h2, h3, h4, p, figure {
  margin: 0;
}

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--navy-soft);
  outline-offset: 3px;
  border-radius: 6px;
}

.on-navy :focus-visible {
  outline-color: #ffffff;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 720px) {
  .container {
    padding-inline: var(--space-5);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: -60px;
  background: var(--navy);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--dur-base) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Directional icon flip ----------
   Icons that encode a direction (arrows, chevrons pointing "forward")
   must mirror in RTL; icons that don't (search, heart, bell...) must not.
   Opt in per-icon with this class rather than flipping globally. */
[dir="rtl"] .flip-rtl {
  transform: scaleX(-1);
}
