/* /guides/: community guides rendered from content/guides/*.md (lib/guides.php).
   Pixel art from the Habbo Origins client is shown at whole multiples only:
   .px images never shrink, wide rows and tables scroll sideways instead. */

.guides-page .page-toolbar {
  align-items: flex-end;
}

.guide-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* —— /guides/ index —— */

.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 100%;
  padding: 0.9rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface-inset, var(--control-bg));
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.guide-card:hover,
.guide-card:focus-visible {
  border-color: var(--accent);
}

.guide-card-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 10rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: var(--control-bg);
  overflow: hidden;
}

.guide-card-art img {
  display: block;
  max-width: none;
  height: auto;
  image-rendering: pixelated;
}

.guide-card-title {
  margin: 0;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  text-shadow: var(--title-shadow);
  -webkit-font-smoothing: none;
}

.guide-card-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.guide-card-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.guide-chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
}

.guide-chip--draft {
  border-color: var(--warn, #c9a227);
  color: var(--warn, #c9a227);
}

/* —— Guide page —— */

.guide-room {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface-inset, var(--control-bg));
}

.guide-toc-label {
  margin-right: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.guide-toc a {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  color: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}

.guide-toc a:hover,
.guide-toc a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.guide-read {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 0.4rem;
}

.guide-body {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.guide-body > *:first-child {
  margin-top: 0;
}

.guide-body p {
  margin: 0 0 0.85rem;
}

.guide-body h2,
.guide-body h3 {
  margin: 1.6rem 0 0.55rem;
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1.3;
  text-shadow: var(--title-shadow);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  scroll-margin-top: calc(var(--habbend-page-top, 0px) + 1rem);
}

.guide-body h2 { font-size: 1.2rem; }
.guide-body h3 { font-size: 1.02rem; }

.guide-body ul,
.guide-body ol {
  margin: 0.65rem 0 0.85rem;
  padding-left: 1.25rem;
}

.guide-body li + li {
  margin-top: 0.2rem;
}

.guide-body a {
  color: var(--accent);
}

.guide-body code {
  font-size: 0.9em;
}

.guide-body blockquote {
  margin: 0.85rem 0;
  padding: 0.45rem 0 0.45rem 0.85rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 40%, var(--control-border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
}

/* Review notes: admins only, from the drafts' NEEDS CHECK lines. */
.guide-note {
  margin: 0.85rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--warn, #c9a227);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warn, #c9a227) 8%, transparent);
  font-size: 0.9rem;
  line-height: 1.5;
}

.guide-note-label {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0 0.4rem;
  border-radius: 4px;
  background: var(--warn, #c9a227);
  color: #1b1b1b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.guide-table-head {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.guide-footnote {
  color: var(--muted);
  font-size: 0.88rem;
}

.guide-mark {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
  color: var(--accent);
}

/* —— Pictures —— */

/* habbend.css makes every img display:block; guide pictures sit inline
   with their captions and table names. */
.guide-body img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Game art: whole multiples only. Width/height are set in the markup, so
   the image keeps them and the row scrolls if the viewport is narrower. */
.guide-body img.px {
  image-rendering: pixelated;
  max-width: none;
  height: auto;
}

.guide-body p img.px {
  margin: 0 0.15rem;
}

.guide-art {
  margin: 0.6rem 0 1rem;
  line-height: 0;
}

.guide-figs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem 1.5rem;
  margin: 0.75rem 0 1.1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--surface-inset, var(--control-bg));
  overflow-x: auto;
}

.guide-figs figure {
  margin: 0;
  text-align: center;
  flex: 0 0 auto;
}

.guide-figs figure img {
  display: block;
  margin: 0 auto;
}

.guide-figs figcaption {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* —— Tables —— */

.guide-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.guide-table th,
.guide-table td {
  padding: 0.3rem 0.45rem;
  border-bottom: 1px solid var(--control-border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.guide-table th {
  background: var(--surface-inset, var(--control-bg));
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 0.82rem;
  -webkit-font-smoothing: none;
}

.guide-table tbody tr:last-child td {
  border-bottom: 0;
}

.guide-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--control-border) 25%, transparent);
}

.guide-table td img.px {
  margin-right: 0.45rem;
}

.guide-table td:first-child {
  white-space: nowrap;
}

.guide-body details {
  margin: 0 0 1rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
}

.guide-body details > summary {
  cursor: pointer;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 0.9rem;
  -webkit-font-smoothing: none;
}

.guide-body details[open] > summary {
  margin-bottom: 0.6rem;
}

.guide-body details .guide-table-wrap {
  margin-bottom: 0.4rem;
}

/* —— Foot —— */

.guide-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--control-border);
}

.guide-foot-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .guide-read {
    padding: 0;
  }

  .guide-body h2 { font-size: 1.1rem; }

  .guide-figs {
    gap: 0.9rem 1rem;
  }
}

