/*
 * Forum guides: how a guide reads (components/guide.js), the block editor
 * (pages/guide-editor.js), the "Made by readers" gallery, a forum's settings
 * and team, pinned posts and the badges on guides in lists.
 */

/* ---------- Small shared pieces ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-chip--pin {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.space-header__buttons {
  display: flex;
  gap: 8px;
}

/* ---------- Guides in lists ---------- */

.thread-row--cover {
  align-items: start;
}

.thread-row__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.thread-row__cover {
  flex: none;
  width: 112px;
  height: 84px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.thread-row__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pinned-threads {
  display: grid;
  gap: 10px;
}

.pinned-threads:empty {
  display: none;
}

.pinned-threads__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- One post ---------- */

.thread__edited,
.thread__pinned {
  color: var(--ink-faint);
}

.thread__pinned {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-text);
}

.thread__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.thread__actions .is-on {
  color: var(--accent-text);
}

/* ---------- A guide ---------- */

.guide-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 6px;
}

.guide-facts > div {
  display: grid;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.guide-facts dt {
  color: var(--ink-faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.guide-facts dd {
  margin: 0;
  font-weight: 600;
}

.guide-facts__kind {
  align-content: center;
  background: var(--accent-soft) !important;
  color: var(--accent-text);
}

.guide {
  display: grid;
  gap: 14px;
  font-size: 1.02rem;
  line-height: 1.6;
}

.guide__heading {
  margin: 10px 0 0;
  font-size: 1.3rem;
}

h3.guide__heading {
  font-size: 1.08rem;
}

.guide__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guide__photo {
  margin: 0;
}

.guide__photo img {
  display: block;
  width: 100%;
  max-height: 560px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--surface-sunken);
}

.guide__photo figcaption {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-align: center;
}

.guide__list,
.guide__checklist {
  margin: 0;
  padding-left: 22px;
}

.guide__checklist {
  display: grid;
  gap: 4px;
  padding: 0;
  list-style: none;
}

.guide__checklist label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
}

.guide__checklist input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.guide__checklist li.is-done span {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.guide__steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide__steps li {
  display: flex;
  gap: 12px;
}

.guide__steps p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}

.guide__step-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.guide__callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.guide__callout p {
  margin: 0;
}

.guide__callout--warning {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.guide__callout--note {
  border-left-color: var(--line-strong);
  background: var(--surface-muted);
}

.guide__spoiler {
  padding: 10px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

.guide__spoiler summary {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
}

.guide__spoiler p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.guide__table-wrap {
  overflow-x: auto;
}

.guide__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.guide__table th,
.guide__table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.guide__table th {
  background: var(--surface-muted);
}

.guide__divider {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---------- Series ---------- */

.guide-series {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.guide-series__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
}

.guide-series__parts {
  margin: 0 0 8px;
  padding-left: 22px;
}

.guide-series__parts [aria-current] {
  font-weight: 700;
}

.guide-series__next {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.guide-series__continue {
  justify-self: end;
}

/* ---------- Made by readers ---------- */

.made-this {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.made-this__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.05rem;
}

.made-this__count {
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.8rem;
}

.made-this__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.made-this__item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.made-this__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.made-this__who {
  position: absolute;
  inset: auto 0 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.6));
  color: #fff;
  font-size: 0.75rem;
}

.made-this__empty {
  margin: 0;
  color: var(--ink-soft);
}

.reply__made-this {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-text);
  font-weight: 600;
}

.reply-box__made-this {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------- The block editor ---------- */

.guide-editor {
  display: grid;
  gap: 14px;
}

.guide-editor__title {
  font-size: 1.3rem;
  font-weight: 700;
}

.guide-editor__templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-editor__details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.guide-editor__details:empty {
  display: none;
}

.guide-editor__blocks {
  display: grid;
  gap: 10px;
}

.guide-block {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.guide-block__bar {
  display: flex;
  align-items: center;
  gap: 2px;
}

.guide-block__kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.guide-block__row {
  display: flex;
  gap: 8px;
}

.guide-block__heading {
  flex: 1;
  font-weight: 700;
}

.guide-block__size {
  width: auto;
}

.guide-block__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.guide-block__marker {
  flex: none;
  width: 22px;
  padding-top: 8px;
  color: var(--ink-soft);
  text-align: right;
}

/* One line to start with, growing as you type. */
.guide-block__item textarea {
  flex: 1;
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

.guide-block__photo {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.guide-block__photo img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-sm);
}

.guide-block__pick {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  padding: 28px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
}

.guide-block__table {
  overflow-x: auto;
}

.guide-block__table table {
  border-collapse: collapse;
}

.guide-block__table td {
  padding: 2px;
}

.guide-block__table .input {
  min-width: 110px;
}

.guide-block__table .is-header {
  font-weight: 700;
}

.guide-block__check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.guide-editor__add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}

.guide-editor__add-label {
  margin-right: 4px;
  color: var(--ink-soft);
  font-weight: 600;
}

.guide-editor__preview {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.guide-editor__series .input + .input {
  margin-top: 8px;
}

.guide-editor__actions {
  position: sticky;
  bottom: calc(var(--tabbar-height, 0px) + 8px);
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- A forum's settings and team ---------- */

.community-header__posting {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.forum-settings {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.forum-settings__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.1rem;
}

.forum-settings fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.choice-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice-card span {
  display: grid;
}

.choice-card small {
  color: var(--ink-soft);
}

.forum-team {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.forum-team__title {
  margin: 0;
  font-size: 1rem;
}

.forum-team__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.forum-team__person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.forum-team__name {
  display: grid;
  flex: 1;
  min-width: 0;
}

.forum-team__name small {
  color: var(--ink-soft);
}

.forum-team__add {
  display: flex;
  gap: 8px;
}

.forum-team__add input {
  flex: 1 1 auto;
  min-width: 0;
}

.forum-team__add select {
  flex: none;
  width: auto;
}

.guide-editor__series-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* The forum's buttons wrap instead of running off a narrow screen. */
.community-header__actions {
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .thread-row__cover {
    width: 84px;
    height: 64px;
  }

  .guide-block__row,
  .forum-team__add {
    flex-wrap: wrap;
  }
}
