/* Shared UI — buttons, avatar picker, loader, step cards, search + view-more.
   Single source of truth for Profile, MySteps, and MyFavs (see CL-1). */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 14px;
  border-radius: 999px;
  padding: 11px 26px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--cream);
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--ink);
}

.btn-secondary:hover {
  opacity: 0.85;
}

.btn-danger {
  background: #a3312a;
  color: var(--cream);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.avatar-option {
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  background: var(--bg-alt);
  overflow: hidden;
  aspect-ratio: 1;
}

.avatar-option img {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-option.selected {
  border-color: var(--ink);
}

/* ---------- Loader ---------- */

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.loader[hidden] {
  display: none;
}

.loader-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  animation: ekyatra-spin 0.8s linear infinite;
}

@keyframes ekyatra-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Step cards ---------- */

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.steps-grid[hidden] {
  display: none;
}

.step-card-wrap {
  display: flex;
  flex-direction: column;
}

.step-card {
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(38, 35, 31, 0.12);
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* The grid card is a link to the STEP page (see STEP spec). */
a.step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(38, 35, 31, 0.18);
}

a.step-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.step-card-image {
  height: 150px;
  flex: none;
  position: relative;
  background-size: cover;
  background-position: center;
}

.step-card-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24, 28, 24, 0.45) 0%, rgba(24, 28, 24, 0.12) 40%, rgba(24, 28, 24, 0.82) 100%);
}

.step-card-meta {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px 0;
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250, 247, 241, 0.92);
}

.step-card-meta span {
  white-space: nowrap;
}

.step-card-meta span:last-child {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-card-quote {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  font-size: 15px;
  line-height: 1.3;
  color: #faf7f1;
}

.step-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.step-card-reflection {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(38, 35, 31, 0.8);
}

/* YATRA-CR-2 — preview: up to 2 lines of each section's notes, hard-clipped with
   a trailing ellipsis, in the 3 background treatments. */
.step-card-notes {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(38, 35, 31, 0.85);
  overflow: hidden;
}

/* Two-line ellipsis. The inner element does the clamping; padding stays on the
   parent so the max-height math is exact. */
.step-card-notes>span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  max-height: calc(1.45em * 2);
}

