/* Inter Variable, split the way Google Fonts splits it: a visitor fetches the
 * 62 KB latin file and nothing else, and the rest arrive only if a shared item
 * actually contains those scripts. Not subset to the glyphs this page's own
 * strings use — title, username, password and note come from someone else's
 * vault and can be in any script.
 *
 * Declaration order is load-bearing: CSS Fonts 4 checks the LAST matching
 * @font-face first, so whichever file should win a shared codepoint goes last.
 * latin-ext is declared first because it is the biggest (106 KB) and overlaps
 * both vietnamese and cyrillic-ext; letting it win would make a Vietnamese
 * note pull 106 KB for Đ and ơ that the 12 KB vietnamese file already has.
 * latin goes last so the handful of codepoints it shares cost nothing - it is
 * loaded on every page anyway.
 */
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-latin-ext.502c09c6.woff2') format('woff2');
  unicode-range:
    U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-cyrillic-ext.e1d298d5.woff2') format('woff2');
  unicode-range:
    U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-cyrillic.9ed14179.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-vietnamese.ebeb4e11.woff2') format('woff2');
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-latin.3bc3ba94.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+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  /* Monochrome by design: nothing on this page competes with the secret. */
  --bg: #0a0a0b;
  --surface: #161617;
  --inset: rgba(255, 255, 255, 0.05);
  --inset-hover: rgba(255, 255, 255, 0.09);
  --separator: rgba(255, 255, 255, 0.08);

  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.58);
  /* 0.36 measured 3.0:1 on the card - under AA - and it carries the one line
     warning that opening this link may be the only chance. */
  --text-3: rgba(235, 235, 245, 0.54);

  /* The only colours on the page, and both mean something: copied, and how
     long the code lives. Nothing is coloured just to be branded. */
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --blue: #0a84ff;
  --orange: #ff9f0a;

  /* Kryon Pass violet. It brands the page as light and as the product mark -
     never as the colour of a control. */
  --brand-light: #9a74ff;

  --font:
    'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 32px 24px;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* One source of brand light, top left, behind the mark that sits there. */
  background:
    radial-gradient(
      52% 44% at 2% 0%,
      rgba(130, 83, 255, 0.26),
      transparent 62%
    ),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Product mark, top left, on the page rather than inside the card - the card
   belongs to the sender's item, not to us. */
.brandmark {
  position: fixed;
  top: 28px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
  /* never in the way of a row someone is trying to tap */
  pointer-events: none;
}

.bm-logo {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10.5px;
  background: linear-gradient(155deg, var(--brand-light), #7a43f5);
  color: #fff;
}

.bm-logo svg {
  width: 17px;
  height: 16px;
}

.bm-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.bm-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.bm-slug {
  color: var(--text-3);
  font-size: 12.5px;
  letter-spacing: -0.004em;
}

.card {
  width: 100%;
  max-width: 400px;
  /* auto margins rather than relying on align-items:center alone: a card
     taller than the viewport centred by the flex box overflows above the
     scroll origin, and that part can never be scrolled to. */
  margin: auto;
  padding: 16px;
  background: var(--surface);
  border-radius: 28px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 60px -30px rgba(0, 0, 0, 0.9);
  animation: card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

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

/* Icon left, name and site to the right of it: the identity of the item reads
   as one unit, the way a contact or an app header does. */
.head {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
}

.tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
}

.tile svg {
  width: 23px;
  height: 23px;
}

.head-text {
  min-width: 0;
}

.title {
  margin: 0;
  font-size: 20px;
  font-weight: 640;
  line-height: 1.25;
  letter-spacing: -0.024em;
  text-wrap: balance;
}

.title:empty {
  display: none;
}

.subtitle {
  margin: 1px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  letter-spacing: -0.006em;
}

/* ---- body ---- */

.body-wrap {
  margin-top: 18px;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

/* The spinner sits beside its line rather than above it, so loading keeps the
   same left edge as every other state. */
#state-loading {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.lead {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: balance;
}

.note {
  margin: 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
  text-wrap: balance;
}

/* ---- grouped inset list ---- */

.group {
  width: 100%;
  margin: 0;
  background: var(--inset);
  border-radius: 16px;
  overflow: hidden;
}

/* Item rows: label left, value right, actions in a fixed column. Every row is
   the same height and every value ends on the same line, whether the row has
   two buttons, one, or none. */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 9px 8px 9px 16px;
}

/* Separators inset on both sides, so the hairline sits inside the group rather
   than cutting it edge to edge. */
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--separator);
}

/* The row itself copies. The icon stays as the hint that it does. */
.tappable {
  cursor: pointer;
  transition: background 0.14s ease;
}

.tappable:hover {
  background: rgba(255, 255, 255, 0.035);
}

.tappable:active {
  background: rgba(255, 255, 255, 0.06);
}

/* :not(.done) or this outranks the green confirmation - it is one class more
   specific - and the check greys out the moment the pointer is over the row,
   which is exactly when it is being read. */
/* Both :not()s or hover outranks the result state - and on a touch screen
   hover sticks after the tap, so the confirmation would never be seen. */
.tappable:hover .icon-btn:not(.done):not(.failed) {
  color: var(--text-2);
}

/* The row itself is not focusable; light it up when its button takes focus. */
.tappable:has(:focus-visible) {
  background: rgba(255, 255, 255, 0.035);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Swapped by app.js on boot: without a working script the page explains
   itself instead of spinning. */
.no-js-only {
  display: none;
}

.no-js .no-js-only {
  display: block;
}

.no-js #state-loading {
  display: none;
}

