/* ==========================================================================
   凌云科技 · 志愿者信息管理系统
   Shared design tokens, reset and cross-page components
   ========================================================================== */

:root {
  --ink-900: #0b1f36;
  --ink-800: #102a43;
  --ink-700: #1e3a56;
  --ink-600: #334e68;
  --ink-500: #52677d;
  --ink-400: #7b8fa3;
  --ink-300: #a7b7c7;
  --ink-200: #cdd9e5;
  --ink-100: #e7eef6;
  --ink-50: #f3f7fb;

  --blue-700: #0c46c4;
  --blue-600: #1258e8;
  --blue-500: #1a6bff;
  --blue-400: #4c8dff;
  --blue-100: #e8f1ff;
  --blue-50: #f2f7ff;

  --teal-600: #0b8a79;
  --teal-500: #10a792;
  --teal-100: #def7f1;

  --orange-500: #f27a3d;
  --orange-400: #ff935c;
  --orange-100: #ffeadf;

  --red-600: #d93636;
  --red-500: #e54743;
  --red-100: #ffe9e7;

  --green-600: #16815b;
  --green-100: #e2f7ee;

  --white: #ffffff;
  --paper: #f6f9fc;
  --line: #e4ecf5;
  --line-strong: #d5e1ee;

  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC",
    "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --shadow-xs: 0 1px 2px rgba(16, 42, 67, 0.04);
  --shadow-sm: 0 4px 14px rgba(16, 42, 67, 0.06);
  --shadow-md: 0 14px 36px rgba(16, 42, 67, 0.09);
  --shadow-lg: 0 28px 70px rgba(11, 31, 54, 0.16);
  --shadow-blue: 0 10px 24px rgba(26, 107, 255, 0.24);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --max-width: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink-800);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(26, 107, 255, 0.18);
  color: var(--ink-900);
}

:focus-visible {
  outline: 3px solid rgba(26, 107, 255, 0.42);
  outline-offset: 3px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

/* 安装状态检查期间隐藏页面，避免末安装时闪现内容 */
html.ly-checking body {
  visibility: hidden;
}

.preview-notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 10px 12px 10px 14px;
  border: 1px solid #f3d9a8;
  border-radius: 10px;
  background: #fffbf2;
  color: #8a5a18;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 12px 30px rgba(72, 50, 16, 0.16);
  transform: translateX(-50%);
}

.preview-notice span {
  max-width: 520px;
}

.preview-notice button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #a5793a;
  font-size: 16px;
  line-height: 1;
  transition: background-color 0.18s var(--ease);
}

.preview-notice button:hover {
  background: rgba(138, 90, 24, 0.1);
}

@media (max-width: 560px) {
  .preview-notice {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    transform: none;
    font-size: 11px;
  }
}

.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: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--ink-900);
  color: var(--white);
  transform: translateY(-150%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---- Layout helpers ------------------------------------------------------ */
.container {
  width: min(var(--max-width), calc(100% - 48px));
  margin-inline: auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.section-heading {
  max-width: 680px;
}

.section-heading h2 {
  margin-top: 14px;
  color: var(--ink-900);
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin-top: 16px;
  color: var(--ink-500);
  font-size: 16px;
  line-height: 1.85;
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background-color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--blue-500);
  color: var(--white);
  box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
  background: var(--blue-600);
  box-shadow: 0 14px 30px rgba(26, 107, 255, 0.3);
}

.btn-dark {
  background: var(--ink-900);
  color: var(--white);
  box-shadow: 0 10px 24px rgba(11, 31, 54, 0.2);
}

.btn-dark:hover {
  background: var(--ink-800);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-700);
}

.btn-ghost:hover {
  border-color: var(--ink-300);
  background: var(--white);
}

.btn-outline-blue {
  border-color: #cfe0ff;
  background: #f6f9ff;
  color: var(--blue-600);
}

.btn-outline-blue:hover {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.btn-danger {
  background: var(--red-500);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(229, 71, 67, 0.2);
}

.btn-danger:hover {
  background: var(--red-600);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading .btn-label {
  opacity: 0.75;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-500);
  transition: 0.2s var(--ease);
}

.icon-btn:hover {
  border-color: var(--ink-200);
  color: var(--ink-800);
  background: var(--ink-50);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---- Badges / tags ------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-green {
  background: var(--green-100);
  color: var(--green-600);
}

.badge-blue {
  background: var(--blue-100);
  color: var(--blue-600);
}

.badge-orange {
  background: var(--orange-100);
  color: #c25a1d;
}

.badge-grey {
  background: var(--ink-100);
  color: var(--ink-500);
}

/* ---- Modals -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 22, 38, 0.58);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.24s var(--ease);
}

.modal-backdrop.is-visible {
  opacity: 1;
}

.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 34px 90px rgba(4, 17, 31, 0.3);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.28s var(--ease);
  overscroll-behavior: contain;
}

.modal-backdrop.is-visible .modal {
  transform: translateY(0) scale(1);
}

.modal-wide {
  width: min(780px, 100%);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.modal-title {
  color: var(--ink-900);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--ink-400);
  font-size: 13px;
}

.modal-close {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin: -4px -6px 0 0;
  border-radius: 10px;
  color: var(--ink-400);
  transition: 0.2s var(--ease);
}

.modal-close:hover {
  background: var(--ink-50);
  color: var(--ink-800);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 28px 24px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

/* ---- Form fields --------------------------------------------------------- */
.field {
  display: grid;
  gap: 7px;
}

.field + .field {
  margin-top: 18px;
}

.field label {
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 650;
}

.field label .required {
  color: var(--red-500);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-800);
  font-size: 14px;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-300);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 4px rgba(26, 107, 255, 0.1);
}

.field-hint {
  color: var(--ink-400);
  font-size: 12px;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #ffd4cf;
  border-radius: 9px;
  background: #fff6f5;
  color: var(--red-600);
  font-size: 13px;
  line-height: 1.55;
}

/* ---- Toast --------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow-md);
  color: var(--ink-700);
  font-size: 13.5px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.25s var(--ease),
    transform 0.25s var(--ease);
  pointer-events: auto;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-600);
}

.toast-icon svg {
  width: 13px;
  height: 13px;
}

.toast-error .toast-icon {
  background: var(--red-100);
  color: var(--red-600);
}

/* ---- Reveal animation ---------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .container {
    width: min(var(--max-width), calc(100% - 32px));
  }

  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }

  .modal-header {
    padding: 20px 20px 15px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 16px 20px 20px;
  }

  .toast-stack {
    right: 16px;
    bottom: 16px;
  }
}

@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;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
