/* Brand and typography. Shared surface colors are declared here. */
@font-face {
  font-family: 'Outfit';
  src: url('/assets/fonts/outfit-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/assets/fonts/ibm-plex-mono-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  --brand-white: #ffffff;
  --brand-black: #000000;
  --brand-violet: #5148bd;
  color-scheme: light;
  --paper: #f8f9fc;
  --panel: #fff;
  --ink: #202237;
  --muted: #595d77;
  --line: #d9dde9;
  --subtle: #efeeff;
  --accent: #5148bd;
  --accent-dark: #413b9a;
  --mint: #ddf4e5;
  --green: #26553d;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Outfit', var(--sans);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
}
a {
  color: inherit;
  text-underline-offset: 0.22em;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select,
summary {
  cursor: pointer;
}
button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  transform: translateY(-160%);
  background: white;
  padding: 10px 16px;
}
.skip:focus {
  transform: none;
}
.screen-reader {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}
h1,
h2,
h3,
h4 {
  font-family: var(--display);
  line-height: 1.22;
}
img {
  display: block;
  max-width: 100%;
}

/* The approved horizontal lockup sits on a white header. */
.studio-header {
  font-family: var(--display);
  min-height: 73px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(20px, 2.45vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  background: var(--brand-white);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { flex: none; width: 116px; height: auto; }
.brand span {
  font-size: 13px;
  color: var(--muted);
  margin: 5px 0 0 -4px;
}
.workspace-switch {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding-inline-start: 18px;
  border-left: 1px solid var(--line);
}
.workspace-switch select {
  max-width: min(25vw, 260px);
  min-width: 0;
  border: none;
  color: var(--accent-dark);
  padding: 8px 0;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
}
.new-project {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 21px;
  line-height: 1;
}
.new-project:hover,
.navlink:hover {
  color: var(--accent-dark);
  background: var(--subtle);
}
.primary-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
  align-self: stretch;
  margin-inline-start: auto;
  gap: clamp(4px, 1.25vw, 20px);
}
.navlink {
  display: inline-flex;
  align-items: center;
  padding: 3px 4px 0;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  color: var(--muted);
}
.navlink[aria-current='page'] {
  font-weight: 700;
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.local-label {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 40px clamp(20px, 4.45vw, 72px) 60px;
}
main[data-view='run'] {
  padding: 32px clamp(20px, 2.45vw, 44px) 38px;
}
main:focus:not(:focus-visible) {
  outline: 0;
}

/* Artwork fits the same clipped atlas window as the Figma cover. */
.territory-cover {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #d3d0ff;
}
.territory-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url('/assets/artwork/territory-cover.svg') 48% 50% / 123.5% 121.2% no-repeat;
  mask: url('/assets/artwork/territory-mask.svg') 48% 50% / 115.88% 101.81% no-repeat;
}

/* Shared buttons, status, forms and dialogs. */
.btn,
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}
.btn:hover,
.view-btn:hover {
  background: var(--paper);
  border-color: #b5b5ce;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover {
  background: var(--accent-dark);
}
.btn.quiet {
  background: var(--subtle);
  color: var(--accent-dark);
  border-color: transparent;
}
.badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  border-radius: 30px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #eaecf3;
  color: #484c64;
}
.badge.good {
  background: var(--mint);
  color: var(--green);
}
.badge.good::before {
  content: '';
  width: 7px;
  height: 7px;
  background: url('/assets/icons/confirmed-dot.svg') center / contain no-repeat;
}
.badge.warn {
  background: #fbefba;
  color: #634a13;
}
.badge.bad {
  background: #fce4e6;
  color: #82313b;
}
input,
textarea,
select {
  max-width: 100%;
  border: 1px solid #b7bbcd;
  border-radius: 7px;
  background: var(--panel);
  padding: 9px 11px;
}
input::placeholder,
textarea::placeholder {
  color: #646982;
}
textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
}
.loading,
.notice,
.empty {
  color: var(--muted);
}
.notice {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.inline-error {
  color: #8b2839;
  font-weight: 500;
  margin-top: 8px;
}
.inline-error:empty {
  display: none;
}
dialog {
  width: min(472px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 16px 64px #20223722;
}
dialog::backdrop {
  background: #20223766;
}
dialog h2 {
  font-size: 29px;
  letter-spacing: -0.04em;
  margin: 0 0 18px;
}
dialog input {
  width: 100%;
  margin-bottom: 12px;
}
.dialog-note,
.origin {
  font-size: 14px;
  color: var(--muted);
}
.origin {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  margin: 12px 0;
  border-block: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.origin strong {
  color: var(--ink);
}
.dialog-actions,
.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}
.dialog-actions {
  justify-content: flex-end;
}
.danger-quiet {
  margin-right: auto;
  color: #86273c;
}
@media (max-width: 900px) {
  .studio-header {
    gap: 12px;
  }
  .local-label {
    display: none;
  }
}
@media (max-width: 680px) {
  .studio-header {
    flex-wrap: wrap;
    gap: 0 10px;
    padding: 13px 16px 0;
  }
  .brand img { width: 98px; height: auto; }
  .brand span {
    font-size: 12px;
  }
  .workspace-switch {
    flex: 1;
    justify-content: flex-end;
    border: 0;
    padding: 0;
  }
  .workspace-switch select {
    max-width: min(40vw, 210px);
    font-size: 13px;
  }
  .primary-nav {
    margin: 8px 0 0;
    flex-basis: 100%;
    gap: 16px;
  }
  .navlink {
    padding-block: 9px;
    font-size: 13px;
  }
  main,
  main[data-view='run'] {
    padding: 24px 16px 40px;
  }
  dialog {
    padding: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
