:root {
  --bg: #f4f6fb;
  --bg-alt: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(43, 58, 85, 0.12);
  --text: #1f2a3d;
  --text-soft: #55617a;
  --text-mute: #7c869c;
  --brand: #2b3a55;
  --brand-2: #3c4f70;
  --accent: #f2b04a;
  --accent-2: #e8863e;
  --link: #2f5fa8;
  --shadow-sm: 0 2px 8px rgba(31, 42, 61, 0.06);
  --shadow-md: 0 10px 30px rgba(31, 42, 61, 0.10);
  --shadow-lg: 0 20px 50px rgba(31, 42, 61, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-h: 72px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1622;
    --bg-alt: #131b2a;
    --surface: rgba(30, 41, 60, 0.68);
    --surface-solid: #18212f;
    --border: rgba(232, 238, 247, 0.12);
    --text: #e8eef7;
    --text-soft: #b4c0d4;
    --text-mute: #8b97ac;
    --brand: #2b3a55;
    --brand-2: #4a5f86;
    --accent: #f2b04a;
    --accent-2: #f08c3c;
    --link: #8fb4f0;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, rgba(242, 176, 74, 0.16), transparent 60%),
    radial-gradient(1000px 520px at 92% 0%, rgba(60, 79, 112, 0.20), transparent 62%),
    linear-gradient(180deg, rgba(43, 58, 85, 0.05), transparent 320px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.25s var(--ease), opacity 0.25s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--accent-2);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(242, 176, 74, 0.65);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.6em;
  line-height: 1.3;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.85rem);
  position: relative;
  padding-left: 18px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 6px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

h3 {
  font-size: clamp(1.08rem, 1.7vw, 1.28rem);
  margin-top: 1.4em;
}

p {
  margin: 0 0 1em;
  color: var(--text-soft);
}

strong {
  color: var(--text);
}

ul, ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
  color: var(--text-soft);
}

li {
  margin-bottom: 0.4em;
}

blockquote {
  margin: 0 0 1em;
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}

blockquote p {
  margin: 0;
}

time {
  color: var(--text-mute);
  font-size: 0.875rem;
}

address {
  font-style: normal;
}

/* ---------- Skip link ---------- */
body > a[href="#main-content"] {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 999;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: top 0.3s var(--ease);
}

body > a[href="#main-content"]:focus {
  top: 16px;
  color: #fff;
}

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(31, 42, 61, 0.06);
}

header > div {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

header > div > a[aria-label="男同网站首页"] {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

header > div > a[aria-label="男同网站首页"] svg {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(43, 58, 85, 0.28);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

header > div > a[aria-label="男同网站首页"]:hover svg {
  transform: rotate(-8deg) scale(1.06);
  box-shadow: 0 10px 22px rgba(242, 176, 74, 0.42);
}

header nav {
  flex: 1 1 auto;
  min-width: 0;
}

header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

header nav li {
  margin: 0;
}

header nav a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

header nav a:hover,
header nav a:focus-visible {
  background: linear-gradient(135deg, rgba(242, 176, 74, 0.22), rgba(232, 134, 62, 0.16));
  color: var(--text);
  transform: translateY(-1px);
}

header form[role="search"] {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 320px;
  margin-left: auto;
}

header form[role="search"] label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

header form[role="search"] input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

header form[role="search"] input[type="search"]::placeholder {
  color: var(--text-mute);
}

header form[role="search"] input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 176, 74, 0.22);
}

header form[role="search"] button {
  padding: 9px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2a3d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(242, 176, 74, 0.35);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
}

header form[role="search"] button:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 10px 22px rgba(242, 176, 74, 0.48);
}

header form[role="search"] button:active {
  transform: translateY(0);
}

/* ---------- Main layout ---------- */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

main > nav[aria-label="面包屑导航"] ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-mute);
}

main > nav[aria-label="面包屑导航"] li {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

main > nav[aria-label="面包屑导航"] li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--text-mute);
  opacity: 0.6;
}

main > nav[aria-label="面包屑导航"] a {
  color: var(--text-soft);
}

main > nav[aria-label="面包屑导航"] a:hover {
  color: var(--accent-2);
}

main > nav[aria-label="面包屑导航"] [aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Sections ---------- */
main section {
  margin-bottom: 28px;
  padding: clamp(20px, 3.2vw, 40px);
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: riseIn 0.7s var(--ease) both;
  transition: box-shadow 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.4s var(--ease);
}

main section:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(242, 176, 74, 0.35);
}

main section > p:last-child,
main section > ul:last-child,
main section > ol:last-child {
  margin-bottom: 0;
}

