@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* === CSS Custom Properties (Flexoki palette) === */
:root {
  --black: #100F0F;
  --white: #FFFCF0;
  --gray-50: #F2F0E5;
  --gray-100: #E6E4D9;
  --gray-200: #CECDC3;
  --gray-300: #B7B5AC;
  --gray-400: #9F9D96;
  --gray-500: #878580;
  --gray-600: #6F6E69;
  --gray-700: #575653;
  --gray-800: #403E3C;
  --gray-900: #282726;
  --gray-950: #1C1B1A;
  --red-500: #AF3029;
  --red-600: #872019;
  --green-600: #4D7B10;
  --focus-ring: #100F0F;
}

/* === Skip Navigation === */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.5rem;
  background: var(--black);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0.5rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--white);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection {
  background: var(--gray-200);
  color: var(--black);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Charter', 'Georgia', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--black);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* === Layout === */
.container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-xs {
  max-width: 24rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

#main-content {
  flex: 1;
}

.page-content {
  min-height: calc(100vh - 56px);
}

/* === Navbar === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
}

.navbar-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}

.navbar-logo {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--black);
  letter-spacing: -0.02em;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-link {
  font-size: 0.875rem;
  color: var(--gray-600);
  transition: color 0.15s;
}

.navbar-link:hover {
  color: var(--black);
}

.navbar-divider {
  width: 1px;
  height: 1rem;
  background: var(--gray-100);
}

.navbar-query-count {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-family: 'JetBrains Mono', monospace;
}

.navbar-hamburger {
  display: none;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  transition: color 0.15s;
}

.navbar-hamburger:hover {
  color: var(--black);
}

.navbar-hamburger svg {
  width: 1.25rem;
  height: 1.25rem;
}

.mobile-menu {
  display: none;
  padding: 1.5rem 0;
  border-top: 1px solid var(--gray-100);
  animation: fadeIn 0.2s ease-out;
}

.mobile-menu.is-open {
  display: block;
}

.mobile-menu-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 0.5rem 0;
}

.mobile-menu-buttons {
  display: flex;
  gap: 0.75rem;
}

.mobile-menu-buttons .btn {
  flex: 1;
  text-align: center;
}

@media (max-width: 768px) {
  .navbar-links {
    display: none;
  }
  .navbar-hamburger {
    display: block;
  }
}

/* === Footer === */
.footer {
  margin-top: 4rem;
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.footer-brand-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.75rem;
  color: var(--gray-500);
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--black);
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  border-radius: 2px;
  font-size: 0.875rem;
  padding: 0.625rem 1.5rem;
}

.btn:focus-visible {
  outline: 1px solid var(--gray-500);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gray-800);
}

.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
}

.btn-outline {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--gray-200);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--black);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: none;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--black);
}

.btn-danger {
  background: var(--red-500);
  color: var(--white);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 1rem;
  height: 1rem;
}

/* === Inputs === */
.input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 0;
  font-size: 1rem;
  font-family: inherit;
  color: var(--black);
  transition: border-color 0.15s;
}

.input::placeholder {
  color: var(--gray-400);
}

.input:focus {
  outline: none;
  border-bottom-color: var(--black);
}

.input-boxed {
  width: 100%;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--black);
  transition: border-color 0.15s;
}

.input-boxed::placeholder {
  color: var(--gray-400);
}

.input-boxed:focus {
  outline: none;
  border-color: var(--black);
}

.input-error {
  border-color: var(--red-500) !important;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.input-error-text {
  font-size: 0.875rem;
  color: var(--red-600);
  margin-top: 0.25rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

/* === Cards === */
.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
}

.card-bordered-black {
  border-color: var(--black);
}

.card-bordered-gray {
  border-color: var(--gray-400);
}

.card:hover {
  border-color: var(--gray-200);
}

.card-padded {
  padding: 2rem;
}

/* === Links === */
.link {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--gray-300);
  transition: text-decoration-color 0.15s;
}

.link:hover {
  text-decoration-color: var(--black);
}

.link-subtle {
  color: var(--gray-500);
  transition: color 0.15s;
}

.link-subtle:hover {
  color: var(--black);
}

/* === Dividers === */
.divider {
  height: 1px;
  background: var(--gray-100);
  width: 100%;
}

.divider-with-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-100);
}

/* === Section Label === */
.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--gray-400);
  font-weight: 500;
}

