/* Blog-wide design tokens and shared layout. */

:root {
  --paper: #fffaf8;
  --surface: #fffdfc;
  --surface-soft: #f8efef;
  --ink: #3f3538;
  --ink-soft: #675c60;
  --muted: #8c7f83;
  --pine: #718773;
  --pine-dark: #536a57;
  --accent: #d47783;
  --accent-dark: #aa5867;
  --line: #eadfe1;
  --line-strong: #d8c8cc;
  --focus: rgba(212, 119, 131, .22);
  --shadow: 0 18px 50px rgba(91, 63, 70, .1);
  --font-display: "LXGW WenKai TC", "STKaiti", "KaiTi", "Noto Serif SC", serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-width: 1180px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection,
.read-body ::selection {
  background: rgba(212, 119, 131, .22);
}

img,
svg {
  display: block;
}

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

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 5px var(--focus);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  text-decoration: none;
  transition: transform .18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 20;
  height: 68px;
  border-bottom: 1px solid rgba(234, 223, 225, .9);
  background: rgba(255, 250, 248, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-header.sticky {
  position: sticky;
  top: 0;
}

.site-header-inner {
  width: min(calc(100% - 40px), var(--page-width));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 7px 18px rgba(170, 88, 103, .18);
}

.brand-section {
  color: var(--muted);
  font-weight: 400;
}

.site-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  transform: scaleX(0);
  background: var(--accent);
  transform-origin: center;
  transition: transform .2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.icon-link,
.icon-button {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .72);
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.icon-link:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--accent-dark);
}

.icon-link svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: 180px;
  transform: translate(-50%, -3px);
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  transform: translate(-50%, 0);
  opacity: 1;
}

.access-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.access-badge svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.access-public,
.access-level1 {
  border-color: rgba(113, 135, 115, .26);
  background: rgba(113, 135, 115, .1);
  color: var(--pine-dark);
}

.access-level2 {
  border-color: rgba(212, 119, 131, .26);
  background: rgba(212, 119, 131, .1);
  color: var(--accent-dark);
}

.access-admin {
  border-color: rgba(139, 58, 66, .23);
  background: rgba(139, 58, 66, .08);
  color: #873a45;
}

.access-legacy {
  border-color: rgba(156, 112, 45, .23);
  background: rgba(156, 112, 45, .09);
  color: #805a22;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .18s ease;
}

.back:hover {
  color: var(--accent-dark);
}

.back svg {
  width: 17px;
  height: 17px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #f8f0f0;
  color: var(--ink-soft);
}

.footer-inner {
  width: min(calc(100% - 40px), var(--page-width));
  min-height: 118px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 0;
}

.footer-brand {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
}

.footer-note,
.footer-meta {
  font-size: 13px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px 18px;
}

.footer-links a,
.footer-link {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}

.footer-links a:hover,
.footer-link:hover {
  color: var(--accent-dark);
}

.section-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.25;
}

.section-sub {
  max-width: 52ch;
  margin-top: 14px;
  color: var(--ink-soft);
}

section.block {
  width: min(calc(100% - 40px), 900px);
  min-height: calc(100vh - 118px);
  margin: 0 auto;
  padding: 96px 0;
}

.not-found {
  min-height: calc(100vh - 186px);
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(255, 250, 248, .9), rgba(255, 250, 248, .96)),
    url("../assets/home-workspace.png") center / cover no-repeat;
}

.not-found-inner {
  width: min(calc(100% - 40px), 720px);
  padding: 78px 0 94px;
  text-align: center;
}

.not-found-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 24px;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(170, 88, 103, .18);
}

.not-found-code {
  color: var(--accent-dark);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.not-found h1 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.3;
}

.not-found p {
  max-width: 42ch;
  margin: 13px auto 0;
  color: var(--ink-soft);
}

.not-found .back {
  margin-top: 27px;
  border-bottom: 1px solid var(--accent);
  color: var(--accent-dark);
  padding-bottom: 3px;
}

@media (max-width: 680px) {
  .site-header {
    height: 60px;
  }

  .site-header-inner,
  .footer-inner {
    width: min(calc(100% - 28px), var(--page-width));
  }

  .site-header-inner {
    gap: 10px;
  }

  .site-brand img {
    width: 31px;
    height: 31px;
  }

  .brand-section {
    display: none;
  }

  .site-nav {
    gap: 0;
  }

  .site-nav a {
    min-width: 44px;
    padding: 0 7px;
    font-size: 13px;
  }

  .header-contact {
    width: 36px;
    height: 36px;
  }

  .footer-inner {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    padding: 28px 0 32px;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .section-title {
    font-size: 34px;
  }

  section.block {
    width: min(calc(100% - 28px), 900px);
    min-height: calc(100vh - 150px);
    padding: 72px 0;
  }

  .not-found {
    min-height: calc(100vh - 210px);
  }

  .not-found-inner {
    width: min(calc(100% - 28px), 720px);
    padding: 64px 0 76px;
  }

  .not-found h1 {
    font-size: 36px;
  }
}

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