/* User-supplied Saudi Web typeface. Only the two actual supplied weights. */
.header nav .game-nav-link { color: #792e42; border-bottom: 1px solid #b98b9a; padding-bottom: 2px; }
@font-face {
  font-family: 'Saudi Web';
  src: url('./assets/SaudiWeb-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Saudi Web';
  src: url('./assets/SaudiWeb-Bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --font: 'Saudi Web', 'Arial', sans-serif;
  --paper: #f6f4ee;
  --surface: #fcfbf7;
  --ink: #103c39;
  --muted: #727772;
  --wine: #813e3b;
  --wine-soft: #f1e8e3;
  --line: #deddd4;
  --radius: 6px;
}

/* The root dir follows the display language; descendants inherit the layout. */
body {
  direction: inherit;
}

body {
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.9;
  font-synthesis: none;
}

h1,
h2,
h3,
.brand,
.brand small,
.language,
.english,
.definition-name,
.definition-pair p[lang='en'],
.reading-body p[lang='en'],
.quote-translation,
.english-counterpart blockquote,
.poem-panel blockquote {
  font-family: var(--font);
}

h1,
h2,
h3,
strong,
b,
.brand,
.search-home h1,
.stat-grid strong {
  font-weight: 700;
}

.brand small,
.language,
.english,
.definition-name,
.quote-translation,
.english-counterpart blockquote,
.poem-panel blockquote {
  font-weight: 400;
}

/* No negative tracking on connected Arabic letters. */
h1,
h2,
h3,
.search-home h1 {
  letter-spacing: normal;
}

.search-home h1 {
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1.7;
  margin-bottom: 1.75rem;
}

.search-form input {
  font-size: 1.125rem;
  line-height: 1.8;
  text-align: start;
}

/* Empty dir=auto inputs default to LTR; placeholders follow the UI language.
   Once text is entered, native auto direction handles Arabic and English. */
.search-form input:placeholder-shown {
  direction: inherit;
}

.search-help {
  font-size: 0.9375rem;
}

.value-card h3 {
  font-size: 1.75rem;
  line-height: 1.7;
}

.evidence-title h3 {
  font-size: 1.3125rem;
  line-height: 1.9;
}

.arabic-quote h3 {
  font-size: 1.5rem;
}

.definition-pair,
.reading-body p {
  line-height: 2;
}

.reading-header h1,
.value-detail h1 {
  line-height: 1.75;
}

/* Bidirectional text is isolated, never allowed to reorder a parent layout. */
[dir='auto'],
[dir='ltr'] {
  unicode-bidi: isolate;
}

[lang='ar'] {
  direction: rtl;
}

.english,
.definition-name,
.definition-pair p[lang='en'],
.reading-body p[lang='en'],
.quote-translation,
.english-counterpart blockquote,
.poem-panel p[lang='en'],
.share-fallback {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

.header nav,
.search-tabs,
.filter-row,
.value-grid,
.evidence-grid,
.search-results,
.value-detail,
.anchor-nav,
.value-chips,
.footer {
  direction: inherit;
}

/* Keep original Arabic quotes aligned correctly within an English interface. */
[dir='rtl']:not(html), .arabic-alt { text-align: right; unicode-bidi: isolate; }
html[dir='ltr'] .search-language { border-left: 0; border-right: 1px solid var(--line); }

.header nav,
.anchor-nav {
  flex-wrap: wrap;
}

.header nav a,
.language {
  white-space: nowrap;
}

/* Keep the established quiet Sadu accent; typography does the visual work. */
.search-form {
  box-shadow: 0 5px 20px #54322305;
}

.value-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 22px #54322306;
}

/* Keep the homepage weave-only; internal pages add one quiet link home. */
.header.sadu-header {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 44px;
  height: auto;
  padding: 0;
  margin: 0;
  border: 0;
}
.sadu-band {
  width: 100%;
  height: 44px;
  background: #faf8f2 url('./assets/sadu-band.svg') center / 288px 44px repeat-x;
}
.header .brand { font-size: 1.375rem; white-space: nowrap; gap: 10px; }
.internal-brand-bar { max-width: 1232px; margin-inline: auto; padding: 14px 32px; display: flex; align-items: center; }
.header .internal-home-link { min-height: 44px; padding-block: 2px; width: fit-content; color: var(--ink); }
.internal-home-link:hover { color: var(--wine); }
.internal-home-link:focus-visible { border-radius: 4px; }
.internal-home-link .sadu-symbol { width: 26px; height: 38px; }
.header nav { justify-content: center; gap: 12px 26px; }
.header nav a { font-size: .9375rem; }
.language { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-color: transparent; }
.language:hover { border-color: var(--ink); }
.language svg { width: 20px; height: 20px; }
.home-route .header { position: relative; z-index: 1; }
.search-home {
  max-width: none;
  min-height: clamp(430px, 34vw, 620px);
  padding: clamp(40px, 4vw, 76px) 24px clamp(72px, 6vw, 112px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #fdfbf7 0, #f8f5ef 75%);
}
.search-home::before, .search-home::after { display: none; }
.hero-content { width: min(100%, 1000px); position: relative; z-index: 1; }
.search-home h1 { font-size: clamp(3rem, 6.2vw, 6.125rem); line-height: 1.4; margin: 0; color: #124b45; }
.hero-tagline { color: #915f50; font-size: clamp(1.25rem, 2.15vw, 1.875rem); line-height: 1.75; margin-top: 12px; }
.hero-divider { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 24px auto; width: min(400px, 54%); }
.hero-divider::before, .hero-divider::after { content: ''; height: 1px; background: #c8beb0; flex: 1; }
.sadu-symbol { display: inline-block; width: 30px; height: 44px; flex: none; background: url('./assets/sadu-motif.svg') center / contain no-repeat; }
.hero-divider .sadu-symbol { width: 24px; height: 28px; background-image: url('./assets/sadu-hero-diamond.svg'); }
.search-form { border: 1px solid #a2776e; border-radius: 999px; padding: 8px 14px; max-width: 760px; background: #ffffff85; }
.search-form:focus-within { outline: 2px solid #813e3b30; outline-offset: 3px; box-shadow: 0 8px 26px #103c3909; }
.search-form button { background: transparent; color: var(--ink); border-radius: 50%; width: 46px; height: 46px; }
.search-form button:hover { background: #103c390a; }
.search-form button svg { width: 28px; height: 28px; }
.search-form input { padding-block: 6px; }
.search-language { font-size: .9375rem; padding: 0 16px; white-space: nowrap; border-left: 1px solid var(--line); }
.search-home .search-form { max-width: 960px; margin-inline: auto; min-height: 80px; padding: 10px 18px; border: 1.5px solid #c4b3a4; background: #fffefb9c; box-shadow: 0 16px 38px #725d4910; }
.search-home .search-form:focus-within { border-color: #426c62; outline: 3px solid #426c6226; outline-offset: 4px; }
.search-home .search-form input { font-size: clamp(1rem, 1.35vw, 1.1875rem); padding-inline: 20px; }
.search-home .search-form input::placeholder { color: #717268; }
.search-home .search-form button { width: 56px; height: 56px; background: #eeeae2; color: #245650; }
.search-home .search-form button:hover { background: #e4e5db; }
.search-home .search-form button svg { width: 30px; height: 30px; }
.search-home .search-language { padding-inline: 20px; color: #717268; border-color: #dbd2c5; font-weight: 400; }
html[lang='ar'] .search-language-ar, html[lang='en'] .search-language-en { color: #245650; font-weight: 700; }
.heritage-edge { position: absolute; inset-block: 0; width: clamp(150px, 20vw, 340px); z-index: -1; pointer-events: none; background: url('./assets/sadu-hero-edge.svg') right center / auto 100% no-repeat; }
.heritage-edge-start { inset-inline-start: 0; }
.heritage-edge-end { inset-inline-end: 0; transform: scaleX(-1); }
.heritage-edge::before, .heritage-edge::after { content: none; }
.section { padding-block: 40px; }
.section-heading { margin-bottom: 24px; }
.section-heading h2 { font-size: clamp(1.625rem, 3vw, 2.25rem); line-height: 1.6; }
.section-heading .eyebrow { font-size: .9375rem; display: flex; align-items: center; gap: 14px; }
.section-heading .eyebrow::before { content: ''; width: 30px; height: 1px; background: var(--wine); }
.value-card, .evidence-card, .reference-card { box-shadow: none; }
.featured-section { padding-top: 28px; }
.featured-values { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.value-card.featured-value { padding: 0; min-height: 0; border-radius: 4px; background: #fbfaf6; }
.value-landscape { height: auto; aspect-ratio: 3 / 1; overflow: hidden; clip-path: polygon(0 0, 100% 0, 100% 87%, 0 100%); background: #e2dfd4; }
.value-landscape .value-photo { display: block; width: 100%; height: 100%; object-fit: cover; overflow: hidden; transition: transform .5s ease; }
.value-meaning-note { margin-block: 1.5rem; padding: 1rem 1.25rem; border-inline-start: 3px solid #a56d5f; background: #f2eee6; }
.value-meaning-note h2 { font-size: 1rem; margin: 0 0 .5rem; }
.value-meaning-note p { margin: 0; line-height: 1.9; }
.editorial-link-note { font-size: .875rem; line-height: 1.85; padding-block-start: .75rem; border-block-start: 1px solid currentColor; }
.editorial-link-note p { margin-block: .4rem 1rem; }
.editorial-connections { margin-block: 2rem; }
.featured-value:hover .value-landscape .value-photo { transform: scale(1.035); }
.featured-value-content { display: flex; flex-direction: column; flex: 1; padding: 10px 19px 15px; }
.featured-value-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.featured-value-title>div { min-width: 0; }
.featured-value h3 { font-size: 1.375rem; line-height: 1.65; }
.featured-value .english, .featured-value .arabic-alt { font-size: .9375rem; margin: 0; min-height: 0; line-height: 1.65; color: #345c56; }
.featured-value .sadu-symbol { width: 24px; height: 36px; }
.value-teaser { font-size: 1rem; line-height: 1.8; margin-top: 7px; color: #4c6861; }
.featured-value .card-bottom { padding-top: 12px; gap: 5px; }
.featured-value .witness-count { font-size: .875rem; gap: 3px; line-height: 1.7; }
.featured-value .card-arrow { color: var(--ink); font-size: 1.25rem; }
.linked-feature { border-radius: 6px; background: #103c39; }
.linked-feature::before { background: url('./assets/sadu-motif.svg') center / 25px 40px repeat-y; width: 25px; opacity: .65; }
.linked-feature .feature-witnesses .evidence-card { border-radius: 4px; }
.values-closing { position: relative; isolation: isolate; min-height: 170px; display: flex; align-items: center; justify-content: center; gap: 24px; overflow: hidden; padding: 26px 100px; color: #fffdf8; background: #103c39; text-align: center; }
.values-closing::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .25; background: url('./assets/alula-sammy-six.jpg') center 62% / cover; }
.values-closing::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #103c3900, #103c39c9); }
.values-closing p { font-size: clamp(1.375rem, 2.3vw, 1.75rem); line-height: 1.7; }
.values-closing div>span { display: block; margin-top: 12px; font-size: .9375rem; }
.closing-weave { position: absolute; inset-block: 0; inset-inline-start: 25px; width: 50px; background: url('./assets/sadu-motif.svg') center / 48px 72px repeat-y; opacity: .55; }
.photo-credit { position: absolute; inset-inline-end: 28px; bottom: 15px; font-size: .75rem; color: #e0e9e3; text-decoration: underline; text-underline-offset: 3px; }
.image-credits { padding-top: 10px; padding-bottom: 45px; }
.image-credits p, .image-credits li { font-size: 1rem; }
.image-credits li { margin-block: 12px; }
.image-credits a { text-decoration: underline; text-underline-offset: 4px; }
.footer { max-width: none; padding: 24px max(32px, calc((100vw - 1168px) / 2)); margin-top: 0; background: #103c39; color: #fcfbf7; border-color: #ffffff24; }
.footer .brand { font-size: 1.125rem; }
.footer p { color: #d2ddd8; font-size: .875rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: .875rem; }
.footer a:hover { color: #e1c4a7; }
.footer { flex-wrap: wrap; }
.footer nav { flex: 1 1 560px; align-items: center; }
.footer .language { border-color: #e0e9e355; color: #fcfbf7; font-size: .9375rem; padding: 7px 16px; }
.footer .language:hover { background: #ffffff0a; border-color: #e0e9e3; }

/* Small bottom invitation: no backdrop, focus trap, or blocked page interaction. */
.game-invite {
  position: fixed;
  inset-inline-end: max(20px, env(safe-area-inset-left));
  inset-block-end: calc(20px + env(safe-area-inset-bottom));
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(360px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 40px #103c3924;
  text-align: start;
  animation: game-invite-enter 420ms cubic-bezier(.2, .7, .2, 1) both;
}
.game-invite[hidden] { display: none; }
.game-invite-weave {
  flex: 0 0 22px;
  height: 54px;
  background: url('./assets/sadu-motif.svg') center / contain no-repeat;
}
.game-invite-content { flex: 1; min-width: 0; }
.game-invite-content p { font-size: 1rem; line-height: 1.8; font-weight: 700; text-align: start; }
.game-invite-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 9px;
  padding: 5px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: #fcfbf7;
  font-size: .9375rem;
}
.game-invite-play:hover { background: #245650; }
.game-invite-close {
  flex: 0 0 44px;
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
}
.game-invite-close:hover { background: var(--wine-soft); }
@keyframes game-invite-enter {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .game-invite { animation: none; }
}
@media (max-width: 650px) {
  .game-invite { inset-inline-end: max(16px, env(safe-area-inset-left)); inset-block-end: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 1100px) {
  .header { padding-inline: 28px; gap: 18px; }
  .header .brand { font-size: 1.125rem; }
  .header nav { gap: 10px 16px; }
  .heritage-edge { width: 16vw; opacity: .65; }
  .hero-content { width: min(100%, 900px); }
  .featured-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer { flex-wrap: wrap; }
}

@media (max-width: 650px) {
  .header { padding: 14px 20px; }
  .header nav { justify-content: center; }
  .header .brand { font-size: 1.125rem; }
  .header .brand img { width: 40px; height: 40px; }
  .header nav a { font-size: .875rem; }
  .header.sadu-header { height: auto; min-height: 30px; padding: 0; }
  .sadu-band { height: 30px; background-size: 196px 30px; }
  .internal-brand-bar { padding: 10px 24px; }
  .search-home { min-height: 370px; padding: 44px 20px 68px; }
  .hero-content { width: 100%; }
  .hero-tagline { font-size: 1.1875rem; margin-top: 8px; }
  .hero-divider { margin-block: 22px; width: 55%; gap: 14px; }
  .hero-divider .sadu-symbol { width: 19px; height: 23px; }
  .heritage-edge { opacity: .32; width: 70px; }
  .search-form { padding: 6px 7px; }
  .search-form input { padding-inline: 8px; }
  .search-language { padding-inline: 9px; font-size: .875rem; }
  .search-home .search-form { min-height: 64px; padding: 8px; }
  .search-home .search-form button { width: 44px; height: 44px; }
  .search-home .search-form button svg { width: 25px; height: 25px; }
  .search-home .search-form input { padding-inline: 10px; font-size: 1rem; }
  .search-home .search-language { padding-inline: 10px; }
  .footer { gap: 16px; padding: 24px 22px; }
  .footer nav { gap: 10px 18px; }
  .footer p { display: block; width: 100%; }
  .featured-values { gap: 14px; }
  .value-card.featured-value { grid-column: auto; }
  .featured-value-content { padding-inline: 13px; }
  .featured-value-title .sadu-symbol { display: none; }
  .featured-value .witness-count { font-size: .875rem; }
  .value-card.featured-value h3 { font-size: 1.375rem; }
  .values-closing { padding: 25px 48px 44px; }
  .closing-weave { inset-inline-start: 6px; width: 28px; background-size: 28px 44px; }
  .header nav {
    gap: 0.5rem 0.875rem;
  }

  .search-home h1 {
    font-size: clamp(2.25rem, 9.7vw, 3.625rem);
    margin: 0;
  }

  .search-form input {
    font-size: 1rem;
  }

  .search-help,
  .filter-pill,
  .anchor-nav,
  .back-link {
    font-size: 0.875rem;
  }

  .value-card h3 {
    font-size: 1.625rem;
  }
}

@media (max-width: 390px) {
  .featured-values { grid-template-columns: 1fr; }
}

/* Value connections describe the proverb's meaning, never a person's virtue. */
.witness-counts { display: grid; gap: 6px; min-width: 0; }
.relation-counts { display: block; font-size: .8125rem; color: #526b64; line-height: 1.7; }
.relation-counts i { font-style: normal; margin-inline: 6px; }
.relation-chips a { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.relation-chips small { font-size: .75rem; font-weight: 400; border-inline-start: 1px solid currentColor; padding-inline-start: 8px; }
.relation-chips .relation-absent { color: #7b4939; background: #f5ede6; border-color: #ddc8bb; }
.relation-label { display: block; font-size: .8125rem; line-height: 1.8; margin-block: 6px; font-weight: 700; color: #315c50; }
.relation-absent .relation-label, .relation-label.relation-absent { color: #7b4939; }
.relation-group { margin-block-start: 36px; padding-block-start: 22px; border-block-start: 2px solid #b9cbc2; scroll-margin-block-start: 24px; }
.relation-group.relation-absent { border-color: #caa994; }
.relation-group > .section-heading h2 { font-size: clamp(1.3rem, 2.3vw, 1.8rem); }
.relation-group > .section-note { margin-block: 10px 22px; }
.relation-filters { margin-block: 20px; }
.analysis-relations { display: grid; gap: 12px; }
.analysis-relations .editorial-link-note { margin: 0; }
.relation-group .editorial-link-note { margin-block-start: 16px; }
