/* THE FBD SURFACE. The design language of the marketing and dashboard pages, taken from the
   landing design: IBM Plex type, the slate palette, the amber accent. The studio keeps its own
   styles; this file only serves the pages around it.

   Theme and accent ride on the root element the way the design carries them:
   data-fbd-theme = light | dark, data-fbd-accent = blue | orange. */

:root,
:root[data-fbd-theme="light"] {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #eef2f7;
  --grid: #e6ebf2;
  --ink: #0f172a;
  --ink-2: #3f4a59;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --line-3: #94a3b8;
  --amber: #0f6fd1;
  --green: #15803d;
  --red: #b91c1c;
}

:root[data-fbd-accent="orange"] {
  --amber: #e0a212;
}

:root[data-fbd-theme="dark"][data-fbd-accent="orange"] {
  --amber: #fbbf24;
}

:root[data-fbd-theme="dark"] {
  --bg: #0e141c;
  --surface: #141c26;
  --surface-2: #1b2532;
  --grid: #1f2c3a;
  --ink: #e4edf8;
  --ink-2: #9db1c9;
  --muted: #8495a9;
  --line: #26323f;
  --line-2: #354555;
  --line-3: #58697d;
  --amber: #4aa8ff;
  --green: #4ade80;
  --red: #f87171;
}

/* ------------------------------------------------------------------ the page frame */

.fbd-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* Button links own their colors; keep the generic link selector's specificity. */
.fbd-page a:where(:not(.fbd-btn)) {
  color: var(--amber);
  text-decoration: none;
}

.fbd-page a:where(:not(.fbd-btn)):hover {
  color: var(--ink);
}

.fbd-page p a:where(:not(.fbd-btn)) { text-decoration: underline; text-underline-offset: .2em; }

.fbd-page ::selection {
  background: var(--amber);
  color: var(--bg);
}

.fbd-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Type voices */

.fbd-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.fbd-heading {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.fbd-mono {
  font-family: "IBM Plex Mono", monospace;
}

/* The numbered section head: the big amber figure beside the title */

.fbd-section-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.fbd-section-num {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  color: var(--amber);
}

/* ------------------------------------------------------------------ the header */

.fbd-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.fbd-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.fbd-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

.fbd-logo-mark {
  width: 15px;
  height: 15px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  position: relative;
  display: inline-block;
  flex: none;
}

.fbd-logo-mark::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 4.5px;
  height: 2px;
  background: var(--amber);
}

.fbd-header-spacer {
  flex: 1;
}

/* The light / dark switch, the design's own segmented mono pair */

.fbd-theme-toggle {
  display: flex;
  border: 1px solid var(--line-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fbd-theme-toggle button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.fbd-theme-toggle button + button {
  border-left: 1px solid var(--line-2);
}

.fbd-theme-toggle button.on {
  background: var(--ink);
  color: var(--bg);
}

.fbd-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  font-size: 13.5px;
}

.fbd-nav-link {
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  padding-bottom: 3px;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  font: inherit;
}

.fbd-nav-link:hover {
  color: var(--ink);
}

.fbd-nav-link.active {
  color: var(--ink);
  border-bottom-color: var(--amber);
}

/* The account pill of a signed in header */

.fbd-account-pill {
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 9px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--bg);
  color: var(--ink);
}

.fbd-account-pill:hover {
  border-color: var(--line-3);
}

.fbd-account-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  display: inline-block;
  position: relative;
  flex: none;
}

.fbd-account-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--amber);
}

.fbd-account-kind {
  color: var(--muted);
}

/* ------------------------------------------------------------------ buttons */

.fbd-btn {
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  padding: 11px 18px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
}

.fbd-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.fbd-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* the filled amber call to action */

.fbd-btn-primary {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--bg);
}

.fbd-btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
}

/* the outlined amber button */

.fbd-btn-outline {
  border-color: var(--amber);
  background: var(--bg);
  color: var(--amber);
}

.fbd-btn-outline:hover {
  background: var(--amber);
  color: var(--bg);
}

/* the quiet button, plain border */

.fbd-btn-quiet {
  font-weight: 400;
  border-color: var(--line-2);
  color: var(--ink-2);
}

.fbd-btn-quiet:hover {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

/* the small inline button of table rows and card corners */

.fbd-btn-tiny {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--muted);
  padding: 3px 8px;
}

.fbd-btn-tiny:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.fbd-btn-tiny.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ------------------------------------------------------------------ cards and thumbnails */

.fbd-card {
  border: 1px solid var(--line);
  background: var(--bg);
}

/* the empty drawing-sheet thumbnail the design uses everywhere */

.fbd-grid-thumb {
  background-color: var(--surface);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 18px 18px;
}

.fbd-card-link {
  border: 1px solid var(--line);
  background: var(--bg);
  display: block;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.fbd-card-link:hover {
  border-color: var(--amber);
  color: var(--ink);
}

/* ------------------------------------------------------------------ tables */

.fbd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.fbd-table th {
  border-bottom: 1px solid var(--line-2);
  padding: 12px 10px;
  text-align: center;
  vertical-align: bottom;
}

.fbd-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  vertical-align: top;
}

.fbd-table .fbd-cell-row {
  font-weight: 600;
  color: var(--ink);
}

.fbd-table .fbd-cell-note {
  color: var(--muted);
  font-size: 13px;
}

.fbd-table .fbd-cell-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* the four tones the feature matrix uses */

.fbd-tone-yes {
  color: var(--amber);
}

.fbd-tone-no {
  color: var(--line-3);
}

.fbd-tone-maybe {
  color: var(--muted);
}

.fbd-tone-num {
  color: var(--ink);
}

/* ------------------------------------------------------------------ the dialog */

.fbd-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fbd-dialog-card {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line-2);
  width: 100%;
  max-width: 520px;
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
}

.fbd-dialog-card.wide {
  max-width: 720px;
}

.fbd-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.fbd-dialog-head h3 {
  margin: 0;
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  font-size: 20px;
}

.fbd-dialog-x {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--muted);
  padding: 3px 9px;
}

.fbd-dialog-x:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.fbd-dialog-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fbd-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ form fields */

.fbd-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fbd-field label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.fbd-input,
.fbd-select {
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 8px 10px;
  width: 100%;
}

.fbd-input:focus,
.fbd-select:focus {
  outline: none;
  border-color: var(--amber);
}

.fbd-hint {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--muted);
}

.fbd-error {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--red);
}

.fbd-success {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--green);
}

/* radio rows the destination pickers use */

.fbd-radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  cursor: pointer;
}

.fbd-radio-row.on {
  border-color: var(--amber);
}

.fbd-radio-row input {
  accent-color: var(--amber);
}

/* ------------------------------------------------------------------ footer */

.fbd-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.fbd-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  justify-content: space-between;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------ small screens */

/* The header earns the right to two rows: logo and workspace on the first, the switches and
   the account on the second. The dialog hugs the edges; the page breathes a little less. */

@media (max-width: 900px) {
  .fbd-header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px 16px;
  }
}

@media (max-width: 720px) {
  .fbd-container {
    padding: 0 16px;
  }

  .fbd-dialog {
    padding: 12px;
  }

  .fbd-account-pill b {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fbd-footer-inner {
    padding: 20px 16px;
  }
}
