/* ==========================================================
   Calculator Worlds - styles
   ========================================================== */

:root {
  --indigo: #5b5ff0;
  --indigo-dark: #4a4dd6;
  --indigo-soft: #eef0ff;
  --navy: #14204f;
  --navy-2: #1b2a63;
  --text: #1f2540;
  --muted: #5d6482;
  --border: #e4e7f5;
  --bg: #f7f8fe;
  --white: #ffffff;
  --green: #35b46f;
  --orange: #f5821f;
  --pink: #ee4d6c;
  --blue: #3b8cf0;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(70, 80, 160, 0.08);
  --shadow-sm: 0 3px 12px rgba(70, 80, 160, 0.07);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -5%, #ece9ff 0%, transparent 60%),
    radial-gradient(700px 400px at 0% 20%, #eef3ff 0%, transparent 60%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
button, input { font-family: inherit; }
svg { display: block; }

.container { width: min(1280px, 100% - 48px); margin-inline: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 15px; padding: 12px 28px;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.btn--primary { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px rgba(91, 95, 240, .3); }
.btn--primary:hover { background: var(--indigo-dark); transform: translateY(-1px); }

.panel {
  background: rgba(255, 255, 255, .85);
  border: 1px solid #eef0fb;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.section-title { font-size: 32px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #f0f1fa;
}
.header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 84px;
}

.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo__text { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; }
.logo__text span { color: var(--indigo); }

.main-nav { display: flex; align-items: center; flex: 1; justify-content: space-between; gap: 24px; }
.main-nav > ul { display: flex; align-items: center; gap: 40px; margin-inline: auto; }
.main-nav a { font-weight: 500; font-size: 16px; color: var(--navy); display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; }
.main-nav a:hover, .main-nav a.is-active { color: var(--indigo); }
.chev { font-size: 14px; display: inline-flex; }

.has-dropdown { position: relative; }
.dropdown {
  position: absolute; top: 100%; left: -12px; min-width: 190px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: all .18s ease;
}
.dropdown a { display: block; padding: 10px 14px; border-radius: 10px; font-size: 15px; }
.dropdown a:hover { background: var(--indigo-soft); }
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: none; }

.header-search {
  display: flex; align-items: center; gap: 10px;
  width: 300px; height: 52px; padding: 0 16px;
  background: #fff; border: 2px solid var(--border); border-radius: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.header-search:focus-within { border-color: #b9bcf7; box-shadow: 0 0 0 4px rgba(91, 95, 240, .08); }
.header-search__icon { color: #8b90b3; font-size: 20px; display: inline-flex; }
.header-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.header-search input::placeholder { color: #9aa0c0; }

.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--navy); margin: 5px 0; border-radius: 2px; transition: .2s; }

/* ---------------- Hero ---------------- */
.hero { padding: 48px 0 24px; }
.hero__inner { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 40px; padding-inline: 24px; }
.hero__text h1 { font-size: clamp(40px, 5.2vw, 66px); font-weight: 800; color: var(--navy); letter-spacing: -.03em; line-height: 1.08; }
.hero__text > p { margin-top: 28px; font-size: 19px; line-height: 1.65; color: #1f2749; max-width: 640px; }

.hero-search {
  margin-top: 32px; display: flex; align-items: center; gap: 10px;
  max-width: 640px; padding: 8px 8px 8px 20px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.hero-search__icon { color: #8b90b3; font-size: 20px; display: inline-flex; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 12px 0; color: var(--text); }
.hero-search input::placeholder { color: #9aa0c0; }

.popular-searches { margin-top: 22px; }
.popular-searches__label { font-size: 14px; font-weight: 500; color: var(--navy); }
.popular-searches ul { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.chip {
  display: inline-block; padding: 8px 20px; font-size: 14px; color: var(--navy);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  transition: all .2s;
}
.chip:hover { background: var(--indigo-soft); border-color: #c6c9fa; color: var(--indigo); }

.hero__art { display: flex; justify-content: center; }
.hero__art img { width: 100%; max-width: 560px; animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------------- Category cards ---------------- */
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 16px; }
.category-card {
  position: relative; display: flex; gap: 18px; align-items: flex-start;
  background: #fff; border: 1px solid #eef0fb; border-radius: 18px;
  padding: 28px 24px 24px; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.category-card__icon {
  flex: none; width: 60px; height: 60px; border-radius: 16px; color: #fff;
  display: grid; place-items: center; font-size: 28px;
}
.category-card__icon--indigo { background: linear-gradient(135deg, #7b7ff5, #5258e6); }
.category-card__icon--green { background: linear-gradient(135deg, #4cc783, #2fa968); }
.category-card__icon--orange { background: linear-gradient(135deg, #ffa043, #f27b13); }
.category-card__icon--pink { background: linear-gradient(135deg, #f46a85, #e6405f); }
.category-card__body { display: flex; flex-direction: column; gap: 6px; padding-bottom: 36px; }
.category-card__title { font-size: 17px; font-weight: 700; color: var(--navy); }
.category-card__text { font-size: 14px; color: var(--muted); line-height: 1.6; }
.category-card__arrow {
  position: absolute; right: 22px; bottom: 18px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px; color: var(--navy);
  background: #fff; border: 1px solid #d9dcf7;
  transition: background .2s, color .2s;
}
.category-card:hover .category-card__arrow { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* ---------------- Calculator section ---------------- */
.calc-section { margin-top: 40px; }
.tool-search {
  display: flex; align-items: center; margin-top: 24px;
  background: #fff; border: 2px solid var(--border); border-radius: 14px; height: 58px; padding: 0 8px 0 24px;
  transition: border-color .2s, box-shadow .2s;
}
.tool-search:focus-within { border-color: #b9bcf7; box-shadow: 0 0 0 4px rgba(91, 95, 240, .08); }
.tool-search input { flex: 1; border: 0; outline: 0; font-size: 16px; background: transparent; color: var(--text); }
.tool-search input::placeholder { color: #9aa0c0; }
.tool-search__btn { border: 0; background: none; cursor: pointer; font-size: 22px; color: #7c82a8; padding: 8px 12px; border-left: 1px solid var(--border); display: inline-flex; }

.calc-layout { display: grid; grid-template-columns: 340px 1fr; gap: 40px; margin-top: 36px; align-items: start; }
.calc-info h3 { font-size: 24px; font-weight: 700; color: var(--navy); }
.underline { display: block; width: 52px; height: 3px; border-radius: 3px; background: var(--indigo); margin: 10px 0 18px; }
.calc-info p { font-size: 16px; color: #2c3358; line-height: 1.7; }
.calc-info__art { margin-top: 26px; max-width: 300px; }

.calc {
  background: #fff; border: 1px solid #eef0fb; border-radius: 16px;
  padding: 0 0 12px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.calc__display {
  background: var(--navy-2); color: #fff; text-align: right;
  border-radius: 8px; margin: 0; padding: 10px 24px; min-height: 72px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  overflow: hidden;
}
.calc__expr { font-size: 14px; color: #aab2e0; min-height: 18px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.calc__expr::-webkit-scrollbar { display: none; }
.calc__result { font-size: 34px; font-weight: 500; line-height: 1.15; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.calc__result::-webkit-scrollbar { display: none; }

.calc__keys {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; padding: 14px 12px 4px;
}
.key {
  height: 56px; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 17px; font-weight: 500; color: var(--navy);
  background: #eef0f9; box-shadow: inset 0 -2px 0 rgba(20, 32, 79, .04);
  transition: transform .08s, background .15s, filter .15s;
  user-select: none;
}
.key sup { font-size: .62em; margin-left: 1px; }
.key:hover { filter: brightness(.96); }
.key:active { transform: scale(.95); }
.key:focus-visible { outline: 3px solid rgba(91, 95, 240, .45); outline-offset: 1px; }
.key--n { background: #f5f6fc; font-weight: 700; }
.key--o { background: #eef0f9; font-size: 20px; }
.key--d { background: var(--navy-2); color: #fff; font-weight: 600; }
.key--e { background: var(--indigo); color: #fff; font-size: 22px; font-weight: 600; }
.key--d:hover, .key--e:hover { filter: brightness(1.12); }

.calc__angle {
  grid-column: span 2; display: flex; align-items: center; justify-content: center; gap: 18px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; height: 56px; font-size: 15px; color: var(--muted);
}
.calc__angle label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.calc__angle input { position: absolute; opacity: 0; pointer-events: none; }
.calc__angle .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #b8bde0; display: inline-block; position: relative; }
.calc__angle input:checked + .radio { border-color: var(--indigo); }
.calc__angle input:checked + .radio::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--indigo); }
.calc__angle input:checked ~ * { color: var(--navy); }
.calc__angle label:has(input:checked) { color: var(--navy); }
.calc__angle input:focus-visible + .radio { outline: 3px solid rgba(91, 95, 240, .45); outline-offset: 2px; }

.tool-page-calc { max-width: 980px; margin-top: 24px; }

/* ---------------- Percentage calculator ---------------- */
.pct-tool { max-width: 720px; margin-top: 20px; }
.pct-note { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.pct-heading { font-size: 18px; font-weight: 700; color: var(--navy); margin: 28px 0 12px; }
.pct-box {
  background: var(--indigo-soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 8px; font-size: 14px; color: var(--navy);
}
.pct-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pct-row:has(.field) { align-items: flex-start; }
.pct-input { flex: 0 1 130px; min-width: 90px; position: relative; display: block; }
.pct-box .field__input { height: 42px; padding: 0 12px; font-size: 14px; }
.pct-box input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.pct-box input[type="number"]::-webkit-inner-spin-button,
.pct-box input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pct-input--percent input { padding-right: 28px; }
.pct-input--percent::after {
  content: '%'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.pct-box .key { height: 42px; padding: 0 16px; font-size: 14px; font-weight: 600; }
.pct-box .key:not(.key--e) { background: var(--border); }
.pct-actions { display: flex; gap: 8px; margin-top: 12px; }
.pct-row__action { margin-left: auto; }
.pct-result { margin-top: 12px; font-size: 16px; font-weight: 700; color: var(--indigo-dark); overflow-wrap: anywhere; }
.pct-result.is-error { color: var(--pink); font-weight: 500; }

/* ---------------- Age calculator ---------------- */
.tool-calc { padding: 0; }
.tool-calc .calc__result, .tool-calc .calc__expr { white-space: normal; overflow-wrap: anywhere; }
#ageTool { max-width: 980px; margin-top: 24px; }
.tool-calc__body { display: flex; flex-direction: column; gap: 16px; padding: 18px 16px 16px; }
.tool-calc__clear { width: 100%; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 14px; font-weight: 500; color: var(--muted); }
.field__input {
  width: 100%; height: 52px; padding: 0 14px;
  background: #fff; border: 2px solid var(--border); border-radius: 10px; outline: 0;
  font-size: 16px; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field__input:focus { border-color: #b9bcf7; box-shadow: 0 0 0 4px rgba(91, 95, 240, .08); }
.field__input::placeholder { color: #9aa0c0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.stat { background: #f5f6fc; border-radius: 10px; padding: 12px 14px; }
.stat dt { font-size: 13px; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: var(--navy); }

/* ---------------- Popular tools ---------------- */
.popular { margin-top: 40px; padding: 28px 24px 32px; }
.popular__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.popular .section-title { font-size: 28px; }
.view-all { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--navy); }
.view-all svg { color: var(--indigo); font-size: 18px; }
.view-all:hover { color: var(--indigo); }

.tool-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.tool-card {
  --c: var(--indigo); --c-soft: #eef0ff;
  display: flex; align-items: center; gap: 14px; padding: 16px 14px;
  background: #fff; border: 1px solid color-mix(in srgb, var(--c) 22%, white); border-radius: 14px;
  transition: transform .2s, box-shadow .2s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tool-card--blue { --c: var(--blue); --c-soft: #e8f2ff; }
.tool-card--green { --c: var(--green); --c-soft: #e5f7ee; }
.tool-card--orange { --c: var(--orange); --c-soft: #fff0e2; }
.tool-card--indigo { --c: var(--indigo); --c-soft: #eceeff; }
.tool-card__icon {
  flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--c-soft); color: var(--c);
  display: grid; place-items: center; font-size: 26px;
}
.tool-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-card__name { font-size: 15px; font-weight: 600; color: var(--navy); line-height: 1.3; }
.tool-card__cat { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c); margin-top: 2px; }
.tool-card.is-hidden { display: none; }
.no-results { margin-top: 16px; color: var(--muted); }

/* ---------------- Inner pages ---------------- */
.page-section { padding: 40px 0 20px; }
.page-title { font-size: 36px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.page-section .tool-grid { margin-top: 24px; }
.muted { color: var(--muted); font-size: 17px; margin-bottom: 20px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a:hover { color: var(--indigo); }

/* ---------------- Footer ---------------- */
.site-footer { margin-top: 56px; position: relative; }
.footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 40px; padding: 24px 24px 40px; }
.footer__brand p { margin: 18px 0 20px; font-size: 15px; color: #2c3358; line-height: 1.75; max-width: 400px; }
.social { display: flex; gap: 12px; }
.social a {
  width: 42px; height: 42px; border-radius: 50%; background: #e9ebfb; color: var(--navy);
  display: grid; place-items: center; font-size: 19px; transition: all .2s;
}
.social a:hover { background: var(--indigo); color: #fff; transform: translateY(-2px); }
.footer__col h4 { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 22px; }
.footer__col li { margin-bottom: 18px; font-size: 15px; color: #2c3358; }
.footer__col a:hover { color: var(--indigo); }
.contact-line { display: flex; align-items: center; gap: 10px; }
.contact-line__icon { color: var(--indigo); font-size: 18px; display: inline-flex; }

.footer__bottom { border-top: 1px solid #e8eaf7; }
.footer__bottom-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 24px; font-size: 14px; color: #2c3358; flex-wrap: wrap; }
.footer__bottom ul { display: flex; gap: 48px; flex-wrap: wrap; }
.footer__bottom a:hover { color: var(--indigo); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1200px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .header-search { width: 230px; }
  .main-nav > ul { gap: 26px; }
}

@media (max-width: 1024px) {
  .hero__inner { grid-template-columns: 1fr; padding-inline: 0; }
  .hero__art { order: -1; }
  .hero__art img { max-width: 420px; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-layout { grid-template-columns: 1fr; gap: 24px; }
  .calc-info__art { display: none; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 16px;
    background: #fff; padding: 16px 24px 24px; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav > ul { flex-direction: column; align-items: stretch; gap: 4px; margin: 0; }
  .main-nav a { padding: 10px 0; }
  .dropdown { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 14px; display: none; }
  .has-dropdown.is-open .dropdown { display: block; }
  .header-search { width: 100%; }
  .site-header { position: relative; }
}

@media (max-width: 760px) {
  .container { width: min(1280px, 100% - 32px); }
  .panel { padding: 20px 16px; }
  .section-title { font-size: 24px; }
  .hero { padding-top: 24px; }
  .hero__text > p { font-size: 16px; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .calc__keys { gap: 6px; padding: 10px 6px 2px; }
  .key { height: 46px; font-size: 14px; border-radius: 8px; }
  .calc__angle { font-size: 12px; gap: 8px; height: 46px; }
  .calc__result { font-size: 28px; }
  .footer__bottom ul { gap: 20px; }
}

@media (max-width: 560px) {
  .category-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .hero-search { flex-wrap: wrap; padding: 12px; }
  .hero-search input { flex-basis: calc(100% - 36px); }
  .hero-search .btn { width: 100%; }
  .footer__grid { grid-template-columns: 1fr; gap: 28px; }
  .popular__head { flex-direction: column; align-items: flex-start; }
  .key { height: 42px; font-size: 12px; }
  .key sup { font-size: .7em; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