.step-card-notes.step-sec-1 {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

.step-card-notes.step-sec-2 {
  background: rgb(168, 205, 158);
  color: rgba(38, 35, 31, 0.92);
}

.step-card-notes.step-sec-3 {
  margin-top: auto;
  background: var(--bg-alt);
}

/* YATRA-CR-2 — detailed view: full per-section blocks + bottom tag list. */
.step-section {
  padding: 12px 14px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-section.step-sec-1 {
  background: #ffffff;
  padding-left: 0;
  padding-right: 0;
}

.step-section.step-sec-2 {
  background: rgb(168, 205, 158);
}

.step-section.step-sec-3 {
  background: var(--bg-alt);
}

.step-section-title,
.step-section-cite {
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* YATRA-CR-3 — verse citation sits right under the verse, a touch tighter. */
.step-section-cite {
  margin-top: -2px;
}

.step-section-verse {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.step-section-interpretation {
  font-style: italic;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(38, 35, 31, 0.8);
}

.step-section-notes {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(38, 35, 31, 0.92);
}

.step-section.step-sec-2 .step-section-title,
.step-section.step-sec-2 .step-section-cite,
.step-section.step-sec-2 .step-section-interpretation {
  color: rgba(38, 35, 31, 0.9);
}

.step-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.step-tag {
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 5px 11px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 1px;
  padding-left: 2px;
}

.card-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.card-action-btn:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.card-action-btn svg {
  width: 18px;
  height: 18px;
}

.like-btn.is-favorite {
  color: #e0245e;
}

.like-btn.is-favorite svg path {
  fill: currentColor;
}

.card-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Search + view more ---------- */

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  max-width: 480px;
}

.search-bar input {
  flex: 1;
  min-width: 0;
  font-family: 'Karla', sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 18px;
}

.search-bar input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.view-more-row {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.empty-state {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 32px 0;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

/* ---------- Create-step widget (floating action button) ---------- */
/* Shared across pages via _partials/create-step-widget.html — see CR-PROFILE-2. */

.create-step-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(38, 35, 31, 0.35);
  z-index: 50;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.create-step-fab:hover {
  transform: scale(1.06);
  opacity: 0.92;
}

.create-step-fab svg {
  width: 26px;
  height: 26px;
}

@media (max-width: 600px) {
  .avatar-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .create-step-fab {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
  }

  .create-step-fab svg {
    width: 22px;
    height: 22px;
  }
}

/* ---------- STEP page — one full card + like/share ---------- */
/* See the STEP section of docs/product-specs/initialrequirements.md. */

.step-detail {
  max-width: 620px;
  margin: 0 auto;
}

.step-card--full {
  cursor: default;
}

.step-card--full .step-card-image {
  height: clamp(220px, 42vw, 320px);
}

.step-card--full .step-card-quote {
  font-size: clamp(18px, 3.4vw, 24px);
  font-family: 'Petrona', serif;
}

.step-card--full .step-card-body {
  padding: 22px clamp(18px, 4vw, 28px) clamp(18px, 4vw, 28px);
  gap: 14px;
}

.step-card--full .step-card-meta {
  font-size: 11px;
  letter-spacing: 0.14em;
}

.step-card--full .step-card-reflection {
  font-size: 15px;
  line-height: 1.65;
}

.step-card--full .step-section {
  padding: 16px 18px;
}

.step-card--full .step-section.step-sec-1 {
  padding-left: 0;
  padding-right: 0;
}

.step-card--full .step-section-verse {
  font-size: 18px;
}

.step-card--full .step-section-interpretation {
  font-size: 14px;
}

.step-card--full .step-section-notes {
  font-size: 14px;
}

.step-detail-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

.step-detail-actions[hidden] {
  display: none;
}

.step-detail-actions .btn svg {
  width: 18px;
  height: 18px;
  margin-right: 8px;
}

.step-detail-actions .like-btn.is-favorite {
  background: #e0245e;
  color: #fff;
}

.step-detail-actions .like-btn.is-favorite svg path {
  fill: currentColor;
}

/* Owner tools: edit (STEP-CR-4) + delete (STEP-CR-1) */
.step-danger {
  margin-top: 26px;
  text-align: center;
}

.step-danger[hidden] {
  display: none;
}

.step-edit-link,
.step-delete-link {
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Karla', sans-serif;
  font-size: 13px;
  color: var(--ink-faint);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.step-edit-link {
  margin-right: 18px;
}

.step-edit-link:hover {
  color: var(--ink);
}

.step-delete-link:hover {
  color: #a3312a;
}

.step-edit-link[hidden],
.step-delete-link[hidden] {
  display: none;
}

.step-edit-panel {
  max-width: 420px;
  margin: 16px auto 6px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  text-align: left;
}

.step-edit-panel[hidden] {
  display: none;
}

.step-edit-preview {
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-alt);
  margin-bottom: 12px;
}

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

.step-edit-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.step-edit-actions .btn {
  padding: 8px 18px;
  font-size: 13px;
}

.step-edit-loader {
  margin-top: 12px;
  padding: 0;
  justify-content: flex-start;
}

.step-edit-error {
  margin-top: 12px;
  font-size: 13px;
  color: #a3312a;
  background: rgba(163, 49, 42, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
}

.step-edit-error[hidden] {
  display: none;
}

.step-delete-confirm {
  margin-top: 14px;
  border: 1px solid rgba(163, 49, 42, 0.35);
  background: rgba(163, 49, 42, 0.06);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
}

.step-delete-confirm[hidden] {
  display: none;
}

.step-delete-confirm p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

.step-delete-confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.step-delete-loader {
  margin-top: 14px;
  padding: 0;
  justify-content: flex-start;
}

.step-delete-error {
  margin-top: 14px;
  font-size: 13px;
  color: #a3312a;
  background: rgba(163, 49, 42, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
}

.step-delete-error[hidden] {
  display: none;
}

/* ---------- Share encouragement ---------- */
/* Reusable section injected via _partials/share-encourage.html on the Profile
   and STEP pages — do not duplicate (see STEP spec). */

.share-encourage {
  background: var(--ink);
  color: rgba(250, 247, 241, 0.9);
  border-radius: 16px;
  padding: 28px;
  margin-top: 40px;
}

.share-encourage .eyebrow {
  color: rgba(250, 247, 241, 0.65);
  margin-bottom: 14px;
}

/* "Share a Step" — gradient wordmark that stands out on the dark panel. */
.share-encourage .share-eyebrow {
  display: inline-block;
  font-family: 'Petrona', serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
  background: linear-gradient(95deg, #f6a531 25%, #e94f9c 50%, #e9e74f 75%, #8df06c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.share-encourage .share-citation {
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250, 247, 241, 0.6);
  margin: 0 0 10px;
}

.share-encourage .share-sanskrit {
  font-size: 21px;
  color: #faf7f1;
  margin: 0 0 6px;
}

.share-encourage .share-quote {
  font-family: 'Petrona', serif;
  font-style: italic;
  font-size: 18px;
  color: #faf7f1;
  margin: 0 0 10px;
}

.share-encourage p {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(250, 247, 241, 0.85);
  margin: 0 0 16px;
  max-width: 68ch;
}

.share-encourage p:last-child {
  margin-bottom: 0;
}

.share-encourage strong {
  color: #faf7f1;
  font-weight: 500;
}

/* ---------- Threaded comments (STEP-CR-2) ---------- */

.comments {
  margin-top: 44px;
}

.comments-title {
  font-family: 'Petrona', serif;
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 18px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.comment-form textarea,
.comment-reply-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  font-family: 'Karla', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
}

.comment-form textarea:focus,
.comment-reply-form textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.comments-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: #a3312a;
  background: rgba(163, 49, 42, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
}

.comments-error[hidden] {
  display: none;
}

.comment-list,
.comment-replies {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.comment-replies {
  margin: 14px 0 0;
  padding-left: 20px;
  border-left: 2px solid var(--line);
}

.comment {
  margin-bottom: 20px;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--bg-alt);
  flex: none;
}

.comment-author {
  font-weight: 500;
  font-size: 14px;
}

.comment-date {
  font-family: 'Azeret Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.comment-text {
  margin: 6px 0 4px;
  font-size: 14px;
  line-height: 1.65;
  color: rgba(38, 35, 31, 0.85);
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 2px;
}

.comment-reply-btn,
.comment-delete-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: 'Karla', sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment-reply-btn:hover {
  color: var(--ink);
}

.comment-delete-btn {
  color: var(--ink-faint);
}

.comment-delete-btn:hover {
  color: #a3312a;
}

.comment-reply-form {
  margin: 12px 0 4px;
}

.comment-reply-actions,
.comment-delete-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.comment-reply-actions .btn,
.comment-delete-actions .btn {
  padding: 8px 18px;
  font-size: 13px;
}

.comment-delete-confirm {
  margin: 12px 0 4px;
  border: 1px solid rgba(163, 49, 42, 0.35);
  background: rgba(163, 49, 42, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
}

.comment-delete-confirm p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

.comment-delete-loader {
  margin-top: 10px;
  padding: 0;
  justify-content: flex-start;
}