/* MyFeed: Bootstrap purple theme */
:root {
  --mf-primary: #6b3fa0;
  --mf-primary-soft: #8b5cf6;
  --mf-ink: #1f1630;
  --mf-muted: #6b6280;
  --mf-card: rgba(255, 255, 255, 0.92);
  --mf-line: rgba(107, 63, 160, 0.14);
  --bs-primary: #6b3fa0;
  --bs-primary-rgb: 107, 63, 160;
  --bs-link-color: #5a3388;
  --bs-link-hover-color: #45266a;
}

.article-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--mf-line);
  border-radius: 0.5rem;
  overflow: hidden;
  text-decoration: none;
}

.article-preview > img {
  width: 9rem;
  max-width: 35%;
  height: 7rem;
  object-fit: cover;
}

.article-preview-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.75rem;
  overflow-wrap: anywhere;
}

.article-preview-text > span {
  color: var(--mf-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.article-preview:hover,
.article-preview:focus-visible {
  border-color: var(--mf-primary);
}

.composer-textarea textarea {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  padding: 0.625rem 0.75rem;
  color: var(--mf-ink);
  background-color: #fff;
  border: 1px solid var(--mf-line);
  border-radius: 0.5rem;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.composer-textarea textarea::placeholder {
  color: #8b8299;
}

.composer-textarea textarea:focus {
  border-color: #b69ad8;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(107, 63, 160, 0.2);
}

body.myfeed {
  color: var(--mf-ink);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(139, 92, 246, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 5%, rgba(196, 181, 253, 0.35), transparent 50%),
    linear-gradient(180deg, #f6f1fb 0%, #efe8f8 45%, #f8f6fb 100%);
}

.myfeed-shell {
  max-width: min(72rem, 94vw);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
}

.myfeed-brand {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 3.35rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  padding-bottom: 0.25em;
  background: linear-gradient(115deg, #3b1d63 0%, #6b3fa0 45%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.myfeed-tag {
  color: var(--mf-muted);
  font-size: 1.02rem;
  margin: 0.4rem 0 0;
  max-width: 36rem;
}

.myfeed-public-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 1rem !important;
}

.myfeed-public-header > .me-auto {
  display: contents;
}

.myfeed-public-header .myfeed-brand {
  grid-column: 1;
  grid-row: 1;
}

.myfeed-public-header .myfeed-tag {
  grid-column: 1 / -1;
  grid-row: 2;
}

.myfeed-public-header .myfeed-nav {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  padding-top: 0 !important;
}

@media (max-width: 430px) {
  .myfeed-public-header .myfeed-brand {
    font-size: clamp(1.35rem, 7vw, 2rem);
  }

  .myfeed-public-header:has(.admin-link) .myfeed-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 1rem;
  }
}

.myfeed-nav a.admin-link {
  margin-left: auto;
}

.btn-primary {
  --bs-btn-bg: var(--mf-primary);
  --bs-btn-border-color: var(--mf-primary);
  --bs-btn-hover-bg: #5a3388;
  --bs-btn-hover-border-color: #5a3388;
  --bs-btn-active-bg: #45266a;
  --bs-btn-active-border-color: #45266a;
}

.btn-outline-primary {
  --bs-btn-color: var(--mf-primary);
  --bs-btn-border-color: var(--mf-primary);
  --bs-btn-hover-bg: var(--mf-primary);
  --bs-btn-hover-border-color: var(--mf-primary);
  --bs-btn-active-bg: #5a3388;
  --bs-btn-active-border-color: #5a3388;
}

.composer-trigger {
  cursor: text;
  border-color: var(--mf-line) !important;
  background: #fff;
}

.composer-panel .form-label {
  font-weight: 600;
  font-size: 0.9rem;
}

#composer-quill {
  background: #fff;
  border-radius: 0 0 0.5rem 0.5rem;
  min-height: 8.5rem;
}

.ql-toolbar.ql-snow {
  border-color: var(--mf-line) !important;
  border-radius: 0.5rem 0.5rem 0 0;
  background: #faf7ff;
}

.ql-container.ql-snow {
  border-color: var(--mf-line) !important;
  font-family: inherit;
  font-size: 1.05rem;
}

.ql-editor {
  min-height: 8rem;
  max-height: 18rem;
  overflow-y: auto;
}

.ql-editor.ql-blank::before {
  color: #9b92ad;
  font-style: normal;
}

.ql-snow .ql-picker.ql-expanded .ql-picker-options {
  z-index: 5;
}

.composer-emoji-wrap {
  position: relative;
}

.ql-snow .ql-emoji svg {
  width: 18px;
  height: 18px;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  max-height: 9rem;
  overflow-y: auto;
  padding: 0.55rem;
  border: 1px solid var(--mf-line);
  border-radius: 0.65rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(59, 29, 99, 0.12);
  margin-top: 0.55rem;
}

.emoji-picker[hidden] {
  display: none !important;
}

.emoji-btn {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1.2;
  padding: 0.2rem 0.3rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.emoji-btn:hover,
.emoji-btn:focus-visible {
  background: #f1e9ff;
}

.post-card {
  border: 1px solid var(--mf-line);
  background: var(--mf-card);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(59, 29, 99, 0.06);
  border-radius: 1rem;
}

.post-body {
  word-break: break-word;
  font-size: 1.05rem;
  line-height: 1.55;
}

.post-body p:last-child {
  margin-bottom: 0;
}

.embed iframe {
  width: 100%;
  border: 0;
  border-radius: 0.65rem;
}

.embed-media img {
  display: block;
  max-width: 100%;
  height: auto;
  background: transparent;
}

.embed-media video {
  max-height: 28rem;
  object-fit: contain;
  background: #1a1226;
}

#feed-window {
  overflow-anchor: none;
}

html:has(#feed-controller) {
  scroll-behavior: auto;
}

#feed-status {
  min-height: 3rem;
}

#feed-new-posts,
.feed-retry {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1040;
}

#feed-new-posts {
  top: 1rem;
}

