/*
 * Styles for the small building blocks used all over the app: buttons, cards, avatars, form
 * fields, menus, dialogs, toasts, badges, tabs, people rows and the loading / empty states.
 * Each section below names the component. Loaded on every page by index.html.
 */

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
}

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

.btn--soft {
  background: var(--surface-sunken);
}
.btn--soft:hover:not(:disabled) {
  background: var(--line-strong);
}

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

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger-ghost {
  color: var(--danger);
}
.btn--danger-ghost:hover {
  background: var(--danger-soft);
}

.btn--sm {
  height: 34px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.btn--lg {
  height: 50px;
  padding: 0 26px;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn--icon {
  width: 40px;
  padding: 0;
}

/* While busy() is running: hide the label, show a spinner in its place. */
.btn.is-busy {
  color: transparent !important;
}
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink-faint);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn--primary.is-busy::after {
  border-color: var(--accent-ink);
  border-top-color: transparent;
}

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

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- Avatars ---------- */

.avatar {
  --size: 40px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  border-radius: 50%;
  background: hsl(var(--hue) 55% var(--avatar-bg-l));
  color: hsl(var(--hue) 45% var(--avatar-ink-l));
  font-size: calc(var(--size) * 0.38);
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--xs { --size: 24px; }
.avatar--sm { --size: 32px; }
.avatar--md { --size: 40px; }
.avatar--lg { --size: 64px; }
.avatar--xl { --size: 120px; }

.avatar-link {
  display: inline-flex;
  border-radius: 50%;
}

/* A border from the points shop: a ring painted just inside the edge, so it
   never changes the avatar's size or the layout around it. */
.avatar--ringed {
  position: relative;
}

.avatar--ringed::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: max(2px, calc(var(--size) * 0.07));
  border-radius: 50%;
  background: var(--ring);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* ---------- Forms ---------- */

.form {
  display: grid;
  gap: 16px;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.form__actions--start {
  justify-content: flex-start;
}

/* Quieter grey text for hints and details. */
.muted {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.form__error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 500;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 600;
}

.field__hint {
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.field__error {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 500;
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Drop-downs (birthday, privacy): our own arrow instead of the browser's grey one, a muted
   colour while still on the "Month / Day / Year" prompt, and readable options in dark themes. */
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4c7' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select.input:hover {
  border-color: var(--accent);
}
select.input:has(option[value=""]:checked) {
  color: var(--ink-faint);
}
select.input option {
  background: var(--surface);
  color: var(--ink);
}

/* Custom dropdown (replaces native selects so it looks the same everywhere). */
.dropdown {
  position: relative;
  width: 100%;
  min-width: 0;
}
.dropdown__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 44px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dropdown__button:hover,
.dropdown.is-open .dropdown__button {
  border-color: var(--accent);
}
.dropdown__button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.dropdown__value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown__value.is-placeholder {
  color: var(--ink-faint);
}
.dropdown__chevron {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
  transition: transform 0.18s ease;
}
.dropdown__chevron svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}
.dropdown.is-open .dropdown__chevron {
  transform: rotate(180deg);
}
.dropdown__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  min-width: 100%;
  max-width: calc(100vw - 24px);
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  animation: dropdown-in 0.14s ease-out;
}
.dropdown__list[hidden] {
  display: none;
}
.dropdown__list::-webkit-scrollbar {
  width: 8px;
}
.dropdown__list::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: var(--line-strong);
}
.dropdown__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.dropdown__option:hover {
  background: var(--accent-soft);
}
.dropdown__option.is-active {
  background: var(--accent-soft);
}
.dropdown__option[aria-selected="true"] {
  font-weight: 700;
}
.dropdown__option[aria-selected="true"]::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 640px), (pointer: coarse) {
  .dropdown__option {
    min-height: 44px;
  }
}
@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dropdown__list {
    animation: none;
  }
  .dropdown__chevron,
  .dropdown__button {
    transition: none;
  }
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Password field: the show/hide eye sits inside the input, on the right. */
.field__input-wrap {
  position: relative;
}

.field__input-wrap .input {
  padding-right: 48px;
}

.field__reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.15s;
}

.field__reveal:hover {
  color: var(--ink);
}

.field__reveal:focus-visible {
  outline: none;
  color: var(--ink);
  box-shadow: var(--focus-ring);
}

.field__reveal[aria-pressed="true"] {
  color: var(--accent-text);
}

