/* ==========================================================================
   App layer: auth, catalog and detail pages on top of the storefront styles.
   Reuses the tokens defined in styles.css.
   ========================================================================== */

/* --- header auth slot ----------------------------------------------------- */
.auth-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  max-width: 220px;
  padding: 0 0.5rem 0 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--frost);
  font-size: 13px;
  font-weight: 600;
}

.user-chip:hover {
  background: var(--frost-hover);
}

.user-chip__avatar {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  place-items: center;
  border-radius: 999px;
  background: #121313;
  color: #f4ff71;
  font-size: 12px;
  font-weight: 700;
}

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

.user-pop {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 60;
  width: 264px;
  padding: 6px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 16px 44px rgba(18, 19, 19, 0.16), 0 0 0 1px rgba(18, 19, 19, 0.07);
}

.user-pop__head {
  padding: 0.5rem 0.625rem 0.625rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}

.user-pop__email {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pop__plan {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted-fg);
}

.user-pop__item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 10px;
  font-size: 13px;
  text-align: left;
}

.user-pop__item:hover {
  background: var(--muted);
}

.user-pop__item--danger {
  color: #a02622;
}

.user-pop__label {
  padding: 0.5rem 0.625rem 0.25rem;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--ink-rgb), 0.45);
}

.user-pop__tenant {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.625rem;
  border-radius: 10px;
  font-size: 13px;
}

.user-pop__tenant:hover {
  background: var(--muted);
}

.user-pop__tenant[aria-current="true"] {
  background: var(--muted);
  font-weight: 600;
}

/* --- subscription banner -------------------------------------------------- */
.sub-banner {
  background: #121313;
  color: #fff;
}

.sub-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0.625rem 1rem;
  font-size: 13px;
}

@media (min-width: 640px) {
  .sub-banner__inner {
    padding-left: 1.5rem;
    padding-right: 1.75rem;
  }
}

.sub-banner__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f4ff71;
  box-shadow: 0 0 0 4px rgba(244, 255, 113, 0.18);
}

.sub-banner__text {
  min-width: 0;
}

.sub-banner__text strong {
  font-weight: 600;
}

.sub-banner__actions {
  display: flex;
  margin-left: auto;
  gap: 0.5rem;
}

.sub-banner__btn {
  display: inline-flex;
  height: 1.9rem;
  align-items: center;
  padding: 0 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.sub-banner__btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* --- auth dialog ---------------------------------------------------------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: rgba(18, 19, 19, 0.4);
  backdrop-filter: blur(4px);
}

.auth-overlay[data-open="true"] {
  display: flex;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 24px 60px rgba(18, 19, 19, 0.3);
}

.auth-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted-fg);
}

.auth-close:hover {
  background: var(--muted);
  color: var(--fg);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-sub {
  margin-top: 0.25rem;
  font-size: 13px;
  color: var(--muted-fg);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin: 1.25rem 0 1rem;
  padding: 4px;
  border-radius: 12px;
  background: var(--muted);
}

.auth-tab {
  flex: 1;
  height: 2rem;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-fg);
}

.auth-tab.is-active {
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 1px 0 rgba(18, 19, 19, 0.04), 0 6px 16px rgba(18, 19, 19, 0.06);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-field {
  display: grid;
  gap: 0.3rem;
  font-size: 12.5px;
  font-weight: 600;
}

.auth-field[hidden],
.auth-error[hidden] {
  display: none;
}

.auth-field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted-fg);
}

.auth-field input {
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}

.auth-field input:focus {
  outline: 2px solid rgba(18, 19, 19, 0.25);
  outline-offset: 1px;
}

.auth-error {
  padding: 0.5rem 0.625rem;
  border-radius: 8px;
  background: #fdecea;
  color: #7a1c14;
  font-size: 12.5px;
}

.auth-divider {
  position: relative;
  margin: 1rem 0;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-fg);
}

.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hairline);
}

.auth-divider span {
  position: relative;
  padding: 0 0.5rem;
  background: var(--card);
}

.auth-fine {
  margin-top: 1rem;
  font-size: 11px;
  color: var(--muted-fg);
  text-align: center;
}

/* --- catalog -------------------------------------------------------------- */
.page-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .page-shell {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .page-shell {
    padding: 0 2rem;
  }
}

.skills-page {
  padding: 2.5rem 0 4rem;
}

.skills-head {
  display: grid;
  gap: 0.75rem;
  max-width: 720px;
}

.skills-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.skills-sub {
  color: rgba(var(--ink-rgb), 0.6);
  line-height: 1.7;
}

.skills-search {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.skills-search input {
  flex: 1;
  height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--frost);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.75rem;
}

.filter-chip {
  display: inline-flex;
  height: 2rem;
  align-items: center;
  padding: 0 0.875rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(var(--ink-rgb), 0.65);
}

.filter-chip:hover {
  background: var(--frost);
}

.filter-chip.is-active {
  background: #121313;
  border-color: #121313;
  color: #fff;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.75rem 1.25rem;
}

/* --- system feedback ------------------------------------------------------ */
.auth-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: #fdecea;
  border-bottom: 1px solid #f2c2bd;
  color: #7a1c14;
  font-size: 13px;
  line-height: 1.5;
}

.auth-banner__detail {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  opacity: 0.75;
  word-break: break-word;
}

.auth-banner__close {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
}

.auth-banner__close:hover {
  opacity: 1;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #121313;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 16px 40px rgba(18, 19, 19, 0.28);
  transition: opacity 0.3s, transform 0.3s;
}

.app-toast.is-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.user-pop__role {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-fg);
}

.skills-empty {
  padding: 3rem 0;
  color: var(--muted-fg);
}

.skills-empty a {
  text-decoration: underline;
}

.card__badge--pro {
  border-color: rgba(18, 19, 19, 0.15);
  background: rgba(18, 19, 19, 0.82);
  color: #fff;
  backdrop-filter: blur(8px);
}

.card__output {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- skill detail --------------------------------------------------------- */
.skill-detail {
  padding: 1.5rem 0 4rem;
}

.detail-crumbs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 12.5px;
  color: var(--muted-fg);
}

.detail-crumbs a:hover {
  color: var(--fg);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.detail-main {
  max-width: 920px;
}

.detail-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  aspect-ratio: 16 / 9;
}

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

.detail-title {
  margin-top: 1.25rem;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.detail-summary {
  margin-top: 0.75rem;
  max-width: 60ch;
  line-height: 1.7;
  color: rgba(var(--ink-rgb), 0.62);
}

.detail-stats {
  display: flex;
  gap: 1.25rem;
  margin-top: 1rem;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(var(--ink-rgb), 0.55);
}

.detail-card {
  position: sticky;
  top: 6rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.detail-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-hint {
  margin-top: 0.5rem;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-fg);
}

.detail-ready {
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(244, 255, 113, 0.35);
}

.detail-ready-title {
  font-size: 13px;
  font-weight: 600;
}

.detail-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
  font-size: 12.5px;
  color: rgba(var(--ink-rgb), 0.62);
}

.detail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.detail-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.detail-tool img {
  width: 16px;
  height: 16px;
}

.detail-related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.detail-related-title {
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (min-width: 900px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

@media (max-width: 639px) {
  .user-chip__name {
    display: none;
  }
}
