/* searg.in — shared styles */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --bg-grad: radial-gradient(120% 90% at 50% -20%, #e9ecf5 0%, #f6f7f9 55%, #f6f7f9 100%);
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --text: #14171c;
  --muted: #636b78;
  --faint: #8b93a1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --danger-border: #fbd3ce;
  --warn: #93500a;
  --warn-soft: #fffaeb;
  --warn-border: #fbe6b4;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ok-border: #baecd0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px -12px rgba(16, 24, 40, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e13;
    --bg-grad: radial-gradient(120% 90% at 50% -20%, #1a1f2e 0%, #0f1218 55%, #0c0e13 100%);
    --surface: #14171f;
    --surface-2: #1b1f29;
    --border: #262b36;
    --border-strong: #363d4c;
    --text: #eceef2;
    --muted: #9aa3b2;
    --faint: #6d7686;
    --accent: #7c78f0;
    --accent-hover: #8f8bf5;
    --accent-soft: #1d1e35;
    --accent-text: #0c0e13;
    --danger: #ff9d95;
    --danger-soft: #2a1614;
    --danger-border: #4a221d;
    --warn: #f0c274;
    --warn-soft: #251c0d;
    --warn-border: #453313;
    --ok: #6ee7a8;
    --ok-soft: #0e2419;
    --ok-border: #1d4432;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

/* ------------------------------------------------------------------ head -- */

.masthead {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}

.mark {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
}

.mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.message .mark {
  width: 3.25rem;
  height: 3.25rem;
}

.wordmark {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.975rem;
  max-width: 34rem;
}

/* ------------------------------------------------------------------ tabs -- */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 550;
  font-size: 0.925rem;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* ----------------------------------------------------------------- cards -- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

@media (max-width: 30rem) {
  .card {
    padding: 1.35rem 1.15rem;
  }
}

.card + .card {
  margin-top: 1.25rem;
}

.field {
  margin-bottom: 1.4rem;
}

.field:last-child {
  margin-bottom: 0;
}

label,
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--faint);
  font-size: 0.8125rem;
}

.hint-inline {
  font-weight: 400;
  color: var(--faint);
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

textarea,
input[type='text'],
input[type='url'],
input[type='password'] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 8.5rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.counter {
  display: flex;
  justify-content: flex-end;
  color: var(--faint);
  font-size: 0.78125rem;
  margin-top: 0.3rem;
}

.counter.over {
  color: var(--danger);
  font-weight: 600;
}

/* ----------------------------------------------------------------- radio -- */

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 34rem) {
  .choices {
    grid-template-columns: repeat(4, 1fr);
  }
}

.choice {
  position: relative;
  display: block;
  margin: 0;
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.choice span {
  display: block;
  text-align: center;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.choice:hover span {
  color: var(--text);
}

.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.choice input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --------------------------------------------------------------- buttons -- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.block {
  width: 100%;
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn.small {
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* --------------------------------------------------------------- results -- */

.out {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.out input {
  font-family: var(--mono);
  font-size: 0.875rem;
  background: var(--surface-2);
}

.note {
  display: flex;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.note.warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
  color: var(--warn);
}

.note.bad {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.note.good {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

.note strong {
  font-weight: 650;
}

/*
 * Result and viewer cards are built from blocks that appear and disappear, so
 * they space themselves as a stack instead of relying on each block's own
 * margins — that way a hidden neighbour never leaves a gap or a cramped seam.
 */
#result > *,
#viewer-card > *,
#viewer-output > * {
  margin-bottom: 0;
}

#result > * + *,
#viewer-card > * + *,
#viewer-output > * + * {
  margin-top: 1.15rem;
}

#result > .card-sub,
#viewer-card > .card-sub {
  margin-top: 0.35rem;
}

.field + .note {
  margin-top: 0.9rem;
}

/*
 * An inline error in the composer is a block in the same rhythm as the fields
 * around it, so it never ends up flush against the submit button.
 */
#panel-secret > .note,
#panel-link > .note {
  margin-top: 1.4rem;
  margin-bottom: 1.4rem;
}

.secret-box {
  margin: 0;
  padding: 1.1rem 1.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 26rem;
  overflow: auto;
}

.card-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.9rem;
  padding-top: 0.15rem;
  color: var(--faint);
  font-size: 0.8125rem;
}

.spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

/* ---------------------------------------------------------------- footer -- */

.footer {
  margin-top: 2.5rem;
  color: var(--faint);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.footer p {
  margin: 0 0 0.6rem;
}

.footer a {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.center {
  text-align: center;
}

/* ------------------------------------------------------- message page ---- */

.message {
  max-width: 30rem;
  margin: 0 auto;
  text-align: center;
}

.message .mark {
  margin: 0 auto 1.25rem;
}

.message h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.message p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}
