/* ============================================================
   Function page redesign — scoped mockup
   Used by individual function pages (e.g. /pretrained-classifiers/screw-type/)
   when they set `layout: default` + `custom_css: [function-redesign]`.

   Visual language mirrors /assets/css/docs.css:
     Inter body, JetBrains Mono code, blue #1e5c97, orange #d4932e,
     green #16a34a, subtle borders, light surfaces.

   All selectors are namespaced under .fn-page to avoid bleed.
   ============================================================ */

.fn-page {
  --fn-font:  Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --fn-mono:  "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --fn-blue:        #1e5c97;
  --fn-blue-hover:  #155082;
  --fn-blue-soft:   #eef3fb;
  --fn-orange:      #d4932e;
  --fn-green:       #16a34a;

  --fn-bg:          #ffffff;
  --fn-bg-subtle:   #f6f8fa;
  --fn-bg-hover:    #f0f3f7;

  --fn-border:        #d0d7de;
  --fn-border-subtle: #e8ecf0;

  --fn-text:        #1c1e21;
  --fn-text-muted:  #57606a;
  --fn-text-light:  #6e7781;

  --fn-r:    6px;
  --fn-r-lg: 10px;
  --fn-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --fn-shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
  --fn-shadow-lg: 0 18px 38px rgba(15, 23, 42, 0.10);

  font-family: var(--fn-font);
  color: var(--fn-text);
  background: var(--fn-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.fn-page * { box-sizing: border-box; }

.fn-page a { color: var(--fn-blue); text-decoration: none; }
.fn-page a:hover { color: var(--fn-blue-hover); text-decoration: underline; }

/* ── Layout shell ───────────────────────────────────────── */
.fn-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.fn-section { padding: 64px 0; }
.fn-section--tight { padding: 40px 0; }
.fn-section--alt { background: var(--fn-bg-subtle); border-top: 1px solid var(--fn-border-subtle); border-bottom: 1px solid var(--fn-border-subtle); }

/* ── Hero ───────────────────────────────────────────────── */
.fn-hero {
  padding: 56px 0 24px;
  background:
    radial-gradient(900px 380px at 85% -10%, rgba(30, 92, 151, 0.08), transparent 70%),
    radial-gradient(700px 300px at 10% 0%,  rgba(212, 147, 46, 0.07), transparent 70%);
  border-bottom: 1px solid var(--fn-border-subtle);
}

.fn-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.fn-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fn-blue);
  background: var(--fn-blue-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.fn-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fn-green); }

.fn-h1 {
  font-family: var(--fn-font);
  font-size: 44px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fn-text);
  margin: 0 0 16px;
}
.fn-h1 .fn-h1-accent { color: var(--fn-blue); }

.fn-sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--fn-text-muted);
  margin: 0 0 28px;
  max-width: 540px;
}

/* ── CTAs ───────────────────────────────────────────────── */
.fn-cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

.fn-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--fn-font);
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--fn-r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  text-decoration: none !important;
  white-space: nowrap;
}
.fn-btn:active { transform: translateY(1px); }

.fn-btn--primary {
  background: var(--fn-blue);
  color: #fff !important;
  border-color: var(--fn-blue);
  box-shadow: var(--fn-shadow-sm);
}
.fn-btn--primary:hover { background: var(--fn-blue-hover); border-color: var(--fn-blue-hover); color: #fff !important; }

.fn-btn--ghost {
  background: #fff;
  color: var(--fn-text) !important;
  border-color: var(--fn-border);
}
.fn-btn--ghost:hover { background: var(--fn-bg-hover); }

.fn-btn--lg { padding: 14px 26px; font-size: 15px; }

.fn-btn-icon { width: 16px; height: 16px; }

/* ── Meta strip under CTAs ──────────────────────────────── */
.fn-meta-row {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--fn-text-light);
  font-size: 13px;
}
.fn-meta-row > span { display: inline-flex; align-items: center; gap: 6px; }
.fn-meta-row svg { width: 14px; height: 14px; color: var(--fn-blue); }

