html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--tl-page-canvas);
}

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

img {
  max-width: 100%;
  height: auto;
}

:root {
  --tl-container-max: 1000px;
  --tl-radius: 0;
  --tl-font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --tl-font-mono: "JetBrains Mono", ui-monospace, monospace;

  --tl-surface: #fbf8ff;
  --tl-surface-dim: #d7d8f4;
  --tl-surface-bright: #fbf8ff;
  --tl-surface-container-lowest: #ffffff;
  --tl-surface-container-low: #f4f2ff;
  --tl-surface-container: #edecff;
  --tl-surface-container-high: #e6e6ff;
  --tl-surface-container-highest: #e0e0fc;
  --tl-on-surface: #181a2e;
  --tl-on-surface-variant: #5b403f;
  --tl-inverse-surface: #2d2f44;
  --tl-inverse-on-surface: #f1efff;
  --tl-outline: var(--tl-on-surface);
  --tl-outline-variant: var(--tl-on-surface);
  --tl-surface-tint: #bb152c;
  --tl-primary: #b7102a;
  --tl-on-primary: #ffffff;
  --tl-primary-container: #db313f;
  --tl-on-primary-container: #fffbff;
  --tl-inverse-primary: #ffb3b1;
  --tl-secondary: #485f84;
  --tl-on-secondary: #ffffff;
  --tl-secondary-container: #bbd3fd;
  --tl-on-secondary-container: #445a7f;
  --tl-tertiary: #7a5500;
  --tl-on-tertiary: #ffffff;
  --tl-tertiary-container: #996c00;
  --tl-on-tertiary-container: #fffbff;
  --tl-error: #ba1a1a;
  --tl-on-error: #ffffff;
  --tl-error-container: #ffdad6;
  --tl-on-error-container: #93000a;
  --tl-primary-fixed: #ffdad8;
  --tl-primary-fixed-dim: #ffb3b1;
  --tl-on-primary-fixed: #410007;
  --tl-on-primary-fixed-variant: #92001c;
  --tl-secondary-fixed: #d5e3ff;
  --tl-secondary-fixed-dim: #b0c7f1;
  --tl-on-secondary-fixed: #001b3c;
  --tl-on-secondary-fixed-variant: #30476a;
  --tl-tertiary-fixed: #ffdea9;
  --tl-tertiary-fixed-dim: #ffba27;
  --tl-on-tertiary-fixed: #271900;
  --tl-on-tertiary-fixed-variant: #5e4100;
  --tl-background: #fbf8ff;
  --tl-on-background: #181a2e;
  --tl-surface-variant: #e0e0fc;

  /* Full-page shell: one field from header through main to footer */
  --tl-page-canvas: solid 1px var(--tl-surface);
  /* Top bar under header / line above footer (independent of outline-variant cards) */
  --tl-site-header-rule: #ffffff;
  --tl-site-footer-rule: #ffffff;

  /* domain.html only: page field + header/footer chrome (defaults match pre-refactor domain look) */
  --tl-domain-page-canvas: var(--tl-background);
  --tl-domain-chrome-bg: var(--tl-surface);
  /* Match domain chrome fill so the rule does not read as a colored stripe */
  --tl-domain-header-rule: var(--tl-background);
  --tl-domain-footer-rule: var(--tl-background);

  /* Homepage section dividers (index.html); not used on domain feature rails */
  --tl-domain-section-separator-0: #ffffff;
  --tl-domain-section-separator-1: #ffffff;
  --tl-domain-section-separator-2: #ffffff;

  /* Section kickers: top eyebrow line + label (domains vs team) */
  --tl-eyebrow-domains-line: var(--tl-primary);
  --tl-eyebrow-domains-text: var(--tl-primary);
  --tl-eyebrow-team-line: var(--tl-primary);
  --tl-eyebrow-team-text: var(--tl-primary);

  /* Hero: bottom rule only (does not use global section / outline tokens) */
  --tl-hero-section-bottom-rule: var(--tl-surface);

  /* Approach: intro + steps panels (opaque surface + border; independent of outline-variant) */
  --tl-approach-frame-surface: var(--tl-surface);
  --tl-approach-frame-border: #000000;

  /* Approach timeline: title column borders (Understand / Find / …) */
  --tl-approach-steps-title-cell-border: #000000;

  /* Team member cards: outer + column rules (does not change other bordered UI) */
  --tl-team-member-card-border: #000000;

  /* domain.html header/footer fill (isolated from --tl-page-canvas) */
  --tl-domain-header-background: var(--tl-background);
  --tl-domain-footer-background: var(--tl-background);
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

body {
  font-family: var(--tl-font-sans);
  background-color: var(--tl-page-canvas);
  color: var(--tl-on-surface);
  text-align: left;
  overflow-x: hidden;
  min-height: 100%;
  min-height: -webkit-fill-available;
}

.page-canvas {
  background-color: var(--tl-page-canvas);
}

/* Lock scroll when mobile drawer open (iOS + desktop) */
html.mobile-nav-open,
body.mobile-nav-open {
  overflow: hidden;
  touch-action: none;
}

/* Hero title: readable size on small screens (section min-height: Tailwind min-h-[716px] on #hero-section) */
@media (max-width: 767px) {
  .tamari-hero-title {
    font-size: clamp(1.85rem, 8vw, 2.75rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.02em !important;
  }

  .tamari-domain-title {
    font-size: clamp(1.75rem, 7vw, 2.5rem) !important;
    line-height: 1.1 !important;
  }
}

/* Touch-friendly controls (WCAG ~44px minimum) */
.tap-target {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

/* Mobile navigation drawer */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  visibility: hidden;
  pointer-events: none;
}

.mobile-nav-overlay.is-open {
  visibility: visible;
  pointer-events: auto;
}

.mobile-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 26, 46, 0.48);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-nav-overlay.is-open .mobile-nav-backdrop {
  opacity: 1;
}

.mobile-nav-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(22rem, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: 100%;
  background: var(--tl-surface-container-lowest);
  border-left: 1px solid var(--tl-outline-variant);
  box-shadow: -8px 0 24px rgba(24, 26, 46, 0.12);
  transform: translate3d(100%, 0, 0);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-overlay.is-open .mobile-nav-panel {
  transform: translate3d(0, 0, 0);
}

.mobile-nav-panel-inner {
  padding-top: env(safe-area-inset-top, 0px);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-panel {
    transition: none;
  }

  .mobile-nav-backdrop {
    transition: none;
  }
}

/* Site header: one row; overflow switches to compact (hamburger) via header-fit.js */
.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.5rem;
  background-color: var(--tl-page-canvas);
  border-bottom: 1px solid var(--tl-site-header-rule);
}

.site-header-brand {
  justify-self: start;
}

.site-header-nav {
  display: flex;
}

.site-header-cta {
  justify-self: end;
}

.site-header .nav-menu-toggle-btn {
  display: none;
}

.site-header[data-header-mode="inline"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
}

.site-header[data-header-mode="inline"] .nav-menu-toggle-btn {
  display: none;
}

.site-header[data-header-mode="inline"] .site-header-nav {
  display: flex;
}

.site-header[data-header-mode="compact"] {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.site-header[data-header-mode="compact"] .site-header-nav {
  display: none;
}

.site-header[data-header-mode="compact"] .nav-menu-toggle-btn {
  display: inline-flex;
}

.site-header[data-header-mode="compact"] .site-header-brand {
  flex: 1;
  min-width: 0;
}

.site-header[data-header-mode="compact"] .site-header-cta {
  flex-shrink: 0;
}

/* Before header-fit runs: phones show compact; tablets/desktop show inline grid */
@media (max-width: 767px) {
  html:not([data-header-ready]) .site-header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }

  html:not([data-header-ready]) .site-header .site-header-nav {
    display: none;
  }

  html:not([data-header-ready]) .site-header .nav-menu-toggle-btn {
    display: inline-flex;
  }

  html:not([data-header-ready]) .site-header .site-header-brand {
    flex: 1;
    min-width: 0;
  }
}

@media (min-width: 768px) {
  html:not([data-header-ready]) .site-header .nav-menu-toggle-btn {
    display: none;
  }

  html:not([data-header-ready]) .site-header .site-header-nav {
    display: flex;
  }
}

.site-header-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 0.35rem;
  white-space: nowrap;
}

