/* Ironhold landing page. Light theme is the default; dark theme applies when
   the system prefers dark (unless the visitor chose light) or when chosen. */

:root {
  color-scheme: light;
  --bg: #f3efe6;
  --glow: rgba(214, 104, 34, 0.16);
  --masonry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5h64M0 32.5h64M.5 0v32M32.5 32v32' fill='none' stroke='%23000' stroke-opacity='.07'/%3E%3C/svg%3E");
  --surface: #fffcf6;
  --surface-2: #f7f2e8;
  --border: #e0d7c6;
  --border-strong: #cdbfa8;
  --text: #1c1d20;
  --muted: #5a5e67;
  --accent: #b4531a;
  --accent-hover: #963f0f;
  --on-accent: #ffffff;
  --code-bg: #f3ecdf;
  --ok: #1d7536;
  --ok-bg: #e2f2e5;
  --off: #62666f;
  --off-bg: #ebe8e1;
  --warn: #855600;
  --warn-bg: #f7ecd0;
  --minecraft: #3b8a2a;
  --tmod: #1d6fa0;
  --shadow: 0 1px 2px rgba(48, 34, 12, 0.06), 0 10px 30px -12px rgba(48, 34, 12, 0.18);
  --ring: rgba(180, 83, 26, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1115;
    --glow: rgba(240, 138, 60, 0.17);
    --masonry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5h64M0 32.5h64M.5 0v32M32.5 32v32' fill='none' stroke='%23fff' stroke-opacity='.06'/%3E%3C/svg%3E");
    --surface: #161a20;
    --surface-2: #1b2028;
    --border: #272d36;
    --border-strong: #363e4a;
    --text: #e9ebee;
    --muted: #9ba3ae;
    --accent: #f08a3c;
    --accent-hover: #ffa25e;
    --on-accent: #1a0e05;
    --code-bg: #0f1318;
    --ok: #62d283;
    --ok-bg: rgba(98, 210, 131, 0.12);
    --off: #9ba3ae;
    --off-bg: rgba(155, 163, 174, 0.12);
    --warn: #f1c35f;
    --warn-bg: rgba(241, 195, 95, 0.12);
    --minecraft: #74c752;
    --tmod: #55b6e3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
    --ring: rgba(240, 138, 60, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1115;
  --glow: rgba(240, 138, 60, 0.17);
  --masonry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5h64M0 32.5h64M.5 0v32M32.5 32v32' fill='none' stroke='%23fff' stroke-opacity='.06'/%3E%3C/svg%3E");
  --surface: #161a20;
  --surface-2: #1b2028;
  --border: #272d36;
  --border-strong: #363e4a;
  --text: #e9ebee;
  --muted: #9ba3ae;
  --accent: #f08a3c;
  --accent-hover: #ffa25e;
  --on-accent: #1a0e05;
  --code-bg: #0f1318;
  --ok: #62d283;
  --ok-bg: rgba(98, 210, 131, 0.12);
  --off: #9ba3ae;
  --off-bg: rgba(155, 163, 174, 0.12);
  --warn: #f1c35f;
  --warn-bg: rgba(241, 195, 95, 0.12);
  --minecraft: #74c752;
  --tmod: #55b6e3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
  --ring: rgba(240, 138, 60, 0.55);
}

/* ---- base ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

main:focus {
  outline: none;
}

/* ---- hero ---- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-bottom: clamp(32px, 6vw, 56px);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 50% -8%, var(--glow), transparent 70%),
    var(--masonry);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent);
  mask-image: linear-gradient(to bottom, #000 35%, transparent);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.hero-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: clamp(16px, 5vw, 40px);
}

.emblem {
  width: clamp(64px, 12vw, 88px);
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(214, 104, 34, 0.35));
}

.wordmark {
  margin: 18px 0 0;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* letter-spacing adds trailing space after the last letter; balance it */
  margin-right: -0.14em;
}

.tagline {
  margin: 14px 0 0;
  font-size: clamp(1.15rem, 3.4vw, 1.5rem);
  font-weight: 650;
  line-height: 1.3;
  text-wrap: balance;
}

.lede {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.0625rem);
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.9375rem;
  text-decoration: none;
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--accent);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---- server cards ---- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: clamp(16px, 2.5vw, 24px);
}

.card {
  --card-accent: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--card-accent);
}

.card[data-icon="cube"] { --card-accent: var(--minecraft); }
.card[data-icon="sword"] { --card-accent: var(--tmod); }

.card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-accent) 14%, transparent);
  color: var(--card-accent);
  overflow: hidden;
}

.card-icon svg {
  width: 28px;
  height: 28px;
}

.card-icon img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.card-titles {
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.25;
}

.card-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--off);
  background: var(--off-bg);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill[data-state="checking"] .pill-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

.pill[data-state="online"] {
  color: var(--ok);
  background: var(--ok-bg);
}

.pill[data-state="online"] .pill-dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}

.pill[data-state="unknown"] {
  color: var(--warn);
  background: var(--warn-bg);
}

@keyframes pulse {
  50% { opacity: 0.3; }
}

.motd {
  margin: -4px 0 0;
  padding-left: 12px;
  border-left: 3px solid color-mix(in srgb, var(--card-accent) 55%, transparent);
  color: var(--muted);
  font-style: italic;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.address-row {
  display: flex;
  gap: 8px;
}

.address-value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  font-size: clamp(0.95rem, 2.6vw, 1.0625rem);
  font-weight: 600;
  overflow-wrap: anywhere;
  user-select: all;
}

.copy-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 96px;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.copy-btn:hover {
  background: var(--accent-hover);
}

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

.copy-btn .check-icon {
  display: none;
}

.copy-btn[data-copied] {
  background: var(--ok);
  color: var(--surface);
}

.copy-btn[data-copied] .check-icon {
  display: block;
}

.copy-btn[data-copied] .copy-icon {
  display: none;
}

.port {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.port code {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--text);
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 0.9375rem;
}

.facts:not(:has(> div:not([hidden]))) {
  display: none;
}

.facts > div {
  display: contents;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.join {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.join summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.join summary::-webkit-details-marker {
  display: none;
}

.join summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.15s ease;
}

.join[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.join ol {
  margin: 10px 0 0;
  padding-left: 1.35em;
  color: var(--muted);
}

.join li + li {
  margin-top: 6px;
}

.join li code {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.status-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.noscript {
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
}

/* ---- footer ---- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: clamp(40px, 8vw, 72px);
  padding-top: 20px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* ---- 404 page ---- */

.lost {
  display: grid;
  place-items: center;
  min-height: 100vh;
  text-align: center;
}

.lost h1 {
  margin: 16px 0 6px;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
}

.lost p {
  margin: 0 0 22px;
  color: var(--muted);
}

.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-accent:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

/* ---- small screens and motion ---- */

@media (max-width: 420px) {
  .card-head {
    grid-template-columns: auto 1fr;
  }

  .card-head .pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  /* Icon-only copy button so the address fits on one line. The button keeps
     its aria-label, and copying is announced through #announcer. */
  .copy-btn {
    min-width: 48px;
    padding: 0;
  }

  .copy-btn [data-slot="copy-text"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .copy-btn svg {
    width: 20px;
    height: 20px;
  }

  .address-value {
    font-size: 0.9rem;
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.copy-buffer {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
