/* Homepage-only styles. Loaded after mode.css on / and nowhere else.
 *
 * Layout follows the nav mockup: one container as wide as the nav, compact
 * cards and tiles, centered section headings. Nothing is hidden or removed;
 * the rules for this page keep all its text, headings and links.
 */

/* One container for the whole page: the same as the forums' .container (1280px box, 30px side padding = 1220px content). */
main > section,
main > section[aria-labelledby="servers-heading"],
.hero.hero-full > .hero-inner,
.page-guides,
.game-links {
  width: min(calc(100% - 2 * var(--gutter, 30px)), 1220px);
}

/* <picture> wrappers (WebP with a PNG fallback) drop out of layout so the
   existing rules still size the <img> exactly as before. */
.server-card-art picture,
.card-with-icon picture,
.game-links picture {
  display: contents;
}

/* Section rhythm and headings */
main > section.section-band {
  padding: 64px 0;
}

main > section h2 {
  margin: 0 0 18px;
  font-size: 28px;
  line-height: 1.15;
  text-align: center;
}

.feature-overview.section-band,
.home-about,
.home-glance,
.home-server-ips,
.faq {
  text-align: center;
}

.feature-overview.section-band .section-intro,
.home-about > p {
  max-width: 72ch;
  margin-inline: auto;
  text-align: center;
}

/* ---------------------------------------------------------------- Cards */

main > section[aria-labelledby="servers-heading"] {
  min-height: 0;
  display: block;
  padding: 40px 0 56px;
}

main > section[aria-labelledby="servers-heading"] .server-grid {
  grid-template-rows: auto;
  gap: 24px;
}

.server-card {
  height: auto;
}

.server-card-art {
  flex: none;
  min-height: 0;
  padding: 26px 0 22px;
}

.server-card-art img {
  width: 140px;
  height: 140px;
  max-width: none;
  aspect-ratio: auto;
}

/* The description is page text: never hide it on short screens. It grows so
   the buttons sit at the same height across the three cards. */
.server-card-desc {
  display: flex;
  flex: 1 0 auto;
  min-height: 4.8em;
  font-size: .95rem;
}

/* Gold Copy IP is the main action; Play, Servers or Modpack and Discord stay
   as the secondary row below it. */
.server-card .button.copy-ip {
  width: 100%;
  background: var(--accent);
  color: var(--button-primary-text);
  text-shadow: 0 2px 0 var(--button-primary-shadow);
  box-shadow: inset 2px 2px 0 var(--button-primary-light), inset -2px -2px 0 var(--button-primary-dark), 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);
}

/* Play keeps the card's colour but uses the same dark text as Copy IP, so it reads
   clearly (it was a tint of the same colour on the same colour). */
.server-card .cta-row > .button.primary {
  color: #1d1609;
  text-shadow: none;
}

.server-card .cta-row {
  flex-wrap: nowrap;
  gap: 8px;
}

.server-card .cta-row > .button {
  min-width: 0;
  min-height: 42px;
  padding: 0 6px;
  font-size: 12px;
}

/* ------------------------------------------------------- Latest updates */

/* Version B: four cards across. The fragment is written by the forum add-on (same
   markup as before); this is layout only. Each card is tinted by its forum
   (Vanilla green, Cobblemon and Pixelmon amber) using the thread link, the tag
   sits on the image as a pill, and the date stays at the bottom so the cards
   line up. Thumbnails are 16:9 and keep their width and height. */
.latest-updates-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.latest-updates-item {
  --net: var(--accent);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "thumb" "title" "time";
  align-items: start;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border-color: color-mix(in srgb, var(--net) 28%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--net) 7%, var(--content-bg)), var(--content-bg) 55%);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.latest-updates-item:has(a[href*="/forums/vanilla/"]) {
  --net: #10b981;
}

.latest-updates-item:has(a[href*="/forums/pixelmon/"]) {
  --net: #f59e0b;
}

/* Coloured edge along the top of every card. */
.latest-updates-item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 3px;
  background: var(--net);
}

.latest-updates-item:hover {
  transform: translateY(-4px);
  border-color: var(--net);
  box-shadow: 0 16px 32px -14px color-mix(in srgb, var(--net) 60%, transparent);
}

