/* ==========================================================================
   יוצר קודי QR — גיליון סגנון ראשי
   כתיבה בתכונות לוגיות (inline-start/end) כדי שה‑RTL יעבוד ללא היפוכים.
   ========================================================================== */

/* ---------- גופן ---------- */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/heebo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ---------- אסימוני עיצוב ---------- */
:root {
  --font: 'Heebo', 'Segoe UI', system-ui, -apple-system, 'Noto Sans Hebrew', Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --brand: #0f5ea8;
  --brand-strong: #0b4a86;
  --brand-soft: #e8f1fa;
  --brand-ring: #7fb2e0;

  /* צבע המותג של NGG, כפי שנדגם מקובץ הלוגו. יחס הניגודיות שלו מול לבן
     הוא 4.01:1 — מתחת לסף 4.5:1 הנדרש לטקסט רגיל — ולכן הוא משמש
     לאלמנטים דקורטיביים בלבד ולא לטקסט או לפקדים. */
  --ngg-pink: #ec2889;

  --ink: #16202b;
  --ink-2: #46525f;
  --ink-3: #6b7783;

  --bg: #f2f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #dde3ea;
  --line-strong: #c3ccd6;

  --ok: #197149;
  --ok-soft: #e6f4ec;
  --warn: #8a4b06;
  --warn-soft: #fdf1e0;
  --warn-line: #f0c68a;
  --danger: #b02020;
  --danger-soft: #fdeceb;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .06), 0 1px 3px rgba(16, 32, 48, .06);
  --shadow-md: 0 2px 4px rgba(16, 32, 48, .05), 0 8px 24px rgba(16, 32, 48, .08);

  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6db2ee;
    --brand-strong: #8cc3f4;
    --brand-soft: #16293c;
    --brand-ring: #3d7cb3;

    --ink: #eef3f8;
    --ink-2: #b5c1cd;
    --ink-3: #8e9aa6;

    --bg: #0e161f;
    --surface: #16202b;
    --surface-2: #1c2734;
    --line: #2b3846;
    --line-strong: #3d4c5c;

    --ok: #67dda2;
    --ok-soft: #14301f;
    --warn: #f0bd72;
    --warn-soft: #2f2314;
    --warn-line: #5c451f;
    --danger: #f08a86;
    --danger-soft: #35191a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .25), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

/* ---------- איפוס ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* התכונה hidden מקבלת display:none מגיליון הדפדפן בלבד, וכל הכרזת display
   של מחלקה גוברת עליה. הכלל הזה מבטיח שהסתרה מהקוד תמיד עובדת. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-inline-size: 0; }

svg { width: 1.25em; height: 1.25em; display: block; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

button { font: inherit; color: inherit; }

::selection { background: var(--brand-ring); color: #fff; }

/* מיקוד גלוי ועקבי */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: -100px;
  transform: translateX(50%);
  z-index: 100;
  background: var(--surface);
  color: var(--brand);
  padding: 12px 20px;
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { inset-block-start: 0; }

/* ---------- פריסה ---------- */
.wrap {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-inline: 16px;
}

.site-header {
  background: var(--surface);
  border-block-end: 1px solid var(--line);
  /* פס בצבע המותג. אלמנט דקורטיבי בלבד, ולכן אינו כפוף לדרישות ניגודיות. */
  border-block-start: 3px solid var(--ngg-pink);
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
}
.site-header__inner {
  display: flex;
  align-items: center;
  min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand__logo {
  display: block;
  width: auto;
  height: 34px;
}
/* מפריד דק בין סמל הארגון לשם הכלי, כדי שהשניים ייקראו כשתי יחידות נפרדות */
.brand__rule {
  width: 1px;
  height: 24px;
  background: var(--line-strong);
}
.brand__text { font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em; }

main { padding-block: 28px 56px; }

.intro { margin-block-end: 24px; text-align: center; }
.intro__title {
  font-size: clamp(1.6rem, 5.5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  margin-block-end: 10px;
}
.intro__lead {
  color: var(--ink-2);
  max-width: 52ch;
  margin-inline: auto;
  font-size: 1.02rem;
}

/* ---------- כרטיסים ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  margin-block-end: 18px;
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 0;
}
.card__body { padding: 18px 20px 22px; }
.card__title { font-size: 1.2rem; font-weight: 700; line-height: 1.35; }
.card__sub { color: var(--ink-2); font-size: .95rem; margin-block-start: 3px; }

.step {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  margin-block-start: 2px;
}

/* ---------- שדות ---------- */
.field + .field, .field + .btn { margin-block-start: 16px; }
.field__label {
  display: block;
  font-weight: 600;
  font-size: .97rem;
  margin-block-end: 7px;
}
.field__help {
  color: var(--ink-3);
  font-size: .875rem;
  line-height: 1.55;
  margin-block-start: 7px;
}
.field__error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: .9rem;
  font-weight: 500;
  margin-block-start: 9px;
}
.field__error svg { width: 1.1em; height: 1.1em; margin-block-start: .18em; }

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  padding-inline: 14px;
  min-height: 58px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-shell:focus-within {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.input-shell[data-invalid='true'] { border-color: var(--danger); }
.input-shell__icon { color: var(--ink-3); }
.input-shell__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  padding-block: 12px;
  text-align: left;      /* כתובות אינטרנט נקראות משמאל לימין */
  direction: ltr;
}
.input-shell__input:focus { outline: none; }
.input-shell__input::placeholder { color: var(--ink-3); opacity: 1; }
.input-shell__clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-2);
  cursor: pointer;
}
.input-shell__clear:hover { background: var(--line-strong); }
.input-shell__clear svg { width: 16px; height: 16px; }

