/* One cream sheet on the dark ground for a screen about a single object at
   length: team settings, profile, publishing a space. Same material and radius
   as the reading card; sections are separated by hairlines, never by boxes. */

.sheet {
  max-width: 860px;
  margin: 0 auto;
  border-radius: var(--radius-sheet);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-display);
}

.sheet--narrow {
  max-width: 680px;
}

.sheet__bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline);
}

.sheet__bar-spacer {
  flex: 1;
}

.sheet__bar-link {
  min-width: 0;
  max-width: 320px;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;

  &:disabled {
    opacity: 0.42;
    cursor: default;
  }
}

.sheet__bar-link > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet__body {
  padding: 52px clamp(28px, 5vw, 56px) 56px;
}

.sheet__identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 22px;
  align-items: center;

  & .mark {
    grid-row: 1;
  }

  & .sheet__title {
    grid-row: 1;
    grid-column: 2;
  }

  & .sheet__lede {
    grid-row: 2;
    grid-column: 2;
  }
}

.sheet__title {
  font: 700 clamp(38px, 4.6vw, 58px)/1 var(--font-display);
  letter-spacing: -0.04em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.sheet__lede {
  margin-top: 14px;
  font: 400 20px/1.45 var(--font-display);
  color: var(--ink-lede);

  & b {
    color: var(--ink);
    font-weight: 600;
  }
}

.sheet__section {
  margin-top: 44px;
  padding-top: 36px;
  border-top: 1px solid var(--hairline);
}

.sheet__section-head {
  display: flex;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 20px;
}

.sheet__section-title {
  flex: 1;
  font: 700 15px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sheet__section-meta {
  font: 500 15px/1 var(--font-display);
  color: var(--ink-faint);
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ─── A person in a row ──────────────────────────────────────────────────── */

.person {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-row);
  background: var(--row);
}

.person__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font: 700 17px/1 var(--font-display);

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

.person__avatar--pending {
  background: var(--chip);
  color: var(--ink-faint);
}

.person__id {
  flex: 1;
  min-width: 0;
}

.person__name {
  overflow: hidden;
  font: 600 18px/1.25 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person__you {
  margin-left: 6px;
  font-weight: 500;
  color: var(--ink-faint);
}

.person__mail {
  margin-top: 2px;
  overflow: hidden;
  font: 500 15px/1 var(--font-display);
  color: var(--ink-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person__role {
  display: flex;
  flex: none;
  gap: 8px;
  align-items: center;
  font: 600 15px/1 var(--font-display);
  color: var(--ink-lede);
}

.person__role-note {
  font-weight: 500;
  color: var(--ink-muted);
}

.person__role-select {
  width: auto;
  height: 40px;
  padding: 0 40px 0 14px;
  border-radius: var(--radius-row-sm);
  background-color: transparent;
  background-position: right 12px center;
  font-size: 15px;
  font-weight: 600;

  &:hover {
    background-color: var(--row-hover);
  }
}

.person__menu {
  position: relative;
  flex: none;
  opacity: 0;
  transition: opacity var(--transition-fast);

  .person:hover &,
  .person:focus-within &,
  &:has(.menu--open) {
    opacity: 1;
  }
}

.person__menu-trigger {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;

  &:hover {
    background: var(--row-hover);
    color: var(--ink);
  }
}

/* ─── Identity mark: a team logo or an avatar with a hover-revealed menu ─── */

.mark {
  position: relative;
  flex: none;
}

.mark__form {
  display: none;
}

.mark__slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 19px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 28px/1 var(--font-display);
  cursor: pointer;
}

.mark--round .mark__slot {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-pill);
  font-size: 30px;
}

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

.mark__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--cover) 60%, transparent);
  color: var(--on-cover);
  opacity: 0;
  transition: opacity var(--transition-fast);

  .mark__slot:hover &,
  .mark__slot:focus-visible & {
    opacity: 1;
  }
}

.mark__menu-form {
  display: contents;
}

/* ─── Site logo picker on the publish sheet ──────────────────────────────── */

.brand {
  display: flex;
  gap: 26px;
  align-items: flex-start;
}

.brand__logo {
  flex: none;
  width: 112px;
  text-align: left;
}

.brand__fields {
  flex: 1;
  min-width: 0;
}

.brand__logo .mark {
  margin: 0;
}

.brand__logo .mark__slot {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-mono);
  background: var(--row);
  color: var(--ink-faint);
}

.brand__logo .mark__image {
  object-fit: contain;
}

.brand__caption {
  margin-top: 10px;
  font: 500 13px/1.4 var(--font-display);
  color: var(--ink-muted);
}

/* ─── Appearance: brand colour + cover ───────────────────────────────────────
   The preview and cover band derive from --brand (set on .appearance, repainted
   live by the accent controller) with the same clamp the public surface uses. */

.appearance {
  --accent-ink: oklch(from var(--brand) min(l, 0.45) c h);
}

.appearance__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 8px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch--selected {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink);
}

.accent-custom {
  display: flex;
  gap: 10px;
  align-items: center;
}

.accent-well {
  flex: none;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-row);
  background: none;
  cursor: pointer;
  appearance: none;
}

