/* Design tokens — Google Material palette. Light is the default, dark is opt-in via [data-theme="dark"].
   Values are raw RGB channels so Tailwind utilities keep working with /alpha modifiers. */
:root,
:root[data-theme='light'] {
  --ink: 255 255 255;
  --surface: 248 249 250;
  --surface-strong: 241 243 244;
  --tint: 232 240 254;
  --line: 218 220 224;
  --paper: 32 33 36;
  --muted: 95 99 104;
  --accent: 26 115 232;
  --accent-strong: 23 78 166;
  --g-red: 217 48 37;
  --g-yellow: 249 171 0;
  --g-green: 24 128 56;
  --g-blue: 66 133 244;

  --elev-1: 0 1px 2px 0 rgb(60 64 67 / 0.3), 0 1px 3px 1px rgb(60 64 67 / 0.15);
  --elev-2: 0 1px 2px 0 rgb(60 64 67 / 0.3), 0 2px 6px 2px rgb(60 64 67 / 0.15);
  --elev-3: 0 4px 8px 3px rgb(60 64 67 / 0.15), 0 1px 3px 0 rgb(60 64 67 / 0.3);

  --syn-keyword: 166 38 164;
  --syn-string: 24 128 56;
  --syn-number: 183 107 1;
  --syn-entity: 26 115 232;
  --syn-comment: 128 134 139;
  --syn-type: 152 104 1;
  --syn-operator: 1 132 188;
  --syn-variable: 217 48 37;
}

:root[data-theme='dark'] {
  --ink: 32 33 36;
  --surface: 41 42 45;
  --surface-strong: 48 49 52;
  --tint: 27 41 60;
  --line: 60 64 67;
  --paper: 232 234 237;
  --muted: 154 160 166;
  --accent: 138 180 248;
  --accent-strong: 174 203 250;
  --g-red: 242 139 130;
  --g-yellow: 253 214 99;
  --g-green: 129 201 149;
  --g-blue: 138 180 248;

  --elev-1: 0 1px 2px 0 rgb(0 0 0 / 0.6), 0 1px 3px 1px rgb(0 0 0 / 0.3);
  --elev-2: 0 1px 2px 0 rgb(0 0 0 / 0.6), 0 2px 6px 2px rgb(0 0 0 / 0.3);
  --elev-3: 0 4px 8px 3px rgb(0 0 0 / 0.3), 0 1px 3px 0 rgb(0 0 0 / 0.6);

  --syn-keyword: 198 120 221;
  --syn-string: 129 201 149;
  --syn-number: 253 214 99;
  --syn-entity: 138 180 248;
  --syn-comment: 128 134 139;
  --syn-type: 253 214 99;
  --syn-operator: 120 194 204;
  --syn-variable: 242 139 130;
}

/* Base */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  font-family: 'Google Sans', 'Google Sans Text', Roboto, Arial, sans-serif;
  background-color: rgb(var(--ink));
  color: rgb(var(--paper));
  overflow-x: clip;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.00625em;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Google display type: large, regular weight, tightened tracking */
h1, h2, h3, .g-display {
  font-family: 'Google Sans Display', 'Google Sans', Roboto, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: -0.0125em;
}

h1 {
  letter-spacing: -0.02em;
}

.mono {
  font-family: 'Roboto Mono', 'Google Sans Mono', monospace;
  font-feature-settings: 'liga' 0;
}

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
  user-select: none;
}

/* Hero / CTA ground: Google Blue 50 tint, not a multi-hue wash */
.g-tint {
  background-color: rgb(var(--tint));
}

.g-tint-soft {
  background-image: linear-gradient(180deg, rgb(var(--tint)) 0%, rgb(var(--tint) / 0.45) 55%, rgb(var(--ink)) 100%);
}

/* The four-colour Google rule */
.g-rule {
  height: 3px;
  border-radius: 9999px;
  background-image: linear-gradient(
    90deg,
    rgb(var(--g-blue)) 0 25%,
    rgb(var(--g-red)) 25% 50%,
    rgb(var(--g-yellow)) 50% 75%,
    rgb(var(--g-green)) 75% 100%
  );
}

/* Material surfaces: 8px radius, hairline border, elevation only on hover */
.g-card {
  background-color: rgb(var(--ink));
  border: 1px solid rgb(var(--line));
  border-radius: 8px;
  transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1), border-color 200ms ease;
}

.g-card-hover:hover {
  box-shadow: var(--elev-2);
}

.g-elev-1 { box-shadow: var(--elev-1); }

/* Buttons — Material 3 geometry with Google Cloud sizing */
.g-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.00714em;
  isolation: isolate;
  transition: box-shadow 200ms cubic-bezier(0.2, 0, 0, 1), border-color 200ms ease;
}

/* State layer: Material's 8% hover / 12% pressed overlay */
.g-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-color: currentColor;
  opacity: 0;
  transition: opacity 150ms ease;
}

