/* ==========================================================================
   IFinTechy 2026 Design System
   --------------------------------------------------------------------------
   Evolution, not revolution: keeps the brand's deep-navy + blue + coral
   language and elevates it with a fluid type scale, refined surfaces,
   accessible interactions and first-class dark mode.
   ========================================================================== */

/* ----- Design tokens -------------------------------------------------- */
:root {
  /* Brand */
  --brand-950: #0b1524;
  --brand-900: #0f1b2d;   /* header / footer surface (evolved #2c3e50) */
  --brand-800: #16263d;
  --brand-700: #1f3350;
  --blue-600:  #2563eb;   /* primary action (evolved #3498db) */
  --blue-500:  #3b82f6;
  --blue-400:  #60a5fa;
  --coral-500: #f0564a;   /* accent (evolved #e74c3c) */
  --emerald-500:#10b981;
  --amber-500: #f59e0b;

  /* Light surfaces */
  --bg:            #f7f9fc;
  --surface:       #ffffff;
  --surface-2:     #f1f5f9;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --ink:       #0f1b2d;
  --ink-2:     #334155;
  --ink-3:     #64748b;
  --ink-inverse:#f8fafc;

  --link: var(--blue-600);

  /* Effects */
  --shadow-sm: 0 1px 2px rgb(15 27 45 / .06);
  --shadow-md: 0 6px 16px -4px rgb(15 27 45 / .10);
  --shadow-lg: 0 16px 40px -12px rgb(15 27 45 / .18);
  --ring: 0 0 0 3px rgb(37 99 235 / .35);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Fluid type scale */
  --text-xs:  clamp(.72rem, .70rem + .1vw, .78rem);
  --text-sm:  clamp(.84rem, .82rem + .1vw, .9rem);
  --text-base:clamp(1rem, .98rem + .15vw, 1.0625rem);
  --text-lg:  clamp(1.125rem, 1.08rem + .3vw, 1.25rem);
  --text-xl:  clamp(1.3rem, 1.2rem + .5vw, 1.5rem);
  --text-2xl: clamp(1.6rem, 1.4rem + 1vw, 2rem);
  --text-3xl: clamp(2rem, 1.7rem + 1.6vw, 2.75rem);
  --text-4xl: clamp(2.4rem, 2rem + 2.4vw, 3.5rem);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1180px;
  --header-h: 72px;
  --speed: .22s;
  --ease: cubic-bezier(.4, 0, .2, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #0b1220;
  --surface:       #101a2c;
  --surface-2:     #16233a;
  --border:        #223650;
  --border-strong: #31486a;

  --ink:   #eef3fa;
  --ink-2: #c4d0e2;
  --ink-3: #8ba0bd;

  --link: var(--blue-400);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 6px 16px -4px rgb(0 0 0 / .5);
  --shadow-lg: 0 16px 40px -12px rgb(0 0 0 / .6);

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

img, svg, video { max-width: 100%; height: auto; }
img { border-radius: inherit; }

h1, h2, h3, h4 { line-height: 1.2; color: var(--ink); margin: 0 0 .6em; font-weight: 800; letter-spacing: -.015em; }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
p  { margin: 0 0 1em; color: var(--ink-2); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

::selection { background: rgb(37 99 235 / .25); }

.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  background: var(--blue-600); color: #fff; padding: .7rem 1.2rem;
  border-radius: 0 0 var(--radius-sm) 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

main { min-height: 60vh; }

/* ----- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; font-size: var(--text-sm);
  padding: .7rem 1.35rem; border-radius: var(--radius-full);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease), color var(--speed) var(--ease);
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 4px 14px -4px rgb(37 99 235 / .55); }
.btn-primary:hover { background: var(--blue-500); box-shadow: 0 8px 22px -6px rgb(37 99 235 / .6); }

.btn-accent { background: var(--coral-500); color: #fff; }
.btn-accent:hover { filter: brightness(1.07); }

.btn-outline { border-color: var(--border-strong); color: var(--ink); background: transparent; }
.btn-outline:hover { border-color: var(--blue-500); color: var(--blue-600); background: var(--surface); }

.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-lg { padding: .95rem 1.9rem; font-size: var(--text-base); }
.btn-sm { padding: .45rem .95rem; font-size: var(--text-xs); }
.btn-block { width: 100%; }

/* ----- Badges / chips ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em;
  padding: .3rem .75rem; border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--blue-600) 12%, transparent);
  color: var(--blue-600);
}
[data-theme="dark"] .badge { color: var(--blue-400); }
.badge-accent { background: color-mix(in srgb, var(--coral-500) 14%, transparent); color: var(--coral-500); }
.badge-soft { background: var(--surface-2); color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.05rem; border-radius: var(--radius-full);
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--ink-2); font-weight: 600; font-size: var(--text-sm);
  transition: all var(--speed) var(--ease); text-decoration: none !important;
}
.chip:hover { border-color: var(--blue-500); color: var(--blue-600); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ----- Header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--brand-900) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgb(255 255 255 / .08);
  transition: box-shadow var(--speed) var(--ease);
}
.site-header.is-scrolled { box-shadow: var(--shadow-md); }

.header-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: 1.45rem; font-weight: 800; color: #fff !important;
  text-decoration: none !important; letter-spacing: -.02em; flex-shrink: 0;
}
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-500), var(--coral-500));
  color: #fff; font-size: 1.05rem; box-shadow: 0 4px 12px -2px rgb(37 99 235 / .5);
}
.logo-text span { color: var(--blue-400); }

.nav-desktop { display: flex; align-items: center; gap: .25rem; margin-left: .5rem; }

.nav-link {
  display: inline-flex; align-items: center; gap: .45rem;
  color: rgb(255 255 255 / .82); font-weight: 600; font-size: var(--text-sm);
  padding: .55rem .9rem; border-radius: var(--radius-sm);
  text-decoration: none !important; transition: all var(--speed) var(--ease);
  background: transparent; border: 0; cursor: pointer; font-family: inherit;
}
.nav-link:hover, .nav-link[aria-expanded="true"] { color: #fff; background: rgb(255 255 255 / .10); }
.nav-link .fa-chevron-down { font-size: .6rem; transition: transform var(--speed) var(--ease); }
.nav-link[aria-expanded="true"] .fa-chevron-down { transform: rotate(180deg); }

.nav-item { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .5rem; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: all var(--speed) var(--ease); z-index: 1001;
}
.nav-item.open .dropdown-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .8rem; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 600; font-size: var(--text-sm);
  text-decoration: none !important;
}
.dropdown-link:hover { background: var(--surface-2); color: var(--blue-600); }
.dropdown-link i { width: 18px; text-align: center; color: var(--ink-3); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.header-search { position: relative; }
.header-search input {
  width: clamp(160px, 22vw, 260px);
  padding: .55rem 2.5rem .55rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid rgb(255 255 255 / .18);
  background: rgb(255 255 255 / .10); color: #fff;
  font: inherit; font-size: var(--text-sm);
  transition: all var(--speed) var(--ease);
}
.header-search input::placeholder { color: rgb(255 255 255 / .55); }
.header-search input:focus { background: rgb(255 255 255 / .16); border-color: var(--blue-400); outline: none; }
.header-search button {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: rgb(255 255 255 / .75); cursor: pointer;
  padding: .4rem .55rem; border-radius: var(--radius-full);
}
.header-search button:hover { color: #fff; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-full); border: 1px solid rgb(255 255 255 / .18);
  background: rgb(255 255 255 / .08); color: #fff; cursor: pointer;
  font-size: .95rem; transition: all var(--speed) var(--ease);
}
.icon-btn:hover { background: rgb(255 255 255 / .16); }

.nav-toggle { display: none; }

/* Mobile drawer */
.mobile-nav {
  display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 999;
  background: var(--bg); overflow-y: auto; padding: 1.25rem;
}
.mobile-nav.open { display: block; }
.mobile-nav .mobile-group { border-bottom: 1px solid var(--border); padding: .4rem 0; }
.mobile-nav a, .mobile-nav .mobile-heading {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem .5rem; font-weight: 700; color: var(--ink);
  text-decoration: none !important; border-radius: var(--radius-sm);
}
.mobile-nav a:hover { background: var(--surface-2); }
.mobile-nav .mobile-sub a { font-weight: 600; color: var(--ink-2); padding-left: 2.2rem; }
.mobile-nav .mobile-heading { color: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; }
.mobile-search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.mobile-search input {
  flex: 1; padding: .75rem 1rem; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font: inherit;
}

@media (max-width: 992px) {
  .nav-desktop, .header-search { display: none; }
  .nav-toggle { display: inline-grid; }
}

/* ----- Hero --------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(1000px 520px at 85% -10%, rgb(37 99 235 / .5), transparent 60%),
    radial-gradient(760px 420px at -10% 110%, rgb(240 86 74 / .35), transparent 60%),
    linear-gradient(160deg, var(--brand-950), var(--brand-800));
  padding: clamp(4rem, 9vw, 7rem) 0;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgb(255 255 255 / .07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 75%, transparent);
}
.hero-inner { position: relative; z-index: 1; max-width: 780px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue-400); background: rgb(96 165 250 / .12);
  padding: .45rem 1rem; border-radius: var(--radius-full);
  border: 1px solid rgb(96 165 250 / .3); margin-bottom: 1.4rem;
}
.hero h1 { color: #fff; font-size: var(--text-4xl); margin-bottom: 1rem; }
.hero h1 .accent { background: linear-gradient(90deg, var(--blue-400), var(--coral-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: rgb(255 255 255 / .78); font-size: var(--text-lg); max-width: 620px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 2.2rem; margin-top: 2.6rem; }
.hero-stat b { display: block; font-size: var(--text-2xl); color: #fff; }
.hero-stat span { color: rgb(255 255 255 / .6); font-size: var(--text-sm); }

/* ----- Sections ------------------------------------------------------------ */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2.2rem; flex-wrap: wrap; }
.section-head .kicker { color: var(--blue-600); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: var(--text-xs); margin-bottom: .4rem; display: block; }
.section-head h2 { margin: 0; }
.section-head p { margin: .5rem 0 0; color: var(--ink-3); max-width: 560px; }

/* ----- Grids ------------------------------------------------------------ */
.grid { display: grid; gap: 1.6rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

/* ----- Cards ------------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

.post-card { display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.post-card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); border-radius: 0; }
.post-card:hover .post-card-media img { transform: scale(1.05); }
.post-card-media .badge { position: absolute; top: .9rem; left: .9rem; background: rgb(15 27 45 / .78); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.post-card-media .media-fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 2.2rem; color: var(--blue-500);
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue-600) 14%, var(--surface-2)), color-mix(in srgb, var(--coral-500) 10%, var(--surface-2)));
}
.post-card-body { padding: 1.3rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.post-card h3 { font-size: var(--text-lg); margin: 0; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--blue-600); text-decoration: none; }
.post-card .excerpt { color: var(--ink-3); font-size: var(--text-sm); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: .9rem; color: var(--ink-3); font-size: var(--text-xs); margin-top: auto; padding-top: .6rem; }
.post-meta i { margin-right: .3rem; }

.post-card-featured { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .post-card-featured { display: grid; grid-template-columns: 1.15fr 1fr; }
  .post-card-featured .post-card-media { aspect-ratio: auto; min-height: 320px; }
  .post-card-featured .post-card-body { padding: 2rem 2.2rem; justify-content: center; }
  .post-card-featured h3 { font-size: var(--text-2xl); }
  .post-card-featured .excerpt { -webkit-line-clamp: 3; font-size: var(--text-base); }
}

/* Tool cards */
.tool-card { padding: 1.5rem; display: flex; flex-direction: column; gap: .7rem; height: 100%; text-decoration: none !important; }
.tool-card-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
  box-shadow: 0 6px 16px -6px rgb(37 99 235 / .6);
}
.tool-card:nth-child(3n) .tool-card-icon { background: linear-gradient(135deg, var(--coral-500), #f98a76); box-shadow: 0 6px 16px -6px rgb(240 86 74 / .55); }
.tool-card:nth-child(3n+2) .tool-card-icon { background: linear-gradient(135deg, var(--emerald-500), #34d399); box-shadow: 0 6px 16px -6px rgb(16 185 129 / .5); }
.tool-card h3 { font-size: var(--text-lg); margin: 0; color: var(--ink); }
.tool-card p { margin: 0; color: var(--ink-3); font-size: var(--text-sm); flex: 1; }
.tool-card .tool-cta { color: var(--blue-600); font-weight: 700; font-size: var(--text-sm); }
.tool-card:hover .tool-cta { text-decoration: underline; text-underline-offset: 3px; }

/* Category cards */
.category-card { padding: 1.35rem; display: flex; align-items: center; gap: 1rem; text-decoration: none !important; }
.category-card .cat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.35rem; background: var(--surface-2); flex-shrink: 0;
}
.category-card b { color: var(--ink); display: block; }
.category-card span { color: var(--ink-3); font-size: var(--text-xs); }

/* ----- Blog listing layout -------------------------------------------- */
.listing-layout { display: grid; gap: 2.2rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .listing-layout { grid-template-columns: minmax(0, 1fr) 320px; } }

/* Post grids inside the listing layout render two-up. The generic .grid-2
   minimum (420px) cannot fit twice beside the 320px sidebar, which was
   collapsing blog/category listings to one oversized card per row. */
.listing-layout .grid-2 { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .listing-layout .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sidebar { display: flex; flex-direction: column; gap: 1.4rem; }
.sidebar-card { padding: 1.4rem; }
.sidebar-card h3 { font-size: var(--text-base); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-bottom: 1rem; }
.sidebar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.sidebar-list a {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; font-size: var(--text-sm);
  text-decoration: none !important;
}
.sidebar-list a:hover { background: var(--surface-2); color: var(--blue-600); }
.sidebar-list .count { color: var(--ink-3); font-size: var(--text-xs); background: var(--surface-2); border-radius: var(--radius-full); padding: .1rem .55rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }

.page-head { padding: clamp(2.2rem, 5vw, 3.4rem) 0 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; font-size: var(--text-sm); color: var(--ink-3); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--blue-600); }
.breadcrumbs .sep { opacity: .5; }

/* ----- Pagination -------------------------------------------------------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: .45rem; margin: 2.6rem 0 .6rem; flex-wrap: wrap; }
.pagination a, .pagination .page-current, .pagination .page-gap {
  min-width: 42px; height: 42px; padding: 0 .8rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-weight: 700; font-size: var(--text-sm);
  border: 1.5px solid var(--border); color: var(--ink-2); background: var(--surface);
  text-decoration: none !important;
}
.pagination a:hover { border-color: var(--blue-500); color: var(--blue-600); }
.pagination .page-current { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.pagination .page-gap { border: 0; background: none; }

/* ----- Alerts / messages ------------------------------------------------ */
.messages { position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 1200; display: flex; flex-direction: column; gap: .6rem; max-width: min(92vw, 420px); }
.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue-600);
  color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .9rem 1.1rem; font-size: var(--text-sm); font-weight: 600;
  animation: slide-in .35s var(--ease);
}
.alert-success { border-left-color: var(--emerald-500); }
.alert-error   { border-left-color: var(--coral-500); }
.alert-warning { border-left-color: var(--amber-500); }
.alert .close { margin-left: auto; background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 1rem; }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }

/* ----- Forms -------------------------------------------------------------- */
.field { margin-bottom: 1.15rem; }
.field label { display: flex; justify-content: space-between; font-weight: 700; font-size: var(--text-sm); color: var(--ink); margin-bottom: .45rem; }
.field label .hint { color: var(--ink-3); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: .7rem .95rem;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
.textarea { min-height: 140px; resize: vertical; }
.input-group { position: relative; }
.input-group .prefix, .input-group .suffix {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-weight: 700; font-size: var(--text-sm); pointer-events: none;
}
.input-group .prefix { left: .95rem; }
.input-group .suffix { right: .95rem; }
.input-group .has-prefix { padding-left: 2.3rem; }
.input-group .has-suffix { padding-right: 3.3rem; }

input[type="range"] { width: 100%; accent-color: var(--blue-600); height: 6px; cursor: pointer; }

/* ----- Calculator layout -------------------------------------------------- */
.tool-hero { background: linear-gradient(160deg, var(--brand-950), var(--brand-800)); color: #fff; padding: clamp(2.6rem, 6vw, 4rem) 0; }
.tool-hero .breadcrumbs, .tool-hero .breadcrumbs a { color: rgb(255 255 255 / .65); }
.tool-hero h1 { color: #fff; display: flex; align-items: center; gap: .9rem; margin-bottom: .6rem; }
.tool-hero h1 i { font-size: .8em; color: var(--blue-400); }
.tool-hero p { color: rgb(255 255 255 / .78); max-width: 720px; margin: 0; }

.calc-layout { display: grid; gap: 1.8rem; align-items: start; grid-template-columns: 1fr; margin-top: -2.2rem; position: relative; z-index: 2; }
@media (min-width: 960px) { .calc-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }

.calc-card { padding: 1.7rem; }
.calc-card h2 { font-size: var(--text-lg); margin-bottom: 1.3rem; display: flex; align-items: center; gap: .6rem; }
.calc-card h2 i { color: var(--blue-600); }

.results-card { position: sticky; top: calc(var(--header-h) + 20px); padding: 1.7rem; }
.result-hero { text-align: center; padding: 1.2rem 1rem 1.4rem; border-radius: var(--radius); background: linear-gradient(150deg, color-mix(in srgb, var(--blue-600) 10%, var(--surface)), color-mix(in srgb, var(--coral-500) 7%, var(--surface))); border: 1px solid var(--border); margin-bottom: 1.2rem; }
.result-hero .label { color: var(--ink-3); font-size: var(--text-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.result-hero .value { font-size: var(--text-3xl); font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; margin-top: .3rem; word-break: break-word; }
.result-hero .sub { color: var(--ink-3); font-size: var(--text-sm); margin-top: .35rem; }

.result-rows { display: flex; flex-direction: column; }
.result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .75rem .2rem; border-bottom: 1px dashed var(--border); font-size: var(--text-sm); }
.result-row:last-child { border-bottom: 0; }
.result-row .k { color: var(--ink-3); font-weight: 600; }
.result-row .v { color: var(--ink); font-weight: 800; text-align: right; }
.result-row .v.pos { color: var(--emerald-500); }
.result-row .v.neg { color: var(--coral-500); }

.stack-bar { display: flex; height: 14px; border-radius: var(--radius-full); overflow: hidden; margin: 1rem 0 .5rem; background: var(--surface-2); }
.stack-bar > span { display: block; height: 100%; transition: width .4s var(--ease); }
.stack-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: var(--text-xs); color: var(--ink-3); }
.stack-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; vertical-align: baseline; }
.c-principal { background: var(--blue-600); }
.c-interest { background: var(--coral-500); }
.c-growth { background: var(--emerald-500); }

.calc-note { font-size: var(--text-xs); color: var(--ink-3); margin-top: 1rem; }

/* ----- Prose (article-style content) ------------------------------------ */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; }
.prose ul, .prose ol { color: var(--ink-2); padding-left: 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .1em .4em; }
.prose blockquote { border-left: 4px solid var(--blue-500); margin: 1.4rem 0; padding: .4rem 0 .4rem 1.2rem; color: var(--ink-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.formula-box {
  font-family: var(--font-mono); font-size: var(--text-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; color: var(--ink-2);
  overflow-x: auto;
}

/* FAQ accordion */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: .8rem; overflow: hidden; }
.faq-item summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.05rem 1.3rem; font-weight: 700; color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "\2b"; font-weight: 800; color: var(--blue-600); transition: transform var(--speed) var(--ease); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-body { padding: 0 1.3rem 1.15rem; color: var(--ink-2); font-size: var(--text-sm); }

/* Steps */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.steps li { counter-increment: step; display: flex; gap: 1rem; color: var(--ink-2); }
.steps li::before {
  content: counter(step); flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--blue-600) 12%, transparent); color: var(--blue-600); font-weight: 800;
}

/* ----- Newsletter block --------------------------------------------------- */
.newsletter-box { display: flex; gap: .6rem; flex-wrap: wrap; }
.newsletter-box input { flex: 1 1 200px; }
.newsletter-note { font-size: var(--text-xs); color: var(--ink-3); margin-top: .55rem; }

/* ----- Footer ------------------------------------------------------------- */
.site-footer { background: var(--brand-950); color: rgb(255 255 255 / .72); margin-top: clamp(3rem, 7vw, 5rem); }
.footer-grid { display: grid; gap: 2.4rem; padding: clamp(2.6rem, 6vw, 4rem) 0 2.2rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.4fr; } }
.site-footer h3 { color: #fff; font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 1.1rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.footer-links a { color: rgb(255 255 255 / .68); font-size: var(--text-sm); }
.footer-links a:hover { color: #fff; }
.footer-about p { color: rgb(255 255 255 / .6); font-size: var(--text-sm); max-width: 34ch; }
.footer-social { display: flex; gap: .6rem; margin-top: 1rem; }
.footer-bottom {
  border-top: 1px solid rgb(255 255 255 / .1);
  padding: 1.4rem 0; display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: center; font-size: var(--text-xs); color: rgb(255 255 255 / .5);
}
.footer-bottom a { color: rgb(255 255 255 / .6); }
.footer-bottom a:hover { color: #fff; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-footer .input { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .18); color: #fff; }
.site-footer .input::placeholder { color: rgb(255 255 255 / .45); }
.footer-disclaimer { font-size: var(--text-xs); color: rgb(255 255 255 / .42); padding-bottom: 1.6rem; max-width: 900px; }

/* Back to top */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 46px; height: 46px; border-radius: var(--radius-full); border: 0; cursor: pointer;
  background: var(--blue-600); color: #fff; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all var(--speed) var(--ease);
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { background: var(--blue-500); }

/* ----- Utilities ---------------------------------------------------------- */
.text-center { text-align: center; }
.muted { color: var(--ink-3); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.75rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 1.5rem; }
.empty-state i { font-size: 2.6rem; color: var(--ink-3); opacity: .6; margin-bottom: 1rem; display: block; }

/* ----- Motion & a11y ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .site-footer, .back-to-top, .messages, .sidebar { display: none !important; }
}

/* Signed result colors in the hero stat (e.g. investment gain/loss) */
.result-hero .value.pos { color: var(--emerald-500); }
.result-hero .value.neg { color: var(--coral-500); }

/* Error pages */
.error-page { min-height: 62vh; display: grid; place-items: center; text-align: center; padding: 3rem 1rem; }
.error-code {
  font-size: clamp(5rem, 18vw, 9rem); font-weight: 800; line-height: 1;
  background: linear-gradient(120deg, var(--blue-500), var(--coral-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* =====================================================================
   Tools v2 — premium toolkit additions
   ===================================================================== */

/* ----- Toolbar (share / copy / print / reset) ----- */
.tool-toolbar { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; margin: 0 0 1rem; }
.tbtn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: var(--text-sm);
  font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s, transform .1s;
}
.tbtn:hover { border-color: var(--brand); color: var(--brand); }
.tbtn:active { transform: translateY(1px); }
.tbtn:disabled { opacity: .7; cursor: default; }
.tbtn-ghost { background: transparent; }

/* ----- Chart card ----- */
.chart-card { padding: 1.4rem 1.5rem 1.1rem; margin-top: 1.6rem; }
.chart-title { font-size: var(--text-base); color: var(--text-2); margin: 0 0 .9rem; display: flex; gap: .5rem; align-items: center; }
.chart-stage { position: relative; }
.chart-stage canvas { width: 100%; height: 260px; display: block; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(2, 8, 23, .12);
  padding: .55rem .7rem; font-size: var(--text-xs); line-height: 1.5; min-width: 150px;
}
.chart-tip b { display: block; margin-bottom: .2rem; color: var(--text-1); }
.chart-tip span, .chart-legend span { display: flex; align-items: center; gap: .45rem; color: var(--text-2); }
.chart-tip i, .chart-legend i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.chart-legend {
  position: static; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; justify-content: center;
  border: 0; box-shadow: none; background: transparent; padding: .8rem 0 0; font-size: var(--text-sm);
}
.chart-hint { margin: .55rem 0 0; font-size: var(--text-xs); color: var(--text-3); text-align: center; }

/* ----- Advanced options ----- */
details.adv { border: 1px dashed var(--border); border-radius: 12px; padding: .35rem .9rem; margin: 1.1rem 0 .4rem; }
details.adv summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: var(--text-sm); color: var(--text-2); padding: .5rem 0;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::after { content: "\002B"; margin-left: auto; font-size: 1.1rem; color: var(--text-3); }
details.adv[open] summary::after { content: "\2212"; }
details.adv[open] { border-style: solid; background: var(--surface-2, rgba(148,163,184,.06)); }
details.adv .field { margin-top: .9rem; }
.rows-subhead {
  margin: 1rem 0 .35rem; font-size: var(--text-xs); font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); display: flex; gap: .5rem; align-items: baseline;
}
.rows-subhead.in-form { margin-top: 1.2rem; }
.rows-subhead .hint { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ----- Validation ----- */
.input.input-error { border-color: var(--coral, #f0645c); box-shadow: 0 0 0 3px rgba(240, 100, 92, .15); }

/* ----- Dynamic rows (debts / net worth) ----- */
.dyn-head { display: none; }
.dyn-row { display: grid; gap: .5rem; margin-bottom: .55rem; align-items: center; }
.dyn-row .input { min-width: 0; }
.row-2 { grid-template-columns: 1.4fr 1fr 34px; }
.row-3 { grid-template-columns: 1.4fr 1fr 1fr 34px; }
.row-4 { grid-template-columns: 1.3fr 1fr .8fr .9fr 34px; }
@media (min-width: 700px) {
  .dyn-head { display: grid; gap: .5rem; font-size: var(--text-xs); font-weight: 700; color: var(--text-3); margin-bottom: .35rem; }
}
.row-remove {
  width: 34px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--text-3); font-size: 1.05rem; cursor: pointer; line-height: 1;
}
.row-remove:hover { color: var(--coral, #f0645c); border-color: var(--coral, #f0645c); }
.row-add {
  display: inline-flex; align-items: center; gap: .45rem; margin: .2rem 0 .4rem;
  padding: .5rem .8rem; border-radius: 10px; border: 1px dashed var(--border);
  background: transparent; color: var(--text-2); font-size: var(--text-sm); font-weight: 600; cursor: pointer;
}
.row-add:hover { border-color: var(--brand); color: var(--brand); }
.calc-card h2.mt { margin-top: 1.6rem; }
.result-row.wrap .v { white-space: normal; text-align: right; max-width: 60%; font-size: var(--text-sm); }
.result-row.warn .v { color: var(--coral, #f0645c); white-space: normal; text-align: right; max-width: 75%; font-size: var(--text-sm); }
.result-hero .value-sm { font-size: clamp(1.05rem, 2.6vw, 1.35rem); line-height: 1.35; }

/* ----- Scenario mini bars (affordability) ----- */
.mini-bars { margin-top: 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.mini-bar { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: .6rem; }
.mb-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-3); }
.mb-track { height: 10px; border-radius: 999px; background: var(--surface-2, rgba(148,163,184,.15)); overflow: hidden; }
.mb-fill { display: block; height: 100%; border-radius: inherit; transition: width .35s ease; }

/* ----- Hub: search, chips, strips ----- */
.hub-controls { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; margin-bottom: 1.6rem; }
.hub-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.hub-search i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: .85rem; }
.hub-search .input { padding-left: 2.3rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  padding: .42rem .85rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-link { text-decoration: none; }
.recent-strip { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: 0 0 1.8rem; }
.recent-strip .kicker { display: inline-flex; gap: .45rem; align-items: center; margin: 0; }
.recent-links { display: flex; flex-wrap: wrap; gap: .45rem; }
.featured-grid .tool-card { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }

/* ----- Print: turn a tool page into a clean report ----- */
@media print {
  .site-header, .site-footer, .tool-toolbar, .back-to-top, .breadcrumbs,
  .tool-related, .tool-faq, .newsletter, .rail-promo, .chart-hint, .row-add, .row-remove,
  select[data-currency], label[for="currency-select"] { display: none !important; }
  body { background: #fff; }
  .tool-hero { padding: 0 0 .5rem; background: none; color: #000; }
  .calc-layout { grid-template-columns: 1fr !important; gap: 1rem; }
  .card { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  .chart-card { page-break-inside: avoid; }
  a[href]::after { content: "" !important; }
}