.latest-updates-thumb {
  grid-area: thumb;
  position: relative;
  border-radius: 0;
  overflow: hidden;
}

/* A soft fade at the bottom of the image so the pill and the title read cleanly. */
.latest-updates-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .5));
  pointer-events: none;
}

.latest-updates-thumb img {
  transition: transform .35s ease;
}

.latest-updates-item:hover .latest-updates-thumb img {
  transform: scale(1.05);
}

/* The tag is a pill on the image, in the card's colour. */
.latest-updates-tag {
  grid-area: thumb;
  z-index: 2;
  align-self: start;
  justify-self: start;
  margin: 14px 0 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--net) 82%, #000);
  color: #fff;
  font-size: .68rem;
  letter-spacing: .06em;
  line-height: 1.3;
}

.latest-updates-title {
  grid-area: title;
  display: block;
  margin: 0;
  padding: 16px 18px 0;
  font-size: 1.02rem;
  line-height: 1.3;
}

.latest-updates time {
  grid-area: time;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 18px 18px;
  color: var(--text);
  font-size: .82rem;
}

.latest-updates time::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--net);
}

@media (max-width: 1100px) {
  .latest-updates-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .latest-updates-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ Hero */

.hero.hero-full > .hero-inner {
  padding: 64px 0;
}

.hero.hero-full h1 {
  max-width: none;
  margin: 0 0 16px;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
}

.hero.hero-full .lede {
  margin: 0 0 24px;
  font-size: 16px;
}

.hero.hero-full .eyebrow {
  margin: 0 0 12px;
}

.hero.hero-full .hero-player-count {
  margin: 16px auto 0;
}

.hero.hero-full h1 {
  text-wrap: balance;
}

.hero.hero-full .lede {
  max-width: 66ch;
  margin-inline: auto;
  text-wrap: pretty;
}

/* Join panel: the two IPs as copyable cells, the website-vs-server note and the
   live count together in one card. Same text as before, nothing removed. */
.hero-join {
  width: min(100%, 760px);
  margin: 28px auto 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--mode-color, var(--accent)) 22%, var(--border));
  border-radius: 14px;
  background: linear-gradient(180deg, #1d1e22, #141518);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.hero.hero-full .hero-ips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
  margin: 0;
}

.hero.hero-full .hero-ips span {
  justify-self: stretch;
  align-self: stretch;
  min-width: 0;
  min-height: 64px;
  flex-flow: row wrap;
  align-items: baseline;
  align-content: center;
  justify-content: flex-start;
  gap: 2px 8px;
  position: relative;
  padding: 12px 48px 12px 20px;
  border: 1px solid #3a3c43;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a2b30, #222328);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .07);
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

/* Accent edge and a copy glyph: the cells read as raised, clickable cards. */
.hero.hero-full .hero-ips span::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mode-color, var(--accent));
}

.hero.hero-full .hero-ips span::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background: #8c8f96;
  -webkit-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="9" y="9" width="12" height="12" rx="2" fill="none" stroke="black" stroke-width="2.2"/><path d="M5 15V5a2 2 0 0 1 2-2h8" fill="none" stroke="black" stroke-width="2.2"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="9" y="9" width="12" height="12" rx="2" fill="none" stroke="black" stroke-width="2.2"/><path d="M5 15V5a2 2 0 0 1 2-2h8" fill="none" stroke="black" stroke-width="2.2"/></svg>') center / contain no-repeat;
}

.hero.hero-full .hero-ips span:hover,
.hero.hero-full .hero-ips span:focus-visible {
  transform: translateY(-2px);
  border-color: var(--mode-color, var(--accent));
  background: linear-gradient(180deg, #2f3036, #25262b);
  box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .09);
}

.hero.hero-full .hero-ips span:hover::after {
  background: var(--mode-color, var(--accent));
}

.hero.hero-full .hero-ips b {
  flex: 0 0 100%;
  color: #8c8f96;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero.hero-full .hero-ips i {
  color: var(--title);
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .01em;
}

.hero.hero-full .hero-ips small {
  color: #8c8f96;
  font-size: 12px;
  font-weight: 600;
}

