/* =========================================================================
   Is It AI? — a self-contained tool page (templates/is_it_ai.html).
   Uses the Socials design tokens from design.css (brand purple, surface,
   border, pill buttons). Logical properties keep it correct in RTL.
   ========================================================================= */

.iia-shell {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ---- top bar ------------------------------------------------------------- */
.iia-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0;
  background: rgba(248, 250, 252, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.iia-brand { display: inline-flex; align-items: center; text-decoration: none; }
.iia-brand .brand-logo { height: 30px; }
.iia-topbar-actions { display: flex; align-items: center; gap: 10px; }
.iia-back { text-decoration: none; font-size: 13px; padding: .45rem .9rem; }

/* ---- heading ------------------------------------------------------------- */
.iia-head { text-align: center; margin-bottom: 20px; }
.iia-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 6px; color: var(--text); }
.iia-sub { font-size: .92rem; color: var(--text-2); margin: 0 auto; max-width: 46rem; }

/* ---- how it works / important ------------------------------------------- */
.iia-help {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  padding: 18px 20px; margin-bottom: 18px;
}
.iia-help-h { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-600); margin: 0 0 8px; }
.iia-steps, .iia-bullets { margin: 0; padding-inline-start: 1.15rem; color: var(--text-2); font-size: .87rem; line-height: 1.7; }
/* The step markers are generated by the browser, not text nodes, so the client
   digit pass cannot reach them — pick the numeral system with CSS instead. */
.iia-steps { list-style-type: decimal; }
.is-fa .iia-steps { list-style-type: persian; }
.iia-important .iia-help-h { color: #b45309; }
.iia-important .iia-bullets { color: #92400e; }
.iia-important { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r-md); padding: 14px 16px; margin: -6px; }

/* ---- upload -------------------------------------------------------------- */
.iia-upload-card { padding: 0; overflow: hidden; margin-bottom: 18px; }
/* COMPACT drop zone: one short row (icon beside the text) instead of a 210px
   block with everything stacked. The tool is used mostly on a phone, where a
   big empty box just pushed the result off screen — this is the same
   affordance in about a third of the height. `_drop-inner` is the grid that
   makes the icon span the two text lines; it is centred so a wide card does
   not strand a narrow row at one edge. */
.iia-drop {
  display: flex; align-items: center; justify-content: center;
  min-height: 0; padding: 16px 18px;
  border: 2px dashed var(--border-2); border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer; text-align: start; transition: border-color .15s, background .15s;
  margin: 12px;
}
.iia-drop:hover, .iia-drop:focus-visible, .iia-drop.iia-over {
  border-color: var(--brand-500); background: var(--brand-50); outline: none;
}
.iia-drop-inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px; align-items: center;
}
.iia-drop-ico { grid-row: 1 / span 2; font-size: 1.7rem; line-height: 1; }
.iia-drop-title { font-weight: 700; color: var(--text); font-size: .9rem; }
.iia-drop-hint { color: var(--text-3); font-size: .76rem; margin-top: 3px; }

