/*
  Shared Freely UI layer.
  Source of truth: computefreely.com/assets/shared/freely-ui.css
  Other Freely sites copy this file with `npm run sync:design`.
*/

:root {
  color-scheme: light;
  --freely-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --freely-page: #f5f4ee;
  --freely-surface: #fffdfa;
  --freely-surface-panel: rgba(255, 253, 250, 0.88);
  --freely-surface-soft: #edf6f3;
  --freely-ink: #17211f;
  --freely-ink-soft: #2d3a36;
  --freely-muted: #65726f;
  --freely-line: rgba(23, 33, 31, 0.13);
  --freely-line-strong: rgba(23, 33, 31, 0.24);
  --freely-teal: #0f948c;
  --freely-teal-dark: #0a605c;
  --freely-green: #2f7a55;
  --freely-orange: #c75d23;
  --freely-yellow: #f1b928;
  --freely-red: #b42318;
  --freely-focus: #2563eb;
  --freely-violet: #5d5bd7;
  --freely-radius: 8px;
  --freely-shadow: 0 22px 70px rgba(23, 33, 31, 0.14);

  --page: var(--freely-page);
  --paper: var(--freely-page);
  --surface: var(--freely-surface);
  --paper-strong: var(--freely-surface);
  --surface-soft: var(--freely-surface-soft);
  --ink: var(--freely-ink);
  --ink-soft: var(--freely-ink-soft);
  --muted: var(--freely-muted);
  --line: var(--freely-line);
  --line-strong: var(--freely-line-strong);
  --teal: var(--freely-teal);
  --teal-dark: var(--freely-teal-dark);
  --green: var(--freely-green);
  --orange: var(--freely-orange);
  --yellow: var(--freely-yellow);
  --red: var(--freely-red);
  --coral: var(--freely-orange);
  --coral-dark: #943421;
  --rose: #b4234f;
  --amber: #b7791f;
  --violet: var(--freely-violet);
  --focus: var(--freely-focus);
  --shadow: var(--freely-shadow);
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  color: var(--ink);
  font-family: var(--freely-font);
  line-height: 1.5;
}

@supports selector(body:has(.app-shell)) {
  body:has(.app-shell) {
    background:
      linear-gradient(135deg, rgba(15, 148, 140, 0.1), transparent 34rem),
      linear-gradient(315deg, rgba(199, 93, 35, 0.08), transparent 32rem),
      var(--page);
  }
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(23, 33, 31, 0.08);
  background: rgba(245, 244, 238, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand small {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(23, 33, 31, 0.16);
  border-radius: var(--freely-radius);
  background: var(--surface);
  object-fit: cover;
}

.topbar-actions,
.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.34rem 0.66rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.78);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
}

.nav-links a {
  padding: 0.45rem 0.72rem;
  border-radius: var(--freely-radius);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 850;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: rgba(15, 148, 140, 0.1);
  color: var(--teal-dark);
  outline: none;
}

.app-shell {
  gap: clamp(1rem, 2.2vw, 1.5rem);
  width: min(1600px, 100%);
  padding: clamp(1rem, 2.4vw, 1.5rem);
}

.workspace-pane,
.preview-pane,
.control-pane,
.panel {
  min-width: 0;
}

.workspace-pane,
.preview-pane,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--freely-radius);
  background: var(--freely-surface-panel);
}

.workspace-pane,
.preview-pane {
  box-shadow: var(--shadow);
}

.panel {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.74) inset;
}

.workspace-header,
.preview-header,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.compact-header {
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 0.22rem;
  color: var(--orange);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-header h1,
.preview-header h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(1.9rem, 4.8vw, 3.65rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.panel-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.16;
  letter-spacing: 0;
}

.engine-badge,
.preview-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 2rem;
  max-width: 18rem;
  padding: 0.36rem 0.68rem;
  border: 1px solid rgba(15, 148, 140, 0.24);
  border-radius: 999px;
  color: var(--teal-dark);
  background: rgba(15, 148, 140, 0.1);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.engine-badge.warn {
  border-color: rgba(199, 93, 35, 0.28);
  color: var(--orange);
  background: rgba(199, 93, 35, 0.1);
}

.engine-badge.danger {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--red);
  background: rgba(180, 35, 24, 0.1);
}

.promise-strip {
  border: 1px solid rgba(47, 122, 85, 0.22);
  border-radius: var(--freely-radius);
  background: rgba(47, 122, 85, 0.08);
  color: var(--ink);
}

.promise-strip a {
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration: none;
}

.promise-strip a:hover,
.promise-strip a:focus-visible {
  color: var(--ink);
  outline: none;
}

.drop-zone {
  border-color: var(--line-strong);
  border-radius: var(--freely-radius);
  background: #fffdfa;
}

.drop-zone.dragging {
  border-color: var(--teal);
  background: rgba(15, 148, 140, 0.08);
}

.drop-icon {
  border-color: var(--teal);
  border-radius: var(--freely-radius);
  background: rgba(15, 148, 140, 0.1);
}

.drop-title {
  color: var(--ink);
  font-weight: 900;
}

.drop-note {
  color: var(--muted);
}

.workspace-stats div,
.media-details div {
  border: 1px solid var(--line);
  border-radius: var(--freely-radius);
  background: rgba(255, 253, 250, 0.72);
}

.workspace-stats span,
.media-details span,
.field span,
.range-field span,
.field-row label {
  color: var(--muted);
  font-weight: 850;
}

