.profile-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
}

.profile-column {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.profile-card {
  display: grid;
  gap: 1.1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.profile-card h2 {
  margin-bottom: .35rem;
}

.profile-card p {
  margin: 0;
}

.profile-account-body {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.profile-account-form {
  display: grid;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.profile-account-fields {
  display: grid;
  gap: .85rem;
}

.profile-photo-dialog {
  width: min(720px, calc(100% - 2rem));
  padding: 0;
  overflow: hidden;
}

.profile-photo-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
}

.profile-photo-dialog-content {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.profile-photo-dialog-content h2 {
  margin: .15rem 0 .3rem;
}

.profile-photo-dialog-content p {
  margin: 0;
  color: var(--muted);
}

.profile-photo-crop-stage {
  height: clamp(300px, 55vh, 520px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%),
    var(--surface);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.profile-photo-crop-stage > img {
  display: block;
  max-width: 100%;
}

.profile-photo-rotate-actions,
.profile-photo-dialog .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.profile-photo-dialog .dialog-actions {
  justify-content: flex-end;
  padding-top: .15rem;
}

.profile-photo-dialog .cropper-view-box,
.profile-photo-dialog .cropper-face {
  border-radius: 50%;
}

.notifications-form {
  display: grid;
  gap: .85rem;
}

.notifications-form .check-label {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 600;
}

.notifications-form .check-label input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
}

.appearance-mode {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.appearance-mode .button.is-active {
  background: var(--teal);
  color: var(--on-accent);
  border-color: var(--teal);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
}

.palette-card {
  display: grid;
  gap: .65rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.palette-card:hover,
.palette-card:focus-visible {
  border-color: var(--teal);
  outline: 3px solid color-mix(in srgb, var(--teal) 24%, transparent);
}

.palette-card.is-active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .25rem;
  height: 2rem;
}

.palette-swatches span {
  display: block;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, var(--line));
}

.profile-camp-gate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.profile-camp-gate[hidden] {
  display: none;
}

.profile-camp-gate img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
}

.profile-camp-gate div {
  display: grid;
  gap: .15rem;
}

.profile-camp-gate strong,
.profile-camp-gate small {
  display: block;
}

.profile-camp-gate small {
  color: var(--muted);
}

.profile-camp-gate.is-revealed {
  animation: camp-gate-arrive .6s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes camp-gate-arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.profile-danger-disclosure {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (max-width: 540px) {
  .profile-camp-gate {
    grid-template-columns: auto 1fr;
  }

  .profile-camp-gate .button {
    grid-column: 1 / -1;
  }
}

.profile-danger-disclosure > summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .9rem 1.1rem;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
  list-style: none;
}

.profile-danger-disclosure > summary::-webkit-details-marker {
  display: none;
}

.profile-danger-disclosure > summary::after {
  content: "";
  width: .45rem;
  height: .45rem;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.profile-danger-disclosure[open] > summary::after {
  transform: rotate(-135deg);
}

.profile-danger-disclosure[open] {
  border-color: color-mix(in srgb, var(--coral) 70%, var(--line));
  background: color-mix(in srgb, var(--coral) 8%, var(--surface));
}

.profile-danger-disclosure[open] > summary {
  color: var(--danger-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--coral) 35%, var(--line));
}

.profile-danger-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(250px, .7fr);
  gap: 1.5rem;
  padding: 1.25rem;
}

.profile-danger-body h2 {
  color: var(--danger-ink);
}

.profile-danger-body p {
  margin: 0;
}

.delete-account-form {
  display: grid;
  align-content: start;
  gap: .85rem;
}

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .profile-account-body {
    flex-direction: column;
  }

  .profile-photo-dialog {
    width: calc(100% - 1rem);
  }

  .profile-photo-dialog-content {
    padding: 1rem;
  }

  .profile-photo-crop-stage {
    height: min(55vh, 420px);
  }

  .profile-photo-rotate-actions .button,
  .profile-photo-dialog .dialog-actions .button {
    flex: 1;
  }

  .profile-danger-body {
    grid-template-columns: 1fr;
  }
}
