/* Calcora design system — light-first, bilingual, responsive, and accessible. */
:root {
  color-scheme: light;
  --navy: #12141f;
  --navy-soft: #1b2030;
  --ink: #191d28;
  --muted: #626977;
  --teal: #0d756c;
  --teal-dark: #095c55;
  --teal-light: #dff3ee;
  --mint: #8de2d0;
  --paper: #ffffff;
  --canvas: #f6f7f5;
  --soft: #eef1ee;
  --line: #dfe4e0;
  --line-strong: #c9d1cc;
  --error: #a82d3c;
  --error-bg: #fff1f2;
  --warning-bg: #fff8e8;
  --shadow: 0 18px 45px rgba(18, 20, 31, .08);
  --radius: 16px;
  --radius-small: 10px;
  --container: 1180px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf2ef;
  --muted: #abb5b0;
  --teal: #69cbbb;
  --teal-dark: #8de2d0;
  --teal-light: #193b38;
  --paper: #1b2030;
  --canvas: #11141d;
  --soft: #242a37;
  --line: #343c49;
  --line-strong: #4a5563;
  --error: #ff9ca8;
  --error-bg: #3a2028;
  --warning-bg: #342e20;
  --shadow: 0 18px 45px rgba(0, 0, 0, .2);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Arabic", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
p, h1, h2, h3, ul, ol, dl, dd { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.16; letter-spacing: -.025em; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { letter-spacing: 0; line-height: 1.35; }
h1 { font-size: clamp(2.35rem, 5vw, 4.8rem); }
h2 { font-size: clamp(1.65rem, 2.8vw, 2.45rem); }
h3 { font-size: 1.1rem; }
::selection { background: var(--mint); color: #12141f; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
[hidden] { display: none !important; }
.container { width: min(var(--container), calc(100% - 48px)); margin-inline: auto; }
.section { padding-block: 88px; }
.icon { width: 22px; height: 22px; flex: 0 0 auto; }
.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; }
.skip-link { position: fixed; inset-block-start: 8px; inset-inline-start: 12px; z-index: 1000; padding: 10px 16px; background: var(--paper); color: var(--ink); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.eyebrow { display: block; margin-bottom: 14px; color: var(--teal); font-size: .72rem; font-weight: 800; letter-spacing: .14em; line-height: 1.4; text-transform: uppercase; }
html[dir="rtl"] .eyebrow { letter-spacing: .03em; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 20px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; line-height: 1.25; transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-dark); }
html[data-theme="dark"] .button-primary { color: #10141d; }
.button-secondary { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.button-secondary:hover { border-color: var(--teal); color: var(--teal); }
.button-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.button-quiet:hover { background: var(--soft); color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 10px; color: var(--teal); font-weight: 750; white-space: nowrap; }
.text-link:hover { text-decoration: underline; text-underline-offset: 5px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(16px); }
.header-inner { display: flex; align-items: center; min-height: 74px; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); font-size: 1.35rem; font-weight: 850; letter-spacing: -.04em; }
html[data-theme="dark"] .brand { color: var(--mint); }
.brand-mark { width: 35px; height: 35px; }
.main-nav { display: flex; align-items: center; gap: 28px; margin-inline-start: 28px; }
.main-nav a { position: relative; padding-block: 25px; color: var(--muted); font-size: .9rem; font-weight: 650; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--ink); }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; inset-inline: 0; bottom: 16px; height: 2px; background: var(--teal); }
.header-actions { display: flex; align-items: center; gap: 7px; margin-inline-start: auto; }
.icon-button, .header-search { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.icon-button:hover, .header-search:hover { background: var(--soft); color: var(--ink); }
.language-link { padding: 8px 11px; border-radius: 8px; color: var(--muted); font-size: .84rem; font-weight: 750; }
.language-link:hover { background: var(--soft); color: var(--ink); }
.menu-button { display: none; }

/* Hero */
.hero { position: relative; overflow: hidden; background: var(--navy); color: #fff; }
.hero-pattern { position: absolute; inset: 0; opacity: .15; background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(90deg, transparent, #000); }
.hero::after { content: ""; position: absolute; width: 520px; height: 520px; inset-inline-end: -180px; top: -240px; border: 1px solid rgba(141,226,208,.22); border-radius: 50%; box-shadow: 0 0 0 90px rgba(141,226,208,.025), 0 0 0 180px rgba(141,226,208,.018); }
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); align-items: center; gap: 70px; min-height: 650px; padding-block: 76px; }
.hero-copy { max-width: 720px; }
.hero-badge { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 24px; color: #c6d0d5; font-size: .77rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hero-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(141,226,208,.12); }
.hero h1 { max-width: 650px; margin-bottom: 18px; color: #fff; font-size: clamp(2.8rem, 5.4vw, 5rem); font-weight: 780; letter-spacing: -.055em; }
html[dir="rtl"] .hero h1 { letter-spacing: -.02em; }
.hero-tagline { margin-bottom: 12px; color: var(--mint); font-size: 1rem; font-weight: 700; }
.hero-text { max-width: 620px; margin-bottom: 30px; color: #b7c1c9; font-size: 1.05rem; }
.search-form { position: relative; display: flex; align-items: center; gap: 10px; }
.hero .search-form { max-width: 640px; padding: 7px; border-radius: 13px; background: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.search-icon { position: absolute; inset-inline-start: 20px; width: 20px; height: 20px; color: #65706e; pointer-events: none; }
.search-form input { width: 100%; min-width: 0; min-height: 48px; padding: 10px 16px 10px 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); outline: none; }
html[dir="rtl"] .search-form input { padding: 10px 44px 10px 16px; }
.hero .search-form input { border: 0; background: #fff; color: #191d28; }
.search-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.hero .search-form input:focus { box-shadow: none; }
.search-form .button { flex: 0 0 auto; min-height: 48px; }
.search-suggestions { position: absolute; z-index: 20; inset-inline: 0; top: calc(100% + 9px); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); color: var(--ink); }
.suggestion-link { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.suggestion-link:last-child { border: 0; }
.suggestion-link:hover { background: var(--soft); }
.suggestion-link strong { font-size: .9rem; }
.suggestion-link span { color: var(--muted); font-size: .75rem; }
.hero-assurances { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 23px 0 0; padding: 0; color: #aeb9c1; font-size: .78rem; list-style: none; }
.hero-assurances li { display: flex; align-items: center; gap: 7px; }
.hero-assurances li::before { content: "✓"; color: var(--mint); font-weight: 900; }
.hero-visual { position: relative; direction: ltr; }
.visual-sheet { position: relative; width: 340px; margin-inline: auto; padding: 26px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: #1c2130; box-shadow: 0 30px 90px rgba(0,0,0,.35); transform: rotate(3deg); }
.visual-head { display: flex; gap: 6px; margin-bottom: 36px; }
.visual-head span { width: 7px; height: 7px; border-radius: 50%; background: #475064; }
.visual-head span:first-child { background: var(--mint); }
.visual-equation { margin-bottom: 30px; color: #c2ccd4; font-family: Georgia, serif; font-size: 1.45rem; }
.visual-chart { display: flex; align-items: end; gap: 10px; height: 150px; padding-bottom: 14px; border-bottom: 1px solid #364052; }
.visual-chart i { flex: 1; height: 25%; border-radius: 4px 4px 0 0; background: #354153; }
.visual-chart i:nth-child(2) { height: 34%; }.visual-chart i:nth-child(3) { height: 44%; }.visual-chart i:nth-child(4) { height: 58%; }.visual-chart i:nth-child(5) { height: 76%; }.visual-chart i:nth-child(6) { height: 100%; background: var(--mint); }
.visual-result { display: flex; justify-content: space-between; align-items: end; margin-top: 22px; }
.visual-result span { color: #6f7b8c; font-size: .63rem; letter-spacing: .16em; }
.visual-result strong { color: #fff; font-size: 1.35rem; letter-spacing: -.04em; }
.visual-orbit { position: absolute; display: grid; place-items: center; width: 60px; height: 60px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; background: #252c3c; color: var(--mint); font-family: Georgia, serif; font-size: 1.4rem; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.orbit-one { inset-inline-start: -8px; top: 16%; }.orbit-two { inset-inline-end: -5px; bottom: 11%; }

/* Shared section headings and cards */
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.section-heading h2 { margin-bottom: 10px; }
.section-heading p { max-width: 650px; margin-bottom: 0; color: var(--muted); }
.section-heading.compact { margin-bottom: 26px; }
.section-heading .result-count { flex: 0 0 auto; font-size: .85rem; font-weight: 700; }
.quick-section { padding-block: 58px 64px; border-bottom: 1px solid var(--line); background: var(--paper); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.quick-link { display: flex; align-items: center; gap: 13px; min-height: 76px; padding: 18px 20px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); font-size: .9rem; font-weight: 700; }
.quick-link .icon { width: 20px; color: var(--teal); }
.quick-link b { margin-inline-start: auto; color: var(--muted); font-weight: 400; transition: transform .18s ease; }
.quick-link:hover { background: var(--soft); color: var(--teal); }
.quick-link:hover b { transform: translateX(3px); }
html[dir="rtl"] .quick-link:hover b { transform: translateX(-3px); }
.calculator-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.calculator-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.calculator-card:hover { border-color: var(--line-strong); box-shadow: 0 12px 30px rgba(18,20,31,.06); transform: translateY(-3px); }
.calculator-card > a { display: flex; flex-direction: column; height: 100%; padding: 22px; }
.card-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 24px; }
.tool-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 11px; background: var(--teal-light); color: var(--teal); }
.tool-icon .icon { width: 22px; height: 22px; }
.card-category { padding-top: 3px; color: var(--muted); font-size: .66rem; font-weight: 700; line-height: 1.4; text-align: end; }
.calculator-card h3 { margin-bottom: 9px; font-size: 1rem; }
.calculator-card p { margin-bottom: 22px; color: var(--muted); font-size: .81rem; line-height: 1.6; }
.card-link { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; color: var(--teal); font-size: .75rem; font-weight: 800; }
.category-section { border-block: 1px solid var(--line); background: var(--paper); }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 38px; }
.category-card { display: flex; align-items: center; gap: 18px; min-height: 142px; padding-block: 24px; border-bottom: 1px solid var(--line); }
.category-card .tool-icon { width: 50px; height: 50px; border-radius: 50%; }
.category-card h3 { margin-bottom: 6px; font-size: 1.06rem; }
.category-card p { margin-bottom: 6px; color: var(--muted); font-size: .82rem; }
.category-card div > span { color: var(--teal); font-size: .72rem; font-weight: 750; }
.category-card b { margin-inline-start: auto; color: var(--muted); font-size: 1.1rem; font-weight: 400; }
.category-card:hover h3, .category-card:hover b { color: var(--teal); }

/* Directory and filtering */
.directory-section { background: var(--canvas); }
.directory-filters { display: grid; grid-template-columns: minmax(280px, 1.5fr) minmax(180px, .75fr) minmax(160px, .6fr); gap: 14px; margin-bottom: 28px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.directory-filters label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.directory-filters input, .directory-filters select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--ink); }
.directory-filters input:focus, .directory-filters select:focus { border-color: var(--teal); }
.load-more-wrap { display: flex; justify-content: center; margin-top: 32px; }
.empty-state { padding: 48px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.empty-state h3 { margin: 0; color: var(--muted); font-weight: 600; }

/* Guides and learning */
.learning-section { border-top: 1px solid var(--line); background: var(--paper); }
.learning-section > .container { display: grid; grid-template-columns: .75fr 1.6fr; gap: 60px; align-items: start; }
.learning-intro { position: sticky; top: 110px; }
.learning-intro h2 { margin-bottom: 18px; }
.learning-intro p { margin-bottom: 25px; color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.learning-section .guide-grid { grid-template-columns: 1fr; }
.guide-card { border-top: 2px solid var(--navy); background: var(--paper); }
html[data-theme="dark"] .guide-card { border-color: var(--mint); }
.guide-card > a { display: flex; flex-direction: column; height: 100%; padding: 24px 0; }
.learning-section .guide-card { border-bottom: 1px solid var(--line); border-top-width: 1px; }
.learning-section .guide-card:first-child { border-top: 2px solid var(--navy); }
.guide-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; color: var(--muted); font-size: .72rem; }
.guide-card h3 { margin-bottom: 10px; font-size: 1.16rem; }
.guide-card p { color: var(--muted); font-size: .86rem; }
.guide-card:hover h3 { color: var(--teal); }
.guide-index .guide-card { padding: 26px; border: 1px solid var(--line); border-top: 2px solid var(--navy); border-radius: var(--radius); }
.guide-index .guide-card > a { padding: 0; }
.guide-more { margin-top: 65px; }
.faq-section { background: var(--canvas); }
.faq-layout { display: grid; grid-template-columns: .75fr 1.5fr; gap: 80px; }
.faq-layout > div > p { color: var(--muted); }
.faq-list { border-top: 1px solid var(--line-strong); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 0; cursor: pointer; font-weight: 750; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary span { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: var(--teal); font-size: 1.1rem; font-weight: 400; transition: transform .18s ease; }
.faq-list details[open] summary span { transform: rotate(45deg); }
.faq-answer p { max-width: 700px; margin-bottom: 22px; color: var(--muted); font-size: .9rem; }

/* Standard page hero */
.page-hero { padding-block: 34px 58px; border-bottom: 1px solid var(--line); background: var(--paper); }
.page-hero h1 { max-width: 900px; margin-bottom: 14px; font-size: clamp(2.15rem, 4vw, 3.6rem); }
.page-hero > .container > p { max-width: 750px; margin: 0; color: var(--muted); font-size: 1.02rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 38px; color: var(--muted); font-size: .73rem; }
.breadcrumbs a:hover { color: var(--teal); }
.breadcrumbs span[aria-current="page"] { color: var(--ink); }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.page-title-row > div > p { max-width: 740px; margin-bottom: 0; color: var(--muted); }
.page-hero-icon { display: grid; place-items: center; width: 92px; height: 92px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 24px; background: var(--teal-light); color: var(--teal); }
.page-hero-icon .icon { width: 43px; height: 43px; }

/* Calculator workspace and forms */
.calculator-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; padding-block: 48px 80px; }
.calculator-main { min-width: 0; }
.calculator-panel { padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 12px 40px rgba(18,20,31,.045); }
.calculator-panel-head { display: flex; align-items: center; gap: 15px; margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.calculator-panel-head .eyebrow { margin-bottom: 4px; }
.calculator-panel-head h2 { margin: 0; font-size: 1.35rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field { min-width: 0; }
.form-field label { display: block; margin-bottom: 7px; color: var(--ink); font-size: .78rem; font-weight: 750; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--canvas); color: var(--ink); outline: none; transition: border-color .18s ease, box-shadow .18s ease; }
.form-field textarea { resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 15%, transparent); }
.form-field small { display: block; margin-top: 6px; color: var(--muted); font-size: .7rem; }
.field-full { grid-column: 1 / -1; }
#expression { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.05rem; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.form-actions .button-primary { min-width: 130px; }
.form-note, .small-note { margin: 20px 0 0; color: var(--muted); font-size: .75rem; }
.notice { margin-top: 20px; padding: 12px; border-radius: 8px; background: var(--warning-bg); }
.form-error { margin-top: 20px; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--error) 35%, transparent); border-radius: 8px; background: var(--error-bg); color: var(--error); font-size: .86rem; }
.results-panel { margin-top: 24px; overflow: hidden; border-radius: 12px; background: var(--navy); color: #fff; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid #303747; }
.results-head h3 { margin: 0; color: #fff; font-size: .95rem; }
.copy-button { padding: 5px 0; border: 0; background: none; color: var(--mint); font-size: .72rem; font-weight: 700; }
.copy-button:hover { text-decoration: underline; }
.results-list { margin: 0; padding: 8px 22px; }
.result-row { display: flex; align-items: baseline; justify-content: space-between; gap: 22px; padding: 13px 0; border-bottom: 1px solid #2c3342; }
.result-row:last-child { border: 0; }
.result-row dt { color: #aeb8c2; font-size: .8rem; }
.result-row dd { margin: 0; color: #fff; font-size: 1.08rem; font-weight: 800; text-align: end; overflow-wrap: anywhere; }
.result-note { margin: 0; padding: 14px 22px; border-top: 1px solid #303747; color: #b7c3cc; font-size: .72rem; }
.copy-feedback { min-height: 0; margin: 0; padding: 0 22px; color: var(--mint); font-size: .72rem; }
.copy-feedback:not(:empty) { padding-block: 10px; }
.scientific-keypad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 18px; direction: ltr; }
.scientific-keypad button { min-height: 42px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); color: var(--ink); font-family: ui-monospace, monospace; font-size: .82rem; }
.scientific-keypad button:hover { border-color: var(--teal); color: var(--teal); }
.calculator-aside { min-width: 0; }
.aside-box { position: sticky; top: 105px; padding-inline-start: 20px; border-inline-start: 1px solid var(--line); }
.aside-box h2 { margin-bottom: 16px; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.aside-box a { display: block; padding-block: 7px; color: var(--muted); font-size: .75rem; }
.aside-box a:hover { color: var(--teal); }
.aside-note { margin-top: 30px; padding: 18px; border-radius: 10px; background: var(--teal-light); }
.aside-note strong { color: var(--teal); font-size: .77rem; }
.aside-note p { margin: 7px 0 0; color: var(--muted); font-size: .7rem; }

/* Calculator and standalone articles */
.calculator-article { max-width: 790px; padding-top: 42px; }
.article-intro { margin-bottom: 42px; color: var(--ink); font-size: 1.1rem; line-height: 1.85; }
.calculator-article section, .standalone-article section { margin-bottom: 38px; }
.calculator-article h2, .standalone-article h2 { margin-bottom: 14px; font-size: 1.55rem; }
.calculator-article p, .standalone-article p { color: var(--muted); line-height: 1.9; }
.formula-box { max-width: 100%; margin: 20px 0; padding: 20px; overflow-x: auto; border-inline-start: 3px solid var(--teal); border-radius: 0 9px 9px 0; background: var(--soft); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
html[dir="rtl"] .formula-box { border-radius: 9px 0 0 9px; }
.limitations { padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--warning-bg); }
.limitations p { margin-bottom: 0; }
.related-section { border-top: 1px solid var(--line); background: var(--paper); }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 60px; padding-block: 58px 80px; }
.standalone-article { max-width: 790px; }
.narrow-container { max-width: 860px; padding-block: 55px 85px; }
.legal-article .last-updated { margin-bottom: 35px; color: var(--teal); font-size: .78rem; font-weight: 700; }
.search-page-form { padding-block: 32px 0; }
.search-page-form .search-form { max-width: 760px; }
.search-page-form .search-icon { inset-inline-start: 16px; }

/* Contact and 404 */
.contact-layout { display: grid; grid-template-columns: .75fr 1.25fr; gap: 70px; padding-block: 58px 85px; }
.contact-details { padding-top: 10px; }
.contact-details .tool-icon { margin-bottom: 24px; }
.contact-details h2 { font-size: 1.5rem; }
.contact-details p { color: var(--muted); }
.contact-details .text-link { direction: ltr; }
.contact-form { padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.contact-status { margin: 18px 0 0; padding: 13px; border-radius: 8px; background: var(--teal-light); color: var(--teal); font-size: .8rem; }
.not-found { padding-block: 90px 110px; text-align: center; }
.not-found .container { max-width: 760px; }
.error-code { display: block; color: var(--teal); font-size: clamp(5rem, 14vw, 9rem); font-weight: 850; letter-spacing: -.08em; line-height: 1; }
.not-found h1 { margin-block: 18px; font-size: 2.4rem; }
.not-found p { color: var(--muted); }
.not-found .search-form { margin-block: 35px 25px; text-align: start; }

/* Footer */
.site-footer { padding-block: 64px 28px; background: var(--navy); color: #aab5be; }
.footer-grid { display: grid; grid-template-columns: 1.7fr repeat(3, 1fr); gap: 55px; }
.site-footer .brand { margin-bottom: 18px; color: var(--mint); }
.footer-intro p { max-width: 310px; font-size: .82rem; }
.footer-intro > a { color: #d6dfe4; font-size: .77rem; direction: ltr; }
.footer-grid h2 { margin-bottom: 18px; color: #fff; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.footer-grid ul { margin: 0; padding: 0; list-style: none; }
.footer-grid li { margin-bottom: 10px; }
.footer-grid li a { font-size: .79rem; }
.footer-grid a:hover { color: var(--mint); }
.footer-bottom { display: flex; justify-content: space-between; gap: 30px; margin-top: 50px; padding-top: 24px; border-top: 1px solid #303645; }
.footer-bottom p { margin: 0; font-size: .7rem; }

/* Responsive layout */
@media (max-width: 1080px) {
  .main-nav { gap: 18px; margin-inline-start: 5px; }
  .header-inner { gap: 20px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; }
  .visual-sheet { width: 290px; }
  .calculator-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .learning-section > .container { grid-template-columns: .65fr 1.35fr; gap: 40px; }
  .footer-grid { gap: 30px; }
}

@media (max-width: 860px) {
  .container { width: min(var(--container), calc(100% - 36px)); }
  .section { padding-block: 68px; }
  .main-nav { position: absolute; inset-inline: 18px; top: calc(100% + 8px); display: none; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px 14px; border-radius: 7px; }
  .main-nav a[aria-current="page"] { background: var(--soft); }
  .main-nav a[aria-current="page"]::after { display: none; }
  .menu-button { display: inline-flex; }
  .hero-inner { grid-template-columns: 1fr; min-height: auto; padding-block: 68px; }
  .hero-copy { max-width: 720px; }
  .hero-visual { display: none; }
  .hero-pattern { mask-image: none; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { gap: 0 24px; }
  .learning-section > .container, .faq-layout { grid-template-columns: 1fr; gap: 35px; }
  .learning-intro { position: static; }
  .learning-section .guide-grid { grid-template-columns: repeat(3, 1fr); }
  .learning-section .guide-card { border: 1px solid var(--line); border-radius: 12px; }
  .learning-section .guide-card > a { padding: 20px; }
  .calculator-workspace, .article-layout { grid-template-columns: 1fr; gap: 30px; }
  .calculator-aside { display: none; }
  .contact-layout { gap: 35px; }
  .footer-grid { grid-template-columns: 1.5fr repeat(3, 1fr); gap: 24px; }
}

@media (max-width: 680px) {
  .container { width: min(var(--container), calc(100% - 28px)); }
  .header-inner { min-height: 66px; gap: 10px; }
  .brand { font-size: 1.18rem; }
  .brand-mark { width: 32px; height: 32px; }
  .header-actions { gap: 1px; }
  .header-search { display: none; }
  .language-link { padding-inline: 8px; font-size: .75rem; }
  .icon-button { width: 38px; height: 38px; }
  .hero-inner { padding-block: 52px 58px; }
  .hero h1 { font-size: clamp(2.45rem, 12vw, 3.7rem); }
  .hero-text { font-size: .95rem; }
  .hero .search-form { display: grid; grid-template-columns: 1fr; padding: 7px; }
  .hero .search-form .button { width: 100%; }
  .hero .search-icon { top: 21px; }
  .hero-assurances { gap: 9px 16px; }
  .quick-section { padding-block: 45px; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-link { min-height: 65px; }
  .section-heading { align-items: start; flex-direction: column; gap: 14px; margin-bottom: 26px; }
  .section-heading .text-link { align-self: flex-start; }
  .calculator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .calculator-card > a { padding: 18px; }
  .card-top { margin-bottom: 18px; }
  .card-category { display: none; }
  .category-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 124px; }
  .directory-filters { grid-template-columns: 1fr; }
  .learning-section .guide-grid, .guide-grid { grid-template-columns: 1fr; }
  .guide-index .guide-card { padding: 22px; }
  .page-hero { padding-block: 25px 42px; }
  .breadcrumbs { margin-bottom: 28px; }
  .page-hero-icon { display: none; }
  .calculator-workspace { padding-block: 28px 60px; }
  .calculator-panel { padding: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .form-actions .button { flex: 1; }
  .result-row { align-items: start; flex-direction: column; gap: 3px; }
  .result-row dd { text-align: start; }
  .contact-layout { grid-template-columns: 1fr; padding-block: 40px 60px; }
  .contact-form { padding: 22px; }
  .search-page-form .search-form { display: grid; grid-template-columns: 1fr; }
  .search-page-form .search-icon { top: 16px; }
  .search-page-form .button { width: 100%; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 35px 25px; }
  .footer-intro { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 10px; }
  .not-found .search-form { display: grid; grid-template-columns: 1fr; }
  .not-found .search-icon { top: 16px; }
  .not-found .button { width: 100%; }
}

@media (max-width: 420px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .popular-grid, .related-grid { grid-template-columns: 1fr; }
  .calculator-card p { margin-bottom: 15px; }
  .calculator-panel { padding: 18px; }
  .calculator-panel-head .tool-icon { width: 38px; height: 38px; }
  .scientific-keypad { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .calculator-aside, .form-actions, .copy-button, .related-section, .breadcrumbs { display: none !important; }
  body { background: #fff; color: #000; }
  .page-hero, .calculator-panel { border: 0; box-shadow: none; }
  .calculator-workspace { display: block; padding: 20px 0; }
  .calculator-article { max-width: none; }
  a { text-decoration: none; }
}
