/*
 * t.Co. Design System — tco-design.css v2
 * Personal AI Travel Concierge | David Castiel | HIT M.Design 2026
 * Palette: Deep navy-black + Gold accent + Teal interactive
 *
 * Import in every HTML page:
 *   <link rel="stylesheet" href="../assets/css/tco-design.css">
 *   (adjust relative path per page depth)
 */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;700&family=Assistant:wght@300;400;600&family=Noto+Sans+Hebrew:wght@300;400;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables — Dark Theme (default) ────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:        #0A0A0F;
  --surface:   #13131A;
  --card:      #1C2230;
  --border:    #2A3245;

  /* Brand */
  --gold:      #C8A96E;
  --gold-dim:  rgba(200,169,110,0.12);
  --teal:      #4ECDC4;
  --teal-dim:  rgba(78,205,196,0.12);
  --purple:    #7C6FCD;
  --purple-dim:rgba(124,111,205,0.12);

  /* Text */
  --text-primary:   #F0EDE8;
  --text-secondary: #8A95AA;
  --text-muted:     #4A5568;

  /* Rule */
  --rule: #2A3245;

  /* Typography */
  --font-latin:  'Poppins', 'Assistant', system-ui, sans-serif;
  --font-hebrew: 'Noto Sans Hebrew', 'Assistant', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* Spacing & Shape */
  --unit:       8px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --max-width:  1200px;
}

/* ── Light Theme ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #FAFAF7;
  --surface:   #FFFFFF;
  --card:      #F4F1EB;
  --border:    #E2DDD4;

  --gold:      #9A7A3E;
  --gold-dim:  rgba(154,122,62,0.10);
  --teal:      #2A9E96;
  --teal-dim:  rgba(42,158,150,0.10);
  --purple:    #5A4FAA;
  --purple-dim:rgba(90,79,170,0.10);

  --text-primary:   #1A1814;
  --text-secondary: #6B6560;
  --text-muted:     #A89F96;

  --rule: #E2DDD4;
}

/* ── System Theme ────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg:        #FAFAF7;
    --surface:   #FFFFFF;
    --card:      #F4F1EB;
    --border:    #E2DDD4;
    --gold:      #9A7A3E;
    --gold-dim:  rgba(154,122,62,0.10);
    --teal:      #2A9E96;
    --teal-dim:  rgba(42,158,150,0.10);
    --purple:    #5A4FAA;
    --purple-dim:rgba(90,79,170,0.10);
    --text-primary:   #1A1814;
    --text-secondary: #6B6560;
    --text-muted:     #A89F96;
    --rule: #E2DDD4;
  }
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-latin);
  font-weight: 300;
  line-height: 1.7;
  transition: background 0.25s ease, color 0.25s ease;
}

/* RTL: only direction, NOT text-align — text-align is set per element */
[lang="he"] { direction: rtl; }

/* Hebrew elements — right-aligned Hebrew font */
[lang="he"] [data-he],
[lang="he"] .site-tagline {
  font-family: var(--font-hebrew);
  text-align: right;
}

/* All English/Latin content sections — always left-aligned */
/* This overrides the RTL direction inheritance */
[lang="he"] h1,
[lang="he"] h2,
[lang="he"] h3,
[lang="he"] p,
[lang="he"] li,
[lang="he"] .section-label,
[lang="he"] .card__title,
[lang="he"] .card__body,
[lang="he"] .mc-title,
[lang="he"] .mc-desc,
[lang="he"] .mc-example,
[lang="he"] .voice-trait,
[lang="he"] .voice-desc,
[lang="he"] .voice-eg,
[lang="he"] .voice-no,
[lang="he"] .do-lbl,
[lang="he"] .no-lbl,
[lang="he"] .rule-it,
[lang="he"] .swatch-name,
[lang="he"] .swatch-hex,
[lang="he"] .swatch-role,
[lang="he"] .type-meta,
[lang="he"] .trow,
[lang="he"] .sp-val,
[lang="he"] .comp-lbl,
[lang="he"] .logo-box-lbl,
[lang="he"] .pp-label,
[lang="he"] .pp-tag,
[lang="he"] .q-branch,
[lang="he"] table,
[lang="he"] th,
[lang="he"] td,
[lang="he"] code,
[lang="he"] pre {
  text-align: left;
  font-family: var(--font-latin);
}

/* Exception: footer left side can be Hebrew */
[lang="he"] .site-footer__left {
  font-family: var(--font-hebrew);
  text-align: right;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 2.25rem;  font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--text-primary); margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem;   font-weight: 500; line-height: 1.25; color: var(--text-primary); margin-bottom: 0.4rem; }
h3 { font-size: 1.1rem;   font-weight: 500; color: var(--gold); margin-bottom: 0.3rem; }
h4 { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.09em; }