.hero.hero-full .ip-note {
  max-width: none;
  margin: 16px 4px 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .86rem;
  line-height: 1.55;
  opacity: .85;
  text-wrap: pretty;
}

.hero-join .hero-player-count {
  width: fit-content;
  margin: 12px auto 0 !important;
}

@media (max-width: 560px) {
  .hero.hero-full .hero-ips {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------- Pick your server tiles */

.feature-overview.section-band .features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.feature-overview.section-band .card.card-with-icon {
  min-height: 84px;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--bg);
  box-shadow: none;
}

.feature-overview.section-band .card.card-with-icon:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.feature-overview.section-band .card-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  background: none;
  filter: none;
}

.feature-overview.section-band .card-with-icon h3 {
  margin: 0 0 4px;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
}

.feature-overview.section-band .card-with-icon p {
  font-size: 13px;
  line-height: 1.4;
}

/* ----------------------------------------------------------------- About */

.home-about > p {
  font-size: 16px;
  line-height: 1.65;
}

.about-facts {
  gap: 14px;
  margin-top: 28px;
}

.about-facts li {
  padding: 18px 20px;
  border-radius: 8px;
  text-align: center;
}

.about-fact-value {
  font-size: 1.5rem;
}

.about-fact-label {
  font-size: .85rem;
  line-height: 1.4;
}

.about-more,
p.about-more {
  max-width: none;
  margin: 24px auto 0;
  text-align: center;
}

/* ------------------------------------------------------------- At a glance */

/* At a glance: one panel, two columns. The four server IPs are the answer people
   come for, so they stack on the left as larger rows; the other ten facts are a
   plain label / value list on the right. Same 14 facts, same wording, same order
   in the HTML (the placement is CSS only). */
.glance-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-rows: repeat(20, minmax(0, auto));
  grid-auto-flow: dense;
  gap: 1px;
  margin: 28px 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--border);
  text-align: left;
}

.glance-grid > div {
  grid-column: 2;
  grid-row: span 2;
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  align-items: center;
  gap: 4px 20px;
  padding: 12px 22px;
  background: var(--content-dark);
}

.glance-grid dt {
  margin: 0;
  color: #8c8f96;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.glance-grid dd {
  margin: 0;
  color: #e6e6e6;
  font-size: 15px;
  line-height: 1.45;
}

/* The four server IPs: left column, label over a larger address. */
.glance-grid > div:nth-child(n+4):nth-child(-n+7) {
  grid-column: 1;
  grid-row: span 5;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  column-gap: 16px;
  padding: 16px 24px;
  box-shadow: inset 3px 0 0 var(--ip-color, var(--accent));
  background: color-mix(in srgb, var(--ip-color, var(--accent)) 9%, var(--content-dark));
}