/* Staggered reveal */
main section:nth-of-type(1) { animation-delay: 0.02s; }
main section:nth-of-type(2) { animation-delay: 0.06s; }
main section:nth-of-type(3) { animation-delay: 0.10s; }
main section:nth-of-type(4) { animation-delay: 0.14s; }
main section:nth-of-type(5) { animation-delay: 0.18s; }
main section:nth-of-type(6) { animation-delay: 0.22s; }
main section:nth-of-type(7) { animation-delay: 0.26s; }
main section:nth-of-type(8) { animation-delay: 0.30s; }
main section:nth-of-type(9) { animation-delay: 0.34s; }
main section:nth-of-type(10) { animation-delay: 0.38s; }
main section:nth-of-type(11) { animation-delay: 0.42s; }
main section:nth-of-type(12) { animation-delay: 0.46s; }

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ---------- Hero ---------- */
#hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 52px);
  background:
    linear-gradient(135deg, rgba(43, 58, 85, 0.96) 0%, rgba(60, 79, 112, 0.92) 45%, rgba(242, 176, 74, 0.55) 130%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f4f7fc;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 176, 74, 0.55), transparent 62%);
  filter: blur(30px);
  z-index: -1;
  animation: floatY 9s ease-in-out infinite;
}

#hero::after {
  content: "";
  position: absolute;
  inset: auto auto -30% -15%;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 180, 240, 0.4), transparent 65%);
  filter: blur(36px);
  z-index: -1;
  animation: floatY 12s ease-in-out infinite reverse;
}

#hero h1 {
  color: #ffffff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
  margin-bottom: 0.5em;
}

#hero h1::after {
  content: "";
  display: block;
  width: 96px;
  height: 5px;
  margin-top: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), rgba(255, 255, 255, 0.2));
}

#hero p {
  color: rgba(244, 247, 252, 0.88);
  max-width: 78ch;
}

#hero p:last-of-type {
  margin-top: 18px;
  padding: 12px 18px;
  display: inline-block;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.88rem;
}

#hero p:last-of-type strong {
  color: var(--accent);
}

#hero > div {
  margin: 26px 0 8px;
  display: flex;
  justify-content: center;
}

#hero > div svg {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

#hero > div svg:hover {
  transform: translateY(-6px) scale(1.012);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}

/* ---------- Articles & news cards ---------- */
#news article,
#articles article {
  position: relative;
  margin: 0 0 16px;
  padding: 20px 22px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
  overflow: hidden;
}

#news article::before,
#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

#news article:hover,
#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(242, 176, 74, 0.4);
}

#news article:hover::before,
#articles article:hover::before {
  opacity: 1;
}

#news article:last-child,
#articles article:last-child {
  margin-bottom: 0;
}

#news article h3,
#articles article h3 {
  margin-top: 0;
  margin-bottom: 0.4em;
  font-size: 1.1rem;
}

#articles article h3 a {
  color: var(--text);
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: 0% 3px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.4s var(--ease), color 0.3s var(--ease);
  padding-bottom: 2px;
}

#articles article h3 a:hover {
  color: var(--accent-2);
  background-size: 100% 3px;
}

#articles article p a[href^="/articles/"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand);
  background: linear-gradient(135deg, rgba(242, 176, 74, 0.28), rgba(242, 176, 74, 0.12));
  border: 1px solid rgba(242, 176, 74, 0.45);
  border-radius: var(--radius-pill);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

#articles article p a[href^="/articles/"]::after {
  content: "→";
  transition: transform 0.25s var(--ease);
}

#articles article p a[href^="/articles/"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(242, 176, 74, 0.35);
  background: linear-gradient(135deg, rgba(242, 176, 74, 0.45), rgba(232, 134, 62, 0.25));
}

#articles article p a[href^="/articles/"]:hover::after {
  transform: translateX(4px);
}

@media (prefers-color-scheme: dark) {
  #articles article p a[href^="/articles/"] {
    color: var(--accent);
    background: rgba(242, 176, 74, 0.14);
  }
}

/* ---------- FAQ ---------- */
#faq details {
  margin-bottom: 12px;
  padding: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

#faq details:hover {
  border-color: rgba(242, 176, 74, 0.4);
  box-shadow: var(--shadow-md);
}

#faq details[open] {
  border-color: rgba(242, 176, 74, 0.55);
  box-shadow: var(--shadow-md);
}

#faq summary {
  position: relative;
  padding: 16px 52px 16px 20px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

#faq summary::-webkit-details-marker {
  display: none;
}

#faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
  background: rgba(242, 176, 74, 0.22);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
}

#faq details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1f2a3d;
}

#faq summary:hover {
  background: rgba(242, 176, 74, 0.08);
}

#faq details p {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--text-soft);
  animation: fadeSlide 0.4s var(--ease) both;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- HowTo ---------- */
#howto ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

#howto ol li {
  position: relative;
  counter-increment: step;
  margin-bottom: 12px;
  padding: 14px 18px 14px 58px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

#howto ol li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2a3d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(242, 176, 74, 0.35);
}

#howto ol li:hover {
  transform: translateX(4px);
  border-color: rgba(242, 176, 74, 0.4);
  box-shadow: var(--shadow-sm);
}