.accent-well::-webkit-color-swatch-wrapper {
  padding: 0;
}

.accent-well::-webkit-color-swatch {
  border: 0;
  border-radius: var(--radius-row);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}

.accent-well::-moz-color-swatch {
  border: 0;
  border-radius: var(--radius-row);
}

.accent-hex {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
}

.accent-clear {
  flex: none;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font: 500 14px/1 var(--font-display);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

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

.accent-preview {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 118px;
  padding: 18px 20px;
  overflow: hidden;
  border-radius: var(--radius-row);
  background: var(--accent-ink);
  color: #fff;
}

.accent-preview__k {
  font: 600 12px/1 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.7);
}

.accent-preview__t {
  margin-top: 6px;
  overflow: hidden;
  font: 700 30px/1 var(--font-display);
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--hairline);
}

.cover-field {
  position: relative;
  max-width: 440px;
}

.cover-field__form {
  display: none;
}

.cover-field__slot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 24 / 9;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-mono);
  background: var(--row);
  cursor: pointer;
}

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

.cover-field__band {
  position: absolute;
  inset: 0;
  background: var(--accent-ink);
}

.cover-field__add {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: #fff;
  font: 600 15px/1 var(--font-display);
}

.cover-field__slot--empty:hover .cover-field__band {
  filter: brightness(1.06);
}

.cover-field__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--cover) 55%, transparent);
  color: var(--on-cover);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.cover-field__slot--photo:hover .cover-field__overlay,
.cover-field__slot--photo:focus-visible .cover-field__overlay {
  opacity: 1;
}

.cover-field__menu-form {
  display: contents;
}

.records {
  margin-top: 18px;
  border-radius: var(--radius-row);
  overflow: hidden;
  background: var(--row);
}

.records__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  font: 500 15px/1.4 var(--font-display);
  color: var(--ink-body);
}

.records__row + .records__row {
  border-top: 1px solid var(--hairline);
}

.records__row--head {
  padding-top: 14px;
  padding-bottom: 8px;
  font: 600 12px/1 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.records__type,
.records__name,
.records__value {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}

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

.records__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records__copy {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--chip);
  color: var(--ink-muted);
  cursor: pointer;
}

.records__copy:hover {
  background: var(--chip-hover);
  color: var(--ink);
}

.records-toggle {
  margin-top: 18px;
}

.records-toggle > summary {
  cursor: pointer;
  font: 500 15px/1.4 var(--font-display);
  color: var(--ink-muted);
}

.records-toggle > summary:hover {
  color: var(--ink);
}

.domain-status {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 20px;
  font: 500 15px/1.5 var(--font-display);
  color: var(--ink-body);
}

.domain-status__dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.domain-status--connected .domain-status__dot {
  background: var(--color-success);
}

.domain-status--elsewhere .domain-status__dot {
  background: var(--color-danger);
}

.domain-status a {
  color: var(--ink);
}

.domain-status__sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-muted);
}

@media (width <= 640px) {
  .appearance__grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Override field: a value that falls back to a team default ──────────── */

.override__top {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;

  & .field__label {
    margin-bottom: 0;
  }
}

.override__state {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font: 500 14px/1 var(--font-display);
  color: var(--ink-faint);
}

.override__reset {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-lede);
  font: 500 14px/1 var(--font-display);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
  cursor: pointer;

  &:hover {
    color: var(--ink);
    text-decoration-color: var(--accent);
  }
}

/* ─── Space access list inside the invite and access dialogs ─────────────── */

.access {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.access__item {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 10px 10px 18px;
  border-radius: var(--radius-row);
  background: var(--row);
}

.access__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font: 600 17px/1.25 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access__select {
  width: auto;
  height: 40px;
  padding: 0 40px 0 14px;
  border-radius: var(--radius-row-sm);
  background-color: var(--card);
  background-position: right 12px center;
  font-size: 15px;
}

@media (pointer: coarse) {
  .person__menu {
    opacity: 1;
  }

  .person__menu-trigger {
    width: 44px;
    height: 44px;
  }

  .mark__overlay {
    opacity: 1;
    background: color-mix(in srgb, var(--cover) 40%, transparent);
  }
}

@media (width <= 640px) {
  .sheet {
    border-radius: var(--radius-tile);
  }

  .sheet__bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
  }

  .sheet__bar-link {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .sheet__body {
    padding: 34px 20px 40px;
  }

  .sheet__title {
    font-size: 34px;
  }

  .sheet__lede {
    font-size: 17px;
  }

  .sheet__identity {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 16px;

    & .sheet__title,
    & .sheet__lede {
      grid-column: 1;
      grid-row: auto;
    }

    & .sheet__lede {
      margin-top: 0;
    }
  }

  .person {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 14px 16px;
  }

  .person__id {
    flex-basis: calc(100% - 116px);
  }

  .person__role {
    order: 3;
    flex-basis: 100%;
    padding-left: 60px;
    color: var(--ink-muted);
  }

  .brand {
    flex-wrap: wrap;
  }

  .records__row {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px 12px;
  }

  .records__row--head {
    display: none;
  }

  .records__value {
    grid-column: 1 / -1;
  }
}
