/* ============================================================
   TARRC — BASE DESIGN SYSTEM
   "Precision laboratory meets historic estate"
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,600&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Colour tokens ─────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --cream-canvas: #F6F2EA;
  --mist:         #ECEEF1;
  --bone:         #FAF7F0;

  /* Brand */
  --deep-ink:     #0E1B2C;
  --amber:        #D97A3A;
  --amber-dark:   #A85820;
  --amber-glow:   rgba(217, 122, 58, 0.30);
  --sage:         #7C8E6B;
  --copper:       #B26A3A;

  /* Text */
  --graphite:     #1F2530;
  --soft-graphite:#5E6571;

  /* Borders */
  --haze:         #D8DBDF;

  /* States */
  --moss:         #5C7A4E;
  --clay:         #C4542E;
  --oxblood:      #8E2E2A;

  /* Dark mode overrides (applied via .dark class or media query) */
  --dm-bg:        #0A1320;
  --dm-surface:   #162133;
  --dm-amber:     #C87839;
  --dm-sage:      #9BA889;

  /* Shadows */
  --shadow-card:  0 2px 8px rgba(14, 27, 44, 0.06);
  --shadow-hover: 0 8px 24px rgba(14, 27, 44, 0.10);
  --shadow-chat:  0 -8px 40px rgba(14, 27, 44, 0.12);
  --shadow-guide: 4px 0 16px rgba(14, 27, 44, 0.08);

  /* Spacing scale */
  --space-4:   4px;
  --space-8:   8px;
  --space-12:  12px;
  --space-16:  16px;
  --space-20:  20px;
  --space-24:  24px;
  --space-32:  32px;
  --space-48:  48px;
  --space-64:  64px;
  --space-96:  96px;
  --space-120: 120px;

  /* Radius */
  --r-none:   0;
  --r-input:  10px;
  --r-btn:    11px;
  --r-card:   22px;
  --r-card-s: 15px;
  --r-pill:   999px;

  /* Typography */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Easing */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--cream-canvas);
  color: var(--graphite);
  line-height: 1.55;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }

/* ── Typography scale ──────────────────────────────────────── */
.t-hero    { font-family: var(--font-serif); font-size: clamp(36px, 5.5vw, 68px); font-weight: 600; line-height: 1.15; }
.t-h1      { font-family: var(--font-serif); font-size: clamp(32px, 3.5vw, 48px); font-weight: 600; line-height: 1.18; }
.t-h2      { font-family: var(--font-serif); font-size: clamp(22px, 2.5vw, 30px); font-weight: 500; line-height: 1.25; }
.t-h3      { font-family: var(--font-sans);  font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; line-height: 1.3;  }
.t-body    { font-family: var(--font-sans);  font-size: 17px;  font-weight: 400; line-height: 1.55; }
.t-label   { font-family: var(--font-sans);  font-size: 13px;  font-weight: 500; }
.t-mono    { font-family: var(--font-mono);  font-size: 14px;  font-weight: 500; }
.t-eyebrow { font-family: var(--font-sans);  font-size: 11px;  font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft-graphite); }
.t-btn     { font-family: var(--font-sans);  font-size: 15px;  font-weight: 600; letter-spacing: 0.01em; }

/* Max prose line-length */
.prose { max-width: 66ch; }
p + p  { margin-top: var(--space-24); }

/* ── Global header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--deep-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-32);
  height: 64px;
  gap: var(--space-24);
}

.header-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--bone);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.header-logo span {
  color: inherit !important;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.header-nav a {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: rgba(250, 247, 240, 0.65);
  padding: 8px 14px;
  border-radius: 8px;
  transition: color 180ms var(--ease-out), background 180ms var(--ease-out);
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--bone);
  background: rgba(255,255,255,0.07);
}

.header-nav a.active {
  color: var(--amber);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-shrink: 0;
}

.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(250, 247, 240, 0.65);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 180ms, background 180ms;
}
.header-icon-btn:hover { color: var(--bone); background: rgba(255,255,255,0.08); }

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: rgba(250, 247, 240, 0.5);
  padding: 6px 10px;
  border: 1px solid rgba(250, 247, 240, 0.15);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: all 180ms;
}
.lang-toggle:hover { color: var(--bone); border-color: rgba(250, 247, 240, 0.35); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 24px;
  border-radius: var(--r-btn);
  border: none;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), background 180ms;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--amber);
  color: var(--amber-dark);
}
.btn-primary:hover {
  background: #E8883D;
  box-shadow: 0 6px 20px rgba(217, 122, 58, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--graphite);
  border: 1.5px solid var(--haze);
}
.btn-secondary:hover {
  border-color: var(--graphite);
  box-shadow: var(--shadow-hover);
}

.btn-ghost-light {
  background: rgba(250, 247, 240, 0.12);
  color: var(--bone);
  border: 1.5px solid rgba(250, 247, 240, 0.2);
}
.btn-ghost-light:hover {
  background: rgba(250, 247, 240, 0.2);
  border-color: rgba(250, 247, 240, 0.4);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bone);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

/* ── Left-margin AI guide ──────────────────────────────────── */
.ai-guide {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  align-items: stretch;
  gap: 0;
  pointer-events: none; /* container is invisible; children re-enable */
}