/* ── Hero visual card (collage) ─────────────────────────── */
.fn-hero-card {
  position: relative;
  border-radius: var(--fn-r-lg);
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  box-shadow: var(--fn-shadow-lg);
  overflow: hidden;
}
.fn-hero-card-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--fn-bg-subtle);
  border-bottom: 1px solid var(--fn-border-subtle);
}
.fn-hero-card-chrome span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e1e4e8;
}
.fn-hero-card-chrome span:nth-child(1) { background: #ff5f57; }
.fn-hero-card-chrome span:nth-child(2) { background: #febc2e; }
.fn-hero-card-chrome span:nth-child(3) { background: #28c840; }
.fn-hero-card-chrome em {
  margin-left: 12px;
  font-style: normal;
  font-family: var(--fn-mono);
  font-size: 11.5px;
  color: var(--fn-text-light);
}

.fn-hero-card-body {
  padding: 20px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.fn-hero-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--fn-r);
  background: var(--fn-bg-subtle) center/cover no-repeat;
  border: 1px solid var(--fn-border-subtle);
}

.fn-pred {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fn-pred-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
}
.fn-pred-row .fn-pred-label { color: var(--fn-text); font-weight: 500; }
.fn-pred-row .fn-pred-score { color: var(--fn-text-light); font-variant-numeric: tabular-nums; font-family: var(--fn-mono); font-size: 12px; }
.fn-pred-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--fn-bg-hover);
  overflow: hidden;
}
.fn-pred-bar > i {
  display: block;
  height: 100%;
  background: var(--fn-blue);
  border-radius: 999px;
}
.fn-pred-row.fn-pred-top .fn-pred-label { color: var(--fn-blue); font-weight: 600; }
.fn-pred-row.fn-pred-top .fn-pred-bar > i { background: linear-gradient(90deg, var(--fn-blue), #4a8fd1); }

/* ── Try-it section ─────────────────────────────────────── */
.fn-try-card {
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-lg);
  box-shadow: var(--fn-shadow-md);
  padding: 28px;
}

.fn-try-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.fn-try-head h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.fn-try-head p {
  margin: 0;
  color: var(--fn-text-muted);
  font-size: 14px;
}

/* The embed-image widget is injected by /assets/js/embed-image.js inside .fn-try-card .fn-embed-host */
.fn-embed-host #invoke-container .upload-area {
  border-radius: var(--fn-r-lg) !important;
  border: 2px dashed var(--fn-blue) !important;
  background-color: var(--fn-blue-soft) !important;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.fn-embed-host #invoke-container .upload-area:hover {
  background-color: #e4ecf6 !important;
}
.fn-embed-host #invoke-container .upload-instructions {
  font-family: var(--fn-font) !important;
  color: var(--fn-text) !important;
}
.fn-embed-host #invoke-container #prediction,
.fn-embed-host #invoke-container #no-prediction,
.fn-embed-host #invoke-container #error {
  font-family: var(--fn-font) !important;
}

/* ── Section headings ───────────────────────────────────── */
.fn-h2 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.fn-section-sub {
  color: var(--fn-text-muted);
  font-size: 15px;
  margin: 0 0 32px;
  max-width: 680px;
}

/* ── Labels grid ────────────────────────────────────────── */
.fn-labels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.fn-label-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r);
  font-size: 13.5px;
  color: var(--fn-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.fn-label-chip:hover {
  border-color: var(--fn-blue);
  box-shadow: var(--fn-shadow-sm);
  transform: translateY(-1px);
}
.fn-label-chip-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--fn-blue-soft);
  color: var(--fn-blue);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fn-label-chip-icon svg { width: 16px; height: 16px; }

.fn-labels-more {
  margin-top: 18px;
  font-size: 13px;
  color: var(--fn-text-muted);
}

/* ── Use cases ──────────────────────────────────────────── */
.fn-use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.fn-use-card {
  padding: 22px;
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-lg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fn-use-card:hover {
  border-color: var(--fn-blue);
  box-shadow: var(--fn-shadow-md);
}
.fn-use-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--fn-blue-soft);
  color: var(--fn-blue);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.fn-use-card-icon svg { width: 18px; height: 18px; }
.fn-use-card h3 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--fn-text);
}
.fn-use-card p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fn-text-muted);
  margin: 0;
}

