@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-variable.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-italic-variable.woff2') format('woff2');
  font-weight: 100 1000;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/source-serif-4-variable.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Sans Hebrew';
  src: url('/assets/fonts/noto-sans-hebrew.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Tokens follow the TachlisAI app (frontend/src/styles/base.css) and the
   refined brand palette (frontend/public/brand/refined/palette-and-usage.json). */
:root {
  --ink: #263f58;
  --accent: #2b4c7e;
  --gold: #c4a265;
  --gold-text: #84672c;
  --text: #1c1c1a;
  --text-2: #5f5f5a;
  --text-3: #74746e;
  --line: #eaeae5;
  --line-strong: #263f58;
  --surface: #fafaf8;
  --card: #ffffff;
  --surface-2: #f2f1ec;
  --focus: #1f5fae;
  --font-sans: 'DM Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --radius: 12px;
  --container: 1024px;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

html[dir='rtl'] {
  --font-sans: 'Noto Sans Hebrew', 'DM Sans', 'Segoe UI', Arial, sans-serif;
  --font-serif: 'Noto Sans Hebrew', 'Source Serif 4', Georgia, serif;
}

[dir='rtl'] h1,
[dir='rtl'] h2,
[dir='rtl'] h3 {
  letter-spacing: 0;
}

[dir='rtl'] .breadcrumbs svg,
[dir='rtl'] .article-row > svg {
  transform: rotate(180deg);
}

[dir='rtl'] .lang-menu {
  right: auto;
  left: 0;
}

code {
  unicode-bidi: isolate;
  direction: ltr;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  z-index: 20;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgb(232 184 92 / 55%);
  color: #11100d;
}


/* Header */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  width: 118px;
  height: auto;
}

.brand-divider {
  width: 1px;
  height: 26px;
  background: var(--line);
}

.brand-label {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang {
  position: relative;
}

.lang summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang-menu {
  position: absolute;
  background: var(--card);
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(18 24 32 / 10%);
  z-index: 10;
}

.lang-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
}

.lang-menu a[aria-current='true'] {
  background: var(--surface-2);
  font-weight: 500;
}

.header-link {
  font-size: 15px;
  text-underline-offset: 3px;
}

/* Search */

.search {
  position: relative;
  margin-top: 56px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 17px;
}

.search-field input::placeholder {
  color: var(--text-2);
  opacity: 1;
}

.search-field input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-field:focus-within {
  border-bottom-width: 2px;
  padding-bottom: 13px;
}

.search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(18 24 32 / 12%);
  overflow: hidden;
  z-index: 15;
}

.search-suggestions a {
  display: block;
  padding: 12px 18px;
  text-decoration: none;
  border-top: 1px solid var(--line);
}

.search-suggestions a:first-child {
  border-top: 0;
}

.search-suggestions a:hover,
.search-suggestions a[aria-selected='true'] {
  background: var(--surface-2);
}

.suggestion-title {
  display: block;
  font-weight: 500;
}

.suggestion-meta {
  display: block;
  font-size: 13px;
  color: var(--text-3);
}

.search-suggestions .suggestion-all {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

main.container {
  padding-top: 64px;
  padding-bottom: 96px;
  min-height: 50vh;
}

/* Home */

.collection-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
}

.collection-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  height: 100%;
  min-height: 168px;
  padding: 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.collection-card:hover {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgb(38 63 88 / 6%);
}

.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.tile-lg {
  width: 96px;
  height: 96px;
}

.collection-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}

.collection-card-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.collection-card-desc {
  font-size: 14px;
  color: var(--text-2);
}

/* Breadcrumbs */