.feed-retry {
  bottom: 1rem;
}

.feed-image {
  height: min(28rem, 65vw);
}

.feed-image a {
  display: block;
  height: 100%;
  cursor: zoom-in;
}

.feed-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-modal-dialog {
  width: max-content;
  max-width: calc(100vw - 2rem);
  margin: 1rem auto;
}

.image-modal-content {
  background: #fff;
  border: 0;
}

.image-modal-body {
  max-height: calc(100dvh - 5rem);
  overflow: auto;
  padding: 0;
}

.image-modal-body img {
  display: block;
  max-width: none;
}

#feed-window [hidden],
#feed-controller [hidden] {
  display: none !important;
}

[data-feed-load] {
  position: relative;
  z-index: 1;
}

[data-comment-window] {
  overflow-wrap: anywhere;
}

.like-form {
  display: inline;
}

.badge.text-bg-light {
  color: var(--mf-primary) !important;
  background: #f1e9ff !important;
  border-color: var(--mf-line) !important;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #f1e9ff;
  border: 1px solid var(--mf-line);
  margin: 0.25rem;
}

:root {
  --mf-primary: #27084e;
  --mf-primary-soft: #54267a;
  --mf-ink: #292330;
  --mf-muted: #625b68;
  --mf-card: #fff;
  --mf-line: rgba(39, 8, 78, 0.14);
  --bs-primary: #27084e;
  --bs-primary-rgb: 39, 8, 78;
  --bs-link-color: #27084e;
  --bs-link-color-rgb: 39, 8, 78;
  --bs-link-hover-color: #54267a;
  --bs-link-hover-color-rgb: 84, 38, 122;
}

body.myfeed {
  background-color: #68547b;
  background-image:
    radial-gradient(ellipse 52% 55% at 100% 100%, rgba(255, 255, 255, 0.55), rgba(233, 220, 246, 0.17) 40%, transparent 72%),
    radial-gradient(ellipse 52% 55% at 0% 100%, rgba(255, 255, 255, 0.55), rgba(233, 220, 246, 0.17) 40%, transparent 72%),
    radial-gradient(ellipse 80% 80% at 15% 0%, rgba(196, 128, 184, 0.17), transparent 70%),
    radial-gradient(ellipse 80% 80% at 95% 95%, rgba(102, 110, 156, 0.12), transparent 75%);
  background-attachment: fixed;
}

.theme-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.theme-decor__mark-field {
  position: absolute;
  left: calc(50% + min(21rem, 50vw - 1rem) - 4rem);
  top: 42%;
  width: min(28vw, 20rem);
  height: min(42vh, 26rem);
  pointer-events: none;
  transition: left 0.5s ease, top 0.5s ease, width 0.5s ease, height 0.5s ease;
}

.theme-decor--shuffle .theme-decor__mark-field {
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
}

.theme-decor__crab,
.theme-decor__mark {
  position: absolute;
  user-select: none;
  transition: left 0.5s ease, top 0.5s ease, transform 0.5s ease;
  animation: theme-decor-float 3.8s ease-in-out infinite;
}

.theme-decor__crab {
  color: #ff8a75;
  font-size: 2rem;
  line-height: 1;
  opacity: 0.75;
  filter: hue-rotate(-18deg) saturate(2.8) brightness(1.05)
    drop-shadow(0 2px 6px rgb(229 57 53 / 40%));
}

.theme-decor__mark {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.92;
  filter: drop-shadow(0 4px 14px rgb(0 0 0 / 40%));
  animation-duration: 5s;
}

.theme-decor__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes theme-decor-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-decor__mark-field,
  .theme-decor__crab,
  .theme-decor__mark {
    animation: none;
    transition: none;
  }
}

.myfeed-shell {
  position: relative;
  z-index: 1;
  max-width: min(66rem, 94vw);
}

