/* aoglang — static site, mobile-first */
:root {
  --color-bg: #f4f6f8;
  --color-surface: #fff;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border: #e5e7eb;
  --font-sans: "Segoe UI", system-ui, -apple-system, "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --content-padding: clamp(1rem, 3vw, 2rem);
  --header-h: 3.5rem;
  --radius: 0.5rem;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #fff;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.header-wrap {
  position: relative;
  width: 100%;
}

.header-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--content-padding);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo img {
  width: 2rem;
  height: 2rem;
}

.nav-main {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-main a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-main a[aria-current="page"] {
  font-weight: 600;
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch {
  display: flex;
  gap: 0.2rem;
  font-size: 0.8125rem;
}

.lang-switch a {
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-muted);
}

.lang-switch a[aria-current="true"] {
  background: var(--color-accent);
  color: #fff;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
}

.nav-drawer {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem var(--content-padding);
  box-shadow: var(--shadow-lg);
}

.nav-drawer.is-open {
  display: block;
}

.nav-drawer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-drawer li + li {
  margin-top: 0.65rem;
}

.nav-drawer a {
  color: var(--color-text);
  text-decoration: none;
}

@media (min-width: 900px) {
  .menu-toggle {
    display: none;
  }

  .nav-main {
    display: flex;
  }
}

main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 1.5rem var(--content-padding) 2rem;
}

.hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

.hero p {
  color: var(--color-muted);
  width: 100%;
  max-width: 100%;
  margin: 0 auto 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background: var(--color-accent);
  color: #fff !important;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

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

.btn-outline {
  background: transparent;
  color: var(--color-accent) !important;
  border: 1px solid var(--color-accent);
}

.btn-outline:hover {
  background: rgb(37 99 235 / 0.08);
}

.section-title {
  font-size: 1.25rem;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* 卡片列表：桌面至少 5 列；瀑布流由 masonry.js 设置 grid-row span */
.masonry-grid,
.card-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
  align-items: start;
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) {
  .masonry-grid,
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .masonry-grid,
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .masonry-grid,
  .card-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.masonry-grid .card,
.card-grid .card {
  grid-column: span 1;
  min-width: 0;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-thumb {
  width: 100%;
  aspect-ratio: var(--thumb-ar, 4 / 3);
  height: auto;
  display: block;
  background: var(--color-border);
  object-fit: cover;
}

.card-body {
  padding: 1rem;
}

.card-body h2,
.card-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
}

.card-body h2 a,
.card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.card-body h2 a:hover,
.card-body h3 a:hover {
  color: var(--color-accent);
}

.card-meta {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin: 0;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgb(37 99 235 / 0.1);
  color: var(--color-accent);
  margin-right: 0.35rem;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 2rem 0;
  margin-top: auto;
  width: 100%;
}

.footer-inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--content-padding);
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.footer-brand strong {
  font-size: 1.1rem;
}

.footer-brand p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.footer-nav a {
  color: var(--color-muted);
  text-decoration: none;
}

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

.footer-legal {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.footer-legal a {
  color: var(--color-muted);
}

.article-header {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.5rem;
}

.article-header h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.prose {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.prose-wide {
  width: 100%;
  max-width: 100%;
}

.prose h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
}

.prose h3 {
  font-size: 1.1rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1rem;
}

.prose code {
  font-size: 0.9em;
  background: var(--color-border);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--color-border);
}

.breadcrumb a {
  color: var(--color-muted);
}

/* 图集详情：与列表相同列数；瀑布流行高由 masonry.js 计算 */
.gallery-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
  align-items: start;
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.gallery-grid figure {
  margin: 0;
  grid-column: span 1;
  min-width: 0;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: var(--thumb-ar, 4 / 3);
  height: auto;
  display: block;
  object-fit: cover;
}

.gallery-grid figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.gallery-grid figcaption strong {
  display: block;
  color: var(--color-text);
  font-size: 0.9375rem;
  margin-bottom: 0.35rem;
}

.gallery-grid figcaption p {
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.gallery-grid .gallery-keywords {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.gallery-intro {
  max-width: 100%;
  margin: 0 0 1.5rem;
  color: var(--color-muted);
}

/* Video */
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow-lg);
}

.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.picture-hero {
  margin: 0 0 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.picture-hero img {
  width: 100%;
  aspect-ratio: var(--thumb-ar, 16 / 9);
  height: auto;
  display: block;
  object-fit: cover;
}

.picture-article figure a {
  display: block;
}

.video-meta {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0 1.25rem;
}

.video-article .player {
  margin-bottom: 0;
}

video.player {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  border-radius: var(--radius);
  background: #000;
}

/* Search — compact (legacy) */
.search-box {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.5rem;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.search-box input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* Home — first screen search */
.page-home-search main {
  max-width: none;
  padding: 0;
}

/* 覆盖通用 .search-screen 的全屏高度，避免挡住下方「最新内容」 */
.page-home-search .home-search-screen {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 0;
}

.page-home-search .home-content {
  position: relative;
  z-index: 1;
}

.page-home-search .hero-first-screen {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: clamp(1.5rem, 5vh, 3rem) var(--content-padding) clamp(1rem, 3vh, 2rem);
  margin: 0;
}

.page-home-search .hero-first-screen h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.page-home-search .home-search-screen.has-query .hero-first-screen {
  padding-top: clamp(1.25rem, 3vh, 2rem);
  padding-bottom: 0.75rem;
}

.page-home-search .home-search-panel {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--content-padding) 1.5rem;
}

.page-home-search main.is-searching .home-content {
  display: none;
}

.page-home-search .home-content {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--content-padding) 3rem;
}

/* 整张卡片可点击 */
.card-anchor {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.card-anchor:hover .card-body h2,
.card-anchor:hover .card-body h3 {
  color: var(--color-accent);
}

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

/* Full-screen search page (legacy redirect target) */
.page-search-full {
  background: var(--color-bg);
}

.page-search-full .site-header {
  position: relative;
  box-shadow: none;
  border-bottom: 1px solid var(--color-border);
}

.page-search-full main {
  max-width: none;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-search-full .site-footer {
  margin-top: 0;
}

.search-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 1px);
  min-height: calc(100dvh - var(--header-h) - 1px);
}

.search-screen.has-query .search-hero {
  flex: 0 0 auto;
  justify-content: flex-start;
  padding-top: clamp(1.5rem, 4vh, 3rem);
  padding-bottom: 1rem;
}

.search-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  transition: padding 0.25s ease;
}

