/* KORIXA design system — light/dark, RTL-ready (logical properties only) */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --text: #101623;
  --muted: #5b6474;
  --border: #e3e6ee;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --grad: linear-gradient(135deg, #5b5bd6, #8b5cf6 55%, #c084fc);
  --ring: rgba(91, 91, 214, 0.28);
  --footer-bg: #0e1424;
  --footer-text: #aab4cc;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 22, 35, 0.05), 0 8px 24px -12px rgba(16, 22, 35, 0.12);
  --shadow-lg: 0 24px 48px -24px rgba(16, 22, 35, 0.28);
  --ok: #16a34a;
  --warn: #ea580c;
  --bad: #dc2626;
}
[data-theme="dark"] {
  --bg: #0b101d;
  --surface: #131a2b;
  --surface-2: #1a2337;
  --text: #e7eaf3;
  --muted: #98a2b8;
  --border: #243049;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --grad: linear-gradient(135deg, #6d6df0, #9d6bfa 55%, #c88bfc);
  --ring: rgba(129, 140, 248, 0.35);
  --footer-bg: #080c16;
  --ok: #4ade80; --warn: #fb923c; --bad: #f87171;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, canvas { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
p { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1080px; margin-inline: auto; padding-inline: 20px; }
.skip {
  position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 8px;
}
.skip:focus { inset-inline-start: 8px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.logo {
  font-weight: 800; font-size: 1.35rem; letter-spacing: 0.04em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo:hover { text-decoration: none; }
.logo-dot { color: var(--text); -webkit-text-fill-color: var(--text); }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  color: var(--muted); font-weight: 600; font-size: 0.95rem;
  padding: 8px 12px; border-radius: 999px;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.search { position: relative; flex: 1 1 180px; max-width: 320px; margin-inline-start: auto; }
.search-input {
  width: 100%; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 0.92rem;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.search-results {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); overflow: hidden; display: grid;
}
.search-results a { padding: 10px 14px; color: var(--text); font-size: 0.93rem; border-block-end: 1px solid var(--border); }
.search-results a:last-child { border-block-end: 0; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.search-empty { padding: 10px 14px; color: var(--muted); font-size: 0.9rem; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-wrap select {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 1.05rem; cursor: pointer; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative; text-align: center; padding: 72px 20px 56px; overflow: clip;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; z-index: -1;
}
.hero::before { width: 420px; height: 420px; background: var(--accent-2); opacity: 0.25; top: -160px; inset-inline-start: -120px; }
.hero::after { width: 380px; height: 380px; background: var(--accent); opacity: 0.18; bottom: -180px; inset-inline-end: -100px; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem; font-weight: 600;
}
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); margin: 18px auto 14px; max-width: 720px; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--muted); max-width: 620px; margin: 0 auto 26px; font-size: 1.08rem; }
.hero .search { max-width: 460px; margin: 0 auto 26px; flex-basis: auto; }
.hero .search-input { padding: 14px 20px; font-size: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 0.88rem; font-weight: 600; color: var(--muted); box-shadow: var(--shadow);
}

/* ---------- sections & cards ---------- */
.section { padding-block: 34px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.section-title h2 { margin: 0; }
.count-pill {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; align-items: center; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tool-card:hover {
  transform: translateY(-3px); text-decoration: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-lg);
}
.tool-icon {
  flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center;
  font-size: 1.45rem; border-radius: 14px; background: var(--surface-2);
}
.tool-body { display: grid; gap: 2px; min-width: 0; }
.tool-name { font-weight: 700; font-size: 1rem; }
.tool-desc { color: var(--muted); font-size: 0.87rem; }
.tool-arrow { margin-inline-start: auto; color: var(--accent); font-weight: 700; }

/* ---------- tool page ---------- */
.breadcrumb { padding-top: 24px; color: var(--muted); font-size: 0.88rem; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { opacity: 0.6; }
.tool-head { padding-block: 18px 8px; max-width: 780px; }
.tool-head .intro { color: var(--muted); font-size: 1.02rem; }
.tool-shell {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin-block: 18px; max-width: 780px;
}
.tool-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.field > span { color: var(--muted); }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-size: 0.98rem;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
input[type="color"] { padding: 4px; height: 46px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.pair { display: flex; gap: 8px; }
.radio-row, .check-grid { display: flex; flex-wrap: wrap; gap: 12px 20px; font-size: 0.93rem; color: var(--muted); }
.check-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); display: grid; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.93rem; color: var(--muted); }
.radio-row label, .check-grid label, .check { display: flex; align-items: center; gap: 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px var(--ring); }
.btn-primary:hover { filter: brightness(1.06); text-decoration: none; }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-soft:hover { border-color: var(--accent); text-decoration: none; }
.btn-copy { background: var(--surface-2); color: var(--accent); border-color: var(--border); justify-self: start; }
.btn-copy:hover { border-color: var(--accent); }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.btn-grid .btn { padding: 9px 10px; font-size: 0.88rem; }

.form-error { color: var(--bad); font-weight: 600; font-size: 0.92rem; margin: 0; }

.result-box {
  margin-top: 18px; padding: 22px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 12px;
}
.result-label { color: var(--muted); font-size: 0.88rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.result-main {
  margin: 0; font-size: clamp(1.4rem, 4vw, 2.1rem); font-weight: 800; line-height: 1.3;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result-tag { color: var(--muted); font-weight: 600; margin: 0; }
.result-tag::before { content: "● "; color: var(--accent); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat {
  display: grid; gap: 2px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.stat-val { font-weight: 800; font-size: 1.25rem; overflow-wrap: anywhere; }
.stat-lbl { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.stat-btn { cursor: pointer; font: inherit; text-align: start; transition: border-color 0.15s; }
.stat-btn:hover { border-color: var(--accent); }

.share-bar { height: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.share-fill { height: 100%; background: var(--grad); width: 0; transition: width 0.4s ease; }

.pw-output {
  display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap;
  background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 14px;
}
.pw-output code { flex: 1 1 240px; font-size: 1.15rem; font-weight: 700; word-break: break-all; min-height: 1.5em; }
.strength { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; }
.strength-bars { display: inline-flex; gap: 4px; }
.strength-bars i { width: 26px; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.strength-bars i.on.s1 { background: var(--bad); border-color: var(--bad); }
.strength-bars i.on.s2 { background: var(--warn); border-color: var(--warn); }
.strength-bars i.on.s3 { background: var(--ok); border-color: var(--ok); }
.strength-bars i.on.s4 { background: var(--accent-2); border-color: var(--accent-2); }

.num-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.num-chip {
  padding: 10px 18px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-weight: 800; font-size: 1.1rem;
}
.qr-wrap { display: grid; gap: 14px; justify-items: center; }
.qr-wrap canvas { border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.color-preview { height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: inset var(--shadow); }

/* ---------- prose sections ---------- */
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.6em; }
.howto { counter-reset: step; display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.howto li {
  counter-increment: step; display: flex; gap: 12px; align-items: baseline;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.howto li::before {
  content: counter(step); flex: 0 0 26px; width: 26px; height: 26px; display: inline-grid; place-items: center;
  background: var(--grad); color: #fff; border-radius: 999px; font-size: 0.85rem; font-weight: 800;
  transform: translateY(3px);
}
details.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0; margin-block-end: 10px; overflow: hidden;
}
details.faq-item summary {
  cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; color: var(--accent); font-weight: 800; font-size: 1.2rem; }
details.faq-item[open] summary::after { content: "–"; }
details.faq-item .faq-a { padding: 0 18px 16px; color: var(--muted); margin: 0; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

/* ---------- legal pages ---------- */
.legal-body { max-width: 780px; }
.legal-body p { color: var(--muted); }
.legal-body p strong, .legal-body p a { color: var(--text); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 20px; }
.notfound h1 { font-size: clamp(3rem, 10vw, 5rem); }
.notfound .code { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }

/* ---------- ads ---------- */
.ad-slot {
  margin-block: 26px; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius);
  display: grid; gap: 8px; min-height: 110px; place-items: center; background: var(--surface);
}
.ad-label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* ---------- consent ---------- */
.consent {
  position: fixed; inset-inline: 16px; bottom: 16px; z-index: 90;
  max-width: 640px; margin-inline: auto; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  font-size: 0.92rem;
}
.consent p { margin: 0; flex: 1 1 260px; color: var(--muted); }
.consent div { display: flex; gap: 8px; }

/* ---------- footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); margin-top: 60px; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding-block: 44px 28px;
}
.footer-brand .logo-footer { color: #fff; -webkit-text-fill-color: #fff; background: none; }
.footer-brand .logo-dot { color: var(--accent-2); -webkit-text-fill-color: var(--accent-2); }
.footer-brand p { font-size: 0.9rem; margin-block-start: 10px; max-width: 300px; }
.site-footer h4 { color: #fff; font-size: 0.9rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--footer-text); font-size: 0.92rem; }
.site-footer a:hover { color: #fff; }
.lang-list { display: flex; flex-wrap: wrap; gap: 6px 14px !important; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08); padding-block: 18px;
  font-size: 0.85rem; color: #77819a;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .main-nav { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 48px 16px 40px; }
  .tool-shell { padding: 18px; }
}
@media (max-width: 520px) {
  .header-inner { gap: 10px; }
  .search { order: 10; flex-basis: 100%; max-width: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
