/* ==========================================================================
   Bio page editor (2026) - an app screen on the app shell.
   sns.css owns every colour, size, radius, shadow and spacing value via
   tokens; this file adds only the layout that is unique to this page.
   No colour literals, no raw px for spacing, no IDs as selectors, no
   !important. The published bio page (profile.css) is a separate system and
   must never load this file or sns.css.
   ========================================================================== */

/* --- Page frame ------------------------------------------------------------ */

.sns-page.bio-page {
  max-width: 1280px;
  padding-bottom: var(--s-16);
}

.bio-loading {
  padding: var(--s-20) 0;
  text-align: center;
  color: var(--sns-ink-4);
  font-size: var(--fs-base);
}

.bio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--s-8);
  align-items: start;
}

@media (max-width: 1023px) {
  .bio-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.bio-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.bio-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.bio-card-title {
  margin: 0;
}

.bio-card-note {
  margin: 0;
}

/* --- Topbar actions --------------------------------------------------------- */

.bio-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.bio-save-state {
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .bio-save-state {
    display: none;
  }
}

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

.bio-tabs {
  margin-bottom: var(--s-6);
}

/* --- Identity row -------------------------------------------------------------- */

.bio-identity {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

#avatarPrev {
  width: 80px;
  height: 80px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--sns-brand-tint-2);
  color: var(--sns-brand-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: var(--fs-sm);
  text-align: center;
}

#avatarPrev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--r-full);
}

.bio-identity-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.bio-identity-text .sns-row-title,
.bio-identity-text .sns-row-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bio-details {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  border-top: 1px solid var(--sns-line);
  padding-top: var(--s-4);
}

/* .bio-fld--wide carries flex-basis 240px, which is a WIDTH in the wrapping
   rows it was written for. This panel is a column, so the same basis became a
   240px height and every wide field rendered as a label and an input floating
   above a void. In a column the fields size to their content. */
.bio-details > .bio-fld {
  flex: 0 0 auto;
}

/* textarea needs auto height: .sns-input sets 44px for single-line fields */
textarea.sns-input {
  height: auto;
  min-height: var(--s-16);
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
  line-height: 1.6;
  resize: vertical;
}

.bio-fields {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.bio-fld {
  flex: 1 1 160px;
  min-width: 0;
}

.bio-fld--wide {
  flex: 2 1 240px;
}

.bio-fld--sel {
  flex: 0 1 130px;
  min-width: 110px;
}

.bio-field-label {
  display: block;
  color: var(--sns-ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--s-2);
}

.bio-field-help {
  display: block;
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
  margin-top: var(--s-1);
}

.bio-check {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  cursor: pointer;
}

.bio-check input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--sns-brand);
}

/* --- Public link row ------------------------------------------------------------ */