.search-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.search-hero .search-tagline {
  color: var(--color-muted);
  margin: 0 0 clamp(1.5rem, 4vh, 2.5rem);
  font-size: clamp(0.95rem, 2.5vw, 1.125rem);
}

.search-form-large {
  width: 30%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

@media (max-width: 1024px) {
  .search-form-large {
    width: 50%;
  }
}

@media (max-width: 768px) {
  .search-form-large {
    width: 75%;
  }
}

@media (max-width: 480px) {
  .search-form-large {
    width: 100%;
  }
}

.search-form-large .search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-form-large:focus-within .search-input-wrap {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgb(37 99 235 / 0.15), var(--shadow-lg);
}

.search-form-large .search-icon {
  flex-shrink: 0;
  margin-left: 1.25rem;
  color: var(--color-muted);
  pointer-events: none;
}

.search-form-large input[type="search"] {
  flex: 1;
  border: none;
  background: transparent;
  padding: 1.1rem 1rem 1.1rem 0.75rem;
  font-size: clamp(1.125rem, 3vw, 1.375rem);
  line-height: 1.4;
  color: var(--color-text);
  min-width: 0;
}

.search-form-large input[type="search"]:focus {
  outline: none;
}

.search-form-large input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 1.25rem;
  width: 1.25rem;
  margin-right: 0.5rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E") center/contain no-repeat;
  cursor: pointer;
}

.search-form-large .search-submit {
  flex-shrink: 0;
  margin: 0.35rem 0.35rem 0.35rem 0;
  padding: 0.75rem 1.35rem;
  border: none;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.search-form-large .search-submit:hover {
  background: var(--color-accent-hover);
}

.search-hints {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.search-hints kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  background: var(--color-surface);
}

.search-panel {
  flex: 1;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--content-padding) 2.5rem;
  overflow-y: auto;
}

.search-panel[hidden] {
  display: none;
}

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-results li {
  padding: 1rem 1.15rem;
  margin-bottom: 0.65rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.search-results li:hover {
  border-color: var(--color-accent);
}

.search-results a {
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  color: var(--color-text);
}

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

.search-results p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.search-results .result-tags {
  margin-top: 0.5rem;
}

.search-empty {
  color: var(--color-muted);
  padding: 2rem 1rem;
  text-align: center;
  font-size: 1rem;
}

.search-browse {
  margin-top: 0.5rem;
}

.search-browse h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.search-browse-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.search-browse-list a {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.875rem;
}

.search-browse-list a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

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

/* Contact form */
.form {
  width: 100%;
  max-width: 100%;
}

.form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form input,
.form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--color-surface);
}

.form textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-note {
  font-size: 0.8125rem;
  color: var(--color-muted);
  margin-top: 1rem;
}

/* 404 */
.page-error {
  text-align: center;
  padding: 4rem 1rem;
}

.page-error h1 {
  font-size: 4rem;
  margin: 0;
  color: var(--color-accent);
  line-height: 1;
}

/* Lang landing */
.lang-landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
}

.lang-landing .logo {
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

/* RSS link */
.feed-link {
  font-size: 0.875rem;
}

.feed-link a::before {
  content: "⬤ ";
  color: #f97316;
  font-size: 0.6rem;
  vertical-align: middle;
}

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