.site-footer {
  background-color: var(--tl-page-canvas);
  border-top: 1px solid var(--tl-site-footer-rule);
}

/* domain.html: restore legacy shell + canvas without affecting index / --tl-page-canvas */
html.domain-page {
  background-color: var(--tl-domain-page-canvas);
}

html.domain-page body {
  background-color: var(--tl-domain-page-canvas);
}

html.domain-page .site-header {
  background-color: var(--tl-domain-header-background);
  border-bottom-color: var(--tl-domain-header-rule);
}

html.domain-page .site-footer {
  background-color: var(--tl-domain-footer-background);
  border-top-color: var(--tl-domain-footer-rule);
}

html.domain-page main {
  background-color: transparent;
}

/* Hero section bottom edge (token does not affect other sections) */
#hero-section {
  border-bottom: 1px solid var(--tl-hero-section-bottom-rule);
}

.approach-intro-frame,
.approach-steps-frame {
  background-color: var(--tl-approach-frame-surface);
  border-color: var(--tl-approach-frame-border);
}

#approach-steps .approach-steps-title-cell {
  border-color: var(--tl-approach-steps-title-cell-border);
}

.team-member-card {
  border: 1px solid var(--tl-team-member-card-border);
}

.team-member-card > .team-member-card__media,
.team-member-card > .team-member-card__body {
  border-color: var(--tl-team-member-card-border);
}

