:root {
  --akofam-purple: #3b0067;
  --akofam-purple-dark: #24003f;
  --akofam-purple-soft: #f7f0fc;

  --akofam-orchid: #da70d6;
  --akofam-orchid-dark: #8a247f;
  --akofam-lavender-strong: #d9c1ef;

  --akofam-ink: #21172d;
  --akofam-text: #342841;
  --akofam-muted: #564a64;

  --akofam-white: #ffffff;
  --akofam-card-soft: #fbf8ff;

  --akofam-border: rgba(59, 0, 103, .10);
  --akofam-border-strong: rgba(59, 0, 103, .22);

  --akofam-radius: 26px;
  --akofam-radius-sm: 18px;

  --akofam-focus: #24003f;
  --akofam-focus-light: #da70d6;

  --akofam-transition: 180ms ease;
}

/* Base */
.ako-family-page,
.ako-family-page * {
  box-sizing: border-box;
}

.ako-family-page {
  width: 100%;
  overflow: visible;
  background: transparent;
  color: var(--akofam-ink);
}

.ako-family-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* Safety: old sections no longer used */
.ako-family-hero,
.ako-family-stat-strip,
.ako-family-search,
.ako-family-card__tag {
  display: none !important;
}

/* Directory wrapper */
.ako-family-directory {
  padding: clamp(18px, 4vw, 42px) 0 clamp(44px, 7vw, 78px);
}

.ako-family-directory-head {
  display: block;
  max-width: 820px;
  margin-bottom: clamp(20px, 3vw, 34px);
}

.ako-family-directory-head h2 {
  margin: 0;
  color: var(--akofam-purple-dark);
  font-size: clamp(1.85rem, 4vw, 3.25rem);
  line-height: 1;
  letter-spacing: -.045em;
  font-weight: 950;
}

.ako-family-directory-head p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--akofam-text);
  font-size: clamp(1rem, 1.5vw, 1.08rem);
  line-height: 1.65;
}

/* Profile grid */
.ako-family-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.2vw, 24px);
  align-items: stretch;
}

/* Profile cards */
.ako-family-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  min-height: 100%;
  display: flex;
  flex-direction: column;

  padding: clamp(18px, 2vw, 22px);
  border: 1px solid var(--akofam-border);
  border-radius: var(--akofam-radius);

  background:
    radial-gradient(circle at 50% -18%, rgba(218, 112, 214, .10), transparent 46%),
    linear-gradient(180deg, var(--akofam-white), var(--akofam-card-soft));

  box-shadow: none;
  color: var(--akofam-ink);

  transition:
    transform var(--akofam-transition),
    border-color var(--akofam-transition);
}

.ako-family-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(
    90deg,
    var(--akofam-purple-dark),
    var(--akofam-orchid-dark),
    var(--akofam-orchid),
    var(--akofam-lavender-strong)
  );
}

.ako-family-card:hover,
.ako-family-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--akofam-border-strong);
}

/* Card top */
.ako-family-card__top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding-top: 2px;
}

.ako-family-card__photo {
  width: clamp(72px, 7vw, 84px);
  aspect-ratio: 1;
  flex: 0 0 auto;

  border-radius: 50%;
  padding: 4px;

  background: linear-gradient(
    135deg,
    var(--akofam-purple-dark),
    var(--akofam-orchid-dark),
    var(--akofam-lavender-strong)
  );

  box-shadow: 0 0 0 5px #ffffff;
}

.ako-family-card__photo img,
.ako-family-card__photo span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.ako-family-card__photo img {
  display: block;
  object-fit: cover;
  object-position: 50% 35%;
  background: #f1eaf7;
}

.ako-family-card__photo span {
  display: grid;
  place-items: center;

  background: #ffffff;
  color: var(--akofam-purple-dark);

  font-size: 1.25rem;
  font-weight: 950;
}

/* Identity */
.ako-family-card__identity {
  min-width: 0;
}

.ako-family-card__identity h3 {
  margin: 0;
  color: var(--akofam-purple-dark);
  font-size: clamp(1.04rem, 1.4vw, 1.16rem);
  line-height: 1.22;
  letter-spacing: -.02em;
  font-weight: 950;
}

.ako-family-card__identity p {
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 0;
  padding: .4rem .68rem;

  border-radius: 999px;
  background: var(--akofam-purple-soft);

  color: var(--akofam-purple);
  font-size: .82rem;
  line-height: 1.25;
  font-weight: 850;
}

/* Bio preview */
.ako-family-card__bio {
  margin: 18px 0 0;
  color: var(--akofam-text);
  font-size: .96rem;
  line-height: 1.62;
}

.ako-family-card__bio p {
  margin: 0;
}

