/* ==========================================================================
   OptiFormula site styles
   Logo orange (#E86425) is kept for the logo and decorative marks only.
   Text and filled buttons use --of-accent, which passes WCAG AA on white and ivory.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@700;800&display=swap');

:root {
  /* Brand */
  --of-logo-orange: #e86425;
  --of-accent: #b9461a; /* 5.31:1 on white, 5.04:1 on ivory */
  --of-accent-hover: #a23d16; /* 6.53:1 on white */
  --of-accent-tint: #fbefe8;

  /* Neutrals */
  --of-ink: #1b1b1a;
  --of-text: #383836;
  --of-text-muted: #646461; /* 5.64:1 on ivory */
  --of-line: #e4e1d8;
  --of-line-strong: #8c8a84; /* 3.45:1 on white, for input borders */
  --of-bg: #ffffff;
  --of-bg-alt: #faf9f5;
  --of-bg-dark: #1b1b1a;
  --of-text-on-dark: #d9d7cf;
  --of-text-on-dark-muted: #b8b6ae; /* 8.49:1 on dark */
  --of-accent-on-dark: #f08a55; /* 6.95:1 on dark */
  --of-focus: #1b1b1a;

  /* Legacy aliases still referenced by subpage styles */
  --of-orange: var(--of-accent);
  --of-orange-tint: var(--of-accent-tint);
  --of-carbon: var(--of-ink);
  --of-charcoal: var(--of-text);
  --of-slate: var(--of-text-muted);
  --of-muted: var(--of-text-muted);
  --of-border: var(--of-line);
  --of-border-strong: var(--of-line);
  --of-ivory: var(--of-bg-alt);
  --of-stone: var(--of-bg-alt);
  --of-white: var(--of-bg);
  --of-green: #15803d;

  /* Type */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', sans-serif;

  --text-caption: 0.8125rem; /* 13px */
  --text-small: 0.9375rem; /* 15px */
  --text-body: 1rem; /* 16px */
  --text-lede: 1.125rem; /* 18px */
  --text-h3: 1.25rem; /* 20px */
  --text-h2: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem); /* 28–36px */
  --text-h1: clamp(2rem, 1.5rem + 2.2vw, 3rem); /* 32–48px */

  /* Space */
  --space-section: clamp(4rem, 3rem + 4vw, 6.5rem);
  --radius: 8px;
}

/* Plus Jakarta Sans has no basic Cyrillic; Inter does. */
html:lang(ru) {
  --font-display: var(--font-sans);
}

/* Tracking breaks joined scripts and adds nothing to these others. */
html:lang(ar) *,
html:lang(ur) *,
html:lang(hi) *,
html:lang(th) *,
html:lang(zh) * {
  letter-spacing: 0 !important;
}

/* The screenshot deck offsets follow the reading direction. */
html[dir='rtl'] .of-deck {
  --of-deck-dir: -1;
}

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

html {
  font-family: var(--font-sans);
  color: var(--of-text);
  background-color: var(--of-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 88px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--of-text);
  background-color: var(--of-bg);
}

img {
  max-width: 100%;
}

/* Long single words, such as German compounds, must not push headings off narrow screens. */
h1,
h2,
h3 {
  overflow-wrap: break-word;
  hyphens: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--of-accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--of-focus);
  outline-offset: 2px;
}

.of-on-dark {
  --of-focus: #ffffff;
}

.of-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;
}

.of-skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--of-ink);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.of-skip-link:focus {
  top: 12px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.of-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-inline: 24px;
}

@media (max-width: 640px) {
  .of-container {
    padding-inline: 16px;
  }
}

.of-section {
  padding-block: var(--space-section);
}

.of-section--alt {
  background-color: var(--of-bg-alt);
}

.of-section--dark {
  background-color: var(--of-bg-dark);
  color: var(--of-text-on-dark);
}

/* Section headings: left aligned, no badges */
.of-section-header {
  max-width: 46rem;
  margin: 0 0 3rem;
}

.of-section-title {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--of-ink);
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

.of-section--dark .of-section-title {
  color: #ffffff;
}

.of-section-subtitle {
  font-size: var(--text-lede);
  line-height: 1.6;
  color: var(--of-text-muted);
  margin: 0;
  text-wrap: pretty;
}

.of-section--dark .of-section-subtitle {
  color: var(--of-text-on-dark-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.of-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .of-btn {
    transition-property: background-color, border-color, color;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
  }
}

.of-btn--primary {
  background-color: var(--of-accent);
  color: #ffffff;
}

.of-btn--secondary {
  background-color: transparent;
  color: var(--of-ink);
  border-color: var(--of-line-strong);
}

.of-btn--sm {
  min-height: 40px;
  padding: 8px 16px;
}

@media (hover: hover) {
  .of-btn--primary:hover {
    background-color: var(--of-accent-hover);
    color: #ffffff;
  }

  .of-btn--secondary:hover {
    border-color: var(--of-ink);
    background-color: var(--of-bg-alt);
  }
}

/* Text link with an arrow, used for "see all" style links */
.of-link {
  font-weight: 600;
  color: var(--of-accent);
  text-decoration: underline;
}

@media (hover: hover) {
  .of-link:hover {
    color: var(--of-accent-hover);
  }
}

/* ==========================================================================
   Page hero for inner pages
   ========================================================================== */

.of-page-hero {
  padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem) clamp(2rem, 1.5rem + 2vw, 3rem);
  background-color: var(--of-bg-alt);
  border-block-end: 1px solid var(--of-line);
}

.of-page-hero__back {
  margin: 0 0 0.75rem;
  font-size: var(--text-small);
}

.of-page-hero__back a {
  color: var(--of-accent);
  font-weight: 600;
}

.of-page-hero__back a::before {
  content: '← ';
}

[dir='rtl'] .of-page-hero__back a::before {
  content: '→ ';
}

.of-page-hero__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--of-ink);
  text-wrap: balance;
}

.of-page-hero__lede {
  margin: 0;
  max-width: 44rem;
  font-size: var(--text-lede);
  line-height: 1.6;
  color: var(--of-text-muted);
  text-wrap: pretty;
}

/* ==========================================================================
   Reference directory (home page and references page)
   ========================================================================== */

.of-ref-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  max-width: 44rem;
}

@media (max-width: 640px) {
  .of-ref-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}

.of-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.of-field label {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--of-ink);
}

.of-field input,
.of-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--of-line-strong);
  border-radius: var(--radius);
  background-color: var(--of-bg);
  color: var(--of-ink);
  font-size: 1rem;
}

.of-field input::placeholder {
  color: var(--of-text-muted);
}

.of-ref-status {
  margin: 1.25rem 0 1rem;
  font-size: var(--text-small);
  color: var(--of-text-muted);
  font-variant-numeric: tabular-nums;
}

.of-ref-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 0 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.of-ref {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  border-block-end: 1px solid var(--of-line);
}

.of-ref img {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.of-ref__name {
  margin: 0;
  font-weight: 600;
  color: var(--of-ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.of-ref__city {
  margin: 0;
  font-size: var(--text-small);
  color: var(--of-text-muted);
}

.of-ref-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-block: 1.5rem;
}

.of-ref-empty p {
  margin: 0;
}

.of-ref-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  margin-block-start: 2rem;
}

