/* Amnezi app page styles. Loaded after /assets/site.css; uses its variables only. */

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.app { padding-top: 2.5rem; }
.app > * + * { margin-top: 1.5rem; }
.app-intro h1 { margin-bottom: 0.4em; }
.app .lead { font-size: 1.15rem; color: var(--muted); max-width: 42rem; margin-bottom: 0.75rem; }
.privacy-note {
  display: inline-block;
  max-width: 42rem;
  margin: 0;
  padding: 0.5rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
}

/* Panels and form layout */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 0;
}
.panel h2 { margin-bottom: 0.5em; }
.panel h3 { margin: 1.5rem 0 0.5rem; }
.panel > h3:first-child { margin-top: 0; }

.group { border: 0; margin: 0 0 1.75rem; padding: 0; min-width: 0; }
.group legend { padding: 0; margin-bottom: 0.9rem; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.field { margin-bottom: 1.1rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .label, .label-row > label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.label { display: block; }
.req { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

.app .grid-2 { display: grid; gap: 0 1.25rem; margin-top: 0; }
.app .panel .grid-2 > * { min-width: 0; }

input[type="text"], input[type="password"], select, textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input[type="text"]:hover, input[type="password"]:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[type="text"]:focus-visible, input[type="password"]:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 5rem; }
textarea.mono, .mono { font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.5; white-space: pre; overflow: auto; }
select { appearance: auto; cursor: pointer; }

.row { display: flex; gap: 0.5rem; align-items: stretch; }
.row input { flex: 1 1 auto; min-width: 0; }
.row .btn { flex: none; }

.help { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--muted); }
.help-error { color: var(--fg); font-weight: 700; background: var(--warn-soft); border-radius: 4px; padding: 0.1rem 0.4rem; }

.check { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.6rem; font-size: 0.9rem; font-weight: 400; cursor: pointer; }
.check input { margin: 0.3rem 0 0; flex: none; width: 1rem; height: 1rem; accent-color: var(--accent); }

.label-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin-bottom: 0.35rem; }
.label-row > label:first-child { margin-bottom: 0; }
.file-pick { display: inline-flex; }
.file-pick .btn { margin: 0; }
.file-pick input:focus-visible + .btn { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Buttons (extends site.css .btn) */
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--code-bg); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn:disabled, .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn:disabled:hover { border-color: var(--border); }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.actions { align-items: center; margin-top: 1.25rem; }
.actions .status { margin: 0; }

/* Notices */
.notice {
  margin: 1rem 0;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--code-bg);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.notice-error {
  border-color: color-mix(in srgb, var(--fg) 45%, var(--border));
  border-left-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 6%, var(--surface));
  font-weight: 600;
}
.notice-warn {
  border-color: var(--warn-border);
  border-left-color: var(--warn-border);
  background: var(--warn-soft);
  list-style: none;
  padding-left: 0.95rem;
}
.notice-warn li { margin: 0 0 0.3rem; }
.notice-warn li:last-child { margin-bottom: 0; }
.notice > :last-child { margin-bottom: 0; }

.status { min-height: 1.4em; font-size: 0.9rem; color: var(--muted); margin: 0.75rem 0 0; }
#preview[aria-busy="true"] { cursor: progress; }
#preview[aria-busy="true"] #send::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.55em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: amnezi-spin 0.8s linear infinite;
}
@keyframes amnezi-spin { to { transform: rotate(360deg); } }

/* Drop zone */
.drop-zone {
  position: relative;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop-zone p { margin: 0 0 0.25rem; }
.drop-zone p:last-child { margin-bottom: 0; }
.drop-zone:hover { border-color: var(--muted); }
.drop-zone:focus-within { border-color: var(--accent); }
.drop-zone.is-dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
}
.link-like { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; cursor: pointer; }
.link-like:hover { text-decoration-thickness: 2px; }
.drop-zone:has(input:focus-visible) .link-like { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Thumbnails */
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; }
.thumbs:not(:empty) { margin-top: 0.9rem; }
.thumb {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}
.thumb img { display: block; width: 100%; height: 6rem; object-fit: cover; border-radius: 6px; background: var(--code-bg); }
.thumb-name { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; line-height: 1.35; }
.thumb .btn { align-self: flex-start; }