/* === Flash Messages === */
.flash-message {
  padding: 1rem;
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.flash-success {
  border-color: var(--black);
  color: var(--black);
}

.flash-error {
  border-color: var(--red-500);
  color: var(--red-500);
}

.flash-info {
  border-color: var(--gray-300);
  color: var(--gray-600);
}

/* === Query Counter === */
.query-hint {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

/* === Search Page === */
.search-page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.search-hero {
  padding: 4rem 0 0;
  text-align: center;
}

.search-title {
  font-size: 2rem;
  margin-bottom: 2.5rem;
}

.search-bar-section {
  width: 80%;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  text-align: center;
}

/* === Search === */
.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 6rem 0.75rem 0;
  font-size: 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gray-200);
  border-radius: 0;
  font-family: inherit;
  color: var(--black);
  transition: border-color 0.2s;
}

.search-input::placeholder {
  color: var(--gray-400);
}

.search-input:focus {
  outline: none;
  border-color: var(--black);
  background: transparent;
}

.search-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.search-submit {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--gray-400);
  font-size: 0.875rem;
  padding: 0.5rem 0;
  cursor: pointer;
  transition: color 0.15s;
}

.search-submit:hover {
  color: var(--black);
}

.search-word-limit {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--red-500);
}

.search-results-area {
  width: 100%;
}

/* === Results === */
.results-container {
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  padding: 1.5rem;
  animation: fadeIn 0.4s ease-out;
}

.results-header {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.results-header strong {
  color: var(--black);
}

.result-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.result-item:last-child {
  border-bottom: none;
}

.result-keyword {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--black);
}

.result-phrase {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* === Feedback === */
.feedback {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
}

.feedback-prompt {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.feedback-buttons {
  display: flex;
  gap: 0.5rem;
}

.feedback-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-600);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-btn:hover {
  border-color: var(--black);
  color: var(--black);
}

.feedback-thanks {
  font-size: 0.875rem;
  color: var(--green-600);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === Loading === */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}

.loading-text {
  padding: 3rem 0;
  color: var(--gray-400);
  font-size: 1rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.loading-text.fade-in {
  opacity: 1;
}

/* === Plans Grid === */
.plans-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  border: 1px solid var(--gray-100);
  border-radius: 2px;
}

.plan-card.is-popular {
  border-color: var(--gray-300);
}

.plan-card.is-current {
  border-color: var(--gray-200);
}

.plan-badge {
  position: absolute;
  top: -0.75rem;
  left: 1.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 500;
}

.plan-badge-popular {
  background: var(--gray-800);
  color: var(--gray-100);
}

.plan-badge-current {
  background: var(--gray-200);
  color: var(--black);
}

.plan-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
}

.plan-description {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.plan-price {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.plan-price-amount {
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--black);
}

.plan-price-label {
  color: var(--gray-500);
  margin-left: 0.5rem;
}

.plan-queries {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.plan-queries strong {
  color: var(--black);
  font-weight: 600;
}

.plan-queries-duration {
  color: var(--gray-400);
}

.plan-features {
  flex: 1;
  margin-bottom: 2rem;
}

.plan-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.plan-feature-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: var(--black);
}

/* === Auth Pages === */
.auth-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.auth-form {
  width: 100%;
  max-width: 24rem;
}

.auth-title {
  font-size: 1.875rem;
  font-weight: 400;
  margin-bottom: 3rem;
}

.auth-link {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 1.5rem;
  text-align: center;
}

.auth-link a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--gray-300);
}

.auth-link a:hover {
  text-decoration-color: var(--black);
}

/* Google OAuth button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--black);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-google:hover {
  border-color: var(--gray-300);
}

.btn-google svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* === Profile Page === */
.profile-section {
  border: 1px solid var(--gray-100);
  border-radius: 2px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--gray-400);
  font-weight: 500;
  margin-bottom: 1rem;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.profile-label {
  color: var(--gray-500);
}

.profile-value {
  color: var(--black);
  font-weight: 500;
}

/* === FAQ === */
.faq-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.faq-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.75rem;
}

.faq-answer {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.7;
}

/* === Legal Pages === */
.legal-content {
  max-width: 42rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.legal-content h1 {
  font-size: 1.875rem;
  margin-bottom: 2rem;
}

.legal-content h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.legal-content p {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.legal-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.legal-content li {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.7;
  list-style: disc;
  margin-bottom: 0.25rem;
}

/* === Simple Pages (error, thank you) === */
.simple-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.simple-page h1 {
  font-size: 1.875rem;
  margin-bottom: 1rem;
}

.simple-page p {
  color: var(--gray-500);
  max-width: 24rem;
}

/* === Utility === */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-red { color: var(--red-500); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-semibold { font-weight: 600; }

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

.animate-slide-up {
  animation: fadeIn 0.4s ease-out;
}