p  { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.7; margin-bottom: 1rem; }

a  { color: var(--gold); text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.75; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--card);
  color: var(--teal);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.45em;
}

pre {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

.section {
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }

.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 0 20px; }
}

/* ── Theme Bar ───────────────────────────────────────────────────────────── */
.theme-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  direction: ltr; /* always right-aligned */
}

.theme-bar__label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}

.theme-btn {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-latin);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-btn:hover { border-color: var(--gold); color: var(--gold); }
.theme-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #0A0A0F;
  font-weight: 500;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 22px 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: var(--surface);
  direction: ltr; /* logo left, nav right — always */
}

.site-logo {
  font-family: var(--font-latin);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1;
}

.site-tagline {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

.site-nav {
  display: flex;
  gap: 24px;
  align-items: center;
  list-style: none;
}
/* RTL: reverse nav so primary items (Home/בית) appear on the right */
[lang="he"] .site-nav { flex-direction: row-reverse; }
[lang="en"] .site-nav { flex-direction: row; }
.site-nav a { font-size: 13px; color: var(--text-secondary); font-weight: 400; transition: color 0.2s; }
.site-nav a:hover, .site-nav a.active { color: var(--text-primary); opacity: 1; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-footer__left  { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.site-footer__right { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.2s ease;
}
.card:hover { border-color: rgba(200,169,110,0.4); }

.card__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.card__title { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.card__body  { font-size: 13px; color: var(--text-secondary); line-height: 1.65; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-latin);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn-primary  { background: var(--gold);   color: #0A0A0F; }
.btn-primary:hover  { opacity: 0.88; color: #0A0A0F; }
.btn-outline  { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn-outline:hover  { background: var(--gold-dim); opacity: 1; }
.btn-teal     { background: var(--teal);   color: #0A0A0F; }
.btn-teal:hover     { opacity: 0.88; color: #0A0A0F; }

/* ── Status / Tag Pills ──────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill-key     { background: rgba(200,169,110,0.15); color: var(--gold); }
.pill-design  { background: var(--purple-dim);      color: var(--purple); }
.pill-dev     { background: var(--teal-dim);        color: var(--teal); }
.pill-impl    { background: rgba(78,205,196,0.08);  color: var(--teal); }
.pill-qa      { background: rgba(248,183,67,0.12);  color: #F8B743; }
.pill-content { background: rgba(200,169,110,0.10); color: var(--gold); }
.pill-docs    { background: var(--purple-dim);      color: var(--purple); }
.pill-fix     { background: rgba(224,90,95,0.12);   color: #E05A5F; }
.pill-print   { background: var(--teal-dim);        color: var(--teal); }
.pill-hw      { background: rgba(138,149,170,0.12); color: var(--text-secondary); }
.pill-submit  { background: rgba(200,169,110,0.20); color: var(--gold); }
.pill-setup   { background: var(--purple-dim);      color: var(--purple); }
.pill-live    { background: rgba(200,169,110,0.18); color: var(--gold); }
.pill-teardown{ background: rgba(138,149,170,0.12); color: var(--text-secondary); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.tco-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.tco-table th {
  background: var(--card);
  color: var(--gold);
  font-family: var(--font-latin);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tco-table td {
  padding: 9px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tco-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.tco-table tr:hover td { background: var(--gold-dim); }

/* ── Dividers ────────────────────────────────────────────────────────────── */
.rule      { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.rule-gold { border: none; border-top: 1px solid rgba(200,169,110,0.35); margin: 24px 0; }

/* ── Section label ───────────────────────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

/* ── Chapter number ──────────────────────────────────────────────────────── */
.chapter-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.7;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-secondary); }
.text-gold    { color: var(--gold); }
.text-teal    { color: var(--teal); }
.text-mono    { font-family: var(--font-mono); }

.bg-card      { background: var(--card); }
.bg-surface   { background: var(--surface); }

.mt-1 { margin-top:  8px; }  .mb-1 { margin-bottom:  8px; }
.mt-2 { margin-top: 16px; }  .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; }  .mb-3 { margin-bottom: 24px; }
.mt-4 { margin-top: 32px; }  .mb-4 { margin-bottom: 32px; }
.mt-6 { margin-top: 48px; }  .mb-6 { margin-bottom: 48px; }

.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — t.Co. Design System
   Breakpoints:
     Tablet   ≤ 1024px
     Mobile   ≤  640px
     Tiny     ≤  400px
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet (641px – 1024px) ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Header */
  .site-header { padding: 16px 24px; }
  .site-nav { gap: 16px; }
  .site-nav a { font-size: 12px; }
  .site-logo { font-size: 1.3rem; }

  /* Theme bar */
  .theme-bar { padding: 6px 24px; gap: 4px; }
  .theme-bar__label { display: none; } /* hide label, keep buttons */

  /* Layout */
  .section { padding: 40px 24px; }
  .container { padding: 0 24px; }

  /* Grids */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Tables: enable horizontal scroll */
  .tco-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Doc sections (agents, ux-flows) */
  .doc-section { padding: 48px 24px; }
  .orch-grid,
  .demo-grid { grid-template-columns: 1fr; }
  .agents-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ── Mobile (≤ 640px) ─────────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* ── Theme bar ── */
  .theme-bar {
    padding: 6px 12px;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 3px;
    overflow-x: auto;
  }
  .theme-bar__label { display: none; }
  .lang-toggle {
    margin-right: 0;
    padding-right: 0;
    border-right: none;
    padding-left: 6px;
    border-left: 1px solid var(--border);
  }
  .theme-btn { padding: 4px 10px; font-size: 10px; }
  .lang-btn  { padding: 3px 9px;  font-size: 10px; }

  /* ── Header — stack vertically ── */
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px 10px;
  }
  /* Nav: wrap into clean pill row, hide Project Book button */
  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    flex-direction: row !important;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }
  .site-nav li { flex: 0 0 auto; }
  .site-nav a {
    display: block;
    padding: 5px 11px;
    font-size: 11px;
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
  }
  .site-nav a:hover,
  .site-nav a.active {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold);
  }
  /* Hide project book button from nav on mobile — it's in the page body */
  .site-nav li:has(.btn) { display: none; }

  /* ── Sections ── */
  .section { padding: 32px 16px; }
  .container { padding: 0 16px; }
  .doc-section { padding: 36px 16px; }

  /* ── Typography ── */
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }

  /* ── Grids — single column ── */
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .agents-grid { grid-template-columns: 1fr; }
  .stack-grid  { grid-template-columns: 1fr 1fr; }
  .ex-steps    { grid-template-columns: 1fr; }
  .orch-grid,
  .demo-grid   { grid-template-columns: 1fr; }

  /* ── Tables — horizontal scroll ── */
  .tco-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
  .tco-table { min-width: 520px; font-size: 12px; }
  .tco-table th,
  .tco-table td { padding: 8px 10px; }

  /* ── Diagram boxes ── */
  .diagram-wrap { padding: 16px 8px; overflow-x: auto; }
  .diagram-wrap svg { min-width: 500px; }

  /* ── Footer ── */
  .site-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 20px 16px;
  }

  /* ── Cards ── */
  .card { padding: 18px; }

  /* ── Cover (agents.html) ── */
  .cover { padding: 60px 20px 48px; }
  .cover svg { max-width: 100%; min-width: 0; }

  /* ── TOC ── */
  .toc-box { padding: 20px; }

  /* ── Orch / Demo cols ── */
  .orch-card,
  .demo-col { padding: 18px; }
}

/* ── Tiny screens (≤ 400px) ──────────────────────────────────────────── */
@media (max-width: 400px) {
  .site-nav a { font-size: 10px; padding: 5px 7px; }
  .theme-btn  { padding: 4px 8px; font-size: 10px; }
  .lang-btn   { padding: 3px 8px; font-size: 10px; }
  h1 { font-size: 1.4rem; }
  .stack-grid { grid-template-columns: 1fr; }
}

/* ── RTL override: force LTR text-align on all English content ─────────── */
/* When page lang=he, direction:rtl would make text-align default to right.  */
/* These rules explicitly set left-align on every English content element.   */
:root:not([lang="he"]) body,
[lang="en"] body { text-align: left; }

[lang="he"] .ds-section p,
[lang="he"] .ds-section li,
[lang="he"] .ds-section h1,
[lang="he"] .ds-section h2,
[lang="he"] .ds-section h3,
[lang="he"] .doc-section p,
[lang="he"] .doc-section li,
[lang="he"] .doc-section h1,
[lang="he"] .doc-section h2,
[lang="he"] .doc-section h3,
[lang="he"] .mechanic-card *,
[lang="he"] .voice-card *,
[lang="he"] .do-box *,
[lang="he"] .no-box *,
[lang="he"] .card *:not([data-he]),
[lang="he"] .type-specimen *,
[lang="he"] .comp-row *,
[lang="he"] .logo-box *,
[lang="he"] .trow *,
[lang="he"] .spacing-row * {
  text-align: left !important;
  font-family: var(--font-latin) !important;
}

/* Only these elements stay right-aligned in Hebrew mode */
[lang="he"] [data-he],
[lang="he"] .site-tagline,
[lang="he"] .site-footer__left,
[lang="he"] .site-logo {
  text-align: right;
  font-family: var(--font-hebrew);
}