/* —— Card components (lib/guides_components.php) ——
   Fishopedia and plant list: one card per fish or plant. Desktop shows a grid
   of cards with every stat; phones show one compact row per card (art, name,
   level, the key stats) and tap to open the rest. Art stays at 1x or 2x. */

.op {
  margin: 0 0 1.25rem;
}

.op-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.25rem 0 0.75rem;
}

.op-groups {
  align-self: flex-start;
}

.op-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.op-search,
.op-level input {
  appearance: none;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  min-width: 0;
}

.op-search {
  flex: 1 1 11rem;
  max-width: 18rem;
}

.op-search:focus,
.op-level input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.op-level,
.op-now {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.op-level input {
  width: 4.2rem;
  text-align: center;
  -moz-appearance: textfield;
}

.op-level input::-webkit-outer-spin-button,
.op-level input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.op-now input {
  accent-color: var(--accent);
  margin: 0;
}

.op-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.op-group[hidden],
.op-card[hidden] {
  display: none;
}

.op-group-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.op-group-n {
  color: var(--muted);
  font-family: inherit;
  font-weight: 400;
  font-size: 0.8rem;
}

.guide-body .op-group-note {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.guide-body .op-empty {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.op-card {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  grid-template-areas:
    "art main"
    "stats stats"
    "when when";
  align-items: center;
  gap: 0.4rem 0.65rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface-inset, var(--control-bg));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);
}

.op-plant .op-card {
  grid-template-columns: 6.5rem minmax(0, 1fr);
}

.op-card.is-now {
  border-color: color-mix(in srgb, var(--success, #4caf50) 55%, var(--control-border));
}

.op-art {
  grid-area: art;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  min-height: 2.75rem;
  border-radius: 6px;
  background: var(--control-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--control-border) 60%, transparent);
  overflow: hidden;
}

.op-plant .op-art {
  width: 6.5rem;
  min-height: 6.5rem;
}

.guide-body .op-art img.px {
  display: block;
  margin: 0;
}

.op-main {
  grid-area: main;
  min-width: 0;
}

.op-name {
  margin: 0 0 0.2rem;
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  -webkit-font-smoothing: none;
  overflow-wrap: break-word;
}

.op-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  font-size: 0.78rem;
}

.op-lvl,
.op-cost {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--fg);
  font-family: var(--font-pixel);
  font-size: 0.78rem;
  -webkit-font-smoothing: none;
  white-space: nowrap;
}

