/* Instrument Sans (variable, latin subset) and IBM Plex Mono 400 and 600
   (latin subset), served from this origin.
   Licence: fonts/LICENSE.txt (SIL Open Font License 1.1). */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The light brand look: one light theme. */
:root {
  color-scheme: light;

  /* Page (Mist) and the header bar */
  --bg: #F5F5F8;
  --header: #FFFFFF;
  --header-line: #E4E3EC;

  /* The card and the tab in front; the tab behind */
  --surface: #FFFFFF;
  --border: #E4E3EC;
  --shadow: 0 12px 32px rgba(14, 13, 26, 0.06);
  --surface-behind: #ECEBF2;
  --border-behind: #E4E3EC;
  --text-behind: #5F5D73;

  /* Input boxes and the GHOST token chip */
  --input: #F5F5F8;
  --input-border: #E4E3EC;
  --placeholder: #6E6C82;
  --tint: #EEEAFF;
  --token: #EEEAFF;

  /* Text (Ink), accent and warnings */
  --text: #0E0D1A;
  --muted: #4A4860;
  --quiet: #6E6C82;
  --accent: #6B4CFF;
  --danger: #C8264B;
  --caution: #A15C00;

  /* The main button, the wallet button and Summon's success fill */
  --violet: #6B4CFF;
  --violet-hover: #5A3BEE;
  --on-violet: #FFFFFF;
  --wallet-bg: #FFFFFF;
  --wallet-border: #E4E3EC;
  --wallet-text: #0E0D1A;
  --mint: #4FF0C8;

  --raised: #FFFFFF;
  --border-strong: #C9C7D6;
  --focus-ring: 0 0 0 3px rgba(107, 76, 255, 0.3);

  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-small: 10px;
  --card-width: 420px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --speed: 200ms;

  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

h2,
h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

h3 {
  margin-top: 1.25rem;
}

p {
  margin: 0.5rem 0;
  overflow-wrap: anywhere;
}

code,
.address {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

a {
  color: inherit;
  text-decoration: none;
}

.sprite {
  height: 0;
  overflow: hidden;
  position: absolute;
  width: 0;
}

.icon {
  flex: none;
  height: 1.25em;
  width: 1.25em;
}

/* The pixel-ghost logo: by default the body alone in one color
   (currentColor), the eyes as holes, which reads at icon sizes; a mark that
   sets --logo-body and --logo-cells shows the full logo with its cells. */
.logo-body {
  fill: var(--logo-body, currentColor);
}

.logo-cells {
  display: var(--logo-cells, none);
}

.line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.dot {
  fill: currentColor;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Controls */

label {
  color: var(--muted);
  display: block;
  font-size: 0.875rem;
  margin: 0.75rem 0;
}

input,
textarea {
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  color: var(--text);
  display: block;
  font: inherit;
  font-size: 1rem;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  width: 100%;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

input:focus,
textarea:focus,
button:focus-visible,
.tab-panel:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}

button {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
}

button:hover:not(:disabled) {
  border-color: var(--border-strong);
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

button.primary {
  background: var(--violet);
  border-color: transparent;
  color: var(--on-violet);
  font-size: 1.2rem;
  font-weight: 700;
}

button.primary:hover:not(:disabled) {
  background: var(--violet-hover);
  border-color: transparent;
}

button.wide {
  display: block;
  margin: 0.75rem 0 0;
  width: 100%;
}

button.big {
  padding: 0.8rem 1rem;
}

button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0.15rem 0.35rem;
}

button.link:hover:not(:disabled) {
  text-decoration: underline;
}

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

.note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Top bar */

.top {
  align-items: center;
  background: var(--header);
  border-bottom: 1px solid var(--header-line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 2rem);
}

.brand {
  align-items: center;
  display: flex;
  font-size: 1.2rem;
  font-weight: 700;
  gap: 0.5rem;
  letter-spacing: 0.01em;
}

/* The full logo: lavender body, outlined cells. */
.icon-brand {
  --logo-body: #C9BCFF;
  --logo-cells: inline;
  color: var(--text);
  height: 1.6em;
  width: 1.6em;
}

.wallet-anchor {
  position: relative;
}

.wallet-button {
  align-items: center;
  background: var(--wallet-bg);
  border: 1px solid var(--wallet-border);
  border-radius: 999px;
  color: var(--wallet-text);
  display: flex;
  font-weight: 600;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}

.wallet-button:hover:not(:disabled),
.wallet-button[aria-expanded="true"] {
  border-color: var(--accent);
}

#wallet-button-text {
  font-family: var(--font);
  white-space: nowrap;
}

.popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1.1rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(360px, calc(100vw - 2rem));
  z-index: 20;
}

/* The wallet list: one row per quantum-safe wallet the page can connect. */

.popover h2 {
  font-size: 1.05rem;
  margin-top: 0;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wallet-option {
  align-items: center;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  color: var(--text);
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  text-align: left;
  width: 100%;
}

.wallet-option:hover:not(:disabled) {
  border-color: var(--accent);
}

.wallet-option .icon {
  color: var(--accent);
  flex: none;
  height: 1.6em;
  width: 1.6em;
}

.wallet-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wallet-option-name {
  font-weight: 600;
}

.wallet-option-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.field-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0;
}

.balance-big {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* The card and its folder tabs */

main {
  display: flex;
  flex: 1;
  justify-content: center;
  padding: clamp(1rem, 6vh, 4rem) 1rem 2rem;
}

.folder {
  max-width: var(--card-width);
  width: 100%;
}

.tabs {
  display: flex;
  gap: 0.25rem;
}

/* The tab behind sits lower, under the card's edge; the tab in front
   covers the card's top border so the two join. */
.tab {
  background: var(--surface-behind);
  border: 1px solid var(--border-behind);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-behind);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: -1px;
  padding: 0.7rem 1.4rem 0.6rem;
  position: relative;
  transform: translateY(5px);
  z-index: 0;
}

.tab:hover:not(:disabled) {
  border-color: var(--border-behind);
  color: var(--muted);
}

.tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  transform: none;
  z-index: 2;
}