/* Hero primary CTA — solid primary fill (Tailwind CDN + CSS vars can race on first paint) */
#hero-primary-cta {
  background-color: var(--tl-primary);
  color: var(--tl-on-primary);
  border: 1px solid var(--tl-primary);
  min-height: 48px;
  touch-action: manipulation;
}

#hero-primary-cta:hover {
  background-color: var(--tl-on-surface);
  color: var(--tl-surface);
  border-color: var(--tl-on-surface);
}

.grid-bg {
  background-size: 24px 24px;
  background-image:
    linear-gradient(to right, rgba(91, 64, 63, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(91, 64, 63, 0.1) 1px, transparent 1px);
  -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 1) 100%);
  mask-image: linear-gradient(to right, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 1) 100%);
}

.eyebrow-domains {
  color: var(--tl-eyebrow-domains-text);
  border-top-color: var(--tl-eyebrow-domains-line);
}

.eyebrow-team {
  color: var(--tl-eyebrow-team-text);
  border-top-color: var(--tl-eyebrow-team-line);
}

/* ── Scroll Progress Bar ── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--tl-primary);
  z-index: 9999;
  transition: none;
  pointer-events: none;
  display: none;
}

/* ── Reveal System ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal="left"] {
  transform: translateX(-24px);
}

[data-reveal="left"].revealed {
  transform: translateX(0);
}

[data-reveal="right"] {
  transform: translateX(24px);
}

[data-reveal="right"].revealed {
  transform: translateX(0);
}

[data-reveal="scale"] {
  transform: scale(0.98);
}

[data-reveal="scale"].revealed {
  transform: scale(1);
}

/* ── Hero Animations ── */
@keyframes heroWordUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-word {
  display: inline-block;
  opacity: 0;
  animation: heroWordUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-subtitle-anim {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

.hero-scroll-anim {
  opacity: 0;
  animation: fadeSlideUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.scroll-pulse {
  animation: scrollPulse 2.5s ease-in-out infinite;
}

/* ── Word Split Reveal ── */
.split-word {
  display: inline-block;
  opacity: 0.18;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}

.split-word.active {
  opacity: 1;
}

/* ── Scroll-linked Typing Reveal ── */
[data-type-reveal] .type-word {
  display: inline;
  opacity: 1;
  transition: none;
}

[data-type-reveal] .type-word.lit {
  opacity: 1;
}

.cta-accent {
  color: var(--tl-primary);
}

.feature-corner-tl {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  width: 1rem;
  height: 1rem;
  border-top: 1px solid var(--tl-primary);
  border-left: 1px solid var(--tl-primary);
  pointer-events: none;
}

.feature-corner-br {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 1rem;
  height: 1rem;
  border-bottom: 1px solid var(--tl-primary);
  border-right: 1px solid var(--tl-primary);
  pointer-events: none;
}

/* Full-bleed section dividers on index.html only (--tl-domain-section-separator-* in theme) */
.section-sep-tone.section-sep-tone--i0 {
  border-color: var(--tl-domain-section-separator-0);
}

.section-sep-tone.section-sep-tone--i1 {
  border-color: var(--tl-domain-section-separator-1);
}

.section-sep-tone.section-sep-tone--i2 {
  border-color: var(--tl-domain-section-separator-2);
}

.domain-card-bg {
  opacity: 0.07;
  filter: grayscale(1);
}

.btn-flat-primary {
  font-family: var(--tl-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--tl-on-primary);
  background: var(--tl-primary);
  border: 1px solid var(--tl-primary);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-flat-primary:hover {
  background: var(--tl-on-surface);
  color: var(--tl-surface);
  border-color: var(--tl-on-surface);
}

.team-member-image {
  object-fit: cover;
  object-position: center top;
}

.team-member-image-abhi {
  object-position: center 18%;
}

.team-member-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Booking Modal — aligned to light functional theme */
.booking-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 26, 46, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.booking-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.booking-modal-container {
  position: relative;
  width: 90%;
  max-width: 520px;
  max-height: min(85vh, 100dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--tl-surface-container-lowest);
  border: 1px solid var(--tl-outline-variant);
  padding: 48px 40px;
  padding-bottom: max(48px, calc(40px + env(safe-area-inset-bottom, 0px)));
}

.booking-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--tl-on-surface-variant);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.booking-modal-close:hover {
  color: var(--tl-on-surface);
}

.booking-title {
  font-family: var(--tl-font-sans);
  font-size: 28px;
  font-weight: 700;
  color: var(--tl-on-surface);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.booking-subtitle {
  font-size: 15px;
  color: var(--tl-on-surface-variant);
  margin: 0 0 32px;
  line-height: 1.5;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.booking-field label {
  font-family: var(--tl-font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--tl-on-surface-variant);
}

.booking-field input,
.booking-field textarea {
  background: var(--tl-surface-container-low);
  border: 1px solid var(--tl-outline-variant);
  color: var(--tl-on-surface);
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--tl-font-sans);
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
  border-radius: 0;
}

.booking-field input:focus,
.booking-field textarea:focus {
  border-color: var(--tl-primary);
}

.booking-field input[type="date"] {
  color-scheme: light;
}

.booking-btn-primary {
  display: inline-block;
  background: var(--tl-primary);
  color: var(--tl-on-primary);
  border: 1px solid var(--tl-primary);
  padding: 14px 28px;
  font-family: var(--tl-font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
  margin-top: 8px;
}

.booking-btn-primary:hover {
  background: var(--tl-on-surface);
  border-color: var(--tl-on-surface);
  color: var(--tl-surface);
}

.booking-btn-primary:active {
  transform: scale(0.98);
}

.booking-btn-back {
  background: none;
  border: none;
  color: var(--tl-on-surface-variant);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  font-family: var(--tl-font-sans);
  transition: color 0.2s;
}

.booking-btn-back:hover {
  color: var(--tl-primary);
}

.booking-slot-tz-note {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--tl-on-surface-variant);
}

.booking-time-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--tl-on-surface-variant);
}

.booking-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin: 16px 0 24px;
}

.booking-slot-btn {
  background: var(--tl-surface-container-low);
  border: 1px solid var(--tl-outline-variant);
  color: var(--tl-on-surface-variant);
  padding: 10px 8px;
  font-size: 14px;
  font-family: var(--tl-font-sans);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0;
}

.booking-slot-btn:hover {
  border-color: var(--tl-primary);
  color: var(--tl-primary);
}

.booking-slot-btn.selected {
  background: var(--tl-primary);
  color: var(--tl-on-primary);
  border-color: var(--tl-primary);
  font-weight: 600;
}

.booking-confirm-slot {
  width: 100%;
  margin-top: 16px;
}

.booking-loading,
.booking-empty,
.booking-error {
  font-size: 14px;
  color: var(--tl-on-surface-variant);
  margin: 16px 0;
}

.booking-error {
  color: var(--tl-primary);
}

.booking-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 0;
  color: var(--tl-on-surface-variant);
}

.booking-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--tl-outline-variant);
  border-top-color: var(--tl-primary);
  border-radius: 50%;
  animation: booking-spin 0.8s linear infinite;
}

@keyframes booking-spin {
  to {
    transform: rotate(360deg);
  }
}

.booking-confirmation {
  text-align: center;
}

.booking-check-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tl-primary);
  color: var(--tl-on-primary);
  font-size: 28px;
  font-weight: 700;
  border-radius: 0;
}

.booking-details {
  background: var(--tl-surface-container-low);
  border: 1px solid var(--tl-outline-variant);
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.booking-details p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--tl-on-surface-variant);
}

.booking-details p:last-child {
  margin-bottom: 0;
}

.booking-details a {
  color: var(--tl-primary);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-word {
    opacity: 1;
    animation: none;
  }
  .hero-subtitle-anim,
  .hero-scroll-anim {
    opacity: 1;
    animation: none;
  }
  .split-word {
    opacity: 1;
    transition: none;
  }
  [data-type-reveal] .type-word {
    opacity: 1;
  }
  .scroll-pulse {
    animation: none;
    opacity: 1;
  }
}