/* ---------- Contact ---------- */
#contact address {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

#contact address p {
  margin: 0;
  padding: 14px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

#contact address p:hover {
  transform: translateY(-3px);
  border-color: rgba(242, 176, 74, 0.45);
  box-shadow: var(--shadow-sm);
}

#contact address a {
  font-weight: 600;
  word-break: break-all;
}

/* ---------- Sitemap & links ---------- */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

#sitemap li,
#links li {
  margin: 0;
}

#sitemap a,
#links a {
  display: inline-block;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: transform 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

#sitemap a:hover,
#links a:hover {
  transform: translateY(-2px);
  color: var(--text);
  border-color: rgba(242, 176, 74, 0.55);
  background: linear-gradient(135deg, rgba(242, 176, 74, 0.2), rgba(242, 176, 74, 0.06));
  box-shadow: 0 8px 20px rgba(242, 176, 74, 0.22);
}

/* ---------- Footer ---------- */
footer {
  margin-top: 8px;
  padding: 48px 24px 32px;
  background:
    linear-gradient(180deg, rgba(43, 58, 85, 0.06), rgba(43, 58, 85, 0.14)),
    var(--bg-alt);
  border-top: 1px solid var(--border);
}

footer > section {
  max-width: 1240px;
  margin: 0 auto 22px;
  padding: 20px 24px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

footer > section:hover {
  border-color: rgba(242, 176, 74, 0.35);
  box-shadow: var(--shadow-md);
}

footer > section h2 {
  font-size: 1.05rem;
  padding-left: 14px;
  margin-bottom: 0.5em;
}

footer > section h2::before {
  width: 4px;
}

footer > section p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-mute);
}

footer > p {
  max-width: 1240px;
  margin: 0 auto 12px;
  padding: 0 24px;
  font-size: 0.88rem;
  color: var(--text-mute);
  text-align: center;
}

footer > p strong {
  color: var(--text-soft);
}

footer > p:last-child {
  margin-bottom: 0;
}

footer > p:last-child a {
  display: inline-block;
  padding: 8px 22px;
  font-weight: 600;
  color: #1f2a3d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 18px rgba(242, 176, 74, 0.35);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

footer > p:last-child a:hover {
  transform: translateY(-2px);
  color: #1f2a3d;
  box-shadow: 0 10px 26px rgba(242, 176, 74, 0.5);
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  header > div {
    gap: 14px;
  }

  header form[role="search"] {
    flex: 1 1 100%;
    order: 3;
    margin-left: 0;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 64px;
  }

  header nav ul {
    gap: 2px;
  }

  header nav a {
    padding: 7px 10px;
    font-size: 0.86rem;
  }

  main {
    padding: 20px 16px 48px;
  }

  main section {
    border-radius: var(--radius-md);
    margin-bottom: 20px;
  }

  #hero {
    border-radius: var(--radius-md);
  }

  #hero > div {
    margin: 20px 0 4px;
  }

  footer {
    padding: 32px 16px 24px;
  }

  footer > section {
    padding: 16px 18px;
    margin-bottom: 16px;
  }

  footer > p {
    padding: 0 16px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 15px;
  }

  header > div {
    padding: 10px 16px;
  }

  header > div > a[aria-label="男同网站首页"] span {
    font-size: 1rem;
  }

  header nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  header nav ul::-webkit-scrollbar {
    height: 4px;
  }

  header nav ul::-webkit-scrollbar-thumb {
    background: rgba(242, 176, 74, 0.5);
    border-radius: 4px;
  }

  header nav a {
    padding: 6px 10px;
    font-size: 0.82rem;
  }

  header form[role="search"] {
    gap: 6px;
  }

  header form[role="search"] button {
    padding: 9px 14px;
  }

  h1 {
    font-size: 1.42rem;
  }

  #hero {
    padding: 22px 18px;
  }

  #hero p:last-of-type {
    display: block;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
  }

  #news article,
  #articles article {
    padding: 16px 16px 16px 18px;
  }

  #faq summary {
    padding: 14px 46px 14px 16px;
    font-size: 0.95rem;
  }

  #faq details p {
    padding: 0 16px 16px;
    font-size: 0.92rem;
  }

  #howto ol li {
    padding: 12px 14px 12px 52px;
    font-size: 0.92rem;
  }

  #howto ol li::before {
    width: 26px;
    height: 26px;
    left: 12px;
    font-size: 0.82rem;
  }

  #contact address {
    grid-template-columns: 1fr;
  }

  #contact address p {
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  #sitemap a,
  #links a {
    padding: 7px 14px;
    font-size: 0.86rem;
  }
}

/* ---------- Motion preferences ---------- */
@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;
  }

  main section {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Print ---------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  header,
  footer > p:last-child,
  #links {
    display: none;
  }

  main section {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    backdrop-filter: none;
    animation: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
</style>