@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #eef3f1;
  --surface: #ffffff;
  --ink: #10231e;
  --muted: #556963;
  --line: #d3dedb;
  --turquoise: #0f8b8d;
  --turquoise-ink: #ffffff;
  --saffron: #f2a900;
  --saffron-ink: #2b1d00;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(16, 35, 30, 0.06);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0c1a1b;
  --surface: #132628;
  --ink: #e8f1ee;
  --muted: #9ab2ab;
  --line: #24403f;
  --turquoise: #2bb7b9;
  --turquoise-ink: #06191a;
  --saffron: #f5b72e;
  --saffron-ink: #251a00;
  --danger: #ff8a80;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c1a1b;
    --surface: #132628;
    --ink: #e8f1ee;
    --muted: #9ab2ab;
    --line: #24403f;
    --turquoise: #2bb7b9;
    --turquoise-ink: #06191a;
    --saffron: #f5b72e;
    --saffron-ink: #251a00;
    --danger: #ff8a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.9;
  font-size: 16px;
}
a { color: var(--turquoise); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--saffron);
  outline-offset: 2px;
}
.wrap { width: min(1080px, 100% - 2rem); margin-inline: auto; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { font-weight: 900; font-size: 1.5rem; text-decoration: none; color: var(--ink); letter-spacing: -0.5px; direction: ltr; unicode-bidi: isolate; }
.brand span { color: var(--saffron); }
.nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--turquoise); }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }
.icon-btn:hover { border-color: var(--turquoise); }

/* hero */
.hero { padding: 4rem 0 2.5rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1.25; font-weight: 900; margin: 0 0 1rem; max-width: 16ch; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin: 0; }

/* tool tiles */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; padding-bottom: 3rem; }
.tile { display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-3px); border-color: var(--turquoise); }
.tile h2 { margin: 0; font-size: 1.3rem; }
.tile p { margin: 0; color: var(--muted); }
.tile .glyph { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; direction: ltr; }
.tile.t1 .glyph { background: var(--turquoise); color: var(--turquoise-ink); }
.tile.t2 .glyph { background: var(--saffron); color: var(--saffron-ink); }
.tile.t3 .glyph { background: var(--ink); color: var(--paper); }
.soon { border-style: dashed; background: transparent; }
.soon .glyph { background: transparent; border: 1px dashed var(--line); color: var(--muted); }

/* tool pages */
.tool-head { padding: 2.5rem 0 1rem; }
.tool-head h1 { margin: 0 0 .5rem; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900; }
.tool-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.crumbs a { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
input[type="text"], input[type="url"], textarea, select, input[type="number"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem;
}
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 1rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.btn { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: .6rem 1.1rem; background: var(--turquoise); color: var(--turquoise-ink); }
.btn.alt { background: var(--saffron); color: var(--saffron-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.07); }
.hint { color: var(--muted); font-size: .92rem; }
.err { color: var(--danger); font-weight: 600; min-height: 1.5em; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }

/* qr */
.qr-out { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 1rem; min-height: 280px; }
.qr-out svg { width: 100%; max-width: 280px; height: auto; display: block; }

/* color */
.swatch { height: 140px; border-radius: 12px; border: 1px solid var(--line); }
.formats { display: grid; gap: .5rem; margin-top: 1rem; }
.fmt { display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .4rem .5rem .4rem .8rem; direction: ltr; }
.fmt code { font-family: ui-monospace, Consolas, monospace; }
.palette { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.chip { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--paper); padding: 0; font: inherit; color: var(--ink); text-align: center; }
.chip i { display: block; height: 72px; }
.chip span { display: block; padding: .3rem; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; direction: ltr; }

/* calculator */
.calc { max-width: 420px; margin-inline: auto; direction: ltr; }
.calc-screen { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; text-align: right; }
.calc-expr { color: var(--muted); min-height: 1.6em; font-family: ui-monospace, Consolas, monospace; overflow-x: auto; white-space: nowrap; }
.calc-res { font-size: 2rem; font-weight: 800; min-height: 2.6rem; overflow-x: auto; white-space: nowrap; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.keys.sci { grid-template-columns: repeat(5, 1fr); margin-bottom: .5rem; }
.keys button { font: inherit; font-size: 1.15rem; font-weight: 600; padding: .85rem 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.keys button:hover { border-color: var(--turquoise); }
.keys button.op { background: var(--paper); color: var(--turquoise); }
.keys button.eq { background: var(--saffron); color: var(--saffron-ink); border-color: transparent; }
.keys button.clr { color: var(--danger); }
.keys.sci button { font-size: .95rem; padding: .6rem 0; }
.calc-mode { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1rem; }
.calc-mode button[aria-pressed="true"] { background: var(--turquoise); color: var(--turquoise-ink); border-color: transparent; }

/* about text */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 2rem; }
details { border-bottom: 1px solid var(--line); padding: .6rem 0; }
summary { cursor: pointer; font-weight: 600; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; padding: 1.5rem 0; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

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

.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--saffron); color: var(--saffron-ink); padding: .5rem 1rem; z-index: 10; border-radius: 0 0 10px 10px; }
.skip:focus { inset-inline-start: 1rem; }