.op-cost {
  background: color-mix(in srgb, var(--warn, #c9a227) 22%, transparent);
}

.guide-body .op-cost img.px,
.guide-body .op-stat img.px {
  margin: 0;
}

.op-stars {
  display: inline-flex;
  gap: 1px;
  line-height: 0;
}

.op-now-badge {
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--success, #4caf50);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.op-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem 0.4rem;
  margin: 0;
  padding: 0.4rem 0 0;
  border-top: 1px solid color-mix(in srgb, var(--control-border) 70%, transparent);
}

.op-plant .op-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.op-stat {
  min-width: 0;
}

.op-stat dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.op-stat dd {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.05rem 0 0;
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  line-height: 1.2;
  -webkit-font-smoothing: none;
}

.op-blank {
  color: var(--muted);
}

.op-dis {
  color: var(--warn, #c9a227);
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.15;
}

.guide-body .op-when {
  grid-area: when;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.op-when-chip.is-timed {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--fg);
}

.op-card.is-now .op-when-chip.is-timed {
  background: color-mix(in srgb, var(--success, #4caf50) 20%, transparent);
}

.op-more {
  display: none;
}

/* —— Level ladder —— */

.lvl-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.lvl-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface-inset, var(--control-bg));
}

.lvl-n {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  width: max-content;
  padding: 0.15rem 0.4rem 0.15rem 0.45rem;
  border-radius: 5px;
  background: #22313f;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  line-height: 1;
  -webkit-font-smoothing: none;
}

.lvl-n-label {
  margin-right: 0.3rem;
  opacity: 0.8;
}

.guide-body .lvl-n img.px {
  margin: 0;
}

.lvl-total {
  font-size: 0.9rem;
}

.lvl-total strong {
  font-family: var(--font-pixel);
  font-weight: 700;
  -webkit-font-smoothing: none;
}

.lvl-next {
  color: var(--muted);
  font-size: 0.78rem;
}

.op-levels details {
  margin-top: 0.25rem;
}

.lvl-table td:first-child {
  font-family: var(--font-pixel);
  -webkit-font-smoothing: none;
}

/* —— Phones: one compact row per card, tap for the rest —— */

@media (max-width: 640px) {
  .op-count {
    flex-basis: 100%;
    margin-left: 0;
  }

  .op-grid,
  .op-plant .op-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .op-card,
  .op-plant .op-card {
    grid-template-columns: 4.5rem minmax(0, 1fr) auto;
    grid-template-areas:
      "art main key"
      "when when when";
    gap: 0.3rem 0.55rem;
    padding: 0.45rem 1.7rem 0.45rem 0.5rem;
  }

  .op-plant .op-art {
    width: 4rem;
    min-height: 2.75rem;
  }

  .op-plant .op-card {
    grid-template-columns: 4rem minmax(0, 1fr) auto;
  }

  .op-name {
    font-size: 0.88rem;
  }

  /* Fish keep "10 XP" on one line; plant labels are longer and stack. */
  .op-fish .op-stat {
    flex-direction: row-reverse;
    align-items: baseline;
    gap: 0.3rem;
  }

  .op-plant .op-stats {
    max-width: 4.5rem;
  }

  .op-stats,
  .op-plant .op-stats {
    grid-area: key;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    max-width: 6.5rem;
    padding: 0;
    border-top: 0;
  }

  .op-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
  }

  .op-stat dt {
    letter-spacing: 0;
    text-transform: none;
    font-size: 0.68rem;
    white-space: normal;
  }

  .op-stat dd {
    justify-content: flex-end;
  }

  .js .op-card:not(.is-open) .op-stat:not(.is-key) {
    display: none;
  }

  .js .op-card:not(.is-open) .op-stars {
    display: none;
  }

  .js .op-card:not(.is-open) .op-when:not(:has(.is-timed)) {
    display: none;
  }

  .op-card.is-open,
  .op-plant .op-card.is-open {
    grid-template-areas:
      "art main main"
      "when when when"
      "stats stats stats";
  }

  .op-card.is-open .op-stats,
  .op-plant .op-card.is-open .op-stats {
    grid-area: stats;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem 0.4rem;
    padding: 0.4rem 0 0;
    border-top: 1px solid color-mix(in srgb, var(--control-border) 70%, transparent);
  }

  .op-card.is-open .op-stat {
    display: block;
    text-align: left;
  }

  .op-card.is-open .op-stat dd {
    justify-content: flex-start;
  }

  .op-card.is-open .op-stats,
  .op-plant .op-card.is-open .op-stats {
    max-width: none;
  }

  .op-card.is-open .op-stat dt {
    font-size: 0.66rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .js .op-more {
    display: block;
    position: absolute;
    inset: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
  }

  .js .op-more::after {
    content: "";
    position: absolute;
    top: 1rem;
    right: 0.8rem;
    width: 0.45rem;
    height: 0.45rem;
    margin-top: 0;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
  }

  .js .op-card.is-open .op-more::after {
    transform: rotate(-135deg);
    margin-top: 0.25rem;
  }

  .js .op-more:focus-visible {
    outline: 2px solid var(--accent);
  }

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

/* —— /fishopedia/ and /plantopedia/ (lib/guides_pages.php) ——
   Full content width, so the card grid gets four columns on a desktop. */

.opedia-body {
  max-width: none;
}

.opedia-intro {
  font-size: 1.02rem;
}

.guide-body .opedia-rules {
  color: var(--muted);
  font-size: 0.88rem;
}

.op-page-link {
  margin-left: 0.25rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.opedia-links {
  padding-left: 1.1rem;
}

.opedia-links li {
  margin-bottom: 0.35rem;
}

.opedia-links span {
  color: var(--muted);
}

.guide-index-heading {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.05rem;
}

.guide-card-art--strip {
  gap: 1rem;
}

.guide-card-art--strip img {
  display: inline-block;
}

@media (max-width: 640px) {
  .op-page-link {
    flex-basis: 100%;
    margin-left: 0;
  }
}