/* ── How it works ───────────────────────────────────────── */
.fn-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 12px;
}
.fn-step {
  position: relative;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-lg);
}
.fn-step-num {
  font-family: var(--fn-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--fn-blue);
  background: var(--fn-blue-soft);
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 10px;
}
.fn-step h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fn-step p { font-size: 13.5px; color: var(--fn-text-muted); line-height: 1.55; margin: 0; }
.fn-step-tag {
  font-family: var(--fn-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fn-text-muted);
  background: var(--fn-bg-subtle);
  border: 1px solid var(--fn-border-subtle);
  padding: 2px 7px;
  border-radius: 999px;
}
.fn-step-progression {
  list-style: none;
  counter-reset: fn-prog;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fn-step-progression li {
  counter-increment: fn-prog;
  position: relative;
  padding: 10px 12px 10px 36px;
  background: var(--fn-bg-subtle);
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-md, 8px);
  font-size: 13px;
  color: var(--fn-text-muted);
  line-height: 1.5;
}
.fn-step-progression li::before {
  content: counter(fn-prog);
  position: absolute;
  top: 10px;
  left: 10px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--fn-blue);
  color: #fff;
  font-family: var(--fn-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fn-step-progression li strong {
  color: var(--fn-text);
  font-weight: 600;
}

/* ── Result explainer (below /invoke widget) ────────────── */
.fn-result-explainer {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--fn-blue-soft, #eaf2fb);
  border: 1px solid rgba(30, 92, 151, 0.18);
  border-radius: var(--fn-r-lg, 10px);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.fn-result-explainer-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--fn-blue);
  margin-top: 1px;
}
.fn-result-explainer-icon svg { width: 100%; height: 100%; }
.fn-result-explainer-body { flex: 1 1 auto; min-width: 0; }
.fn-result-explainer h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--fn-text);
}
.fn-result-explainer p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fn-text-muted);
  margin: 0 0 10px;
}
.fn-result-explainer p strong { color: var(--fn-text); font-weight: 600; }
.fn-result-legend {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fn-result-legend li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--fn-text-muted);
  line-height: 1.5;
}
.fn-result-legend li strong { color: var(--fn-text); font-weight: 600; }
.fn-conf-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 6px;
  display: inline-block;
}
.fn-conf-dot--high { background: #16a34a; }
.fn-conf-dot--mid  { background: #d4932e; }
.fn-conf-dot--low  { background: #dc2626; }
.fn-result-hint {
  font-size: 12.5px;
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed rgba(30, 92, 151, 0.2);
}
.fn-result-hint a { color: var(--fn-blue); font-weight: 600; text-decoration: none; }
.fn-result-hint a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .fn-result-explainer { flex-direction: column; gap: 10px; }
  .fn-result-explainer-icon { width: 20px; height: 20px; }
}

/* ── Under-the-hood spec grid ───────────────────────────── */
.fn-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.fn-spec-card {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fn-spec-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fn-text-light);
}
.fn-spec-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.fn-spec-detail {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fn-text-muted);
  margin: 0;
}

.fn-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--fn-mono);
  background: var(--fn-bg-subtle);
  color: var(--fn-text);
  border: 1px solid var(--fn-border-subtle);
}
.fn-tag--blue   { background: var(--fn-blue-soft);   color: var(--fn-blue);   border-color: rgba(30,92,151,0.18); }
.fn-tag--orange { background: #fdf3e2;               color: #a36d17;          border-color: rgba(212,147,46,0.22); }
.fn-tag--green  { background: #e7f6ec;               color: #15803d;          border-color: rgba(22,163,74,0.22); }

/* Callout banner */
.fn-callout {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--fn-blue-soft);
  border: 1px solid rgba(30,92,151,0.18);
  border-left: 3px solid var(--fn-blue);
  border-radius: var(--fn-r);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fn-text);
}
.fn-callout-icon {
  flex-shrink: 0;
  color: var(--fn-blue);
  margin-top: 1px;
}
.fn-callout-icon svg { width: 18px; height: 18px; }
.fn-callout strong { color: var(--fn-text); }