/* Tab is always visible, clickable, and sits at the left edge */
.ai-guide-tab {
  width: 34px;
  background: var(--deep-ink);
  border: none;
  border-radius: 0 14px 14px 0;
  box-shadow: var(--shadow-guide);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  cursor: pointer;
  flex-shrink: 0;
  pointer-events: auto;
  order: 2; /* tab appears AFTER the panel in flex order, so panel slides out from behind it */
  transition: background 180ms var(--ease-out);
  position: relative;
  z-index: 2;
}
.ai-guide-tab:hover { background: #17273C; }

.ai-guide-tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: rgba(250,247,240,0.75);
  text-transform: uppercase;
  user-select: none;
}

.ai-guide-panel {
  width: 300px;
  background: var(--deep-ink);
  border-radius: 0 var(--r-card) var(--r-card) 0;
  box-shadow: var(--shadow-guide);
  padding: var(--space-24);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  order: 1;
  margin-left: -300px; /* hidden by default, tab sits at left edge */
  transition: margin-left 320ms var(--ease-out);
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.ai-guide.open .ai-guide-panel {
  margin-left: 0; /* slide into view when open */
}

.ai-guide-dot {
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--amber);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

.ai-guide-text {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: rgba(250,247,240,0.85);
}

.ai-guide-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.ai-guide-action {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--amber);
  background: rgba(217,122,58,0.12);
  border: 1px solid rgba(217,122,58,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 180ms, border-color 180ms;
}
.ai-guide-action:hover {
  background: rgba(217,122,58,0.22);
  border-color: rgba(217,122,58,0.45);
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--deep-ink);
  color: rgba(250,247,240,0.65);
  padding: var(--space-64) var(--space-32) var(--space-32);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-48);
  margin-bottom: var(--space-64);
  max-width: 1200px;
  margin-inline: auto;
}

.footer-brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--bone);
  margin-bottom: var(--space-12);
}

.footer-tagline {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(250,247,240,0.5);
  max-width: 28ch;
  margin-bottom: var(--space-24);
}

.footer-col-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(250,247,240,0.4);
  margin-bottom: var(--space-16);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-links a {
  font-size: 14px;
  color: rgba(250,247,240,0.65);
  transition: color 160ms;
}
.footer-links a:hover { color: var(--bone); }

.footer-accreditations {
  border-top: 1px solid rgba(250,247,240,0.08);
  padding-top: var(--space-32);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin-inline: auto;
  flex-wrap: wrap;
  gap: var(--space-16);
}

.footer-accred-logos {
  display: flex;
  align-items: center;
  gap: var(--space-24);
}

.accred-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(250,247,240,0.35);
  border: 1px solid rgba(250,247,240,0.12);
  border-radius: 6px;
  padding: 5px 10px;
  white-space: nowrap;
}

.footer-legal {
  font-size: 12px;
  color: rgba(250,247,240,0.3);
}

.footer-legal a { color: rgba(250,247,240,0.45); }
.footer-legal a:hover { color: rgba(250,247,240,0.7); }

/* ── Containers ────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-32);
}

.container-wide {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: var(--space-32);
}

/* ── Section spacing ───────────────────────────────────────── */
.section { padding-block: var(--space-96); }
.section-sm { padding-block: var(--space-64); }

/* ── Pill tags ─────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
}
.tag-amber { background: var(--amber); color: var(--amber-dark); }
.tag-sage  { background: rgba(124,142,107,0.15); color: var(--sage); }
.tag-mist  { background: var(--mist); color: var(--soft-graphite); }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--soft-graphite);
  padding-block: var(--space-16);
}
.breadcrumb a { color: var(--soft-graphite); transition: color 160ms; }
.breadcrumb a:hover { color: var(--graphite); }
.breadcrumb-sep { opacity: 0.4; font-size: 11px; }
.breadcrumb-current { color: var(--graphite); font-weight: 500; }

/* ── Scroll animations ─────────────────────────────────────── */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── Dark mode ─────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --cream-canvas: var(--dm-bg);
    --bone: var(--dm-surface);
    --mist: #1A2840;
    --amber: var(--dm-amber);
    --sage: var(--dm-sage);
    --graphite: #F0ECE4;
    --soft-graphite: #9FA5B0;
    --haze: #2A3848;
  }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-header { padding-inline: var(--space-16); }
  .header-nav  { display: none; }
  .container, .container-wide { padding-inline: var(--space-16); }
  .section     { padding-block: var(--space-64); }
  .section-sm  { padding-block: var(--space-48); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-32); }
  .ai-guide    { display: none; }
}

/* ── Nuke any legacy search overlay / Cmd K banner ─────── */
#search-overlay,
.search-overlay,
#search-btn,
.search-box,
.search-inner,
.search-hint,
#search-input,
.search-close {
  display: none !important;
}