.g-btn:hover::before { opacity: 0.08; }
.g-btn:active::before { opacity: 0.12; }

.g-btn-filled {
  background-color: rgb(var(--accent));
  color: rgb(var(--ink));
}

.g-btn-filled::before {
  background-color: rgb(var(--ink));
}

.g-btn-filled:hover {
  box-shadow: var(--elev-1);
}

.g-btn-outlined {
  border: 1px solid rgb(var(--line));
  color: rgb(var(--accent));
  background-color: rgb(var(--ink));
}

.g-btn-outlined:hover {
  border-color: rgb(var(--accent) / 0.6);
}

/* Section label — Google sets these in sentence case, not letterspaced caps */
.g-eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: 0.00714em;
  color: rgb(var(--accent));
  margin-bottom: 0.75rem;
}

/* Material assist chip */
.g-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgb(var(--line));
  background-color: rgb(var(--ink));
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.00714em;
  isolation: isolate;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.g-chip-static {
  border-radius: 9999px;
  background-color: rgb(var(--ink));
}

a.g-chip:hover,
li.g-chip:hover {
  box-shadow: var(--elev-1);
}

/* Navigation — flat white bar, elevation appears only once the page scrolls */
.g-nav {
  background-color: rgb(var(--ink));
  border-bottom: 1px solid transparent;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.g-nav.is-scrolled {
  border-bottom-color: rgb(var(--line));
  box-shadow: var(--elev-1);
}

.nav-link {
  position: relative;
  border-radius: 9999px;
  padding: 0.5rem 0.875rem;
  transition: color 200ms ease;
  isolation: isolate;
}

.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-color: rgb(var(--accent));
  opacity: 0;
  transition: opacity 150ms ease;
}

.nav-link:hover {
  color: rgb(var(--accent));
}

.nav-link:hover::before {
  opacity: 0.08;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid rgb(var(--accent));
  outline-offset: 2px;
  border-radius: 8px;
}

/* Code previews */
.code-block {
  font-family: 'Roboto Mono', monospace;
  font-size: 12.5px;
  line-height: 1.85;
  tab-size: 2;
  overflow-x: auto;
  color: rgb(var(--paper));
}

@media (min-width: 768px) {
  .code-block {
    font-size: 13px;
  }
}

.code-block .tk-keyword { color: rgb(var(--syn-keyword)); }
.code-block .tk-string { color: rgb(var(--syn-string)); }
.code-block .tk-number { color: rgb(var(--syn-number)); }
.code-block .tk-entity { color: rgb(var(--syn-entity)); }
.code-block .tk-comment { color: rgb(var(--syn-comment)); font-style: italic; }
.code-block .tk-type { color: rgb(var(--syn-type)); }
.code-block .tk-operator { color: rgb(var(--syn-operator)); }
.code-block .tk-variable { color: rgb(var(--syn-variable)); }
.code-block .tk-muted { color: rgb(var(--muted)); }

/* Feature comparison table */
.compare-table th,
.compare-table td {
  border-bottom: 1px solid rgb(var(--line));
  padding: 1rem 1.5rem;
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  background-color: rgb(var(--surface));
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

/* The recommended column stays tinted through the whole table.
   Row layout is <th scope=row> + three <td>, so the header and body indices line up. */
.compare-featured-3 thead th:nth-child(3),
.compare-featured-3 tbody td:nth-child(3),
.compare-featured-2 thead th:nth-child(2),
.compare-featured-2 tbody td:nth-child(2) {
  background-color: rgb(var(--tint) / 0.6);
}

.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td {
  border-bottom: 0;
}

.compare-table tbody tr:hover th,
.compare-table tbody tr:hover td {
  background-color: rgb(var(--surface));
}

.compare-featured-3 tbody tr:hover td:nth-child(3),
.compare-featured-2 tbody tr:hover td:nth-child(2) {
  background-color: rgb(var(--tint));
}

/* FAQ — Material expansion panel: flat, divided, no card chrome */
.faq-list {
  border-top: 1px solid rgb(var(--line));
}

.faq-item {
  border-bottom: 1px solid rgb(var(--line));
}

.faq-item summary {
  list-style: none;
  padding: 1.25rem 0.5rem;
  border-radius: 8px;
  transition: background-color 150ms ease;
}

.faq-item summary:hover {
  background-color: rgb(var(--surface));
}

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

.faq-icon {
  transition: transform 200ms cubic-bezier(0.2, 0, 0, 1);
}

.faq-item[open] .faq-icon {
  transform: rotate(180deg);
}

/* Scroll-reveal animation, toggled by js/main.js via IntersectionObserver */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms cubic-bezier(0.2, 0, 0, 1), transform 600ms cubic-bezier(0.2, 0, 0, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Theme toggle shows the icon for the theme it switches to */
:root[data-theme='dark'] .theme-icon-dark,
:root[data-theme='light'] .theme-icon-light {
  display: none;
}
