/* ==========================================================================
   Toolbeel Finance — Global design tokens, reset, and base elements
   ========================================================================== */

:root {
  /* Brand colors */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #eff6ff;

  /* Feedback colors */
  --color-success: #15803d;
  --color-success-light: #f0fdf4;
  --color-danger: #dc2626;
  --color-danger-light: #fef2f2;
  --color-warning: #d97706;

  /* Neutrals */
  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-text: #1a1a1a;
  --color-text-muted: #52606d;
  --color-text-subtle: #6b7280;
  --color-border: #e5e7eb;
  --color-border-strong: #8b93a0;

  /* Layout */
  --max-width: 1160px;
  --max-width-narrow: 760px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Typography */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Motion */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
}

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

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

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  display: block;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* Typography
   ========================================================================== */
h1,
h2,
h3,
h4 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}

h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(1.35rem, 1.2rem + 0.8vw, 1.75rem);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-2);
}

h4 {
  font-size: 1.05rem;
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

ul,
ol {
  list-style: none;
}

strong {
  font-weight: 700;
}

/* Layout helpers
   ========================================================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

main {
  min-height: 60vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

/* Forms
   ========================================================================== */
label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--color-text);
  background: #fff;
}

textarea {
  resize: vertical;
}

input[readonly] {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: default;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-subtle);
}

.field {
  margin-bottom: var(--space-4);
}

.field-error input,
.field-error select {
  border-color: var(--color-danger);
}

.field-error-message {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: var(--space-1);
}

/* Section rhythm
   ========================================================================== */
.section {
  padding: var(--space-7) 0;
}

.section-header {
  margin-bottom: var(--space-6);
}

/* Guides is a placeholder stub until real guide content exists — the
   standard section rhythm (built for content-heavy sections) leaves it
   looking disproportionately empty. */
#guides {
  padding: var(--space-5) 0;
}

#guides .section-header {
  margin-bottom: var(--space-3);
}

#guides h2 {
  margin-top: 0;
}

/* FAQ directly follows the compact Guides stub above — the standard
   section padding plus heading margin left a disproportionate gap. */
#faq {
  padding-top: var(--space-5);
}

#faq h2 {
  margin-top: 0;
}

.section-header p {
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* Hero
   ========================================================================== */
.hero {
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
  text-align: center;
}

.hero h1 {
  margin-bottom: var(--space-3);
}

.hero-subtitle {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 46ch;
  margin: 0 auto var(--space-6);
}

/* Calculator search
   ========================================================================== */
.search-form {
  max-width: 480px;
  margin: var(--space-5) auto 0;
  position: relative;
}

.search-form input[type="search"] {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
}

.search-results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  text-align: left;
  z-index: 20;
}

.search-results[hidden] {
  display: none;
}

.search-results-list li + li {
  border-top: 1px solid var(--color-border);
}

.search-result-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.search-result-link:hover,
.search-result-link:focus-visible {
  background: var(--color-primary-light);
  text-decoration: none;
}

.search-result-link.is-disabled {
  color: var(--color-text-subtle);
  cursor: default;
}

.search-result-link.is-disabled:hover {
  background: none;
}

.badge-soon {
  flex-shrink: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-subtle);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
}

.search-empty {
  padding: var(--space-3);
  color: var(--color-text-subtle);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Ad slot placeholders (disabled until AdSense is configured)
   ========================================================================== */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-6) 0;
}