/* Chips */
.chips { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips .chip { margin: 0; }
.chip { white-space: normal; max-width: 100%; }
.chip-button {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip-button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

/* Code blocks and preview */
.code-block { margin: 0 0 1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; }
.code-block.scroll, pre.code-block.scroll { white-space: pre; overflow: auto; max-height: 22rem; overflow-wrap: normal; }
.code-block code { white-space: inherit; overflow-wrap: inherit; }

/* Results */
.results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.25rem; }
.results-head h2 { margin: 0; flex: 1 1 14rem; overflow-wrap: anywhere; }
#r-title:focus { outline: none; }
#r-title:focus-visible, #preview-title:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#preview-title:focus { outline: none; }
#preview-title:focus-visible { outline: 3px solid var(--accent); }

.badge { white-space: nowrap; border: 1px solid transparent; }
.badge-high { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.badge-medium { background: var(--warn-soft); color: var(--fg); border-color: var(--warn-border); }
.badge-low { background: var(--code-bg); color: var(--fg); border-color: var(--muted); border-style: dashed; }
.badge-draft { background: var(--warn-soft); color: var(--fg); border-color: var(--warn-border); }

/* .prose is also a legal-page class in site.css; neutralise its page padding here */
.app .prose { max-width: 46rem; padding: 0; margin: 0 0 1em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.plain-list { padding-left: 1.2em; overflow-wrap: anywhere; }

/* Steps */
.steps { list-style: none; counter-reset: step; margin: 0 0 1.25rem; padding: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 0.75rem 0 0.75rem 2.6rem;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.steps > li:last-child { border-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}
.steps p { margin: 0 0 0.4rem; }
.evidence { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.85rem; }
.evidence.muted { font-style: italic; }

.test-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-top: 1.5rem; }
.test-head h3 { margin: 0 0 0.5rem; }
.test-head .badge { margin-bottom: 0.5rem; }

/* Log viewer */
.log-viewer {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 24rem;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
}
.log-viewer li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0;
  padding: 0.05rem 0.75rem 0.05rem 0;
  min-width: max-content;
  border-left: 3px solid transparent;
}
.log-viewer .ln {
  flex: none;
  min-width: 3.4rem;
  padding-left: 0.6rem;
  text-align: right;
  color: var(--muted);
  user-select: none;
}
.log-viewer code { background: none; padding: 0; font-size: inherit; white-space: pre; }
.log-viewer li.is-highlighted {
  background: color-mix(in srgb, var(--accent) 14%, var(--code-bg));
  border-left-color: var(--accent);
}
.log-viewer li:focus { outline: none; }
.log-viewer li:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }

/* Screenshot dialog */
.shot-dialog {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  overflow: auto;
}
.shot-dialog::backdrop { background: color-mix(in srgb, var(--fg) 60%, transparent); }
.shot-dialog[open] { animation: amnezi-fade 0.15s ease-out; }
@keyframes amnezi-fade { from { opacity: 0; } to { opacity: 1; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.dialog-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.dialog-head .btn { flex: none; }
.shot-dialog img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 6px; }

/* Small screens */
@media (max-width: 800px) {
  .app .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .app { padding-top: 1.5rem; }
  .panel { padding: 1rem; }
  .row { flex-wrap: wrap; }
  .row input { flex-basis: 100%; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
  .log-viewer { max-height: 20rem; }
}

@media (prefers-reduced-motion: reduce) {
  .drop-zone { transition: none; }
  .shot-dialog[open] { animation: none; }
  #preview[aria-busy="true"] #send::after { animation-duration: 2.4s; }
}
