/* OpenWallet ID pages. Linked after tokens/styles.css.
   Layer-3 tokens only, except where a local semantic alias is declared once
   below (the way colors.css itself is written). CSP: no inline styles. */

/* ---- Local aliases ----------------------------------------------------------- */

/* OpenWallet claims accent slot 30 (amethyst). One slot per application.
   See tokens/ACCENT-SLOTS.md: declared locally, not in css/colors.css. */
:root {
  --amethyst: color-mix(in oklab, var(--red) 29%, var(--iris));
  --accent-30: var(--amethyst);
  --accent: var(--accent-30);

  /* The accent's only place in the chrome: the wordmark's full stop, as in
     the extension popup (slot 30 was chosen to carry it on both grounds). */
  --logo-dot: var(--accent);

  /* Button hover, named once so no rule consumes layer 1. Same value as the
     reference components (openpdfedit) and the extension. */
  --brand-hover: var(--green-400);
}

[hidden] {
  display: none !important;
}

/* ---- Page shell -------------------------------------------------------------- */

html {
  background: var(--bg-page);
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}

.ow-top {
  flex: none;
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 var(--space-4);
  border-bottom: var(--border-width) solid var(--border-hairline);
}

/* Wordmark — a port of BrandMark's wordmark variant: "Open" muted, the
   product word full strength, the full stop in --logo-dot. */
.ow-brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-lg);
}
.ow-brand__word {
  font: var(--weight-medium) 1em / 1 var(--font-display);
  letter-spacing: var(--logo-tracking);
  color: var(--logo-fg);
  white-space: nowrap;
}
.ow-brand__prefix {
  color: var(--text-muted);
}
.ow-brand__word .dot {
  color: var(--logo-dot);
}
.ow-brand__suffix {
  font: var(--type-ui);
  color: var(--text-muted);
}

.ow-main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--sdk-max) + var(--space-4) * 2);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (max-width: 480px) {
  .ow-main {
    padding-top: var(--space-5);
  }
}

.ow-foot {
  text-align: center;
}
.ow-never {
  text-align: center;
}

/* ---- Card and its content ---------------------------------------------------- */

.oa-card {
  display: block;
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-hairline);
  border-radius: var(--radius-lg);
}
.ow-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  animation: oa-fade-up var(--duration-base) var(--ease-out);
}
@media (max-width: 400px) {
  .ow-card {
    padding: var(--space-5) var(--space-4);
  }
}
.ow-card > .oa-eyebrow {
  margin-bottom: calc(var(--space-2) * -1);
}

.ow-title {
  font: var(--type-h4);
  letter-spacing: var(--tracking-heading);
  color: var(--text-strong);
}
.ow-title:focus,
.ow-title:focus-visible {
  outline: none;
  box-shadow: none;
}
.ow-lead {
  color: var(--text-body);
}
.ow-muted {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.ow-num {
  font-family: var(--font-mono);
}

.ow-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ow-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ow-error:empty {
  display: none;
}

.ow-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Waiting on the extension: the spinner and one line. */
.ow-wait {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* A checkbox the whole row of which is the tap target. */
.ow-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--touch-min);
  padding: var(--space-3);
  border: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  font: var(--type-ui);
  color: var(--text-strong);
  cursor: pointer;
}
.ow-check:hover {
  background: var(--surface-hover);
}
.ow-check .oa-checkbox {
  flex: none;
  margin: 1px 0 0;
}

/* Checked is black, never green: green means "action", not "on". */
.oa-checkbox {
  accent-color: var(--text-strong);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.oa-checkbox:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---- Spinner in a busy button ------------------------------------------------ */

.ow-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: oa-spin 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ow-spinner {
    animation-duration: 2.4s;
  }
}

/* Screen-reader-only live regions. */
.ow-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- oa- components: the subset these pages use, copied from the reference
   implementation (openpdfedit components.css, via the extension's port).
   Every value a token. ------------------------------------------------------ */

.oa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h-sm);
  padding: 0 10px;
  font: var(--weight-medium) var(--text-sm) / 1 var(--font-sans);
  letter-spacing: var(--tracking-body);
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: var(--transition-control);
}
.oa-btn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.oa-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.oa-btn--lg {
  height: var(--control-h-lg);
  padding: 0 18px;
  font-size: var(--text-base);
}
.oa-btn--block {
  width: 100%;
}
.oa-btn--primary {
  background: var(--brand);
  color: var(--brand-contrast);
}
.oa-btn--primary:hover:not(:disabled) {
  background: var(--brand-hover);
}
.oa-btn--primary:active:not(:disabled) {
  background: var(--brand-strong);
}
.oa-btn--secondary {
  background: var(--surface-card);
  color: var(--text-strong);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.oa-btn--secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}
.oa-btn--secondary:active:not(:disabled) {
  background: var(--surface-active);
}
/* The base layer's focus ring is a box-shadow; components that carry their
   own resting shadow must restate it or they would hide it. */
.oa-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.oa-field__error {
  font: var(--type-caption);
  font-size: var(--text-sm);
  color: var(--danger-fg);
}

.oa-notice {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
  color: var(--text-body);
  font: var(--type-caption);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.oa-notice--warning {
  background: var(--warning-bg);
}
.oa-notice--danger {
  background: var(--danger-bg);
}
