/* ============================================================
   1TB.SITE — Design System v2
   Warm paper · white cards · one vermilion accent
   Readability first: body 15px, labels never below 11.5px.
   ============================================================ */

:root {
  --paper: #f7f5f0;
  --surface: #fffefb;
  --surface-2: #fbf9f4;
  --ink: #191813;
  --ink-2: #545147;
  --ink-3: #6f6a5d;
  --line: #e6e1d7;
  --line-2: #d3ccbc;
  --accent: #c8452c;
  --accent-deep: #a3351f;
  --accent-soft: #f8e9e3;
  --good: #2c7a53;
  --warn: #a3711a;
  --bad: #b03623;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(25, 24, 19, 0.04), 0 10px 26px -22px rgba(25, 24, 19, 0.35);
  --shadow-hover: 0 2px 6px rgba(25, 24, 19, 0.06), 0 20px 44px -24px rgba(25, 24, 19, 0.4);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --shell: 1180px;
  --pad: 32px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------------- top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 245, 240, 0.88);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
}

.brand em {
  font-style: normal;
  color: var(--ink-3);
  font-weight: 500;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.16s, color 0.16s;
}

.nav a:hover {
  background: var(--surface);
  color: var(--ink);
}

.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent), 0 1px 2px rgba(25, 24, 19, 0.05);
}

/* ---------------- page head ---------------- */

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 302px;
  align-items: end;
  gap: 48px;
  padding: 52px 0 34px;
  border-bottom: 1px solid var(--line-2);
}

.crumbs {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.crumbs b {
  color: var(--accent);
  font-weight: 600;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.022em;
}

.lede {
  margin: 16px 0 0;
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.78;
  color: var(--ink-2);
}

/* ---------------- meta card ---------------- */

.meta-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 0;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  min-height: 46px;
}

.meta-row + .meta-row {
  border-top: 1px solid var(--line);
}

.meta-k {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

.meta-v {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}

/* ---------------- sections ---------------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 46px 0 18px;
}

.section-idx {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.section-title {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------------- cards ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.card-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------------- buttons / inputs ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.btn:hover {
  border-color: var(--ink-3);
  box-shadow: var(--shadow);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}

.input {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input::placeholder {
  color: var(--ink-3);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------- chips / tags ---------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.chip:hover {
  border-color: var(--ink-3);
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip-n {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag-accent {
  border-color: rgba(200, 69, 44, 0.28);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  flex: none;
}

.dot-live {
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

/* ---------------- list ---------------- */

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

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  transition: background 0.16s;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  background: var(--surface-2);
}

/* ---------------- misc ---------------- */

.empty {
  padding: 40px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

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

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 64px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}

.foot a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.16s;
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d8d2c4;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
}

/* ---------------- responsive ---------------- */

@media (max-width: 1000px) {
  .page-head {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 42px;
  }

  .meta-card {
    max-width: 420px;
  }
}

@media (max-width: 700px) {
  :root {
    --pad: 18px;
  }

  .topbar-in {
    height: 58px;
  }

  .nav {
    gap: 2px;
  }

  .nav a {
    padding: 6px 9px;
    font-size: 12px;
  }

  .nav a:nth-child(n + 4) {
    display: none;
  }

  .page-head h1 {
    font-size: 27px;
  }

  .lede {
    font-size: 14.5px;
  }

  .foot {
    margin-top: 48px;
    padding-bottom: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