.tab:focus-visible {
  box-shadow: var(--focus-ring);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  position: relative;
  z-index: 1;
}

.card[data-tab="vanish"] {
  border-top-left-radius: 0;
}

.tab-panel {
  border-radius: var(--radius-small);
}

/* The Vanish amount box */

.amount-box {
  align-items: center;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  display: flex;
  gap: 0.75rem;
  margin: 0;
  padding: 0.9rem 1rem;
}

.amount-box:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.amount-box input {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--text);
  flex: 1;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.amount-box input:focus {
  box-shadow: none;
}

.token {
  align-items: center;
  background: var(--token);
  border-radius: 999px;
  color: var(--text);
  display: flex;
  flex: none;
  font-size: 0.95rem;
  font-weight: 600;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem 0.35rem 0.5rem;
}

.token .icon {
  color: var(--accent);
}

.balance-line {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.875rem;
  gap: 0.35rem;
  justify-content: flex-end;
  margin: 0.4rem 0 0;
}

/* Keys and checks */

.key-panel,
.check {
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  margin-top: 1rem;
  padding: 0.9rem;
}

.secret {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  user-select: all;
  word-spacing: 0.4em;
}

.blurred {
  filter: blur(0.45em);
  user-select: none;
}

.groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.groups label {
  flex: 1 1 6rem;
  margin: 0.25rem 0;
}

.groups input {
  font-family: var(--mono);
}

.groups input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* The Vanish screens: save the key, check it, the waiting bar, Done */

.screen h2 {
  font-size: 1.15rem;
}

.word-grid {
  display: grid;
  gap: 0.4rem 0.75rem;
  grid-auto-flow: column;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(8, auto);
  list-style: none;
  margin: 0.9rem 0;
  padding: 0;
}

.word-grid li {
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  display: flex;
  font-family: var(--mono);
  font-size: 0.9rem;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.35rem 0.5rem;
}

.word-grid .n {
  color: var(--muted);
  flex: none;
  min-width: 1.4em;
  text-align: right;
}

.waiting {
  padding: 1.5rem 0 0.5rem;
  text-align: center;
}

.bar {
  background: var(--input);
  border-radius: 999px;
  height: 3px;
  overflow: hidden;
}

.bar span {
  background: var(--violet);
  border-radius: 999px;
  display: block;
  height: 100%;
  width: 40%;
}

.waiting p {
  color: var(--muted);
  font-size: 0.9rem;
}

.done {
  text-align: center;
}

/* Summon's confirm screen: the amount and the address, then Confirm or Cancel */

.confirm {
  padding: 1rem 0 0.25rem;
  text-align: center;
}

.confirm p {
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-done {
  color: var(--accent);
  display: block;
  height: 3rem;
  margin: 0.5rem auto 0.25rem;
  width: 3rem;
}

/* Summon's success moment: the logo in ink on a mint fill. Mint is never
   used as text on white. */
#summon-done .icon-done {
  background: var(--mint);
  border-radius: var(--radius-small);
  box-sizing: content-box;
  color: var(--text);
  padding: 0.6rem;
}

.error-line {
  color: var(--danger);
  font-size: 0.875rem;
}

/* The Summon screens: the paste box, the amount box, the three steps, Done */

.key-box {
  margin: 0 0 0.75rem;
}

.key-box textarea {
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.95rem;
  margin: 0;
  padding: 0.9rem 1rem;
}

#summon-note {
  color: var(--muted);
}

/* The payout field under the amount, and the Summon's privacy warnings */

.payout-box {
  display: block;
  margin: 0.75rem 0 0;
}

.payout-box span {
  color: var(--muted);
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}