.select {
  width: 100%;
  min-height: var(--tap);
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.select:focus-visible { border-color: var(--brand); }

/* ---------- כפתורים ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--lg { min-height: 60px; font-size: 1.1rem; font-weight: 700; }
.btn--sm { min-height: 40px; padding: 7px 13px; font-size: .9rem; gap: 6px; }
.btn--sm svg { width: 1.05em; height: 1.05em; }

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
@media (prefers-color-scheme: dark) { .btn--primary { color: #08121c; } }
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }

.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-busy { pointer-events: none; opacity: .8; }

/* ---------- תוצאה ותצוגה מקדימה ---------- */
.result { display: grid; gap: 18px; }
@media (min-width: 620px) {
  .result { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
}

.preview__frame {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
}
/* לוח שחמט המדמה שקיפות */
.preview__frame[data-transparent='true'] {
  --sq: 12px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e2e8ee 25%, transparent 25%, transparent 75%, #e2e8ee 75%),
    linear-gradient(45deg, #e2e8ee 25%, transparent 25%, transparent 75%, #e2e8ee 75%);
  background-size: calc(var(--sq) * 2) calc(var(--sq) * 2);
  background-position: 0 0, var(--sq) var(--sq);
}
/* התצוגה המקדימה מצוירת ברזולוציה גבוהה ומוקטנת בעזרת ההחלקה של הדפדפן.
   nearest-neighbour (image-rendering: pixelated) היה משמיט שורות מודולים
   ביחס הקטנה לא שלם ומעוות את התצוגה. */
.preview__frame canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 300px;
}
.preview__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: .85rem;
  margin-block-start: 9px;
}
.preview__hint svg { width: 1.05em; height: 1.05em; }

.result__label { font-size: .875rem; color: var(--ink-3); font-weight: 600; }
.result__url {
  font-family: var(--font-mono);
  font-size: .95rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  margin-block: 6px 12px;
  overflow-wrap: anywhere;
}
.result__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- קבוצות אפשרויות ---------- */
.group + .group, .group + .advanced { margin-block-start: 24px; }
.group__legend {
  font-weight: 700;
  font-size: 1.02rem;
  margin-block-end: 11px;
}

.options { display: grid; gap: 10px; }
@media (min-width: 560px) {
  .options--format { grid-template-columns: 1fr 1fr; }
  .options--size { grid-template-columns: repeat(3, 1fr); }
  .options--bg { grid-template-columns: 1fr 1fr; }
}

/* התווית עצמה היא היעד ללחיצה; כפתור הבחירה מוסתר חזותית אך נשאר
   בעץ הנגישות ובסדר ה‑Tab. position:relative על התווית מקבע את הכפתור
   המוסתר בתוך גבולות הכרטיס ולא בפינת העמוד. */
.option { display: block; cursor: pointer; position: relative; }
.option input {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.option__box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 13px 15px;
  padding-inline-start: 46px;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}

/* סמן בחירה מפורש. הצבע לבדו אינו מספיק כאמצעי העברת מידע,
   ולכן המצב הנבחר מסומן גם בצורה — עיגול מלא לעומת עיגול ריק. */
.option__box::before {
  content: '';
  position: absolute;
  inset-inline-start: 15px;
  inset-block-start: 15px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.option:hover .option__box { border-color: var(--line-strong); }
.option:hover .option__box::before { border-color: var(--ink-3); }
.option input:checked + .option__box {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.option input:checked + .option__box::before {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 3px var(--surface);
}
.option input:focus-visible + .option__box {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.option__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.option__name { font-weight: 700; font-size: 1.02rem; }
.option__desc { color: var(--ink-2); font-size: .875rem; line-height: 1.5; }
.option--compact .option__desc { font-size: .84rem; }

/* אפשרות מנוטרלת — נשארת נראית אך מסומנת כלא זמינה */
.option.is-disabled { cursor: not-allowed; }
.option.is-disabled .option__box {
  opacity: .5;
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: none;
}

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}

.swatch {
  flex: none;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
}
.swatch--white { background: #fff; }
.swatch--checker {
  --sq: 5px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccd5de 25%, transparent 25%, transparent 75%, #ccd5de 75%),
    linear-gradient(45deg, #ccd5de 25%, transparent 25%, transparent 75%, #ccd5de 75%);
  background-size: calc(var(--sq) * 2) calc(var(--sq) * 2);
  background-position: 0 0, var(--sq) var(--sq);
}

/* ---------- הערות ---------- */
.note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-block-start: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--ink-2);
  font-size: .875rem;
  line-height: 1.55;
}
.note svg { width: 1.05em; height: 1.05em; margin-block-start: .22em; color: var(--brand); }
.note--warn {
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  color: var(--warn);
}
.note--warn svg { color: var(--warn); }

/* ---------- אפשרויות מתקדמות ---------- */
.advanced {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}
.advanced__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap);
  padding: 11px 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.advanced__summary::-webkit-details-marker { display: none; }
.advanced__summary:hover { background: var(--surface); }
.advanced__chevron { color: var(--ink-3); transition: transform .18s; }
.advanced[open] .advanced__chevron { transform: rotate(180deg); }
.advanced__body {
  padding: 4px 15px 18px;
  border-block-start: 1px solid var(--line);
}
.advanced__body .field:first-child { margin-block-start: 16px; }

.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
input[type='color'] {
  inline-size: 56px;
  block-size: 44px;
  padding: 3px;
  border: 2px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
.hex-input {
  inline-size: 110px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: .95rem;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding-inline: 10px;
  text-transform: uppercase;
}

/* ---------- הורדה ---------- */
.download { margin-block-start: 26px; }
.download__meta {
  text-align: center;
  color: var(--ink-3);
  font-size: .85rem;
  margin-block-start: 10px;
  min-height: 1.4em;
}

/* ---------- שאלות נפוצות ---------- */
.faq { margin-block-start: 34px; }
.faq__title { font-size: 1.15rem; font-weight: 700; margin-block-end: 12px; }
.faq__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-block-end: 8px;
  overflow: hidden;
}
.faq__item summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 11px 16px;
  font-weight: 600;
  font-size: .97rem;
  cursor: pointer;
}
.faq__item summary:hover { background: var(--surface-2); }
.faq__item p {
  padding: 0 16px 16px;
  color: var(--ink-2);
  font-size: .92rem;
  line-height: 1.7;
}

/* ---------- כותרת תחתונה ---------- */
.site-footer {
  border-block-start: 1px solid var(--line);
  background: var(--surface);
  padding-block: 24px;
  color: var(--ink-3);
  font-size: .85rem;
  text-align: center;
}
.site-footer__logo {
  display: block;
  width: auto;
  height: 56px;
  margin: 0 auto 12px;
}

/* ---------- הודעת מצב צפה ---------- */
.toast {
  position: fixed;
  inset-block-end: 20px;
  inset-inline: 16px;
  margin-inline: auto;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 17px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--surface);
  font-size: .93rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 50;
  animation: toast-in .22s ease-out;
}
.toast svg { color: #6ee7a8; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- העדפת תנועה מופחתת ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- ניגודיות מוגברת ---------- */
@media (prefers-contrast: more) {
  :root { --line: #8a97a3; --line-strong: #56626e; --ink-2: #2a3540; --ink-3: #46525f; }
}

/* ---------- הדפסה ---------- */
@media print {
  .site-header, .site-footer, .faq, .toast, .download, #download-card, #qr-form, .intro__lead { display: none !important; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}
