/* Editorial Atelier — Sprint 6 premium polish & accessibility */

html { scroll-behavior: smooth; }
body { text-rendering: optimizeLegibility; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 68px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(74, 48, 37, .04);
}

.product-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid rgba(221, 207, 187, .82);
  border-radius: 999px;
  background: rgba(255, 253, 248, .72);
}
.product-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.product-nav a:hover,
.product-nav a[aria-current="true"] {
  background: var(--brown);
  color: #fff;
  box-shadow: 0 5px 14px rgba(74, 48, 37, .13);
}
.product-nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#product-command-center,
#automation-operations,
#control-center-title,
#analytics-intelligence,
#editorial-workspace-shell,
#advanced-analytics {
  scroll-margin-top: 92px;
}

/* Clearer section rhythm after the functional redesign. */
.product-command-center,
.automation-operations,
.control-center,
.analytics-intelligence,
.editorial-workspace-shell,
.advanced-analytics {
  isolation: isolate;
}

.control-center {
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(74, 48, 37, .055);
}
.control-heading { padding: clamp(18px, 2.5vw, 28px); }
.fetch-status { min-height: 34px; }

/* Technical/secondary surfaces should not visually compete with decisions. */
.product-system-details,
.advanced-analytics {
  box-shadow: none;
}
.product-system-details > summary small,
.advanced-analytics > summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

/* Consistent controls. */
button,
input,
select,
summary,
a { -webkit-tap-highlight-color: transparent; }
button,
input,
select { border-radius: 9px; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

button[disabled],
input[disabled],
select[disabled] { cursor: not-allowed; }

/* Prevent long generated titles and technical messages from breaking cards. */
.product-status-card,
.operation-copy,
.intelligence-list-row,
.article-row,
.article-detail,
.worker-error,
.product-attention-copy { overflow-wrap: anywhere; }

/* Stronger low-data semantics without inventing confidence. */
.sample-warning {
  display: inline-flex !important;
  width: max-content;
  margin-top: 5px !important;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(154, 106, 40, .07);
}

/* Advanced tables stay usable instead of breaking the viewport. */
.advanced-analytics .market-table-wrap {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}
.advanced-analytics .market-table { min-width: 720px; }

/* Dialogs stay within small laptop/mobile viewports. */
dialog { max-width: calc(100vw - 24px); }
.connection-dialog,
.image-lightbox { max-height: calc(100dvh - 24px); }

/* Make hidden/collapsed content inert visually while preserving app ownership. */
[hidden] { display: none !important; }

@media (max-width: 980px) {
  .topbar { gap: 10px; }
  .product-nav { margin-left: 10px; overflow-x: auto; scrollbar-width: none; }
  .product-nav::-webkit-scrollbar { display: none; }
  .product-nav a { min-height: 36px; }
}

@media (max-width: 720px) {
  .topbar {
    position: sticky;
    min-height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
  }
  .brand-lockup { min-width: 0; }
  .brand-lockup small { display: none; }
  .product-nav {
    order: 3;
    width: 100%;
    margin: 0;
    justify-content: flex-start;
    border-radius: 12px;
  }
  .product-nav a { flex: 0 0 auto; min-height: 38px; }
  #product-command-center,
  #automation-operations,
  #control-center-title,
  #analytics-intelligence,
  #editorial-workspace-shell,
  #advanced-analytics { scroll-margin-top: 122px; }

  button,
  select,
  input { min-height: 44px; }
}

@media (max-width: 390px) {
  main { padding-left: 10px; padding-right: 10px; }
  .product-command-center,
  .automation-operations,
  .control-center,
  .analytics-intelligence,
  .editorial-workspace-shell,
  .advanced-analytics { border-radius: 15px; }
  .product-nav a { padding-inline: 9px; }
  .product-command-title { font-size: 31px; }
  .intelligence-head h2,
  .workspace-shell-head h2 { font-size: 25px; }
}

@media (prefers-contrast: more) {
  :root { --line: #bcae9a; --muted: #5f5149; }
  .product-health-pill,
  .product-attention,
  .intelligence-card,
  .operations-panel { border-width: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