/* ── Related ────────────────────────────────────────────── */
.fn-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.fn-related-card {
  display: block;
  background: #fff;
  border: 1px solid var(--fn-border-subtle);
  border-radius: var(--fn-r-lg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  color: var(--fn-text) !important;
  text-decoration: none !important;
}
.fn-related-card:hover {
  border-color: var(--fn-blue);
  box-shadow: var(--fn-shadow-md);
  transform: translateY(-2px);
  color: var(--fn-text) !important;
}
.fn-related-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--fn-bg-subtle);
  border-bottom: 1px solid var(--fn-border-subtle);
}
.fn-related-card-body { padding: 14px 16px; }
.fn-related-card-title { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.fn-related-card-meta { font-size: 12px; color: var(--fn-text-light); }

/* ── Final CTA band ─────────────────────────────────────── */
.fn-final-cta {
  background: linear-gradient(135deg, #1e5c97 0%, #2b75b8 100%);
  color: #fff;
  border-radius: var(--fn-r-lg);
  padding: 48px 40px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
}
.fn-final-cta h2 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
  color: #fff;
}
.fn-final-cta p {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  margin: 0;
}
.fn-final-cta-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.fn-final-cta .fn-btn--primary { background: #fff; color: var(--fn-blue) !important; border-color: #fff; }
.fn-final-cta .fn-btn--primary:hover { background: #f0f3f7; color: var(--fn-blue-hover) !important; }
.fn-final-cta .fn-btn--ghost { background: transparent; color: #fff !important; border-color: rgba(255,255,255,0.35); }
.fn-final-cta .fn-btn--ghost:hover { background: rgba(255,255,255,0.10); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .fn-hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .fn-hero-card-body { grid-template-columns: 1fr; }
  .fn-h1 { font-size: 34px; }
  .fn-steps { grid-template-columns: 1fr; }
  .fn-final-cta { grid-template-columns: 1fr; padding: 32px 24px; text-align: left; }
  .fn-final-cta-actions { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .fn-section { padding: 44px 0; }
  .fn-hero { padding: 36px 0 16px; }
  .fn-h1 { font-size: 28px; }
  .fn-sub { font-size: 15px; }
  .fn-try-card { padding: 18px; }
  .fn-cta-row .fn-btn { flex: 1 1 auto; justify-content: center; }
}

/* Shared content components (code samples, FAQ, related links, notes) — used by both the
   classifier and detector pages; formerly inlined in Function.cshtml. */
.fn-code-block { background: #161b22; color: #e6edf3; border: 1px solid #30363d; border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: 12.5px;
  line-height: 1.6; margin: 0 0 14px; }
.fn-code-block code { font-family: inherit; white-space: pre; }
.fn-code-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #6e7781; margin: 0 0 6px; font-weight: 600; }
.fn-doclinks { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; margin-top: 6px; }
.fn-faq-item { border-bottom: 1px solid #e8ecf0; padding: 14px 0; }
.fn-faq-item h3 { font-size: 15px; margin: 0 0 6px; }
.fn-faq-item p { margin: 0; color: #57606a; font-size: 14px; line-height: 1.6; }
.fn-related-links { display: flex; flex-wrap: wrap; gap: 10px; }
.fn-related-links a { border: 1px solid #d0d7de; border-radius: 20px; padding: 6px 14px; font-size: 13px; text-decoration: none; }
.fn-related-links a:hover { border-color: #1e5c97; }
.fn-sensitive-note { background: #FAEEDA; border: 1px solid #e8d9b8; border-radius: 8px; padding: 12px 16px;
  font-size: 13px; color: #634f1e; margin: 16px 0 0; line-height: 1.55; }
.fn-error-banner { background: #FCEBEB; border: 1px solid #F09595; border-radius: 8px; padding: 12px 16px;
  font-size: 14px; color: #791F1F; margin: 12px 0 0; }
.fn-platform-list { columns: 2; gap: 32px; padding-left: 18px; margin: 10px 0 0; }
.fn-platform-list li { margin-bottom: 8px; font-size: 14.5px; color: #333; break-inside: avoid; }
@media (max-width: 700px) { .fn-platform-list { columns: 1; } }
