/* CSS Custom Properties from theme.json */
:root {
  --bg: #ffffff;
  --surface: #f1f2f4;
  --ink: #15171a;
  --muted: #5d6470;
  --accent: #f0a11a;
  --accentInk: #15171a;
  
  /* Type scale */
  --fs-base: 16px;
  --fs-sm: 14px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --fs-2xl: 36px;
  
  /* Spacing scale (compact density) */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;
  
  /* Layout */
  --max-width: 1200px;
  --gutter: var(--sp-lg);
  
  /* Line heights */
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-loose: 1.75;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: var(--fs-base);
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-md);
}

h1 {
  font-size: var(--fs-2xl);
}

h2 {
  font-size: var(--fs-xl);
}

h3 {
  font-size: var(--fs-lg);
}

h4, h5, h6 {
  font-size: var(--fs-base);
}

p {
  margin-bottom: var(--sp-md);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Container and grid utilities */
.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.grid {
  display: grid;
  gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (min-width: 768px) {
  .grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (min-width: 768px) {
  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media (min-width: 1024px) {
  .grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Header and Navigation */
.site-header {
  background-color: var(--bg);
  border-bottom: 1px solid var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-weight: 600;
  color: var(--ink);
  font-size: var(--fs-lg);
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 0.8;
}

.brand:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.brand-name {
  display: block;
}

.site-nav {
  display: flex;
  gap: var(--sp-lg);
  align-items: center;
}

.site-nav a {
  color: var(--ink);
  font-weight: 500;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 2px;
  transition: all 0.2s;
  position: relative;
}

.site-nav a:hover {
  background-color: var(--surface);
}

.site-nav a.here {
  color: var(--accent);
  font-weight: 600;
}

.site-nav a.here::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

.site-nav a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 640px) {
  .site-nav {
    gap: var(--sp-md);
  }
  
  .site-nav a {
    padding: var(--sp-xs) var(--sp-sm);
    font-size: var(--fs-sm);
  }
}

/* Main content */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Sections */
.section {
  padding: var(--sp-2xl) var(--gutter);
}

.section.hero {
  background-color: var(--surface);
  padding: var(--sp-2xl) var(--gutter);
}

.section.hero .wrap {
  text-align: center;
}

.section.hero h1 {
  font-size: clamp(var(--fs-xl), 8vw, 48px);
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-lg);
}

.section.hero .lede {
  font-size: var(--fs-lg);
  color: var(--muted);
  margin-bottom: var(--sp-lg);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.section.cta {
  background-color: var(--surface);
  text-align: center;
  padding: var(--sp-2xl) var(--gutter);
}

.section.cta h1,
.section.cta h2 {
  margin-bottom: var(--sp-md);
}

.section.cta .lede {
  font-size: var(--fs-lg);
  color: var(--muted);
  margin-bottom: var(--sp-lg);
}

/* Prose sections */
.prose {
  max-width: 800px;
}

.prose p {
  line-height: var(--lh-loose);
  margin-bottom: var(--sp-lg);
}

.prose h2 {
  margin-top: var(--sp-2xl);
  margin-bottom: var(--sp-lg);
}

/* Cards */
.card {
  background-color: var(--surface);
  padding: var(--sp-lg);
  border-radius: 4px;
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card h3 {
  margin-bottom: var(--sp-md);
  color: var(--ink);
}

.card p {
  color: var(--muted);
  line-height: var(--lh-loose);
}

.card.featured {
  border: 2px solid var(--accent);
  background-color: var(--bg);
}

.card .tier {
  font-weight: 600;
  margin-bottom: var(--sp-sm);
}

.card .price {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--sp-md);
}

.card .price span {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: normal;
}

.card ul {
  list-style: none;
  margin-top: var(--sp-md);
}

.card li {
  padding: var(--sp-sm) 0;
  padding-left: var(--sp-lg);
  position: relative;
  color: var(--muted);
}

.card li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* Buttons */
.button {
  display: inline-block;
  background-color: var(--accent);
  color: var(--accentInk);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: var(--fs-base);
}

.button:hover {
  opacity: 0.9;
  box-shadow: 0 2px 8px rgba(240, 161, 26, 0.3);
}

.button:focus {
  outline: 2px solid var(--accentInk);
  outline-offset: 2px;
}

.button:active {
  transform: scale(0.98);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  margin-top: var(--sp-lg);
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  font-weight: 500;
}

label span {
  color: var(--ink);
}

input,
textarea,
select {
  padding: var(--sp-md);
  border: 1px solid var(--surface);
  border-radius: 4px;
  font-family: inherit;
  font-size: var(--fs-base);
  background-color: var(--bg);
  color: var(--ink);
  transition: all 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 161, 26, 0.1);
}

input:required,
textarea:required,
select:required {
  border-color: var(--muted);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Footer */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--surface);
  margin-top: auto;
  padding: var(--sp-2xl) var(--gutter);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-2xl);
  margin-bottom: var(--sp-2xl);
}

.footer-heading {
  font-weight: 600;
  margin-bottom: var(--sp-md);
  color: var(--ink);
}

.site-footer ul {
  list-style: none;
}

.site-footer li {
  margin-bottom: var(--sp-sm);
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.legal {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  border-top: 1px solid var(--surface);
  padding-top: var(--sp-lg);
}

/* FAQ */
.faq {
  display: grid;
  gap: var(--sp-lg);
  margin-top: var(--sp-lg);
}

.faq dt {
  font-weight: 600;
  cursor: pointer;
  padding: var(--sp-md);
  background-color: var(--surface);
  border-radius: 4px;
  transition: all 0.2s;
}

.faq dt:hover {
  background-color: rgba(240, 161, 26, 0.1);
}

.faq dd {
  margin-left: 0;
  padding: var(--sp-md);
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: var(--sp-lg);
}

/* Galleries and Images */
.placeholder {
  background-color: var(--surface);
  border: 2px dashed var(--muted);
  border-radius: 4px;
  padding: var(--sp-2xl) var(--sp-lg);
  text-align: center;
  color: var(--muted);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
}

.grid img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Logos section */
.logos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
  align-items: center;
  justify-content: center;
  margin-top: var(--sp-lg);
}

.logos img {
  height: 60px;
  width: auto;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.logos img:hover {
  opacity: 1;
}

.logos .placeholder {
  margin: 0;
  min-height: 60px;
  padding: var(--sp-md);
  border: 1px dashed var(--muted);
  flex: 0 1 auto;
}

/* Team section */
.card .role {
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--sp-sm);
}

/* Testimonials */
blockquote {
  background-color: var(--surface);
  padding: var(--sp-lg);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  font-style: italic;
  line-height: var(--lh-loose);
}

blockquote p {
  margin-bottom: var(--sp-md);
}

blockquote cite {
  display: block;
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  margin-top: var(--sp-sm);
}

/* Note text */
.note {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-style: italic;
  margin-top: var(--sp-lg);
}

/* Chat widget */
.chat-widget {
  position: fixed;
  bottom: var(--sp-lg);
  right: var(--sp-lg);
  z-index: 1000;
  font-family: inherit;
}

.chat-launcher {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background-color: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
}

.chat-launcher:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-launcher:focus {
  outline: 2px solid var(--accentInk);
  outline-offset: 2px;
}

.chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: var(--accentInk);
}

