/* ==========================================================================
   PixelInn — base.css
   Design tokens, typography, navigation, buttons, forms, shared primitives
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --paper: #f1ece1;
  --paper-2: #e7dfce;
  --surface: #faf7ef;
  --surface-2: #f4efe2;
  --ink: #151814;
  --ink-2: #3a413a;
  --muted: #6e7468;
  --muted-2: #8b907f;
  --line: #d9d1bf;
  --line-soft: #e5dece;
  --line-ink: rgba(21, 24, 20, 0.1);

  --accent: #a85b28;
  --accent-ink: #8b4519;
  --accent-wash: #f0e2d2;
  --live: #4c7a46;
  --danger: #9a3b2c;
  --danger-wash: #f4e2de;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
    "Songti SC", "STSong", serif;
  --mono: "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, "Roboto Mono",
    ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --d-fast: 200ms;
  --d-base: 300ms;
  --d-slow: 600ms;

  --nav-h: 68px;
  --shot: 0 24px 60px -32px rgba(30, 26, 18, 0.5);
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent);
  color: #fff8ec;
}

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: top var(--d-fast) var(--ease);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- typography ---------- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(58px, 10.6vw, 164px);
  line-height: 0.9;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.h1 {
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.h2 {
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.h3 {
  font-size: 22px;
  line-height: 1.35;
  font-weight: 600;
}

.h4 {
  font-size: 17px;
  line-height: 1.5;
  font-weight: 600;
}

.lede {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-2);
  text-wrap: pretty;
}

.body-sm {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}

.cap {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

.serif {
  font-family: var(--serif);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- layout ---------- */
.wrap {
  width: min(1240px, 100% - 48px);
  margin-inline: auto;
}

.wrap-narrow {
  width: min(920px, 100% - 48px);
  margin-inline: auto;
}

.section {
  padding-block: clamp(64px, 9vw, 112px);
  position: relative;
}

.section-rule {
  border-top: 1px solid var(--line);
}

/* section header */
.sec-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 48px;
}

.sec-head .sec-title {
  max-width: 620px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  text-transform: none;
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  flex: none;
}

.eyebrow .idx {
  color: var(--muted-2);
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-bd: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease),
    border-color var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}

.btn:hover {
  background: #23271f;
  border-color: #23271f;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn-accent {
  --btn-bg: var(--accent);
  --btn-fg: #fff9ef;
  --btn-bd: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
}

.btn-quiet {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-bd: transparent;
  padding: 0 8px;
}
.btn-quiet:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}
.btn-lg {
  height: 52px;
  padding: 0 24px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* inline text link with arrow */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-ink);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: color var(--d-fast) var(--ease), gap var(--d-fast) var(--ease);
}
.tlink:hover {
  color: var(--ink);
  gap: 10px;
}
.tlink svg {
  width: 14px;
  height: 14px;
}

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1;
  color: var(--ink-2);
  white-space: nowrap;
}

.chip-creative {
  background: #e3ecec;
  border-color: #c6d8d9;
  color: #275b63;
}
.chip-survival {
  background: #e6ebda;
  border-color: #cfd9bd;
  color: #4d5f2f;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.dot-live {
  background: var(--live);
  box-shadow: 0 0 0 3px rgba(76, 122, 70, 0.16);
}
.dot-off {
  background: var(--danger);
}