.bio-urlrow .bio-url {
  color: var(--sns-brand-ink);
  font-size: var(--fs-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Section list --------------------------------------------------------------- */

.bio-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.bio-item {
  display: flex;
  flex-direction: column;
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-1) var(--ease);
}

.bio-item:hover {
  border-color: var(--sns-line-strong);
}

.bio-item .sns-row {
  border: 0;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.bio-item-body {
  display: none;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border-top: 1px solid var(--sns-line);
}

.bio-item.is-open .bio-item-body {
  display: flex;
}

.bio-item .sns-row .sns-icon-btn .sns-chevron {
  transition: transform var(--dur-2) var(--ease);
}

.bio-item.is-open .sns-row .sns-chevron {
  transform: rotate(180deg);
}

.bio-grip {
  display: inline-flex;
  flex: none;
  color: var(--sns-ink-4);
  cursor: grab;
}

.bio-grip .sns-icon {
  width: 16px;
  height: 16px;
}

.bio-items {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  border-top: 1px solid var(--sns-line);
  padding-top: var(--s-3);
}

.bio-itemrow {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.bio-itemrow .sns-input {
  flex: 1 1 120px;
  min-width: 0;
}

.bio-itemrow .bio-inp-wide {
  flex: 1.6 1 160px;
}

.bio-itemrow .bio-inp-sel {
  flex: 0 1 118px;
  min-width: 104px;
}

.bio-itemrow .sns-icon-btn {
  flex: none;
}

.bio-foot-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* --- Username --------------------------------------------------------------------- */

.bio-uname {
  display: flex;
  align-items: stretch;
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.bio-uname:focus-within {
  border-color: var(--sns-brand);
  box-shadow: var(--sns-focus-ring);
}

.bio-uname .bio-pfx {
  display: flex;
  align-items: center;
  padding: 0 var(--s-1) 0 var(--s-3);
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.bio-uname .sns-input {
  border: 0;
  border-radius: 0;
  flex: 1;
  min-width: 0;
  box-shadow: none;
}

.bio-uname .sns-input:focus {
  box-shadow: none;
}

.bio-status {
  display: block;
  min-height: 18px;
  font-size: var(--fs-sm);
  color: var(--sns-ink-4);
}

.bio-status.is-ok {
  color: var(--sns-success);
}

.bio-status.is-bad {
  color: var(--sns-danger);
}

/* --- Theme picker ------------------------------------------------------------------- */

.bio-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}

@media (max-width: 560px) {
  .bio-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.themeCard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-3);
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.themeCard:hover {
  border-color: var(--sns-line-strong);
}

.themeCard.sel {
  border-color: var(--sns-brand);
  box-shadow: var(--sns-focus-ring);
}

.tSwatch {
  width: 100%;
  height: 48px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: var(--s-2);
  border: 1px solid var(--sns-line);
}

.tSwatch i {
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: block;
}

.tName {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--sns-ink-2);
}

/* --- Live preview: the real published page in a phone frame, sticky beside
     the editor. The iframe renders at phone width (390px) and is scaled down
     to the frame, the same technique landing.css uses. -------------------- */

.bio-preview-col {
  position: sticky;
  top: calc(56px + var(--s-6));
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.bio-phone {
  --bio-scale: 0.7;
  width: calc(390px * var(--bio-scale) + var(--s-3) * 2);
  margin: 0 auto;
  padding: var(--s-3);
  background: var(--sns-ink);
  border-radius: 40px;
  box-shadow: var(--sh-lg);
}

.bio-phone-screen {
  position: relative;
  overflow: hidden;
  height: calc(820px * var(--bio-scale));
  border-radius: 30px;
  background: var(--sns-surface);
}

.bio-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 820px;
  border: 0;
  transform: scale(var(--bio-scale));
  transform-origin: top left;
  background: var(--sns-surface);
}

.bio-preview-empty {
  padding: var(--s-16) var(--s-6);
  text-align: center;
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
}

.bio-preview-note {
  margin: 0;
  text-align: center;
}

@media (max-width: 1023px) {
  .bio-preview-col {
    position: static;
  }
}

/* --- Fasa A: simpler editing ------------------------------------------------ */

/* Fields in a column size to their content (the flex-basis 240px of
   .bio-fld--wide became a 240px HEIGHT in column cards: the Featured card
   showed labels floating above empty space). */
.bio-card > .bio-fld,
.bio-item-body > .bio-fld,
.bio-link-more > .bio-fld {
  flex: 0 0 auto;
}

.bio-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.bio-opt {
  font-weight: 400;
  color: var(--sns-ink-4);
  margin-left: var(--s-1);
}

/* progress */
.bio-progress {
  gap: var(--s-2);
}

.bio-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.bio-progress-count {
  color: var(--sns-brand-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.bio-progress-track {
  display: block;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--sns-brand-tint-2);
  overflow: hidden;
}

.bio-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--sns-brand);
  transition: width var(--dur-2) var(--ease);
}

/* row heads */
.bio-head-ic {
  display: inline-flex;
  flex: none;
  color: var(--sns-ink-3);
}

.bio-head-ic .sns-icon {
  width: 18px;
  height: 18px;
}

.bio-item .sns-row:focus-visible {
  box-shadow: var(--sns-focus-ring);
}

.bio-item .sns-icon-btn:disabled {
  opacity: .35;
  cursor: default;
}

/* choice buttons: what a button does, button style */
.bio-choices {
  display: grid;
  gap: var(--s-2);
}

.bio-choices--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bio-choices--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 560px) {
  .bio-choices--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bio-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  min-height: 64px;
  padding: var(--s-2);
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  color: var(--sns-ink-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}

.bio-choice:hover {
  border-color: var(--sns-line-strong);
}

.bio-choice[aria-pressed="true"] {
  border-color: var(--sns-brand);
  background: var(--sns-brand-tint);
  color: var(--sns-brand-ink);
  box-shadow: inset 0 0 0 1px var(--sns-brand);
}

.bio-choice .sns-icon {
  width: 20px;
  height: 20px;
}

.bio-sample {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 140px;
  height: 32px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
}

.bio-sample--fill {
  background: var(--sns-brand);
  color: var(--sns-surface);
}

.bio-sample--line {
  border: 1.5px solid var(--sns-brand);
  color: var(--sns-brand-ink);
}

/* icon picker */
.bio-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: var(--s-2);
}

.bio-icon-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  color: var(--sns-ink-2);
  cursor: pointer;
}