.myfeed-public-header .myfeed-brand {
  background: none;
  color: #fff;
}

.myfeed-public-header .myfeed-tag {
  color: #eee5f2;
}

.myfeed-public-header .myfeed-tag a {
  color: inherit;
}

.myfeed-public-header {
  padding: 1rem 1.25rem 1.1rem !important;
  border: 0 !important;
  border-radius: 0.5rem;
  min-height: clamp(14rem, 34vw, 23rem);
  grid-template-rows: minmax(0, 1fr) auto auto;
  background: transparent url("/assets/theme/header.webp") center center / cover no-repeat;
  box-shadow: 0 8px 22px rgba(22, 4, 48, 0.2);
}

.myfeed-public-header .myfeed-brand {
  grid-column: 1 / -1;
  grid-row: 2;
}

.myfeed-public-header .myfeed-tag {
  grid-row: 3;
}

.myfeed-public-header .myfeed-nav {
  grid-row: 1;
  align-self: start;
  justify-self: end;
}

.myfeed-public-header .theme-back-link {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  color: #fff;
  text-shadow: 0 2px 4px #160430, 0 0 8px #160430;
  text-underline-offset: 0.2em;
}

.myfeed-public-header .theme-back-link:hover {
  color: #fff;
}

.myfeed-public-header .myfeed-brand,
.myfeed-public-header .myfeed-tag {
  text-shadow: 0 2px 4px #160430, 0 0 8px #160430;
}

.myfeed-public-header .myfeed-nav > a:not(.btn) {
  color: #fff !important;
  text-underline-offset: 0.2em;
}

.myfeed-public-header .myfeed-nav > a:not(.btn):hover {
  color: #ffd24a !important;
}

.myfeed-public-header .myfeed-nav > a:not(.btn) {
  text-shadow: 0 2px 4px #160430, 0 0 8px #160430;
}

.myfeed-public-header .btn-primary {
  --bs-btn-color: #27084e;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #fff;
  --bs-btn-hover-color: #27084e;
  --bs-btn-hover-bg: #ffd24a;
  --bs-btn-hover-border-color: #ffd24a;
}

.myfeed-public-header .btn-outline-secondary,
.myfeed-public-header .btn-outline-primary {
  --bs-btn-color: #fff;
  --bs-btn-border-color: rgba(255, 255, 255, 0.7);
  --bs-btn-hover-color: #27084e;
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
}

@media (max-width: 380px) {
  .myfeed-public-header .myfeed-nav {
    grid-column: 1 / -1;
    padding-top: 2rem !important;
  }
}

.btn-primary {
  --bs-btn-hover-bg: #3a1868;
  --bs-btn-hover-border-color: #3a1868;
  --bs-btn-active-bg: #160430;
  --bs-btn-active-border-color: #160430;
}

.btn-outline-primary {
  --bs-btn-active-bg: #160430;
  --bs-btn-active-border-color: #160430;
}

.post-card {
  color: var(--mf-ink);
  border-radius: 0.35rem;
  box-shadow: 0 4px 12px rgba(22, 4, 48, 0.1);
}

#feed-status,
[data-feed-end],
.myfeed-shell > main > section[aria-live] > .text-secondary,
.myfeed-shell > main.row,
.myfeed-shell > footer .text-secondary,
.myfeed-shell > footer a {
  color: #eee5f2 !important;
}

#feed-window > [data-feed-load] {
  --bs-btn-color: #fff;
  --bs-btn-border-color: #eee5f2;
  --bs-btn-hover-color: #27084e;
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
}

.myfeed-shell > header:not(.myfeed-public-header) .myfeed-brand {
  background: none;
  color: #fff;
}

.myfeed-shell > header:not(.myfeed-public-header) .myfeed-tag {
  color: #eee5f2;
}

.myfeed-shell > header:not(.myfeed-public-header) .myfeed-nav > a:not(.btn) {
  color: #fff !important;
}

.myfeed-shell > header:not(.myfeed-public-header) .btn-primary {
  --bs-btn-color: #27084e;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #fff;
  --bs-btn-hover-color: #27084e;
  --bs-btn-hover-bg: #eee5f2;
  --bs-btn-hover-border-color: #eee5f2;
}

.myfeed-shell > header:not(.myfeed-public-header) .btn-outline-secondary,
.myfeed-shell > header:not(.myfeed-public-header) .btn-outline-primary {
  --bs-btn-color: #fff;
  --bs-btn-border-color: #eee5f2;
  --bs-btn-hover-color: #27084e;
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
}

#feed-status:empty {
  min-height: 0;
  margin: 0;
}

[data-feed-end]:not([hidden]) {
  padding: 1rem 0;
}

.composer-trigger:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 3px solid #54267a;
  outline-offset: 3px;
}

.myfeed-shell > header a:focus-visible,
#feed-window > [data-feed-load]:focus-visible,
.myfeed-shell > footer a:focus-visible {
  outline-color: #ffd24a;
}