/* ---------- navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--nav-h);
  background: rgba(241, 236, 225, 0.86);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: none;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  image-rendering: pixelated;
}

.brand-word {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  letter-spacing: -0.015em;
}

.brand-cn {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.24em;
  margin-left: 1px;
  padding-bottom: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color var(--d-fast) var(--ease), background var(--d-fast) var(--ease);
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(21, 24, 20, 0.05);
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
  background: rgba(21, 24, 20, 0.06);
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
}

.nav-toggle span {
  position: relative;
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  transition: transform var(--d-base) var(--ease), background var(--d-fast) var(--ease);
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  transition: transform var(--d-base) var(--ease);
}
.nav-toggle span::before {
  top: -5px;
}
.nav-toggle span::after {
  top: 5px;
}
.nav-toggle[aria-expanded="true"] span {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] span::before {
  transform: translateY(5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span::after {
  transform: translateY(-5px) rotate(-45deg);
}

.nav-panel {
  position: fixed;
  inset: var(--nav-h) 0 0;
  z-index: 89;
  background: rgba(241, 236, 225, 0.98);
  backdrop-filter: blur(20px);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease),
    visibility var(--d-base);
}
.nav-panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.nav-panel a {
  font-size: 24px;
  font-weight: 600;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--d-slow) var(--ease), transform var(--d-slow) var(--ease);
}
.nav-panel[data-open="true"] a {
  opacity: 1;
  transform: none;
}
.nav-panel .nav-panel-meta {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding-block: 56px 28px;
  margin-top: 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-brand .brand {
  margin-bottom: 14px;
}

.footer-note {
  font-size: 14px;
  color: var(--muted);
  max-width: 340px;
  line-height: 1.75;
}

.footer h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  font-family: var(--mono);
}

.footer-links {
  display: grid;
  gap: 9px;
}
.footer-links a,
.footer-links span {
  font-size: 14px;
  color: var(--ink-2);
  transition: color var(--d-fast) var(--ease);
  width: fit-content;
}
.footer-links a:hover {
  color: var(--accent-ink);
}

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-bottom .mono {
  font-size: 12px;
}

/* ---------- forms ---------- */
.field {
  display: grid;
  gap: 7px;
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color var(--d-fast) var(--ease), background var(--d-fast) var(--ease),
    box-shadow var(--d-fast) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:hover,
.textarea:hover {
  border-color: #c7bda7;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(168, 91, 40, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.65;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236e7468' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
}

.err {
  font-size: 13px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field[data-invalid="true"] .input,
.field[data-invalid="true"] .textarea {
  border-color: var(--danger);
}

/* ---------- utility surfaces ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hr {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ---------- toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 300;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: min(92vw, 440px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.5);
  animation: toast-in var(--d-base) var(--ease) both;
  max-width: 100%;
}
.toast[data-tone="error"] {
  background: var(--danger);
}
.toast[data-tone="ok"] {
  background: #2f4a2c;
}
.toast svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.toast[data-leaving="true"] {
  animation: toast-out 220ms var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- modal / drawer ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 20, 16, 0.44);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--d-base) var(--ease), visibility var(--d-base);
  z-index: 100;
  backdrop-filter: blur(2px);
}
.scrim[data-open="true"] {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  z-index: 101;
  left: 50%;
  top: 50%;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transform: translate(-50%, calc(-50% + 16px));
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease),
    visibility var(--d-base);
  box-shadow: 0 40px 80px -40px rgba(20, 22, 18, 0.6);
}
.modal[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%);
}

.drawer {
  position: fixed;
  z-index: 101;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(620px, 100vw);
  background: var(--paper);
  border-left: 1px solid var(--line);
  transform: translateX(24px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease),
    visibility var(--d-base);
  display: flex;
  flex-direction: column;
}
.drawer[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.drawer-body {
  padding: 24px 28px 40px;
  overflow: auto;
  flex: 1;
}
.drawer-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 2;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  color: var(--ink-2);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease),
    border-color var(--d-fast) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- skeleton / empty ---------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    #eee7d7 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: sk 1.4s linear infinite;
  border-radius: var(--radius-xs);
}
@keyframes sk {
  to {
    background-position: -200% 0;
  }
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  background: var(--surface-2);
}
.empty svg {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  color: var(--muted-2);
}
.empty p {
  color: var(--muted);
  font-size: 14px;
}

/* ---------- reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
  will-change: opacity, transform;
}
[data-reveal][data-shown="true"] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .nav-links {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav-right .btn {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .sec-head {
    flex-direction: column;
    align-items: start;
    gap: 16px;
    margin-bottom: 32px;
  }
}

@media (max-width: 560px) {
  .wrap,
  .wrap-narrow {
    width: calc(100% - 36px);
  }
  .brand-cn {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* 皮肤头像统一铺满方框（大头照效果） */
.head img,
[data-head] img,
.rc-av img,
.cm-av img,
.adm-me .av img,
.adm-cm .av img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
  image-rendering: auto;
}