.bio-icon-opt:hover {
  border-color: var(--sns-line-strong);
}

.bio-icon-opt[aria-pressed="true"] {
  border-color: var(--sns-brand);
  background: var(--sns-brand-tint);
  color: var(--sns-brand-ink);
  box-shadow: inset 0 0 0 1px var(--sns-brand);
}

.bio-icon-opt .sns-icon {
  width: 18px;
  height: 18px;
}

/* one link inside a group */
.bio-links {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  border-top: 1px solid var(--sns-line);
  padding-top: var(--s-3);
}

/* Title on top, address under it, tools to the right; More spans the row. */
.bio-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: var(--s-3);
  row-gap: var(--s-2);
  align-items: center;
  padding: var(--s-3);
  background: var(--sns-surface-2);
  border-radius: var(--r-md);
}

.bio-link-main {
  display: contents;
}

.bio-link-ic {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  color: var(--sns-ink-3);
}

.bio-link-ic .sns-icon {
  width: 18px;
  height: 18px;
}

.bio-link-main .bio-link-title {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.bio-link-main .bio-link-href {
  grid-column: 2 / -1;
  grid-row: 2;
  min-width: 0;
}

.bio-link-tools {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

@media (max-width: 560px) {
  .bio-link-main .bio-link-title {
    grid-column: 2 / -1;
  }
  .bio-link-tools {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-end;
  }
}

.bio-link-more {
  grid-column: 1 / -1;
  display: none;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-2);
}

.bio-link.is-more .bio-link-more {
  display: flex;
}

.bio-add-link {
  align-self: flex-start;
}

/* social icons */
.bio-soc-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--s-2);
}

.bio-soc-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  min-height: 68px;
  padding: var(--s-2);
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  color: var(--sns-ink-2);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

.bio-soc-tile:hover {
  border-color: var(--sns-line-strong);
}

.bio-soc-tile[aria-pressed="true"] {
  border-color: var(--sns-brand);
  background: var(--sns-brand-tint);
  box-shadow: inset 0 0 0 1px var(--sns-brand);
}

.bio-soc-tile > .sns-icon {
  width: 20px;
  height: 20px;
}

.bio-soc-check {
  position: absolute;
  top: var(--s-1);
  right: var(--s-1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--sns-brand);
  color: var(--sns-surface);
}

.bio-soc-check .sns-icon {
  width: 11px;
  height: 11px;
  stroke-width: 3.4;
}

.bio-soc-row {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
}

.bio-soc-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--sns-surface-2);
  color: var(--sns-ink-2);
}

.bio-soc-ic .sns-icon {
  width: 20px;
  height: 20px;
}

.bio-soc-main {
  flex: 1;
  min-width: 0;
}

.bio-soc-row > .sns-icon-btn {
  margin-bottom: var(--s-1);
}

.bio-soc-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}

.bio-soc-note {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  color: var(--sns-ink-3);
  margin-bottom: var(--s-2);
}

.bio-soc-note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--sns-success);
}

.bio-soc-note.is-empty::before {
  background: var(--sns-warn);
}

/* input with a fixed prefix, like instagram.com/ */
.bio-affix {
  display: flex;
  align-items: stretch;
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.bio-affix:focus-within {
  border-color: var(--sns-brand);
  box-shadow: var(--sns-focus-ring);
}

.bio-affix .bio-pfx {
  display: flex;
  align-items: center;
  padding: 0 var(--s-3);
  background: var(--sns-surface-2);
  border-right: 1px solid var(--sns-line);
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.bio-affix .sns-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.bio-affix .sns-input:focus {
  box-shadow: none;
}

/* featured picture */
.bio-pic {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.bio-pic-prev {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--sns-surface-2);
  border: 1px solid var(--sns-line);
  color: var(--sns-ink-4);
  overflow: hidden;
}

.bio-pic-prev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bio-more summary {
  color: var(--sns-brand-ink);
  font-size: var(--fs-sm);
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.bio-more .sns-input {
  margin-top: var(--s-2);
  width: 100%;
}



/* --- Fasa A: phones ------------------------------------------------------------ */

.bio-item .sns-row .sns-row-sub {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .bio-soc-ic {
    display: none;
  }
  .bio-affix .bio-pfx {
    padding: 0 var(--s-2);
    font-size: var(--fs-xs);
  }
}

/* --- Guard: the hidden attribute always hides -------------------------------- */

[hidden] {
  display: none;
}