.breadcrumbs ol {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 14px;
  color: var(--text-3);
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumbs a {
  color: var(--text);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Collection */

.collection-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 48px;
}

.collection-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.collection-desc {
  margin: 6px 0 0;
  color: var(--text-2);
}

.collection-count {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

.article-list {
  list-style: none;
  margin: 0 0 48px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

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

.article-list li + li,
.section-header + ul > li:first-child {
  border-top: 1px solid var(--line);
}

.article-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.article-row:hover {
  background: var(--surface-2);
}

.article-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article-row-title {
  font-weight: 500;
}

.article-row-desc {
  font-size: 14px;
  color: var(--text-2);
}

.article-row .icon {
  flex: none;
  color: var(--text);
}

.section-header {
  padding: 28px 24px 28px;
}

.section-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.section-header p {
  margin: 6px 0 0;
  color: var(--text-2);
}

/* Article */

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 672px) 232px;
  justify-content: space-between;
  gap: 64px;
}

.article-header h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.article-desc {
  margin: 14px 0 0;
  color: var(--text-2);
}

.article-updated {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

.article-body {
  margin-top: 28px;
}

.article-body h2 {
  margin: 40px 0 14px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.article-body h3 {
  margin: 28px 0 10px;
  font-size: 18px;
  font-weight: 500;
}

.article-body > h2:first-child,
.article-body > h3:first-child {
  margin-top: 12px;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 0 0 16px;
}

.article-body ul,
.article-body ol {
  padding-inline-start: 24px;
}

.article-body li {
  margin: 6px 0;
}

.article-body li > ul,
.article-body li > ol {
  margin: 6px 0 0;
}

.article-body a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.article-body strong {
  font-weight: 600;
}

.article-body code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.callout {
  margin: 20px 0;
  padding: 14px 18px;
  border-inline-start: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: rgb(196 162 101 / 12%);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 8px;
}

.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 14px;
  text-align: start;
  vertical-align: top;
  border-top: 1px solid var(--line);
}

.table-wrap td code {
  white-space: nowrap;
}

.table-wrap thead th {
  border-top: 0;
  background: var(--surface-2);
  font-weight: 500;
}

/* On this page */

.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding-top: 40px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0 0 12px;
}

.toc a {
  display: block;
  padding-inline-start: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
  text-decoration: none;
  border-inline-start: 2px solid transparent;
}

.toc a:hover {
  color: var(--text);
}

.toc a[aria-current='true'] {
  color: var(--text);
  font-weight: 500;
  border-inline-start-color: var(--ink);
}

/* Need more help */

.help-card {
  margin-top: 48px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.help-card h2 {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

.help-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.help-option {
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.help-option:hover {
  border-color: var(--text-3);
}

.help-option-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}

.help-option-label {
  font-size: 14px;
  color: var(--text-2);
}

.help-option-action {
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.help-card-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

/* Feedback */

.feedback {
  margin-top: 16px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.feedback h2 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 500;
}

.feedback-buttons {
  display: flex;
  gap: 8px;
}

.feedback-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.feedback-btn:hover {
  background: var(--surface-2);
}

.feedback-btn[aria-pressed='true'] {
  background: var(--ink);
  color: #fff;
}

.feedback-form {
  margin-top: 16px;
}

.feedback-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
}

.feedback-submit {
  margin-top: 12px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.feedback-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

.feedback-thanks {
  margin: 12px 0 0;
  color: var(--text-2);
}

/* Related */

.related {
  margin-top: 40px;
}

.related h2 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 500;
}

.related ul,
.plain-links {
  margin: 0;
  padding-inline-start: 20px;
}

.related li,
.plain-links li {
  margin: 6px 0;
}

.related a,
.plain-links a {
  text-underline-offset: 3px;
}

/* Search page */

.search-title {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.search-summary {
  margin: 0 0 32px;
  color: var(--text-2);
}

.article-row-meta {
  font-size: 13px;
  color: var(--text-3);
}

.not-found h1 {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 500;
}

/* Footer */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 24px 56px;
}

.footer-mark img {
  width: 26px;
  height: auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  font-size: 14px;
}

.footer-links a {
  color: var(--text-2);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 20px rgb(18 24 32 / 22%);
  transition: transform 0.15s ease;
  z-index: 12;
}

.chat-launcher:hover {
  transform: scale(1.05);
}

/* Brand headings: Source Serif 4 in Tachlis ink, as in the app and landing page. */
.collection-card-title,
.collection-header h1,
.section-header h2,
.article-header h1,
.article-body h2,
.search-title,
.not-found h1,
.feedback h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
}

/* Responsive */

@media (max-width: 1080px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .header-row {
    padding-top: 20px;
    flex-wrap: wrap;
  }

  .brand {
    gap: 10px;
  }

  .brand img {
    width: 92px;
  }

  .brand-label {
    font-size: 16px;
  }

  .header-link {
    display: none;
  }

  .search {
    margin-top: 28px;
  }

  main.container {
    padding-top: 36px;
    padding-bottom: 64px;
  }

  .chat-launcher {
    display: none;
  }

  .collection-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .collection-card {
    min-height: 0;
    padding: 14px 8px;
  }

  .tile {
    width: 52px;
    height: 52px;
  }

  .tile .icon {
    width: 26px;
    height: 26px;
  }

  .collection-card-title {
    font-size: 18px;
  }

  .tile-lg {
    width: 64px;
    height: 64px;
  }

  .collection-header h1,
  .search-title {
    font-size: 26px;
  }

  .article-header h1 {
    font-size: 28px;
  }

  .article-row {
    padding: 16px;
  }

  .section-header {
    padding: 20px 16px;
  }

  .help-options {
    grid-template-columns: 1fr;
  }
}

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