/* Password checklist: a dot until the rule is met, then a green check. */
.pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 0.8rem;
  transition: color 0.15s;
}

.pw-rule__mark {
  display: inline-block;
  width: 1em;
  text-align: center;
}

.pw-rule.is-met {
  color: var(--success);
}

.pw-rule.is-met .pw-rule__mark {
  font-weight: 700;
}

.input--multiline {
  height: auto;
  min-height: 88px;
  padding: 10px 14px;
  resize: vertical;
}

.field--invalid .input {
  border-color: var(--danger);
}

/* A field that's a button (sign-up's "Read and agree to the terms"): red when it's missing. */
.field--invalid > .btn {
  box-shadow: 0 0 0 2px var(--danger);
  color: var(--danger);
}
.field--invalid .field__error {
  color: var(--danger);
  font-weight: 600;
}

/* A rounded drop-down, like the "Who can see this" choice on posts. */
.pill-select {
  height: 34px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-muted) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d867a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  font-size: 0.85rem;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}

/* A row of joined buttons where one is picked (like a switch with several positions). */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
}

.segmented__option {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.segmented__option.is-selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Choices shown as cards you can tick (one or many). */
.radio-list {
  display: grid;
  gap: 10px;
}

.radio-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.radio-card input {
  margin-top: 4px;
  accent-color: var(--accent);
}

.radio-card__text {
  display: grid;
  gap: 2px;
}

.radio-card__text span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Menus ---------- */

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop 0.12s ease-out;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  text-align: left;
}

.menu__item:hover {
  background: var(--surface-sunken);
}

.menu__item--danger {
  color: var(--danger);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

/* ---------- Dialog ---------- */

.dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
  background: rgb(20 17 12 / 0.45);
  backdrop-filter: blur(2px);
}

.dialog__body {
  display: grid;
  gap: 10px;
  padding: 24px;
}

.dialog__title {
  font-size: 1.15rem;
}

.dialog__message {
  color: var(--ink-soft);
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- Photo adjust (crop) dialog and drop targets ---------- */
/* Functional layout only (Front End Async); Front End CSS may polish. */

.crop-dialog {
  width: min(420px, calc(100vw - 32px));
}

.crop__hint {
  font-size: 0.9rem;
}

.crop__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.crop__stage.is-moving {
  cursor: grabbing;
}

.crop__stage:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.crop__image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform-origin: 0 0;
}

.crop__frame {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgb(20 17 12 / 0.55);
  outline: 2px solid rgb(255 255 255 / 0.85);
  outline-offset: -2px;
  pointer-events: none;
}

.crop__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-faint);
}

.crop__zoom {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

/* One toast message, coloured by its tone (info, success, error). */
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease-out;
  transition: opacity 0.25s, transform 0.25s;
}

.toast--error {
  background: var(--danger);
  color: #fff;
}

.toast--leaving {
  opacity: 0;
  transform: translateY(8px);
}

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

/* ---------- Badge ---------- */

.badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs__tab {
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
}

.tabs__tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--ink);
}

/* ---------- People ---------- */

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.user-row__text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.user-row__name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row__name:hover {
  text-decoration: underline;
}

.user-row__sub {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* People as tiles in a grid (components/user-row.js UserTile). */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
}

.user-tile {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
}

.user-tile__name {
  margin-top: 8px;
  font-weight: 600;
}

