/* ============================================================
   CalcHive: Design System
   Brand: CalcHive ("Quick answers, done-for-you calculations")
   Persona anchor: school teacher: time-pressed, mobile, smart
   Built by JAE's AI Consulting Solutions
   ============================================================ */

/* --------- Design tokens --------- */
:root {
  /* Hive palette */
  --honey:        #F59E0B;
  --honey-dark:   #B45309;
  --honey-soft:   #FEF3C7;
  --cream:        #FFFBEB;
  --navy:         #1E293B;
  --navy-soft:    #334155;

  /* Neutrals */
  --bg:           #FFFBEB;
  --surface:      #FFFFFF;
  --text:         #0F172A;
  --text-muted:   #475569;
  --text-faint:   #94A3B8;
  --border:       #E5E7EB;
  --border-soft:  #F1F5F9;

  /* Semantic */
  --success:      #059669;
  --danger:       #DC2626;
  --info:         #2563EB;

  /* Spacing scale (4px base) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;

  /* Radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-pill: 999px;

  /* Shadows: layered, subtle */
  --shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-honey: 0 8px 24px rgba(245, 158, 11, 0.18);

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Layout */
  --container-max: 1200px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--honey-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--navy); text-decoration: underline; }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: var(--s-3) var(--s-4);
  background: var(--navy);
  color: white;
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; top: 0; }

/* --------- Typography --------- */
h1, h2, h3, h4 {
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-weight: 800;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2vw, 1.375rem); }
h4 { font-size: 1rem; font-weight: 700; }

p { color: var(--text); }
.muted { color: var(--text-muted); }

/* --------- Layout containers --------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

section { padding: var(--s-8) 0; }
@media (max-width: 640px) { section { padding: var(--s-7) 0; } }

/* --------- Top nav --------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 251, 235, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  height: var(--nav-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--honey-dark); text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: var(--s-5);
  list-style: none;
  padding: 0;
  align-items: center;
}
.nav-links a {
  color: var(--navy-soft);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover {
  color: var(--honey-dark);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--honey-dark);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  padding: var(--s-2);
  border-radius: var(--r-sm);
}
.nav-toggle:hover { background: var(--honey-soft); }

@media (max-width: 880px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--cream);
    flex-direction: column;
    padding: var(--s-5);
    gap: var(--s-4);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: inline-flex; }
}

/* --------- Hero --------- */
.hero {
  padding: var(--s-9) 0 var(--s-8);
  text-align: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(245, 158, 11, 0.12), transparent),
    var(--bg);
}

.hero h1 {
  max-width: 18ch;
  margin: 0 auto var(--s-4);
}
.hero h1 .highlight {
  color: var(--honey-dark);
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  max-width: 50ch;
  margin: 0 auto var(--s-6);
  color: var(--text-muted);
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  padding: var(--s-2);
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-bar:focus-within {
  border-color: var(--honey);
  box-shadow: var(--shadow-honey);
}
.search-bar input {
  flex: 1;
  padding: var(--s-3) var(--s-4);
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.search-bar input::placeholder { color: var(--text-faint); }
.search-bar button {
  padding: var(--s-3) var(--s-5);
  background: var(--navy);
  color: white;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease, transform 0.15s ease;
}
.search-bar button:hover { background: var(--honey-dark); }
.search-bar button:active { transform: scale(0.97); }

/* --------- Category grid --------- */
.section-head {
  text-align: center;
  margin-bottom: var(--s-7);
}
.section-head h2 { margin-bottom: var(--s-2); }
.section-head p { color: var(--text-muted); max-width: 55ch; margin: 0 auto; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-5);
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: var(--honey-soft);
  border-radius: 0 var(--r-lg) 0 var(--r-lg);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 0;
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--honey);
  text-decoration: none;
}
.cat-card:hover::before { opacity: 1; }

.cat-icon {
  width: 48px;
  height: 48px;
  background: var(--honey-soft);
  color: var(--honey-dark);
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.cat-card h3 {
  color: var(--navy);
  position: relative;
  z-index: 1;
}
.cat-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  position: relative;
  z-index: 1;
  flex: 1;
}
.cat-card .cat-count {
  font-size: 0.85rem;
  color: var(--honey-dark);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* --------- Popular tools strip --------- */
.popular-strip {
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-4);
}

.tool-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  transition: border-color 0.15s ease, background 0.15s ease;
  color: inherit;
  text-decoration: none;
}
.tool-card:hover {
  border-color: var(--honey);
  background: var(--honey-soft);
  text-decoration: none;
}
.tool-card-icon {
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--honey-dark);
  flex-shrink: 0;
}
.tool-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  line-height: 1.3;
}

/* --------- Why CalcHive --------- */
.why {
  text-align: center;
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-6);
  text-align: left;
}
.why-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.why-card h3 { font-size: 1.125rem; margin-bottom: var(--s-2); }
.why-card p { font-size: 0.95rem; color: var(--text-muted); }

/* --------- Footer --------- */
.site-footer {
  background: var(--navy);
  color: #CBD5E1;
  padding: var(--s-8) 0 var(--s-6);
  margin-top: var(--s-9);
}
.site-footer a { color: #CBD5E1; }
.site-footer a:hover { color: var(--honey); text-decoration: none; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--s-7);
  margin-bottom: var(--s-7);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
  .footer-brand { grid-column: 1 / -1; }
}

.footer-brand .brand { color: white; margin-bottom: var(--s-3); }
.footer-brand p { font-size: 0.9rem; color: #94A3B8; max-width: 36ch; }

.footer-col h4 {
  color: white;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-3);
}
.footer-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.footer-col a { font-size: 0.9rem; }

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: var(--s-5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
  font-size: 0.85rem;
  color: #94A3B8;
}
.footer-bottom a { font-weight: 600; }

/* --------- Page (interior pages) --------- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-5);
}
.page h1 { margin-bottom: var(--s-5); }
.page h2 { margin: var(--s-6) 0 var(--s-3); }
.page h3 { margin: var(--s-5) 0 var(--s-2); }
.page p { margin-bottom: var(--s-3); }
.page ul, .page ol { margin: 0 0 var(--s-3) var(--s-5); }
.page li { margin-bottom: var(--s-2); }

/* --------- Tool / calculator page --------- */
.tool-page {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-5);
}
.tool-breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--s-4);
}
.tool-breadcrumbs a { color: var(--text-muted); }
.tool-breadcrumbs a:hover { color: var(--honey-dark); }

.tool-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s-6);
}

.tool-shell label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy-soft);
  margin: var(--s-4) 0 var(--s-2);
}
.tool-shell input,
.tool-shell select {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  font: inherit;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tool-shell input:focus,
.tool-shell select:focus {
  outline: none;
  border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-3) var(--s-5);
  background: var(--honey);
  color: var(--navy);
  font-weight: 700;
  border-radius: var(--r-md);
  border: none;
  font-size: 1rem;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--honey-dark); color: white; box-shadow: var(--shadow-honey); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--cream); border-color: var(--honey); color: var(--navy); }

.result-panel {
  background: var(--honey-soft);
  border: 1.5px solid var(--honey);
  border-radius: var(--r-md);
  padding: var(--s-5);
  margin-top: var(--s-5);
}
.result-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--honey-dark);
  margin-bottom: var(--s-2);
}
.result-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  word-break: break-word;
}

.tool-content {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.tool-content h2:first-child { margin-top: 0; }

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