/* ============================================================================
   "What would you like to build today?" — the intent popup
   ----------------------------------------------------------------------------
   The first-login HUB that replaced the Quick Start guide as the first thing a
   new account sees. FOUR SQUARE DOORS in a 2×2 grid (Social, Portfolio,
   Professional, Agency), a mini-wizard for the three that make a Public Profile,
   and ONE WIDE DOOR under them ("Set up social media accounts") that shows the
   networks it connects.

   A POPUP (like the guide's), not a page: it is one decision asked once, and it
   must not look like a place you navigate to — or become one the next time the
   user signs in on a phone.

   STACKING ORDER is part of the contract, same as the guide's:
     64  .mobile-bottom-nav
     70  the "+ Create" sheet
     71  .in-veil            <- this file
     72  .ob-veil            <- the Quick Start guide (the connect door opens it)
     80  #modalRoot          <- the real "Add account" modal opens above BOTH
     90+ toasts
   The intent popup sits UNDER the guide on purpose: tapping the connect door
   hands over to the guide and must not leave two dialogs fighting for the same
   screen.

   TWO LAYOUT DECISIONS WORTH THE COMMENT
   1. The grid is 2×2 at EVERY width — four squares on a phone, four squares on
      a desktop. Never a single column (four stacked banners is a scroll, and it
      pushes the connect door off a phone) and never four across (four slivers
      is what a naive `repeat(4, 1fr)` does). The connect door spans both
      columns under them.
   2. The shell is capped at 660px, so the cards keep the phone's proportions on
      a desktop instead of stretching into banners, and a tall screen never turns
      the popup into a full-page list.

   RTL: every horizontal value is a LOGICAL property (inline-start/end), so the
   Farsi build mirrors without a second stylesheet — the same rule as
   onboarding.css. Tap targets are >= 44px for the cards AND for the three text
   links, which are the easiest thing to leave too small.
   ========================================================================= */

.in-veil {
  position: fixed;
  inset: 0;
  z-index: 71;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* `hidden` must win over the flex display above: the app hides things by adding
   the Tailwind `hidden` class, so an element-styled overlay needs this. */
.in-veil[hidden],
.in-veil.hidden { display: none; }

.in-shell {
  position: relative;
  width: 100%;
  max-width: 660px;
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-lg, 18px);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, .12));
  overflow: hidden;
  animation: in-in .22s ease-out;
}

@keyframes in-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .in-shell { animation: none; }
}

/* ---- header: just the close ---------------------------------------------- */
/* Solid white, no gradient, no second copy of the title: the H2 in the body IS
   the title, and the colour comes from the pastel icon squares. */
.in-head {
  flex: none;
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px 0;
  background: #fff;
}
.in-close {
  flex: none;
  /* 44px hit area, even though the ✕ is small. */
  width: 44px;
  height: 44px;
  margin: -4px -4px 0 0;
  padding: 0;
  font: inherit;
  font-size: 15px;
  color: #94a3b8;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.in-close:hover { background: #f1f5f9; color: #0f172a; }

/* ---- body: the question, the cards, the two ways out -------------------- */
.in-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 18px calc(16px + env(safe-area-inset-bottom, 0px));
}
.in-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -.015em;
  color: var(--text-1, #0f172a);
}
.in-sub {
  margin: 6px 0 18px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #94a3b8;
}

/* ---- the doors: FOUR SQUARES (2×2) + ONE WIDE --------------------------- */
/* Two columns at EVERY width, phones included. Four stacked banners made the
   choice a scroll and pushed the connect door (the one that fills the bottom)
   off the screen; four small squares say "pick one of these" at a glance, and
   the wide door underneath is unmistakably a different kind of job. */
.in-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  /* Every row is the height of the tallest card, so the four squares line up
     whether or not one of them carries a state chip. */
  grid-auto-rows: 1fr;
}
@media (min-width: 520px) {
  .in-grid { gap: 12px; }
}

