/*
 * The AiratTop tool palette, token for token, as in pass.airat.top. `--danger` and
 * `--success` are the only additions: this tool has states the generators do not — a
 * secret destroyed, a passphrase refused — and they need a colour that is not the accent.
 */

:root {
  color-scheme: light dark;
  --bg: #f2f6fb;
  --bg-strong: #e7eef8;
  --surface: #ffffff;
  --surface-strong: #eff4fb;
  --text: #101b2b;
  --muted: #536074;
  --accent: #2a6fd6;
  --accent-strong: #1b4f9a;
  --danger: #c62f52;
  --success: #1f8a5b;
  --border: #d7e1ef;
  --shadow: 0 30px 70px rgba(9, 18, 33, 0.12);
  --chip: #e7effb;
  --focus: rgba(42, 111, 214, 0.25);
  --grid: rgba(12, 18, 35, 0.05);
  --action-primary-bg: linear-gradient(135deg, #3a86ff, #2a6fd6);
  --action-primary-text: #f5f8ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111a;
    --bg-strong: #0f1724;
    --surface: #141e2c;
    --surface-strong: #1a2536;
    --text: #e6edf7;
    --muted: #9fb0c7;
    --accent: #61a8ff;
    --accent-strong: #2f6bd1;
    --danger: #ff7a97;
    --success: #5fd6a0;
    --border: #233049;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    --chip: #1b263a;
    --focus: rgba(97, 168, 255, 0.25);
    --grid: rgba(255, 255, 255, 0.05);
    --action-primary-bg: linear-gradient(135deg, #6cb2ff, #3a7de0);
    --action-primary-text: #071018;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 8% 6%, rgba(66, 149, 255, 0.25), transparent 60%),
    radial-gradient(700px 520px at 92% 12%, rgba(28, 78, 160, 0.2), transparent 60%),
    linear-gradient(160deg, var(--bg), var(--bg-strong));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px 64px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  inset: -35% auto auto -10%;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle at center, rgba(58, 134, 255, 0.3), transparent 70%);
  filter: blur(20px);
  opacity: 0.8;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite;
  z-index: 0;
}

/* Slightly deeper blue in light mode, where the dark-mode glow washes out. */
@media (prefers-color-scheme: light) {
  .bg-glow {
    background: radial-gradient(circle at center, rgba(42, 111, 214, 0.28), transparent 70%);
  }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(40px, 20px, 0); }
}

.shell {
  width: min(760px, 100%);
  display: grid;
  gap: 24px;
  position: relative;
  z-index: 1;
}

/* Header */

/*
 * Grid rather than a wrapping flex row. As flex, the actions dropped to their own line
 * whenever the headline was long enough to push the copy column to its max width — which
 * is the create page, and not the view page, so the two headers disagreed depending on
 * which one you were looking at. A two-column grid cannot wrap: the copy column shrinks
 * instead, and the actions stay where they were put.
 */
.brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
}
.brand-copy { max-width: 560px; min-width: 0; }
.brand-actions { display: flex; gap: 10px; align-items: center; }

/* Below this the two columns stop fitting honestly, so they stack. */
@media (max-width: 620px) {
  .brand { grid-template-columns: 1fr; }
  .brand-actions { justify-content: flex-start; }
}
.brand-eyebrow {
  margin: 0 0 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.brand h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.15; }
.brand-subtitle { margin: 0; color: var(--muted); font-size: 0.98rem; }

.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.repo-link:hover { border-color: var(--accent); color: var(--accent); }

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.field { display: grid; gap: 8px; }
.field label { font-size: 0.9rem; font-weight: 500; }
.field .hint { font-size: 0.82rem; color: var(--muted); margin: 0; }

textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
textarea { min-height: 160px; resize: vertical; font-family: "JetBrains Mono", ui-monospace, monospace; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* The optional half of the form, closed by default. */
.extras { border-top: 1px solid var(--border); padding-top: 16px; }
.extras > summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.extras > summary::-webkit-details-marker { display: none; }
.extras > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
}
.extras[open] > summary::before { content: "−"; }
.extras > summary:hover { color: var(--accent); }
.extras[open] > summary { margin-bottom: 16px; color: var(--text); }
.extras .field + .field { margin-top: 16px; }

button.primary {
  padding: 12px 22px;
  border: none;
  border-radius: 12px;
  background: var(--action-primary-bg);
  color: var(--action-primary-text);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.55; cursor: progress; }
button.danger { border-color: var(--danger); color: var(--danger); }

/* Result and reveal */

/*
 * The one-time link, which is a button rather than a box with a button beside it.
 * Sized and coloured as the loudest thing on the card, because copying it is the only
 * thing to do here and losing it is unrecoverable.
 */
.link-copy {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--chip);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.link-copy:hover { background: var(--surface-strong); box-shadow: 0 0 0 4px var(--focus); }
.link-copy:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.link-copy:active { transform: translateY(1px); }

.link-copy-url {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-all;
}

/* The affordance and the confirmation are the same element, so the click answers itself
   in the place the eye already is, instead of in a status line further down. */
.link-copy-cue {
  justify-self: start;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.link-copy.is-copied { border-color: var(--success); }
.link-copy.is-copied .link-copy-cue { color: var(--success); }

/* Destructive, and deliberately quiet until you go near it: nothing on this card should
   compete with the link for attention. */
.link-danger {
  padding: 9px 14px;
  border: 1px solid var(--danger);
  border-radius: 999px;
  background: none;
  color: var(--danger);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.link-danger:hover:not(:disabled) { background: var(--danger); color: var(--surface); }
.link-danger:disabled { opacity: 0.45; cursor: default; }

/* A revealed secret is prose or a credential, not a URL: wrap on spaces, keep newlines. */
.link-copy-url.is-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.block-label { margin: 0; font-size: 0.9rem; font-weight: 500; }

.meta-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.meta-list li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
.meta-list li b {
  color: var(--text);
  font-weight: 500;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
}

.notice { margin: 0; font-size: 0.88rem; color: var(--muted); }
.notice.error { color: var(--danger); }
.notice.success { color: var(--success); }

[hidden] { display: none !important; }

footer { text-align: center; font-size: 0.84rem; color: var(--muted); }
footer a { color: var(--accent); }

@media (max-width: 560px) {
  body { padding: 28px 14px 44px; }
  .card { padding: 18px; border-radius: 16px; }
}