.iia-preview-wrap { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
/* `hidden` must actually hide it: a class rule setting `display:flex` beats the
   UA's `[hidden]{display:none}`, which left the preview's buttons (Choose
   another / Check this image) on screen BEFORE any file was picked. */
.iia-preview-wrap[hidden] { display: none; }
.iia-preview {
  max-width: 100%; max-height: 320px; object-fit: contain;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: #fff; align-self: center;
}
.iia-preview-meta { text-align: center; }
.iia-preview-name { font-weight: 700; color: var(--text); word-break: break-all; font-size: .9rem; }
.iia-preview-size { color: var(--text-3); font-size: .78rem; margin-top: 2px; }
.iia-preview-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- error --------------------------------------------------------------- */
.iia-error {
  background: var(--danger-50); border: 1px solid #fecdd3; color: #9f1239;
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 18px;
  font-size: .88rem; font-weight: 600;
}

/* ---- results ------------------------------------------------------------- */
.iia-results { padding: 20px; }
.iia-verdict-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.iia-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: .95rem;
  padding: .5rem 1rem; border-radius: var(--r-pill); border: 1px solid transparent;
}
.iia-badge.v-ai          { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.iia-badge.v-likely_ai   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.iia-badge.v-not_ai      { background: var(--success-50); color: #047857; border-color: #a7f3d0; }
.iia-badge.v-inconclusive{ background: var(--surface-2); color: #475569; border-color: var(--border-2); }
.iia-badge.v-stripped    { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
/* Stock platform, no camera data: a distinct, neutral-cyan badge — deliberately
   NOT the green "not AI" and NOT the red "AI", because the honest answer is
   "we cannot tell which". */
.iia-badge.v-stock_platform { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
/* Screenshot: slate, deliberately neutral — the tool is NOT saying "AI" or "not
   AI", it is saying "this file cannot answer the question". */
.iia-badge.v-screenshot  { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
/* Unverifiable origin: "no provenance at all". Indigo-tinted so it reads as
   ATTENTION (notable) rather than as the grey shrug of "inconclusive" — while
   staying clearly away from red (AI) and green (not AI). */
.iia-badge.v-unverified  { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.iia-confidence { font-size: .78rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }

.iia-explanation { font-size: .92rem; line-height: 1.7; color: var(--text-2); margin: 0 0 14px; }

.iia-reco {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r-md);
  padding: 14px 16px; margin-bottom: 16px;
}
.iia-reco-title { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #b45309; margin-bottom: 4px; }
.iia-reco-text { margin: 0; font-size: .9rem; color: #92400e; line-height: 1.7; }

.iia-section { margin-top: 18px; }
.iia-section-h { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 0 0 10px; }

.iia-table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
/* `table-layout: fixed` + explicit widths is what stops the columns collapsing:
   the Field column is now allowed to WRAP (it used to be `white-space: nowrap`,
   so a long joined field name like "ApertureValue / ExposureProgram / …" ate the
   whole row and squeezed Value/Meaning down to one character per line). */
.iia-table { width: 100%; border-collapse: collapse; font-size: .84rem; table-layout: fixed; min-width: 560px; }
.iia-table th, .iia-table td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.iia-table th { background: var(--surface-2); font-weight: 700; color: var(--text-2); }
.iia-table tr:last-child td { border-bottom: none; }
.iia-table td.iia-f { font-weight: 700; color: var(--text); }
.iia-table td.iia-v { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .79rem; color: #334155; }
.iia-table td.iia-m { color: var(--text-2); }
/* Signals table (Field / Value / What it means). */
.iia-table th:nth-child(1), .iia-table td:nth-child(1) { width: 33%; }
.iia-table th:nth-child(2), .iia-table td:nth-child(2) { width: 30%; }
.iia-table th:nth-child(3), .iia-table td:nth-child(3) { width: 37%; }
/* Raw metadata table (Field / Value). */
.iia-table-raw { min-width: 420px; }
.iia-table-raw th:nth-child(1), .iia-table-raw td:nth-child(1) { width: 34%; }
.iia-table-raw th:nth-child(2), .iia-table-raw td:nth-child(2) { width: 66%; }
.iia-empty { color: var(--text-3); font-style: italic; }

.iia-raw summary {
  cursor: pointer; font-weight: 700; font-size: .84rem; color: var(--brand-600);
  padding: 6px 0; list-style: none;
}
.iia-raw summary::-webkit-details-marker { display: none; }
.iia-raw summary::before { content: "▸ "; }
.iia-raw[open] summary::before { content: "▾ "; }

/* The "Copy" button under the raw-metadata summary. Right-aligned in a small
   toolbar so it reads as an action ON the table below it, and it only exists
   while the details are open (browsers hide non-summary children when closed). */
.iia-raw-tools { display: flex; justify-content: flex-end; margin: 6px 0 2px; }
.iia-copy-raw {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2, var(--border)); background: #fff;
  color: var(--brand-600); font-size: .78rem; font-weight: 700;
  font-family: inherit; transition: background .15s, border-color .15s;
}
.iia-copy-raw:hover { background: var(--brand-50); border-color: var(--brand-400, var(--brand-500)); }
.iia-copy-raw:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.iia-copy-raw:disabled { opacity: .75; cursor: default; }

.iia-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.iia-filetype { font-size: .78rem; color: var(--text-3); font-family: ui-monospace, monospace; }

.iia-spinner {
  display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff;
  animation: iia-spin .7s linear infinite; vertical-align: -2px;
  margin-inline-end: 6px;
}
@keyframes iia-spin { to { transform: rotate(360deg); } }

/* ---- footer -------------------------------------------------------------- */
.iia-footer {
  text-align: center; color: var(--text-3); font-size: .76rem;
  border-top: 1px solid var(--border); padding-top: 18px; margin-top: 12px;
}

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 720px) {
  .iia-help { grid-template-columns: 1fr; }
  .iia-important { margin: 0; }
  .iia-title { font-size: 1.35rem; }
  .iia-preview-actions .btn-primary,
  .iia-preview-actions .btn-secondary { flex: 1 1 auto; text-align: center; }
  .iia-foot { flex-direction: column; align-items: stretch; }
}

/* ---- phones: the result tables STACK instead of scrolling sideways --------
   The signals table is 3 columns and carried `min-width: 560px`, so on a phone
   it became a horizontal scroller: a row's Field, Value and Meaning could never
   be read together, and the reader had to swipe left and right (reported).
   Below 620px each ROW becomes its own block — the header row is hidden and
   every cell prints on its own line — so a row reads top-to-bottom with no
   horizontal scrolling at all, on the standalone page and the landing pop-up
   alike (they share this file). The raw-metadata table stacks the same way. */
@media (max-width: 620px) {
  /* Nothing overflows any more, so kill the scroll container's sideways scroll
     (a stray scrollbar under a table that fits looks like a bug). */
  .iia-table-scroll { overflow-x: visible; }
  .iia-table { min-width: 0; table-layout: auto; }
  .iia-table thead { display: none; }
  .iia-table, .iia-table tbody, .iia-table tr, .iia-table td { display: block; width: auto; }
  /* `:nth-child(n)` matches the column-width rules above with EQUAL specificity,
     so this later rule resets them — a plain `.iia-table td { width:auto }`
     would lose to `.iia-table td:nth-child(1) { width:33% }`. */
  .iia-table td:nth-child(n), .iia-table th:nth-child(n) { width: auto; }
  .iia-table tr { padding: 10px 2px; border-bottom: 1px solid var(--border); }
  .iia-table tr:last-child { border-bottom: none; }
  .iia-table td { border-bottom: none; padding: 1px 12px; }
  /* The three cells read as one stacked record: field, then value, then the
     explanation. The hierarchy (bold / mono / muted) is the label. */
  .iia-table td.iia-f { font-weight: 700; }
  .iia-table td.iia-v { margin-top: 2px; }
  .iia-table td.iia-m { margin-top: 6px; }
  /* The empty-state cell ("No notable signals were found.") spans the row. */
  .iia-table td.iia-empty { padding: 6px 12px; }
}