.payout-box input {
  font-family: var(--mono);
  font-size: 0.9rem;
  margin: 0;
}

.warning-line {
  border-left: 3px solid var(--caution);
  font-size: 0.875rem;
  padding-left: 0.75rem;
}

.warning-line:empty {
  display: none;
}

.bar.steps span {
  width: 33%;
}

.bar.steps[data-step="2"] span {
  width: 66%;
}

.bar.steps[data-step="3"] span {
  width: 90%;
}

.bar.steps[data-step="4"] span {
  width: 100%;
}

.step-list {
  display: inline-block;
  list-style: none;
  margin: 1rem 0 0.25rem;
  padding: 0;
  text-align: left;
}

.step-list li {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 0.6rem;
  margin: 0.4rem 0;
}

.step-list li::before {
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  color: var(--on-violet);
  content: "";
  display: inline-flex;
  flex: none;
  font-size: 0.7rem;
  height: 1.1rem;
  justify-content: center;
  line-height: 1;
  width: 1.1rem;
}

.step-list li[data-state="now"] {
  color: var(--text);
}

.step-list li[data-state="now"]::before {
  border-color: var(--accent);
}

.step-list li[data-state="done"] {
  color: var(--text);
}

.step-list li[data-state="done"]::before {
  align-items: center;
  background: var(--violet);
  border-color: var(--violet);
  content: "✓";
}

.status:empty,
.error-line:empty,
.activity p:empty,
.chain-status:empty {
  display: none;
}

.status {
  font-size: 0.9rem;
}

.cover {
  border-left: 3px solid var(--border-strong);
  font-size: 0.9rem;
  padding-left: 0.75rem;
}

.cover.warning {
  border-left-color: var(--caution);
}

.activity {
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

#progress {
  color: var(--accent);
}

#error,
.chain-status {
  color: var(--danger);
}

/* Footer and its panels */

.bottom {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.85rem;
  gap: 0.25rem 1rem;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}

.bottom .warn {
  color: var(--caution);
  margin: 0;
}

.bottom .row {
  margin: 0;
}

#network-button.attention::after {
  background: var(--danger);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 0.45rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  width: 0.45rem;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  bottom: 1rem;
  box-shadow: var(--shadow);
  left: 50%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.1rem;
  position: fixed;
  transform: translateX(-50%);
  width: min(var(--card-width), calc(100vw - 2rem));
  z-index: 30;
}

.sheet-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.sheet-head h2 {
  margin: 0;
}

/* The local node lines of the Network panel */

.local-node-found {
  color: var(--accent);
}

.local-node {
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.install-line {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.install-line code {
  background: var(--surface-behind);
  border-radius: 8px;
  flex: 1;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

#local-node-site {
  text-decoration: underline;
}

/* Motion only where the user has not asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .tab {
    transition:
      background-color var(--speed) var(--ease),
      color var(--speed) var(--ease),
      transform var(--speed) var(--ease);
  }

  button,
  input,
  textarea,
  .amount-box {
    transition:
      background-color var(--speed) var(--ease),
      border-color var(--speed) var(--ease),
      box-shadow var(--speed) var(--ease);
  }

  /* The coin fades out when it vanishes and fades in when it is summoned. */
  #vanish-done:not([hidden]) .icon-done {
    animation: coin-out 1.2s var(--ease) forwards;
  }

  #summon-done:not([hidden]) .icon-done {
    animation: coin-in 1.2s var(--ease);
  }

  .tab-panel:not([hidden]),
  .popover:not([hidden]),
  .sheet:not([hidden]) {
    animation: rise var(--speed) var(--ease);
  }

  .sheet:not([hidden]) {
    animation-name: rise-sheet;
  }

  .bar span {
    animation: slide 1.2s var(--ease) infinite;
  }

  /* The Summon bar grows with the step the flow has reached. */
  .bar.steps span {
    animation: none;
    transition: width var(--speed) var(--ease);
  }

  @keyframes slide {
    from {
      transform: translateX(-100%);
    }

    to {
      transform: translateX(250%);
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
  }

  @keyframes rise-sheet {
    from {
      opacity: 0;
      transform: translate(-50%, 8px);
    }
  }

  @keyframes coin-out {
    from {
      opacity: 1;
      transform: none;
    }

    to {
      opacity: 0.3;
      transform: translateY(-8px) scale(0.9);
    }
  }

  @keyframes coin-in {
    from {
      opacity: 0;
      transform: translateY(8px) scale(0.9);
    }
  }
}

@media (max-width: 480px) {
  .top {
    padding: 0.75rem 1rem;
  }

  .wallet-anchor {
    position: static;
  }

  .popover {
    left: 1rem;
    right: 1rem;
    top: 4rem;
    width: auto;
  }

  .card {
    padding: 1rem;
  }

  .amount-box input {
    font-size: 1.6rem;
  }

  .tab {
    flex: 1;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}