/* Focused programmatically after a reveal; it should not draw a ring for that,
   only for real keyboard focus. */
.title:focus {
  outline: none;
}

.title:focus-visible {
  outline: 2px solid var(--text-2);
  outline-offset: 4px;
  border-radius: 4px;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Long values get the label above and the full width below, left-aligned:
   wrapped text ragged against a right edge is the hard kind to read. */
.row-stacked .row-main {
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
}

.row-stacked .row-label {
  font-size: 12.5px;
  line-height: 1.3;
}

.row-stacked .row-value {
  text-align: left;
}

.row-label {
  flex: none;
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* The value takes the rest of the row and wraps rather than shrinking, so a
   long one gets a second line instead of being squeezed or clipped. */
.row-value {
  flex: 1;
  min-width: 0;
  margin: 0;
  text-align: right;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--text);
  word-break: break-word;
  /* A note is the whole payload of a shared note item, and it can be a list of
     backup codes. Collapsing its newlines makes it unreadable, and the view is
     already spent by the time anyone sees that. */
  white-space: pre-wrap;
}

.row-value.mono {
  font-family: var(--mono);
  font-size: 14.5px;
  letter-spacing: 0;
  word-break: break-all;
  user-select: all;
}

/* A run of bullets offers no line-break opportunity, so on a 320px screen it
   would overflow left and paint over the label. */
.row-value.dots {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.18em;
  color: var(--text-2);
  word-break: break-all;
}

/* Sized to what the row actually has: reserving room for two buttons on every
   row left a hole to the right of the single-button ones. The icons still line
   up on the right edge, which is the alignment that reads. */
.row-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: -4px;
}

/* Metadata rows (expires / views): a value that short reads better on the
   same line than stacked under a label. */
.mrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 9px 16px;
}

.mrow + .mrow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--separator);
}

.mrow-label {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.mrow-value {
  margin: 0;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* An underline the same colour as the text: a hairline in --separator measured
   1.3:1 against the row and read as ordinary text, so nothing said it was a
   link at all. */
.row-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-2);
  text-underline-offset: 3px;
  word-break: break-all;
}

.row-link:hover {
  text-decoration-color: var(--text);
}

.row-link:focus-visible {
  outline: 2px solid var(--text-2);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- one-time code ---- */

.code {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.code-val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.07em;
  font-variant-numeric: tabular-nums;
}

.ring {
  flex: none;
  width: 17px;
  height: 17px;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 2.4;
}

.ring .track {
  stroke: rgba(255, 255, 255, 0.12);
}

.ring .fill {
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-dasharray: 53.4;
  transition:
    stroke-dashoffset 0.5s linear,
    stroke 0.3s ease;
}

/* Last few seconds: the code is about to roll, so say so. */
.ring.urgent .fill {
  stroke: var(--orange);
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover:not(.done):not(.failed) {
  background: var(--inset-hover);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--text-2);
  outline-offset: 1px;
}

.icon-btn.done {
  color: var(--green);
  background: var(--green-soft);
}

.icon-btn.failed {
  color: var(--orange);
  background: rgba(255, 159, 10, 0.16);
}

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

.btn {
  width: 100%;
  min-height: 44px;
  padding: 11px 20px;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--inset);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.012em;
  cursor: pointer;
  transition:
    background 0.15s ease,
    filter 0.15s ease,
    transform 0.08s ease,
    opacity 0.15s ease;
}

.btn:hover {
  background: var(--inset-hover);
}

.btn:active {
  transform: scale(0.99);
}

.btn:focus-visible {
  outline: 2px solid var(--text-2);
  outline-offset: 3px;
}

/* The one filled control on the page. White, not a brand colour: it is the
   action, and nothing else here should out-shout the secret. */
.btn-primary {
  background: #f5f5f7;
  color: #131314;
}

.btn-primary:hover {
  background: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

/* ---- foot ---- */

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: -0.005em;
}

/* One step brighter than the line it sits in - enough to read as a name,
   not so much that a footer competes with the secret above it. */
.foot b {
  font-weight: 600;
  color: var(--text-2);
}

/* ---- spinner ---- */

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--text-2);
  animation: spin 0.8s linear infinite;
}

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

/* Phones: a fixed mark would sit on top of the card on a short screen, so it
   joins the flow above it instead. */
@media (max-width: 700px), (max-height: 640px) {
  body {
    flex-direction: column;
    justify-content: flex-start;
    gap: 20px;
    padding: 22px 16px;
  }

  /* Mark pinned to the top of the page; the card takes the space that is left
     and centres itself in it, so neither is stranded in the middle. */
  .brandmark {
    position: static;
    align-self: flex-start;
    gap: 9px;
  }

  .bm-logo {
    width: 30px;
    height: 30px;
    border-radius: 9.5px;
  }

  .bm-logo svg {
    width: 15px;
    height: 14px;
  }

  .bm-name {
    font-size: 14px;
  }

  .bm-slug {
    font-size: 12px;
  }

  .card {
    padding: 14px;
  }

  .row,
  .mrow {
    padding-left: 14px;
    padding-right: 8px;
  }

  .mrow {
    padding-right: 14px;
  }

  .row + .row::before,
  .mrow + .mrow::before {
    left: 14px;
    right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
  .spinner {
    animation-duration: 2.4s;
  }
  .ring .fill,
  .tappable,
  .icon-btn,
  .btn {
    transition: none;
  }
  .btn:active,
  .icon-btn:active {
    transform: none;
  }
}
