/* =====================================================================
   CrowGoal design system
   Palette idea: a crow's feather reads flat black at a glance but
   carries a blue-violet-teal sheen in the light. The UI mirrors that -
   a near-black base, with an iridescent gradient reserved for exactly
   one accent moment per screen (never scattered across every card).
   ===================================================================== */

:root {
  --bg:            #0a0c10;
  --bg-elevated:   #10131a;
  --surface:       rgba(255, 255, 255, 0.045);
  --surface-strong:rgba(255, 255, 255, 0.075);
  --border:        rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text:          #eef0f4;
  --text-dim:      #9aa1af;
  --text-faint:    #656d7c;

  --accent-teal:   #2dd8c3;
  --accent-violet: #8b7cf6;
  --accent-gradient: linear-gradient(120deg, #2dd8c3 0%, #6ea8f7 50%, #8b7cf6 100%);

  --success: #34d399;
  --danger:  #f87171;
  --warning: #fbbf24;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

/* Ambient background texture: two soft, static glows. No scroll-jank. */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(45, 216, 195, 0.10), transparent 60%),
    radial-gradient(50% 35% at 100% 20%, rgba(139, 124, 246, 0.10), transparent 60%),
    var(--bg);
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--text);
}

a { color: inherit; }

::selection { background: rgba(45, 216, 195, 0.28); }

/* ---- Focus visibility (accessibility) --------------------------------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ---- Glass surfaces ---------------------------------------------------- */
.glass-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glass);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  overflow: hidden;
}

.glass-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}

/* ---- "Liquid glass" treatment - iOS-style refractive glass -------------
   A brighter, deeper-blurred surface with a soft specular sheen across the
   top-left and a hairline highlight along the top edge, echoing the look
   of Apple's Liquid Glass material. Used on floating/elevated chrome:
   the nav bar, the mobile drawer, and (via .glass-card already) all cards. */
.liquid-glass {
  position: relative;
  background: linear-gradient(165deg, rgba(255,255,255,0.14), rgba(255,255,255,0.035) 55%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 0 24px rgba(255,255,255,0.03),
    0 12px 36px rgba(0,0,0,0.45);
  overflow: hidden;
}
.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 38%);
  opacity: 0.7;
  pointer-events: none;
}
.glass-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 32%);
  opacity: 0.6;
  pointer-events: none;
}

.tool-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.65rem; }

.tool-card .tool-icon {
  width: 2.75rem; height: 2.75rem;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--accent-teal);
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.975rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  user-select: none;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-gradient);
  color: #06110f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 6px 18px rgba(45,216,195,0.22);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: linear-gradient(165deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--border);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); }

.btn-block { width: 100%; }

/* ---- Form fields --------------------------------------------------------- */
.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.field-input, .field-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field-input::placeholder { color: var(--text-faint); }
.field-input:focus, .field-select:focus {
  border-color: var(--accent-teal);
  background: #0d1016;
}
.field-input.field-error { border-color: var(--danger); }
.field-error-msg { color: var(--danger); font-size: 0.8rem; margin-top: 0.35rem; display: none; }
.field-error-msg.show { display: block; }

/* ---- Result panel --------------------------------------------------------- */
.result-panel {
  opacity: 0;
  transform: translateY(8px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.result-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
  max-height: none;
  overflow: visible;
}

.result-stat { display: flex; flex-direction: column; gap: 0.2rem; }
.result-stat .label { font-size: 0.8rem; color: var(--text-dim); }
.result-stat .value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Header / nav (floating glass bar) --------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: max(env(safe-area-inset-top), 14px) 16px 0;
  pointer-events: none; /* only the pill itself is interactive */
}
.site-header .nav-pill {
  pointer-events: auto;
  max-width: 1180px;
  margin-inline: auto;
  height: 64px;
  padding-inline: 1.25rem;
  border-radius: 999px;
  background: linear-gradient(165deg, rgba(20,22,28,0.72), rgba(12,14,19,0.55));
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 10px 30px rgba(0,0,0,0.45),
    0 1px 2px rgba(0,0,0,0.3);
  transition: box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
}
.site-header .nav-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 35%);
  opacity: 0.8;
  pointer-events: none;
}

.nav-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
}
.nav-icon-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-strong); }

.nav-link {
  color: var(--text-dim);
  font-size: 0.925rem;
  font-weight: 500;
  padding: 0.5rem 0.15rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-link:hover, .nav-link.is-active { color: var(--text); border-color: var(--accent-teal); }

/* ---- Mobile off-canvas drawer (animated) -------------------------------- */
.mobile-drawer-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(4,5,7,0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.mobile-drawer-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(100%, 420px);
  padding: max(env(safe-area-inset-top), 18px) 20px max(env(safe-area-inset-bottom), 20px);
  background: linear-gradient(165deg, rgba(16,18,24,0.92), rgba(10,12,16,0.96));
  border-left: 1px solid rgba(255,255,255,0.12);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  border-radius: 0;
}
.mobile-drawer-panel.is-open { transform: translateX(0); }

.mobile-nav-link {
  display: block;
  padding: 0.85rem 0.75rem;
  min-height: 44px;
  border-radius: 12px;
  font-size: 0.975rem;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease;
}
.mobile-nav-link:hover, .mobile-nav-link:active { background: rgba(255,255,255,0.06); color: var(--text); }

@media (min-width: 1024px) {
  .mobile-drawer-backdrop, .mobile-drawer-panel { display: none; }
}

/* ---- Breadcrumbs ------------------------------------------------------------- */
.breadcrumbs { font-size: 0.85rem; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--accent-teal); }

/* ---- FAQ -------------------------------------------------------------------- */
.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  padding: 1.1rem 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .faq-chevron { transition: transform 0.2s ease; color: var(--text-dim); flex-shrink: 0; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-item + .faq-item { border-top: 1px solid var(--border); }
.faq-item p { padding-bottom: 1.1rem; color: var(--text-dim); }

/* ---- Ad slot -------------------------------------------------------------- */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

/* ---- Instant search dropdown ------------------------------------------------ */
[id$="-search-results"] { display: none; }
[id$="-search-results"].is-visible { display: block; }

/* ---- Table (goal planner monthly table) ------------------------------------ */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-dim); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---- Utility --------------------------------------------------------------- */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.container-page { max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.container-narrow { max-width: 860px; margin-inline: auto; padding-inline: 1.25rem; }

/* ---- Mobile refinement --------------------------------------------------- */
@media (max-width: 640px) {
  .container-page, .container-narrow { padding-inline: 1rem; }
  .glass-card { border-radius: var(--radius-md); }
  .tool-card { padding: 1.15rem; }
  h1.font-display, .font-display.text-4xl { font-size: clamp(1.9rem, 8vw, 2.4rem); }
  .btn { padding: 0.8rem 1.3rem; font-size: 0.95rem; }
  .field-input, .field-select { padding: 0.75rem 0.9rem; font-size: 1rem; } /* 16px avoids iOS input zoom */
  .data-table th, .data-table td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
}

/* Ensure every tappable control meets a comfortable minimum touch target */
a.nav-link, .tool-icon, .faq-item summary { min-height: 44px; display: inline-flex; align-items: center; }
.tool-icon { display: flex; }
