/* ==========================================================================
   LEID GALLERY — Base
   Reset, document defaults, typography primitives, utilities.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-text);
  font-size: var(--t-body);
  font-weight: var(--w-light);
  line-height: var(--lh-text);
  color: var(--tone-fg);
  background-color: var(--tone-bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
  overflow-x: clip;
}

/* The page tone fades between sections once JS is running (tone.js). */
.js body {
  transition:
    background-color var(--d-tone) var(--ease-in-out),
    color var(--d-tone) var(--ease-in-out);
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
p,
figure,
blockquote,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: var(--w-light);
  line-height: var(--lh-title);
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 1.5px solid currentColor;
  outline-offset: 4px;
  border-radius: 1px;
}

::selection {
  background: var(--c-sand);
  color: var(--c-charcoal);
}

/* ---- Typographic primitives ---------------------------------------------- */

/* Latin editorial lettering. Always isolated LTR. */
.latin {
  font-family: var(--f-display);
  font-weight: 400;
  direction: ltr;
  unicode-bidi: isolate;
  font-variation-settings: "opsz" 96;
}

/* Small tracked Latin caps used as captions / labels */
.latin-label {
  font-family: var(--f-display);
  font-size: var(--t-latin-label);
  font-weight: 400;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  direction: ltr;
  unicode-bidi: isolate;
  font-variation-settings: "opsz" 11;
  line-height: 1.4;
}

/* Persian kicker above titles */
.kicker {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--t-micro);
  font-weight: var(--w-regular);
  letter-spacing: 0.02em;
  color: var(--kicker-color, currentColor);
}

.kicker::before {
  content: "";
  inline-size: 2rem;
  block-size: var(--hairline);
  background: currentColor;
  opacity: 0.5;
}

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keeps a phrase together so Persian lines break at natural pauses */
.phrase {
  display: inline-block;
}

/* ---- Skip link -------------------------------------------------------- */
.skip-link {
  position: fixed;
  inset-block-start: var(--s-3);
  inset-inline-start: var(--s-3);
  z-index: var(--z-skip);
  padding: var(--s-2) var(--s-4);
  background: var(--c-charcoal);
  color: var(--c-ivory);
  font-size: var(--t-small);
  transform: translateY(-200%);
  transition: transform var(--d-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: none;
}

/* ---- Layout helpers ------------------------------------------------------ */
.wrap {
  inline-size: 100%;
  max-inline-size: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Media frames reserve their space before the image arrives (no layout shift). */
.frame {
  position: relative;
  overflow: hidden;
  background-color: var(--frame-bg, var(--c-cream));
}

.frame > picture,
.frame > picture > img,
.frame > img {
  inline-size: 100%;
  block-size: 100%;
}

.frame img {
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