.glance-grid > div:nth-child(n+4):nth-child(-n+7) dt {
  grid-column: 2;
  align-self: end;
  color: color-mix(in srgb, var(--ip-color, #8c8f96) 70%, #8c8f96);
}

.glance-grid > div:nth-child(n+4):nth-child(-n+7) dd {
  grid-column: 2;
  align-self: start;
  font-size: 14px;
}

/* Port / version detail: its own line under the address, as a small chip. The
   text is unchanged; the leading comma of ", port 19132" is not shown. */
.glance-note {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--ip-color, #8c8f96) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ip-color, #8c8f96) 10%, transparent);
  color: #d6d8dd;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.glance-comma {
  display: none;
}

/* Copy control at the right of each server IP row. The whole row copies; the
   button is the keyboard and screen-reader target. */
.glance-grid > div:nth-child(n+4):nth-child(-n+7) {
  position: relative;
  padding-right: 76px;
  cursor: pointer;
  transition: background-color .15s ease;
}

.glance-grid > div:nth-child(n+4):nth-child(-n+7):hover {
  background: color-mix(in srgb, var(--ip-color, var(--accent)) 15%, var(--content-dark));
}

.glance-copy {
  position: absolute;
  top: 50%;
  right: 20px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 1px solid color-mix(in srgb, var(--ip-color, #8c8f96) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ip-color, #8c8f96) 12%, transparent);
  color: var(--ip-text, var(--ip-color, #d6d8dd));
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.glance-grid > div:hover .glance-copy,
.glance-copy:focus-visible {
  border-color: var(--ip-color, var(--accent));
  background: color-mix(in srgb, var(--ip-color, #8c8f96) 28%, transparent);
}

.glance-copy:focus-visible {
  outline: 2px solid var(--ip-color, var(--accent));
  outline-offset: 2px;
}

.glance-copy .ic-check {
  display: none;
}

.is-copied .glance-copy .ic-copy {
  display: none;
}

.is-copied .glance-copy .ic-check {
  display: block;
}

.glance-grid > div.is-copied .glance-copy {
  border-color: #10b981;
  background: #10b981;
  color: #fff;
}

.glance-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.glance-icon-gray {
  filter: grayscale(1) brightness(1.05);
}

.glance-grid dd strong {
  color: var(--ip-text, var(--ip-color, var(--mode-color, var(--accent))));
  font-size: 18px;
  letter-spacing: .01em;
}

@media (max-width: 899px) {
  .glance-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .glance-grid > div,
  .glance-grid > div:nth-child(n+4):nth-child(-n+7) {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  .glance-grid > div {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 18px;
  }

  /* Keep each address on one line (no break at the hyphen in mc-complex). */
  .glance-grid > div:nth-child(n+4):nth-child(-n+7) {
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 12px;
    padding: 14px 64px 14px 18px;
  }

  .glance-copy {
    right: 14px;
    width: 38px;
    height: 38px;
  }

  .glance-icon {
    width: 44px;
    height: 44px;
  }

  .glance-grid dd strong {
    font-size: 14.5px;
    white-space: nowrap;
  }
}

/* ------------------------------------------------------------ Server IPs */

.server-ip-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.server-ip-list article {
  padding: 18px 20px;
  border-radius: 8px;
}

.server-ip-list h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.server-ip-list p {
  font-size: .9rem;
  line-height: 1.55;
}

/* ------------------------------------------------------------------- FAQ */

/* Two columns of accordions. The questions and answers stay in the HTML as
   before, so nothing is hidden from crawlers. */
.faq {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  align-items: start;
}

.faq > h2,
.faq > .faq-group-title {
  grid-column: 1 / -1;
}

.faq > .faq-group-title {
  margin: 28px 0 12px;
  font-size: .95rem;
  text-align: left;
}

.faq details {
  margin-bottom: 12px;
  text-align: left;
}

.faq summary {
  padding: 16px 48px 16px 20px;
  font-size: .95rem;
}

.faq summary::after {
  right: 20px;
}

.faq details p {
  padding: 0 20px 18px;
  font-size: .92rem;
}

.home-server-ips + .faq > h2 {
  text-align: center;
}

.home-server-ips + .faq {
  padding-bottom: 48px;
}

/* ------------------------------------- Guide links and server row at foot */

.page-guides {
  justify-content: center;
  font-size: 13px;
}

.game-links {
  margin: 0 auto 48px;
}

/* ---------------------------------------------------------------- Tablet */

@media (max-width: 899px) {
  .feature-overview.section-band .features,
  .server-ip-list,
  .faq {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ----------------------------------------------------- Phone and touch */

@media (max-width: 899px) {
  main > section.section-band {
    padding: 48px 0;
  }

  main > section h2 {
    font-size: 24px;
  }

  .hero.hero-full > .hero-inner {
    padding: 48px 0;
  }

  /* Compact server cards: smaller art, tighter text. Nothing is removed. */
  main > section[aria-labelledby="servers-heading"] {
    padding: 28px 0 40px;
  }

  main > section[aria-labelledby="servers-heading"] .server-grid {
    gap: 18px;
  }

  .server-card-art {
    padding: 18px 0 14px;
  }

  .server-card-art img {
    width: 96px;
    height: 96px;
  }

  .server-card h3 {
    font-size: 1.6rem;
  }

  .server-card-desc {
    min-height: 0;
    font-size: .9rem;
    line-height: 1.5;
  }
}

/* Tap targets: at least 44px for the small text links. */
@media (max-width: 899px), (pointer: coarse) {
  .server-card-links {
    gap: 0 8px;
    padding-top: 6px;
  }

  .server-card-links a,
  .page-guides a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 6px;
  }

  .hero-ips span {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}