.in-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  /* A card is a BUTTON: reset the browser's own font/metrics so the app's
     typography is what the user sees, and keep the box at >= 96px so the whole
     thing is comfortably past the 44px minimum tap target. */
  width: 100%;
  min-height: 96px;
  padding: 16px;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
  /* Same surface as the app's own `.card` (which is #fff) and a light grey
     hairline: the four cards are the screen, and the emphasis comes from the
     icon squares and the hover ring rather than from a heavy border. */
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.in-card:hover {
  border-color: #c7d2fe;
  background: #fcfdff;
  box-shadow: 0 12px 26px -20px rgba(79, 70, 229, .55);
}
.in-card:focus-visible { outline: 2px solid var(--brand-500, #6366f1); outline-offset: 2px; }
.in-card:active { transform: translateY(1px); }

/* The one card that leads to an action with revenue attached (Variant B's "new
   shoot"). A faint ring, not a fill: the four cards keep equal weight. */
.in-card.in-primary { border-color: #c7d2fe; }

/* ---- a SQUARE door: icon on top, then the name and one line of why ------ */
/* Read as four equal choices, so the icon leads and the text sits under it.
   The box is pushed to fill its cell (`align-self: stretch` is the grid's own
   `1fr` row) which is what keeps them looking like squares rather than bars. */
.in-card-sq {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 9px;
  min-height: 118px;
  padding: 13px;
}
.in-card-sq .in-txt { gap: 2px; }
.in-card-sq .in-card-title { font-size: 14.5px; line-height: 1.4; }
.in-card-sq .in-card-sub {
  font-size: 11.5px;
  line-height: 1.65;
  /* Two lines is all a square can hold without becoming a paragraph; the full
     sentence is still in the title attribute for a long-hover reader. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- the WIDE door: "Set up Social Media accounts" ---------------------- */
/* It is a SETUP, not a page to build, so it gets its own shape: the networks it
   wires up are pictured inside the box, the two important words are large and
   bold, and the grammar around them stays small. */
.in-card-wide {
  grid-column: 1 / -1;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px 16px;
}
.in-sm-icons {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: 56%;
}
.in-sm-icons img {
  width: 26px;
  height: 26px;
  padding: 2px;
  box-sizing: border-box;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 0 0 1px #eef2f7;
}
.in-sm-txt { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.in-sm-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 1px;
  line-height: 1.35;
}
.in-sm-main {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.015em;
  color: #0f172a;
}
.in-sm-small { font-size: 12px; font-weight: 600; color: #94a3b8; }

/* A monochrome line icon inside a soft pastel square, one tone per card. */
.in-ico {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
}
.in-ico svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.in-ico[data-tone="violet"] { background: #f5f3ff; color: #7c3aed; }
.in-ico[data-tone="amber"] { background: #fffbeb; color: #b45309; }
.in-ico[data-tone="green"] { background: #ecfdf5; color: #047857; }
.in-ico[data-tone="rose"] { background: #fff1f2; color: #be123c; }
.in-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.in-card-title { font-size: 16px; font-weight: 800; line-height: 1.5; color: #0f172a; }
.in-card-sub {
  font-size: 12.5px;
  line-height: 1.8;
  color: #94a3b8;
}

/* The "where you stand" pill. `.off` is the state that is worth acting on, so it
   is the only tinted one — a row of coloured pills would say nothing. */
.in-chip {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11.5px;
  line-height: 1.9;
  border-radius: 999px;
  background: var(--surface-2, #f1f5f9);
  color: #475569;
}
.in-chip.off { background: #fff7ed; color: #9a3412; }
.in-chip.ok { background: #ecfdf5; color: #047857; }

/* ---- step 2: the Creator / Professional mini-wizard ---------------------- */
/* A quiet back link, never a second filled button: the four cards are the
   choice, and step 2 is still the same single decision. */
.in-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 4px;
  padding: 0 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-600, #4f46e5);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: start;
}
.in-back:hover { color: var(--brand-700, #4338ca); text-decoration: underline; }
.in-back:focus-visible { outline: 2px solid var(--brand-500, #6366f1); outline-offset: 2px; }

/* "Which page am I creating" — the card that was picked, reduced to a chip. */
.in-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
.in-pick .in-ico { width: 34px; height: 34px; border-radius: 10px; }
.in-pick .in-ico svg { width: 18px; height: 18px; }

.in-form { margin: 14px 0 4px; }
.in-field { margin-bottom: 13px; }
.in-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
}
.in-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.in-field input:focus {
  border-color: var(--brand-500, #6366f1);
  outline: 2px solid rgba(99, 102, 241, .18);
}
.in-field input[dir="ltr"] { direction: ltr; }
.in-field .hint {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.7;
  color: #94a3b8;
}
.in-slug { display: flex; align-items: center; gap: 6px; }
/* The input is the flexible part; `width: auto` + `min-width: 0` stops the
   `/p/` prefix and the field's padding from pushing the row past the dialog. */
.in-slug input { flex: 1 1 auto; min-width: 0; width: auto; }
.in-slug .pre {
  flex: none;
  font-size: 12.5px;
  color: #94a3b8;
  direction: ltr;
}
.in-state {
  min-height: 17px;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 800;
}
.in-state.ok { color: #059669; }
.in-state.err { color: #dc2626; }
.in-go {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  margin-top: 2px;
  padding: 12px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}
.in-go:hover { filter: brightness(.95); }
.in-go:focus-visible { outline: 2px solid var(--brand-500, #6366f1); outline-offset: 2px; }

.in-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
}
.in-skip {
  /* 44px tall so the smallest thing on the screen is still a real tap target. */
  min-height: 44px;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  color: #64748b;
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.in-skip:hover { color: var(--brand-600, #4f46e5); }

/* The "don't show this again" tick box, at the inline-end of the footer. It is
   the one thing that stops the auto-open, so it sits on the same row as skip
   rather than in a settings page. 44px tall like every other target. */
.in-noagain {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin-inline-start: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.in-noagain input {
  width: 17px;
  height: 17px;
  flex: none;
  accent-color: var(--brand-600, #4f46e5);
  cursor: pointer;
}

/* A sidebar entry that OPENS this popup instead of switching view (it carries no
   data-nav, like "Contact us").

   ⚠️ DELIBERATELY UNSTYLED — do NOT re-add a font-size here. `.sb-item.sb-next`
   used to be "quieter and smaller than its neighbours" (13px + .82 opacity), and
   at 13px next to 14px rows it read as a DIFFERENT FONT, not as a quieter entry:
   in the English menu it was the one item that did not match. It now inherits
   .sb-item exactly, in both languages (FA/Font: Vazirmatn from body.is-fa, same
   as every neighbour). The class stays because the markup, shell.js and
   test_intent.py address the entry by it. */

@media (prefers-reduced-motion: reduce) {
  .in-card { transition: none; }
  .in-card:active { transform: none; }
}

/* ---- phones: a real sheet, the fix under the thumb ----------------------- */
@media (max-width: 640px) {
  .in-veil { padding: 0; align-items: flex-end; }
  .in-shell {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    animation: none;
  }
  /* Tighter than the desktop dialog on purpose: the 2×2 squares, the wide
     connect door and the skip row have to fit a 360×800 phone WITHOUT scrolling,
     or the promise at the bottom is the one thing the user never reads. */
  .in-body { padding: 14px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .in-title { font-size: 18px; }
  .in-sub { margin: 4px 0 12px; }
  .in-grid { gap: 8px; }
  .in-card { min-height: 78px; padding: 13px; }
  /* The squares get SMALLER, not taller: four of them plus the wide door are the
     whole screen budget on a phone. */
  .in-card-sq { min-height: 104px; padding: 11px; gap: 7px; }
  .in-card-sq .in-card-title { font-size: 13.5px; }
  .in-card-sq .in-card-sub { font-size: 11px; line-height: 1.6; -webkit-line-clamp: 2; }
  .in-ico { width: 38px; height: 38px; border-radius: 10px; }
  .in-ico svg { width: 19px; height: 19px; }
  .in-card-title { font-size: 15px; }
  /* The wide door becomes a full-width rectangle: icons on one line, the words
     under them, and it still spans the whole width of the sheet. */
  .in-card-wide {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    padding: 12px 13px;
  }
  .in-sm-icons { max-width: none; gap: 4px; }
  .in-sm-icons img { width: 22px; height: 22px; border-radius: 6px; }
  .in-sm-main { font-size: 16.5px; }
  .in-sm-small { font-size: 11.5px; }
  .in-foot { margin-top: 6px; padding-top: 8px; }
  /* The mini-wizard is the whole screen on a phone, so its submit button is the
     natural full-width target under the thumb. */
  .in-field input { padding: 12px 13px; font-size: 15px; }
}
