/* ==========================================================================
   ZAKOFLARE Minecraft Mirror — main.css
   零依赖 / CSS 变量驱动主题 / 桌面两屏 · 移动三屏
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}

/* ---------- Tokens ---------- */
:root {
  --font-display: "Archivo", "Segoe UI Variable Display", "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-sans: "Archivo", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  --bg: #eff1f4;
  --bg-deep: #e4e7ec;
  --fg: #07090c;
  --muted: #59626f;
  --line: rgba(7, 9, 12, 0.14);
  --line-strong: rgba(7, 9, 12, 0.26);
  --brand: #1b47ff;
  --brand-soft: rgba(27, 71, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.62);
  --shade-1: rgba(239, 241, 244, 0.95);
  --shade-2: rgba(239, 241, 244, 0.62);
  --shade-3: rgba(239, 241, 244, 0);

  --wrap: 1480px;
  --pad: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --bg: #06080b;
  --bg-deep: #0b0f15;
  --fg: #f2f5fa;
  --muted: #8e99aa;
  --line: rgba(242, 245, 250, 0.15);
  --line-strong: rgba(242, 245, 250, 0.3);
  --brand: #5c8bff;
  --brand-soft: rgba(92, 139, 255, 0.12);
  --glass: rgba(10, 14, 20, 0.55);
  --shade-1: rgba(6, 8, 11, 0.92);
  --shade-2: rgba(6, 8, 11, 0.55);
  --shade-3: rgba(6, 8, 11, 0);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

::selection { background: var(--brand); color: #fff; }

img { max-width: 100%; height: auto; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  font: 500 12px/1 var(--font-mono);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 90;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--glass);
  color: var(--fg);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.theme-toggle:hover { border-color: var(--brand); transform: rotate(-12deg); }
.theme-toggle .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: absolute;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
}
.theme-toggle .icon-moon { opacity: 0; transform: scale(0.6) rotate(30deg); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: scale(0.6) rotate(-30deg); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  background: var(--bg);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  background: linear-gradient(128deg, #f4f6f9 0%, #dfe5ef 52%, #b9c8e2 100%);
}
:root[data-theme="dark"] .hero-canvas {
  background: linear-gradient(128deg, #05070a 0%, #0b1424 58%, #122a4d 100%);
}
.hero-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(96deg, var(--shade-1) 0%, var(--shade-2) 46%, var(--shade-3) 84%),
    linear-gradient(0deg, var(--shade-1) 0%, var(--shade-1) 20%, rgba(239, 241, 244, 0.6) 34%, transparent 60%);
}
:root[data-theme="dark"] .hero-shade {
  background:
    linear-gradient(96deg, var(--shade-1) 0%, var(--shade-2) 46%, var(--shade-3) 84%),
    linear-gradient(0deg, var(--shade-1) 0%, var(--shade-1) 20%, rgba(6, 8, 11, 0.6) 34%, transparent 60%);
}

.hero-inner {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100svh;
  padding-block: clamp(84px, 11vh, 124px) clamp(22px, 3.5vh, 38px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding-bottom: clamp(30px, 6vh, 62px);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 11.4vw, 10.2rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
  text-transform: uppercase;
  text-wrap: balance;
}
.h1-line { display: block; }
.h1-slash {
  color: var(--brand);
  display: inline-block;
  transform: translateY(-0.02em);
}

.hero-lead {
  margin: clamp(18px, 2.6vh, 28px) 0 0;
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-desc {
  margin: 12px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(0.875rem, 1.05vw, 0.95rem);
  line-height: 1.72;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin: clamp(20px, 3.2vh, 30px) 0 0;
  padding: 0;
  list-style: none;
  font: 400 10.5px/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-meta b {
  color: var(--fg);
  font-weight: 500;
  margin-right: 6px;
}

/* ---------- Endpoints strip ---------- */
.endpoints {
  position: relative;
  min-width: 0;
}

.ep-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
}
.ep-head-title {
  margin: 0;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
}
.ep-head-title span { color: var(--muted); }
.ep-head-count {
  font: 400 10.5px/1 var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--brand);
}

.ep-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.ep {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 15px 34px 16px 0;
  transition: background-color 0.3s var(--ease);
}
.ep + .ep {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}
.ep:hover { background: var(--brand-soft); }

.ep-main {
  display: block;
  margin-bottom: 9px;
  text-decoration: none;
  color: inherit;
}

.ep-idx {
  display: block;
  margin-bottom: 10px;
  font: 400 10px/1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ep-text { display: block; min-width: 0; }

.ep-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.ep-title em {
  font: 400 9px/1 var(--font-mono);
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.ep-host {
  display: block;
  margin-top: 6px;
  font: 400 10.5px/1.55 var(--font-mono);
  letter-spacing: -0.01em;
  color: var(--muted);
  overflow-wrap: break-word;
  transition: color 0.25s var(--ease);
}
.ep-host b { display: block; color: var(--fg); font-weight: 500; }
.ep:hover .ep-host { color: var(--fg); }

.ep-up {
  display: block;
  margin-top: 3px;
  font: 400 9.5px/1.5 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.75;
}

.ep-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}
.ep:hover .ep-arrow { color: var(--brand); transform: translate(2px, -2px); }

.ep-copy {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: 400 9px/1 var(--font-mono);
  letter-spacing: 0.1em;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.ep:hover .ep-copy,
.ep-copy:focus-visible { opacity: 1; }
.ep-copy:hover { color: var(--brand); border-color: var(--brand); }
.ep-copy.done { color: var(--brand); border-color: var(--brand); opacity: 1; }

.ep-foot {
  margin: 12px 0 0;
  font: 400 9.5px/1.6 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ep-foot a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.ep-foot a:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100svh;
  padding-block: clamp(56px, 9vh, 104px) clamp(22px, 3.5vh, 36px);
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: clamp(36px, 6vh, 72px);
  width: 100%;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.5fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.footer-brand h2 {
  margin: 0 0 clamp(14px, 2vh, 22px);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.75rem, 3.2vw, 2.9rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  text-wrap: balance;
}

.footer-note {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}
.footer-disclaimer {
  margin: 14px 0 0;
  font: 400 10px/1.7 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.8;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 32px);
}
.footer-cols section { min-width: 0; }
.footer-cols h3 {
  margin: 0 0 4px;
  padding-bottom: 10px;
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-cols ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-cols li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.footer-cols a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.2s var(--ease);
}
.footer-cols a:hover { color: var(--brand); }
.footer-cols li span {
  font: 400 9.5px/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.footer-cta {
  margin-top: auto;
  margin-bottom: clamp(20px, 4vh, 48px);
  padding-top: clamp(24px, 4vh, 48px);
}
.footer-cta-label {
  margin: 0 0 14px;
  font: 500 10px/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-cta-mail {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.55rem, 4.6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.footer-cta-mail:hover { color: var(--brand); border-color: var(--brand); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font: 400 10.5px/1.7 var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--muted);
}
.footer-bottom p { margin: 0; }
.footer-bottom a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.footer-bottom a:hover { color: var(--brand); border-color: var(--brand); }

.footer-meta {
  display: flex;
  gap: 18px;
  margin-left: auto;
}
.ipv6 { display: inline-flex; align-items: center; }
.ipv6 img { display: block; height: 20px; width: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  transform: translate(-50%, 20px);
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font: 400 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Desktop: two-panel scroll snap ---------- */
@media (min-width: 981px) {
  html { scroll-snap-type: y proximity; }
  .hero, .site-footer { scroll-snap-align: start; scroll-snap-stop: normal; }
}

/* 窄桌面：四列条带压缩字号，保证域名仍为两行 */
@media (min-width: 981px) and (max-width: 1260px) {
  .ep { padding-right: 24px; }
  .ep + .ep { padding-left: 14px; }
  .ep-host { font-size: 9.5px; }
  .ep-up { font-size: 8.5px; }
  .ep-copy { font-size: 8px; }
}

/* ---------- Tablet / mobile: three-panel stack ---------- */
@media (max-width: 980px) {
  .hero { min-height: 0; }
  .hero-bg { inset: 0 0 auto 0; height: 100svh; }
  .hero-shade {
    background:
      linear-gradient(180deg, rgba(239, 241, 244, 0.2) 0%, rgba(239, 241, 244, 0.52) 38%, rgba(239, 241, 244, 0.86) 74%, var(--shade-1) 100%);
  }
  :root[data-theme="dark"] .hero-shade {
    background:
      linear-gradient(180deg, rgba(6, 8, 11, 0.2) 0%, rgba(6, 8, 11, 0.52) 38%, rgba(6, 8, 11, 0.86) 74%, var(--shade-1) 100%);
  }

  .hero-inner {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .hero-copy {
    justify-content: flex-end;
    min-height: 100svh;
    padding: calc(78px + env(safe-area-inset-top)) var(--pad) calc(88px + env(safe-area-inset-bottom));
  }

  .hero h1 { font-size: clamp(2.6rem, 13.8vw, 5.4rem); }
  .hero-desc { max-width: none; }

  .endpoints {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100svh;
    padding: 72px var(--pad) calc(72px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg);
  }

  .ep-list { grid-template-columns: minmax(0, 1fr); }
  .ep { padding: 16px 0; }
  .ep + .ep { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .ep-arrow { top: 18px; right: 0; }
  .ep-copy { opacity: 1; }

  .footer-top { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-cols section:last-child { grid-column: 1 / -1; }
  .footer-bottom { gap: 10px 20px; }
  .footer-meta { margin-left: 0; }
}

@media (max-width: 560px) {
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
  .footer-cols section:last-child { grid-column: auto; }
  .footer-bottom { font-size: 10px; }
  .ep-title { font-size: 14px; }
  .ep-host { font-size: 10px; }
  .hero-meta { gap: 8px 18px; }
}

/* ---------- Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .theme-toggle, .hero-bg, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .hero, .site-footer { min-height: 0; }
}