/* Footer / action */
.ako-family-card__footer {
  margin-top: auto;
  padding-top: 18px;

  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.ako-family-card button {
  min-height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: .64rem .96rem;

  border: 0;
  border-radius: 999px;
  background: var(--akofam-purple-dark);

  color: #ffffff;
  font-size: .9rem;
  line-height: 1.2;
  font-weight: 850;

  cursor: pointer;

  transition:
    background-color var(--akofam-transition),
    transform var(--akofam-transition);
}

.ako-family-card button:hover {
  background: var(--akofam-purple);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Empty state */
.ako-family-empty {
  display: none;
  margin-top: 16px;
  padding: 18px;

  border: 1px solid var(--akofam-border);
  border-radius: var(--akofam-radius-sm);
  background: #ffffff;

  color: var(--akofam-text);
  font-weight: 750;
}

/* Modal */
.ako-family-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: none;
  align-items: center;
  justify-content: center;

  padding: clamp(14px, 3vw, 22px);
  background: rgba(22, 0, 38, .74);

  overscroll-behavior: contain;
}

.ako-family-modal.is-open {
  display: flex;
}

.ako-family-modal__panel {
  position: relative;

  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.ako-family-modal__accent {
  height: 9px;
  flex: 0 0 auto;
  background: linear-gradient(
    90deg,
    var(--akofam-purple-dark),
    var(--akofam-orchid-dark),
    var(--akofam-orchid),
    var(--akofam-lavender-strong)
  );
}

.ako-family-modal__body {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: clamp(22px, 4vw, 34px);
}

/* Modal close button — CSS drawn X */
.ako-family-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 0;
  border-radius: 50%;
  background: #1c1c1f;

  color: transparent;
  font-size: 0;
  line-height: 1;

  cursor: pointer;

  transition:
    background-color var(--akofam-transition),
    transform var(--akofam-transition);
}

.ako-family-modal__close::before,
.ako-family-modal__close::after {
  content: "";
  position: absolute;

  width: 18px;
  height: 4px;

  border-radius: 999px;
  background: #ffffff;
}

.ako-family-modal__close::before {
  transform: rotate(45deg);
}

.ako-family-modal__close::after {
  transform: rotate(-45deg);
}

.ako-family-modal__close:hover {
  background: var(--akofam-purple-dark);
  transform: translateY(-1px);
}

/* Modal header */
.ako-family-modal__header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-right: 54px;
}

.ako-family-modal__avatar {
  width: 92px;
  aspect-ratio: 1;
  flex: 0 0 auto;

  display: grid;
  place-items: center;

  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--akofam-purple-dark),
    var(--akofam-orchid-dark)
  );

  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 950;
}

.ako-family-modal h3 {
  margin: 0;
  color: var(--akofam-purple-dark);
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  font-weight: 950;
}

.ako-family-modal__position {
  width: fit-content;
  max-width: 100%;
  margin: 10px 0 0;
  padding: .45rem .72rem;

  border-radius: 999px;
  background: var(--akofam-purple-soft);

  color: var(--akofam-purple);
  font-size: .9rem;
  line-height: 1.2;
  font-weight: 850;
}

.ako-family-modal__position:empty {
  display: none;
}

/* Modal content */
.ako-family-modal__text {
  margin-top: 24px;
  color: var(--akofam-text);
  font-size: 1rem;
  line-height: 1.75;
}

.ako-family-modal__text p {
  margin: 0 0 1rem;
}

.ako-family-modal__text p:last-child {
  margin-bottom: 0;
}