.user-tile__sub {
  margin-bottom: 8px;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.friend-actions {
  display: flex;
  gap: 6px;
}

/* ---------- States ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.empty__title {
  font-size: 1.1rem;
}

.empty__text {
  max-width: 340px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}

/* The spinning loading circle, and the grey shimmering shapes shown while posts load. */
.spinner {
  width: 28px;
  height: 28px;
  margin: 32px auto;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.skeleton__circle,
.skeleton__line {
  display: block;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--surface-sunken), var(--surface-muted), var(--surface-sunken));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton__circle {
  width: 40px;
  height: 40px;
}

.skeleton__line {
  height: 12px;
}

.skeleton__lines {
  display: grid;
  flex: 1;
  gap: 8px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Guided tour ---------- */
.tour {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: none;
}

.tour--center {
  background: rgb(0 0 0 / 0.6);
}

.tour__spot {
  position: fixed;
  border-radius: 14px;
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 0 6px rgb(255 255 255 / 0.25),
    0 0 0 9999px rgb(0 0 0 / 0.6);
  pointer-events: none;
  transition:
    top 0.3s ease,
    left 0.3s ease,
    width 0.3s ease,
    height 0.3s ease;
}

.tour--center .tour__spot {
  display: none;
}

.tour__bubble {
  position: fixed;
  box-sizing: border-box;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  padding: 18px;
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: tour-pop 0.22s ease both;
}

.tour__bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 14px;
  height: 14px;
  background: var(--surface);
  transform: translateX(-50%) rotate(45deg);
}

.tour__bubble[data-side="top"]::before {
  bottom: -7px;
}

.tour__bubble[data-side="bottom"]::before {
  top: -7px;
}

.tour--center .tour__bubble {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-name: tour-pop-center;
}

.tour--center .tour__bubble::before {
  display: none;
}

.tour__count {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0.8;
}

.tour__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.tour__text {
  margin: 0 0 16px;
  line-height: 1.55;
}

.tour__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour__skip {
  margin-right: auto;
}

@keyframes tour-pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tour-pop-center {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour__spot {
    transition: none;
  }
  .tour__bubble {
    animation: none;
  }
}

@media (max-width: 640px) {
  .tour__bubble,
  .tour--center .tour__bubble {
    top: auto !important;
    left: 12px !important;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    transform: none !important;
  }
  .tour__bubble::before {
    display: none;
  }
}

/* ---------- Join card for signed-out visitors (components/join.js) ---------- */

.join-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  text-align: center;
  justify-items: center;
}

.join-card__title {
  font-size: 1.05rem;
  font-weight: 700;
}

.join-card__text {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.join-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Guests' top bar: Sign in / Create account stay on one line on phones. */
.app--guest .topbar__actions {
  gap: 8px;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .app--guest .wordmark {
    display: none;
  }
}

/* ---------- Get the app (js/components/install-app.js) and the offline page (offline.html) ---------- */
.install-app {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.install-app__icon {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.install-app__text {
  flex: 1;
  min-width: 0;
}

.install-app__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.install-app__pitch {
  margin: 0 0 12px;
  color: var(--ink-soft);
}

.install-app__done,
.install-app__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.install-app__done {
  font-weight: 600;
  color: var(--accent);
}

.install-app__hint {
  display: block;
  color: var(--ink-soft);
}

.install-app__steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.install-app__steps li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-app__step-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-sunken);
}

/* The card on a starry background (not used on the home page right now). */
.install-app--earth {
  padding: 24px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  backdrop-filter: blur(12px);
}

.install-app--earth .install-app__pitch,
.install-app--earth .install-app__hint {
  color: rgb(255 255 255 / 0.75);
}

.install-app--earth .install-app__step-icon {
  background: rgb(255 255 255 / 0.12);
}

/* The small "Get the app" pill under the hero buttons. */
.hero__get-app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 7px 16px 7px 8px;
  border: 1px solid var(--e-line, rgb(170 190 255 / 0.14));
  border-radius: 999px;
  background: rgb(255 255 255 / 0.04);
  color: var(--e-ink-soft, rgb(255 255 255 / 0.8));
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition:
    color 0.25s ease,
    border-color 0.25s ease,
    background-color 0.25s ease;
}

.hero__get-app .icon {
  box-sizing: content-box;
  padding: 5px;
  border-radius: 999px;
  background: rgb(170 190 255 / 0.14);
  color: var(--e-ink, #fff);
  transition: transform 0.3s var(--ease-calm, ease);
}

.hero__get-app:hover {
  border-color: rgb(170 190 255 / 0.32);
  background: rgb(255 255 255 / 0.08);
  color: var(--e-ink, #fff);
}

.hero__get-app:hover .icon {
  transform: translateY(2px);
}

.hero__get-app:focus-visible {
  outline: 2px solid var(--e-ink, #fff);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .hero__get-app,
  .hero__get-app .icon {
    transition: none;
  }
  .hero__get-app:hover .icon {
    transform: none;
  }
}

@media (max-width: 480px) {
  .install-app {
    flex-direction: column;
  }
}

.offline {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.offline__card {
  max-width: 420px;
}

.offline__icon {
  border-radius: 16px;
}

/* Installed app on a notched phone: keep the top bar clear of the status bar / notch. */
@media (display-mode: standalone) {
  .topbar-wrap {
    padding-top: env(safe-area-inset-top);
    background: var(--surface);
  }
}
