/* The New project dialog (new-project.js), and the clone line it leaves on a
   new repository's first document. Colours are the theme's tokens throughout,
   so both themes come for free; the one exception is the scrim, which is dark
   in either theme, as every other dialog's is. */

#new-project-dialog {
  width: min(580px, calc(100vw - 24px));
  max-height: min(92vh, 880px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
#new-project-dialog[open] { display: flex; flex-direction: column; }
#new-project-dialog::backdrop { background: #17291f70; backdrop-filter: blur(3px); }

.np-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 18px 14px 24px;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}
.np-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.np-head #np-back { margin-left: -8px; }
.np-head .icon-btn { width: 34px; height: 34px; }
.np-head .icon-btn:hover { background: var(--surface-hover-card); color: var(--text); }
.np-head .icon-btn[hidden] { display: none; }

.np-body { padding: 20px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
.np-lede { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; color: var(--text-soft); }

/* ---- the three ways a project begins ---- */
.np-choices { display: grid; gap: 10px; }
.np-choice {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.np-choice:hover { border-color: var(--accent); background: var(--accent-wash); }
.np-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.np-choice-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
}
.np-choice-icon .ic { width: 20px; height: 20px; }
.np-choice-text { display: grid; gap: 4px; min-width: 0; }
.np-choice-text strong { font-size: 14.5px; font-weight: 600; }
.np-choice-text span { font-size: 12.5px; line-height: 1.55; color: var(--text-soft); }
.np-choice-go { color: var(--text-faint); display: grid; place-items: center; }
.np-choice-go .ic { width: 16px; height: 16px; }
.np-choice:hover .np-choice-go { color: var(--accent); }

/* ---- forms ---- */
.np-form { margin: 0; }
.np-label { display: block; margin: 18px 0 7px; padding: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.np-form > .np-label:first-of-type { margin-top: 0; }
.np-optional { margin-left: 4px; font-weight: 500; font-size: 11.5px; color: var(--text-faint); }
.np-form input:not([type="radio"]), .np-form select {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.np-form input::placeholder { color: var(--text-faint); opacity: 1; }
.np-form input:not([type="radio"]):focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.np-form input:disabled, .np-form select:disabled { opacity: 0.6; }
.np-hint { margin: 7px 0 0; font-size: 12px; line-height: 1.55; color: var(--text-soft); overflow-wrap: anywhere; }
.np-hint a { color: var(--accent); font-weight: 600; text-decoration: none; }
.np-hint a:hover { text-decoration: underline; }
.np-hint.np-bad { color: var(--danger); }
.np-small { margin: 8px 0 0; font-size: 12px; line-height: 1.55; color: var(--text-soft); }

/* "acme / handbook": the account is said, the name is typed. */
.np-repository { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card); overflow: hidden; }
.np-repository:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.np-prefix { display: flex; align-items: center; flex: none; max-width: 45%; padding: 0 2px 0 12px; font: 13px var(--font-mono); color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-form .np-repository input { border: 0; border-radius: 0; height: 40px; padding-left: 6px; font-family: var(--font-mono); font-size: 13px; min-width: 0; }
.np-form .np-repository input:focus-visible { outline: none; }

/* A legend ignores the margin a label takes, so the group carries the gap. */
.np-set { margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.np-set > .np-label { margin: 0 0 7px; }
.np-options { display: grid; gap: 8px; }
.np-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.np-option:hover { border-color: var(--border-hover); }
.np-option:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.np-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Drawn rather than native: the platform's radio ignores the theme, and an
   unchecked one is a white disc on the dark card. */
.np-option input {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-hover);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
}
.np-option input::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.12s ease; }
.np-option input:checked { border-color: var(--accent); }
.np-option input:checked::before { transform: scale(1); }
.np-option input:focus-visible { outline: none; }
.np-option > span { display: grid; gap: 2px; min-width: 0; }
.np-option strong { font-size: 13.5px; font-weight: 600; }
.np-option span span { font-size: 12px; line-height: 1.5; color: var(--text-soft); }

.np-note { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-soft); font-size: 13px; line-height: 1.6; color: var(--text-body); }
.np-note p { margin: 0; }
.np-note-warn { border-color: var(--attn-border); background: var(--attn-bg); color: var(--attn-text); }
.np-note-warn .np-small { color: var(--attn-text-quiet); }
.np-note-bad { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.np-note[hidden] { display: none; }
.np-note-first { margin: 0 0 4px; }
.np-note .text-btn { margin: 6px 0 0 -7px; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.np-waiting { display: flex; align-items: center; gap: 10px; color: var(--text-soft); }

.np-connect { margin-top: 16px; padding: 16px; border: 1px dashed var(--border-dashed); border-radius: 10px; background: var(--bg-soft); }
.np-connect p { margin: 0 0 12px; font-size: 13px; line-height: 1.6; color: var(--text-body); }
.np-github-btn { gap: 8px; padding: 9px 14px; font-size: 13px; text-decoration: none; }
.np-github-btn .ic { width: 16px; height: 16px; }
.np-github-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.np-github-actions:empty { display: none; }
.np-github-actions a { text-decoration: none; }
.np-github-account { margin-top: 14px; }

.np-taken { margin-top: 8px; padding: 11px 12px; border: 1px solid var(--danger); border-radius: 9px; background: var(--danger-bg); }
.np-taken[hidden] { display: none; }
.np-taken p { margin: 0 0 9px; font-size: 13px; line-height: 1.5; color: var(--danger); }
.np-taken-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.np-taken-actions:empty { display: none; }

.np-error { margin: 14px 0 0; font-size: 13px; line-height: 1.5; color: var(--danger); }
.np-error:empty { display: none; }
.np-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.np-foot .ghost-btn, .np-foot .primary { min-height: 38px; padding: 8px 16px; font-size: 13.5px; text-decoration: none; }

/* ---- a stop the person can act on ---- */
.np-stop .np-note:first-child { margin-top: 0; }
.np-stop-title { margin: 22px 0 0; font-size: 15px; font-weight: 600; }
.np-steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: np-step; display: grid; gap: 16px; }
.np-steps li { counter-increment: np-step; position: relative; padding-left: 36px; display: grid; gap: 10px; justify-items: start; font-size: 13px; line-height: 1.6; color: var(--text-body); }
.np-steps li::before {
  content: counter(np-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.np-out { gap: 7px; text-decoration: none; max-width: 100%; white-space: normal; text-align: left; }
.np-out .ic { width: 14px; height: 14px; flex: none; }
a.np-primary-link {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
a.np-primary-link:hover { filter: brightness(1.08); }
a.np-primary-link:focus-visible, .np-out:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.np-status { display: inline-flex; align-items: center; gap: 9px; margin: 0; padding: 7px 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); max-width: 100%; overflow-wrap: anywhere; }
.np-status.is-found { background: var(--success-bg); border-color: var(--success-border); color: var(--text); }
.np-status .ic { width: 14px; height: 14px; flex: none; }
.np-pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); animation: np-pulse 1.4s ease-in-out infinite; }
@keyframes np-pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---- the clone line on a new repository's first document ---- */
.clone-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  min-width: 0;
}
.clone-hint > .ic { width: 14px; height: 14px; flex: none; }
.clone-hint-text { flex: none; }
.clone-hint code { flex: 0 1 auto; min-width: 0; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font: 12px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all; }
.clone-hint .text-btn { flex: none; font-size: 12px; }
.clone-hint .icon-btn { margin-left: auto; width: 28px; height: 28px; }
#doc-pane.viewing-history .clone-hint { display: none; }

@media (max-width: 600px) {
  #new-project-dialog { width: calc(100vw - 16px); max-height: 94vh; border-radius: 12px; }
  .np-head { padding: 14px 12px 12px 16px; }
  .np-body { padding: 16px 16px 20px; }
  .np-choice { grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 12px; padding: 14px 12px; }
  .np-choice-icon { width: 36px; height: 36px; }
  .np-form input:not([type="radio"]), .np-form select { height: var(--tap); font-size: 16px; }
  .np-form .np-repository input { height: calc(var(--tap) - 2px); font-size: 14px; }
  .np-foot { flex-direction: column-reverse; }
  .np-foot .ghost-btn, .np-foot .primary { width: 100%; justify-content: center; min-height: var(--tap); }
  .np-github-btn { width: 100%; justify-content: center; min-height: var(--tap); }
  a.np-primary-link { min-height: var(--tap); }
  .clone-hint { position: relative; flex-wrap: wrap; padding: 10px 12px 10px 16px; row-gap: 6px; }
  .clone-hint > .ic { display: none; }
  .clone-hint-text { flex: 1 1 100%; padding-right: 36px; }
  .clone-hint code { flex: 1 1 0; }
  .clone-hint .icon-btn { position: absolute; top: 4px; right: 6px; margin: 0; }
}
@media (min-width: 601px) {
  .np-options-2 { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .np-choice, .np-option, .np-option input::before { transition: none; }
  .np-pulse { animation: none; opacity: 0.8; }
}