.app-shell .button,
.app-shell .mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.8rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--freely-radius);
  color: var(--ink);
  background: #ffffff;
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.app-shell .button:hover:not(:disabled):not(.disabled),
.app-shell .mini-button:hover:not(:disabled) {
  border-color: rgba(15, 148, 140, 0.38);
  transform: translateY(-1px);
}

.app-shell .button.primary {
  border-color: var(--teal);
  color: #ffffff;
  background: var(--teal);
}

.app-shell .button.ghost {
  color: var(--muted);
  background: transparent;
}

.app-shell .button.danger,
.app-shell .mini-button.danger {
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--red);
  background: #ffffff;
}

.app-shell .button:disabled,
.app-shell .mini-button:disabled,
.app-shell .button.disabled {
  cursor: not-allowed;
  border-color: rgba(23, 33, 31, 0.14);
  color: var(--muted);
  background: rgba(255, 253, 250, 0.72);
  box-shadow: none;
  opacity: 1;
  transform: none;
}

.app-shell .button.primary:disabled,
.app-shell .button.primary.disabled {
  border-color: rgba(23, 33, 31, 0.14);
  color: var(--muted);
  background: rgba(23, 33, 31, 0.08);
}

.app-shell .mini-button {
  min-height: 2.25rem;
  padding: 0.45rem 0.62rem;
  font-size: 0.82rem;
}

.type-card,
.profile-card,
.preset,
.field input,
.field select,
.field textarea,
.payload-output,
.subtle-box,
.empty-state,
.range-field,
.field-row {
  border-color: var(--line);
  border-radius: var(--freely-radius);
  background-color: #fffdfa;
  color: var(--ink);
}

.type-card.active,
.profile-card.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: rgba(15, 148, 140, 0.13);
  box-shadow: 0 0 0 1px rgba(15, 148, 140, 0.1) inset;
}

input[type="range"] {
  accent-color: var(--teal);
}

.field-note,
.subtle-box,
.empty-state p {
  color: var(--muted);
}

body:has(.app-shell) .site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

body:has(.app-shell) .site-footer a {
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration: none;
}

body:has(.app-shell) .site-footer a:hover,
body:has(.app-shell) .site-footer a:focus-visible {
  color: var(--ink);
  outline: none;
}

.suite-footer.site-footer {
  display: grid;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) 0 2rem;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
}

.suite-footer.site-footer .suite-footer-head {
  display: grid;
  gap: 0.18rem;
  max-width: 58rem;
}

.suite-footer.site-footer .suite-footer-head strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.16;
}

.suite-footer.site-footer .suite-footer-head span {
  color: var(--muted);
}

.suite-footer.site-footer .suite-footer-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.suite-footer.site-footer .suite-link {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
  padding: 0.62rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: var(--freely-radius);
  color: var(--ink-soft);
  background: rgba(255, 253, 250, 0.72);
  text-decoration: none;
}

.suite-footer.site-footer .suite-link strong,
.suite-footer.site-footer .suite-link span {
  display: block;
  line-height: 1.16;
}

.suite-footer.site-footer .suite-link strong {
  color: inherit;
  font-size: 0.86rem;
  font-weight: 950;
}

.suite-footer.site-footer .suite-link span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.suite-footer.site-footer .suite-link:hover,
.suite-footer.site-footer .suite-link:focus-visible {
  border-color: rgba(15, 148, 140, 0.3);
  color: var(--teal-dark);
  background: rgba(15, 148, 140, 0.08);
  outline: none;
}

.suite-footer.site-footer .suite-footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.42rem 0.75rem;
}

.suite-footer.site-footer .suite-footer-meta a {
  color: var(--teal-dark);
  font-weight: 850;
  text-decoration: none;
}

.suite-footer.site-footer .suite-footer-meta a:hover,
.suite-footer.site-footer .suite-footer-meta a:focus-visible {
  color: var(--ink);
  outline: none;
}

.discovery-section {
  margin: 0;
  padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1rem, 3vw, 2rem);
}

.discovery-content {
  display: grid;
  gap: 1.2rem;
}

.discovery-section h2,
.discovery-section h3,
.discovery-section p {
  margin-top: 0;
}

.discovery-section h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.discovery-lede {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.8vw, 1.18rem);
}

.discovery-grid,
.faq-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.faq-list {
  margin-top: 0.35rem;
}

.discovery-grid article,
.faq-list article {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--freely-radius);
  background: rgba(255, 253, 250, 0.72);
}

.discovery-grid h3,
.faq-list h3 {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.18;
}

.discovery-grid p,
.faq-list p {
  margin-bottom: 0;
  color: var(--muted);
}

.search-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.search-terms li {
  padding: 0.34rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.78);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 850;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .control-pane {
    margin-top: 1rem;
  }

  .workspace-pane,
  .preview-pane {
    position: relative;
    top: auto;
    max-height: none;
  }

  .discovery-grid,
  .faq-list {
    grid-template-columns: 1fr;
  }

  .suite-footer.site-footer .suite-footer-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .workspace-header,
  .preview-header,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .nav-links {
    justify-content: flex-start;
    width: 100%;
  }

  .app-shell {
    padding: 0.75rem;
  }

  .app-shell .action-row .button {
    flex: 1 1 auto;
  }

  .suite-footer.site-footer .suite-footer-nav {
    grid-template-columns: 1fr;
  }
}