.chat-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background-color: var(--bg);
  border: 1px solid var(--surface);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  transform-origin: bottom right;
  transition: all 0.2s;
}

.chat-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.chat-header {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h2 {
  margin: 0;
  font-size: var(--fs-lg);
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
  transition: color 0.2s;
}

.chat-close:hover {
  color: var(--ink);
}

.chat-close:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.chat-message {
  display: flex;
  gap: var(--sp-md);
  animation: slideIn 0.2s ease-out;
}

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

.chat-message.user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 80%;
  padding: var(--sp-md);
  border-radius: 8px;
  line-height: var(--lh-normal);
  word-wrap: break-word;
}

.chat-message.assistant .chat-bubble {
  background-color: var(--surface);
  color: var(--ink);
}

.chat-message.user .chat-bubble {
  background-color: var(--accent);
  color: var(--accentInk);
}

.chat-form {
  padding: var(--sp-lg);
  border-top: 1px solid var(--surface);
  display: flex;
  gap: var(--sp-sm);
}

.chat-input {
  flex: 1;
  padding: var(--sp-md);
  border: 1px solid var(--surface);
  border-radius: 4px;
  font-family: inherit;
  font-size: var(--fs-base);
  background-color: var(--bg);
  color: var(--ink);
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 161, 26, 0.1);
}

.chat-send {
  padding: var(--sp-md) var(--sp-lg);
  background-color: var(--accent);
  color: var(--accentInk);
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-send:hover {
  opacity: 0.9;
}

.chat-send:focus {
  outline: 2px solid var(--accentInk);
  outline-offset: 2px;
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-unavailable {
  text-align: center;
  color: var(--muted);
  padding: var(--sp-lg);
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --sp-2xl: 32px;
    --sp-xl: 24px;
    --fs-2xl: 28px;
    --fs-xl: 24px;
  }
  
  .section {
    padding: var(--sp-xl) var(--sp-md);
  }
  
  .section.hero {
    padding: var(--sp-xl) var(--sp-md);
  }
  
  .header-inner {
    padding: var(--sp-md) var(--sp-md);
  }
  
  .site-nav {
    gap: var(--sp-md);
  }
  
  .chat-panel {
    width: calc(100vw - 32px);
    height: 60vh;
  }
}

@media (max-width: 480px) {
  :root {
    --sp-2xl: 24px;
    --sp-lg: 16px;
    --fs-2xl: 24px;
    --fs-xl: 20px;
  }
  
  .wrap {
    padding: 0 var(--sp-md);
  }
  
  .section {
    padding: var(--sp-lg) var(--sp-md);
  }
  
  .site-nav a {
    padding: var(--sp-xs) var(--sp-sm);
    font-size: var(--fs-sm);
  }
  
  .grid {
    gap: var(--sp-md);
  }
  
  .button {
    width: 100%;
    text-align: center;
  }
  
  input,
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .chat-panel {
    width: calc(100vw - 16px);
    height: 70vh;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .chat-widget {
    display: none;
  }
}
