/* ============================================================
   The Spanish Map Locator — page-specific styles
   Inherits all tokens from the design system (../landing/ds/)
   Never redeclare :root tokens here.
   ============================================================ */

/* ── Layout ── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg, #F7F5F1);
  color: var(--color-text, #1C1C1C);
}

/* ── Header (mirrors landing/page.css) ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(28, 28, 28, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.logo img {
  height: 2rem;
  width: auto;
}

.wordmark {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.wordmark .es { color: var(--color-teal, #1A6B7C); }
.wordmark .hobby { color: var(--color-text, #1C1C1C); }

.header-note {
  font-size: 0.8125rem;
  color: rgba(28, 28, 28, 0.5);
  font-style: italic;
}

/* ── Hero ── */
.tool-hero {
  max-width: 680px;
  margin: 4rem auto 2.5rem;
  padding: 0 2rem;
  text-align: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-teal, #1A6B7C);
  margin-bottom: 1rem;
}

.rule {
  display: inline-block;
  width: 1.5rem;
  height: 2px;
  background: var(--color-teal, #1A6B7C);
}

.tool-hero h1 {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
}

.accent {
  color: var(--color-teal, #1A6B7C);
}

.lead {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgba(28, 28, 28, 0.75);
  max-width: 560px;
  margin: 0 auto;
}

/* ── API Key Setup ── */
.key-setup {
  max-width: 560px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}

.key-setup-inner {
  background: #fff;
  border: 1px solid rgba(28, 28, 28, 0.12);
  border-radius: 12px;
  padding: 2rem;
}

.key-label {
  font-weight: 600;
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
}

.key-note {
  font-size: 0.8125rem;
  color: rgba(28, 28, 28, 0.55);
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

.key-note-prod {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-orange, #C8662A);
}

.key-form {
  display: flex;
  gap: 0.75rem;
}

.key-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(28, 28, 28, 0.2);
  border-radius: 8px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.875rem;
  background: var(--color-bg, #F7F5F1);
  color: var(--color-text, #1C1C1C);
  outline: none;
  transition: border-color 0.15s;
}

.key-input:focus {
  border-color: var(--color-teal, #1A6B7C);
  box-shadow: 0 0 0 3px rgba(26, 107, 124, 0.12);
}

/* ── Main tool ── */
.tool-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  width: 100%;
}

/* ── Search bar ── */
.search-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.word-input {
  flex: 1;
  padding: 0.875rem 1.125rem;
  border: 1.5px solid rgba(28, 28, 28, 0.18);
  border-radius: 10px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 1.0625rem;
  background: #fff;
  color: var(--color-text, #1C1C1C);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.word-input:focus {
  border-color: var(--color-teal, #1A6B7C);
  box-shadow: 0 0 0 3px rgba(26, 107, 124, 0.12);
}

.word-input::placeholder {
  color: rgba(28, 28, 28, 0.35);
}

/* ── Buttons ── */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-teal, #1A6B7C);
  color: #fff;
}

.btn-primary:hover {
  background: #155e6d;
}

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

.btn-text { display: inline; }
.btn-loading { display: inline-flex; align-items: center; }

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ── Spanish Map ── */
.map-section {
  margin-bottom: 3rem;
}

.map-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(28, 28, 28, 0.1);
  border: 1px solid rgba(28, 28, 28, 0.1);
  border-radius: 14px;
  overflow: hidden;
}

.map-part {
  background: #fff;
  padding: 1.5rem 1.75rem;
  transition: background 0.2s;
}

.map-part[data-part="1"] { background: #fff; }
.map-part[data-part="2"] { background: #fafaf9; }
.map-part[data-part="3"] { background: #f7f5f1; }

.part-header {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.part-number {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-teal, #1A6B7C);
  background: rgba(26, 107, 124, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.part-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text, #1C1C1C);
}

.part-sub {
  font-size: 0.8125rem;
  color: rgba(28, 28, 28, 0.45);
  font-style: italic;
}

.node-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Nodes (chips) ── */
.node {
  padding: 0.35rem 0.875rem;
  border-radius: 100px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1.5px solid rgba(28, 28, 28, 0.15);
  background: transparent;
  color: rgba(28, 28, 28, 0.55);
  cursor: default;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s;
  pointer-events: none;
}

.node.lit {
  background: var(--color-teal, #1A6B7C);
  border-color: var(--color-teal, #1A6B7C);
  color: #fff;
  pointer-events: auto;
  cursor: pointer;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(26, 107, 124, 0.25);
}

.node.lit:hover {
  background: #155e6d;
}

/* ── Part 3 sub-groups ── */
.part3-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.node-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.group-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(28, 28, 28, 0.4);
}

/* ── Results ── */
.results {
  margin-top: 0.5rem;
}

.results-header {
  margin-bottom: 1.5rem;
}

.results-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text, #1C1C1C);
  line-height: 1.5;
  margin: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

/* ── Result card ── */
.result-card {
  background: #fff;
  border: 1px solid rgba(28, 28, 28, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: box-shadow 0.15s;
}

.result-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.card-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-part-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-teal, #1A6B7C);
  background: rgba(26, 107, 124, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.card-category {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text, #1C1C1C);
}

.card-subcategory {
  font-size: 0.75rem;
  color: rgba(28, 28, 28, 0.45);
  font-style: italic;
}

.card-insight {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: rgba(28, 28, 28, 0.8);
  flex: 1;
}

/* ── Results CTA buttons (below all cards) ── */
.results-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-weight: 600;
  border-radius: 10px;
  text-align: center;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, gap 0.15s;
}

.cta-btn:hover {
  gap: 0.65rem;
}

/* Secondary — teal, smaller */
.cta-secondary {
  font-size: 0.9375rem;
  padding: 0.7rem 1.5rem;
  color: var(--color-teal, #1A6B7C);
  background: transparent;
  border: 1.5px solid var(--color-teal, #1A6B7C);
}

.cta-secondary:hover {
  background: rgba(26, 107, 124, 0.07);
}

/* Primary — orange, large & prominent */
.cta-primary {
  font-size: 1.125rem;
  padding: 1.1rem 2.5rem;
  color: #fff;
  background: var(--color-orange, #C8662A);
  border: none;
  box-shadow: 0 4px 16px rgba(200, 102, 42, 0.28);
}

.cta-primary:hover {
  background: #b25822;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200, 102, 42, 0.34);
}

/* ── Error state ── */
.error-state {
  background: #fff3f0;
  border: 1px solid rgba(200, 102, 42, 0.2);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.error-message {
  font-size: 0.9rem;
  color: #a8401a;
  margin: 0;
}

/* ── Key reset ── */
.key-reset {
  margin-top: 2.5rem;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.8125rem;
  color: rgba(28, 28, 28, 0.4);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.link-btn:hover {
  color: rgba(28, 28, 28, 0.7);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid rgba(28, 28, 28, 0.1);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(28, 28, 28, 0.45);
}

.site-footer a {
  color: var(--color-teal, #1A6B7C);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ── Accessibility ── */
.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;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .tool-hero { margin-top: 2.5rem; }
  .search-form { flex-direction: column; }
  .key-form { flex-direction: column; }
  .site-header { padding: 1rem 1.25rem; }
  .tool-main { padding: 0 1.25rem 3rem; }
  .map-part { padding: 1.25rem; }
}
