/* Foundation layer: accessibility + interaction baselines shared by every surface.
   Uses :where() so surface styles can still override. Load after surface CSS. */

:root { color-scheme: dark; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body { -webkit-tap-highlight-color: transparent; overflow-wrap: break-word; }

:where(h1, h2, h3) { text-wrap: balance; }
:where(p, li) { text-wrap: pretty; }
:where(img, svg, video, canvas) { max-width: 100%; }
:where(img) { height: auto; }

::selection { background: rgba(0, 194, 168, 0.3); }

/* Single, consistent keyboard focus indicator */
:where(a, button, summary, select, textarea, input, [role="button"], [role="tab"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--ls-signal-bright, #2dd4bf);
  outline-offset: 2px;
}
:where(a, button, [role="button"], [role="tab"], summary):focus:not(:focus-visible) { outline: none; }

/* Form states: error + disabled clarity */
.linkset-root :is(.ls-input, .ls-textarea, .ls-select)[aria-invalid="true"] {
  border-color: var(--ls-danger, #f87171);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}
.linkset-root .ls-field-error {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: var(--ls-text-sm, 0.8125rem);
  line-height: 1.45;
  color: #fca5a5;
}
.linkset-root .ls-field-help {
  margin-top: 0.5rem;
  font-size: var(--ls-text-sm, 0.8125rem);
  line-height: 1.5;
  color: var(--ls-ink-muted, #94a3b8);
}
:where(button, [role="button"], .ls-btn-violet, .ls-btn-outline):disabled,
:where([aria-disabled="true"]) { cursor: not-allowed; opacity: 0.55; }

/* Touch: 44px targets, no iOS input zoom */
@media (pointer: coarse) {
  .linkset-root :is(.ls-btn-violet, .ls-btn-outline, .ls-btn-ember, .ls-btn-signal, .ls-btn-ghost,
    .ls-sidebar-link, .ls-editor-tab, .ls-studio-menu-btn, .ls-studio-signout,
    .ls-dash-flash__dismiss, .ls-studio-topbar__preview) {
    min-height: 2.75rem;
  }
  .ls-tabbar__item { min-height: 3.5rem; }
}
@media (max-width: 820px) {
  .linkset-root :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, textarea) {
    font-size: max(1rem, 16px);
  }
}

/* Shared shell chrome (marketing/auth/error) on the Signal Carbon palette */
.linkset-root .ls-site-header {
  position: relative;
  z-index: 40;
  border-bottom: 1px solid var(--ls-border);
  background: rgba(11, 18, 32, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.linkset-root .ls-site-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.linkset-root .ls-site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.linkset-root .ls-site-nav a:not([class*="ls-btn"]) {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: var(--ls-radius-sm);
  color: var(--ls-ink-muted);
  text-decoration: none;
  transition: var(--ls-transition);
}
.linkset-root .ls-site-nav a:not([class*="ls-btn"]):hover,
.linkset-root .ls-site-nav a[aria-current="page"] { color: var(--ls-ink); background: rgba(148, 163, 184, 0.1); }
.linkset-root .ls-site-brand { color: var(--ls-ink); text-decoration: none; }
.linkset-root .ls-site-brand:hover { color: var(--ls-signal-bright); }
.linkset-root .ls-site-backdrop {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(0, 194, 168, 0.12), transparent 60%);
}
.linkset-root .ls-auth-card {
  width: 100%;
  max-width: 26.25rem;
  padding: 2rem;
  border: 1px solid var(--ls-border);
  border-radius: 1.5rem;
  background: var(--ls-surface-raised);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
@media (min-width: 640px) { .linkset-root .ls-auth-card { padding: 2.5rem; } }
.linkset-root .ls-site-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--ls-border);
  padding: 2rem 1rem;
  text-align: center;
  font-size: var(--ls-text-sm);
  color: var(--ls-ink-muted);
}
.linkset-root .ls-site-footer a { color: inherit; }
.linkset-root .ls-site-footer a:hover { color: var(--ls-signal-bright); }

/* Honor user motion + contrast preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-contrast: more) {
  :root { --ls-border: rgba(148, 163, 184, 0.8); --ls-ink-muted: #cbd5e1; --ls-ink-faint: #b6c2d3; }
}
@media (forced-colors: active) {
  :where(a, button, input, select, textarea):focus-visible { outline: 2px solid Highlight; }
  .linkset-root .ls-auth-card, .linkset-root .ls-dash-flash { border: 1px solid CanvasText; }
}
@media print {
  .ls-studio-rail, .ls-tabbar, .ls-site-header, .ls-skip { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* Legacy utility remaps: lift low-contrast greys to AA and retire the off-brand lime accent.
   (Tailwind is prebuilt, so these are mapped here rather than re-generated.) */
.linkset-root .text-zinc-500,
.linkset-root .text-slate-500 { color: var(--ls-ink-faint); }
.linkset-root .text-zinc-400 { color: var(--ls-ink-muted); }
.linkset-root :is(.text-lime-200, .text-lime-300, .text-lime-300\/90, .text-lime-400) { color: var(--ls-signal-bright); }
.linkset-root :is(.hover\:text-lime-200, .hover\:text-lime-300):hover { color: var(--ls-ink); }
.linkset-root .hover\:text-zinc-100:hover, .linkset-root .hover\:text-white:hover { color: #fff; }