/* Modal profile links */
.ako-family-profile-links {
  margin-top: 1.25rem;

  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.ako-family-profile-links a {
  min-height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: .62rem .9rem;

  border-radius: 999px;
  background: var(--akofam-purple-dark);

  color: #ffffff;
  font-size: .9rem;
  line-height: 1.2;
  font-weight: 850;
  text-decoration: none;
}

.ako-family-profile-links a:hover {
  background: var(--akofam-purple);
  color: #ffffff;
}

/* CTA */
.ako-family-cta {
  margin-top: clamp(28px, 4vw, 44px);
  padding: clamp(24px, 3vw, 36px);

  border-radius: 30px;
  background:
    radial-gradient(circle at 92% 0%, rgba(218, 112, 214, .20), transparent 18rem),
    linear-gradient(135deg, var(--akofam-purple-dark), #3b0067);

  color: #ffffff;
  box-shadow: none;
}

.ako-family-kicker {
  width: fit-content;
  margin: 0 0 14px;
  padding: .56rem .84rem;

  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24);

  color: #ffffff;
  font-size: .88rem;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ako-family-page .ako-family-cta h2,
.ako-family-page .ako-family-cta p,
.ako-family-page .ako-family-cta .ako-family-kicker {
  color: #ffffff !important;
}

.ako-family-cta h2 {
  max-width: 780px;
  margin: 0;

  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.06;
  letter-spacing: -.04em;
  font-weight: 950;
}

.ako-family-cta p:not(.ako-family-kicker) {
  max-width: 840px;
  margin: 14px 0 0;

  color: rgba(255, 255, 255, .92) !important;
  font-size: 1.02rem;
  line-height: 1.65;
}

/* Focus states */
.ako-family-page button:focus-visible,
.ako-family-page a:focus-visible,
.ako-family-modal__close:focus-visible,
.ako-family-profile-links a:focus-visible {
  outline: 3px solid var(--akofam-focus);
  outline-offset: 4px;
}

.ako-family-card button:focus-visible,
.ako-family-profile-links a:focus-visible {
  outline-color: var(--akofam-focus-light);
}

/* Tablet */
@media (max-width: 1100px) {
  .ako-family-shell {
    width: min(100% - 28px, 960px);
  }

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

/* Modal tablet and smaller */
@media (max-width: 820px) {
  .ako-family-modal {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }

  .ako-family-modal__panel {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    border-radius: 26px 26px 0 0;
  }

  .ako-family-modal__body {
    max-height: calc(92dvh - 9px);
    padding: 24px 22px 30px;
  }

  .ako-family-modal__close {
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
  }

  .ako-family-modal__close::before,
  .ako-family-modal__close::after {
    width: 17px;
    height: 4px;
  }

  .ako-family-modal__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-right: 52px;
  }

  .ako-family-modal__avatar {
    width: 78px;
  }

  .ako-family-modal h3 {
    font-size: clamp(1.45rem, 7vw, 2rem);
    line-height: 1.08;
  }

  .ako-family-modal__text {
    margin-top: 20px;
    font-size: 1rem;
    line-height: 1.7;
  }
}

/* Mobile */
@media (max-width: 680px) {
  .ako-family-shell {
    width: min(100% - 22px, 540px);
  }

  .ako-family-directory {
    padding-top: 18px;
  }

  .ako-family-directory-head {
    margin-bottom: 18px;
  }

  .ako-family-directory-head h2 {
    font-size: clamp(1.75rem, 10vw, 2.6rem);
  }

  .ako-family-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ako-family-card {
    padding: 18px;
    border-radius: 22px;
  }

  .ako-family-card__top {
    min-height: 0;
    align-items: center;
  }

  .ako-family-card__photo {
    width: 72px;
  }

  .ako-family-card__footer {
    align-items: stretch;
    justify-content: stretch;
  }

  .ako-family-card button {
    width: 100%;
  }

  .ako-family-profile-links a {
    width: 100%;
  }

  .ako-family-cta {
    border-radius: 24px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .ako-family-modal__panel {
    max-height: 94dvh;
    border-radius: 24px 24px 0 0;
  }

  .ako-family-modal__body {
    max-height: calc(94dvh - 9px);
    padding: 22px 18px 28px;
  }

  .ako-family-modal__close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .ako-family-modal__close::before,
  .ako-family-modal__close::after {
    width: 16px;
    height: 4px;
  }

  .ako-family-modal__header {
    padding-right: 48px;
  }

  .ako-family-modal__avatar {
    width: 72px;
  }

  .ako-family-modal__position {
    font-size: .84rem;
  }

  .ako-family-profile-links {
    flex-direction: column;
  }
}

/* Very small mobile */
@media (max-width: 420px) {
  .ako-family-shell {
    width: min(100% - 18px, 390px);
  }

  .ako-family-card {
    padding: 16px;
  }

  .ako-family-card__top {
    gap: 12px;
  }

  .ako-family-card__photo {
    width: 66px;
    box-shadow: 0 0 0 4px #ffffff;
  }

  .ako-family-card__identity h3 {
    font-size: 1rem;
  }

  .ako-family-card__identity p {
    font-size: .78rem;
  }
}

/* Very short mobile screens */
@media (max-height: 620px) and (max-width: 820px) {
  .ako-family-modal__panel {
    max-height: 96dvh;
  }

  .ako-family-modal__body {
    max-height: calc(96dvh - 9px);
  }

  .ako-family-modal__avatar {
    width: 64px;
  }

  .ako-family-modal__text {
    margin-top: 16px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ako-family-card,
  .ako-family-card button,
  .ako-family-profile-links a,
  .ako-family-modal__close {
    transition: none;
  }

  .ako-family-card:hover,
  .ako-family-card:focus-within,
  .ako-family-card button:hover,
  .ako-family-modal__close:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .ako-family-card,
  .ako-family-empty,
  .ako-family-modal__panel {
    border: 1px solid CanvasText;
  }

  .ako-family-card::before,
  .ako-family-modal__accent {
    background: CanvasText;
  }

  .ako-family-card button,
  .ako-family-profile-links a,
  .ako-family-modal__close {
    border: 1px solid ButtonText;
  }

  .ako-family-modal__close::before,
  .ako-family-modal__close::after {
    background: ButtonText;
  }
}