/*
 * 方块无界 · 共享样式表 (theme.css)
 * 与主站 limitlessblocks.org 设计系统一致
 * 用法: <link rel="stylesheet" href="/includes/theme.css">
 * 提供 topbar / footer / base body / 设计 token
 */

:root {
  --cream:       #F5EFE3;
  --cream-light: #FAF7F0;
  --cream-glass: rgba(245,239,227,0.72);
  --ink:         #2A1F18;
  --ink-soft:    #5C4A3E;
  --ink-faint:   rgba(42,31,24,0.10);
  --ochre:       #C97B3D;
  --ochre-dark:  #A0651E;
  --ochre-light: rgba(201,123,61,0.12);
  --grass:       #5C8A3A;
  --grass-light: rgba(92,138,58,0.12);
  --dirt:        #6B4F2A;
  --border:      rgba(42,31,24,0.18);
  --shadow:      0 4px 24px rgba(42,31,24,0.10);
  --shadow-sm:   0 2px 12px rgba(42,31,24,0.08);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --font-display:'Fredoka', 'Noto Sans SC', sans-serif;
  --font-body:   'Noto Sans SC', system-ui, sans-serif;
  --max-w:       1100px;
}

/* ── Grain texture (与主站一致) ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ── Base body — 覆盖可能存在的旧样式 ── */
html { scroll-behavior: smooth; }
body {
  background-color: var(--cream) !important;
  color: var(--ink) !important;
  font-family: var(--font-body) !important;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ochre); text-decoration: none; transition: color .15s; }
a:hover { color: var(--ochre-dark); text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: .95rem; font-weight: 600;
  border: 1.5px solid transparent;
  transition: all .2s ease;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--ochre); color: #fff; border-color: var(--ochre); }
.btn-primary:hover {
  background: var(--ochre-dark); border-color: var(--ochre-dark);
  transform: translateY(-2px); box-shadow: 0 6px 20px rgba(201,123,61,.35);
  text-decoration: none; color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--ink-faint);
  border-color: var(--ink-soft);
  text-decoration: none; color: var(--ink);
}

/* ── Topbar (与主站一致) ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--cream-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1.5px solid var(--border);
}
.topbar-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem;
  height: 64px; display: flex; align-items: center; gap: 1.5rem;
}
.brand {
  display: flex; align-items: center; gap: .6rem; flex-shrink: 0; line-height: 1.15;
}
.brand img {
  width: 38px; height: 38px; border-radius: 8px;
  border: 1.5px solid var(--border); object-fit: cover;
}
.brand span {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; color: var(--ink); letter-spacing: -0.01em;
}
.brand em {
  font-style: normal; font-weight: 500; color: var(--ink-soft);
  font-size: .85rem; letter-spacing: 0.02em;
  display: inline-block; margin-left: 1px;
}
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav a {
  padding: .4rem .75rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; color: var(--ink-soft);
  transition: all .2s; text-decoration: none;
}
.nav a:hover { background: var(--ink-faint); color: var(--ink); }
.nav a.active { background: var(--ink-faint); color: var(--ink); }
.nav-cta { margin-left: .5rem; padding: .5rem 1.1rem; font-size: .88rem; }
.nav-toggle {
  display: none; background: none; border: none;
  font-size: 1.4rem; color: var(--ink);
  padding: .25rem; border-radius: var(--radius-sm); margin-left: auto;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--ink-faint); }

@media (max-width: 768px) {
  .nav, .nav-cta { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }
  .topbar-inner { gap: 1rem; }
  body.nav-open .nav,
  body.nav-open .nav-cta {
    display: flex; flex-direction: column;
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--cream-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1.5px solid var(--border);
    padding: 1rem; z-index: 99; align-items: flex-start;
  }
  body.nav-open .nav a { width: 100%; color: var(--ink); }
}

/* ── Footer (与主站一致) ── */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,.75);
  padding: 3.5rem 0 2rem;
}
.footer .container {
  max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-brand {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .8rem;
}
.footer-brand img {
  border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
}
.footer-brand span {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; color: #fff;
}
.footer p { font-size: .88rem; line-height: 1.7; }
.footer h4 {
  font-size: .85rem; font-weight: 700; color: #fff;
  margin-bottom: .8rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: .5rem; }
.footer ul a {
  font-size: .88rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: color .15s;
}
.footer ul a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 1.5rem;
  display: flex; flex-direction: column; gap: .3rem;
  font-size: .82rem;
  color: rgba(255,255,255,.5);
}
.footer-bottom p { margin: 0; line-height: 1.6; }
.footer-bottom a { color: rgba(255,255,255,.55); text-decoration: none; }
.footer-bottom a:hover { color: rgba(255,255,255,.9); text-decoration: none; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
}
