:root {
  --paper: #f3eee3;
  --paper-light: #faf7f0;
  --ink: #201e1a;
  --muted: #716b62;
  --line: #cfc6b7;
  --accent: #35465c;
  --accent-dark: #2b3a4c;
  --serif: "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --page: min(85rem, calc(100vw - 4.5rem));
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 20rem;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

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

.svg-symbols {
  position: absolute;
  overflow: hidden;
}

.site-header,
main,
.site-footer {
  width: var(--page);
  margin-right: auto;
  margin-left: auto;
}

.site-header {
  min-height: 4rem;
  margin-top: .875rem;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.75rem;
  font-size: .8125rem;
  letter-spacing: .12em;
}

.site-brand {
  font-weight: 800;
}

.site-navigation {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.site-navigation a {
  padding: .6rem 0;
  border-bottom: 1px solid transparent;
  font-weight: 700;
}

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

.site-header::after {
  content: "PERSONAL BOOKMARKS\A EST. 2005";
  justify-self: end;
  color: var(--muted);
  font-size: .5625rem;
  line-height: 1.45;
  text-align: right;
  white-space: pre;
}

main {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  align-items: start;
  column-gap: 2.5rem;
}

.page-intro {
  min-height: 0;
  padding: 2.5rem 0 2.25rem;
  border-bottom: 1px solid var(--ink);
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 43rem) auto;
  grid-template-areas:
    "description summary"
    "notice summary";
  align-items: center;
  column-gap: 4rem;
  row-gap: .625rem;
}


.section-label {
  margin: 0 0 1.25rem;
  color: var(--accent);
  font-size: .625rem;
  font-weight: 800;
  letter-spacing: .22em;
}

.page-intro h1 {
  margin: 0;
  max-width: 65rem;
  font: 600 clamp(4.25rem, 7.5vw, 7.5rem)/.95 var(--serif);
  letter-spacing: -.075em;
}

.page-description {
  grid-area: description;
  max-width: 43rem;
  margin: 0;
  font: 400 clamp(1.0625rem, 1.35vw, 1.2rem)/1.75 var(--serif);
}

.page-notice {
  grid-area: notice;
  max-width: 43rem;
  margin: 0;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.65;
}

.directory-summary {
  grid-area: summary;
  position: static;
  align-self: center;
  justify-self: end;
  margin: 0;
  display: flex;
}

.directory-summary > div {
  min-width: 8.75rem;
  padding: 0 1.5rem;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: .7rem;
}

.directory-summary > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.directory-summary dt {
  order: 2;
  font: 400 .8125rem var(--serif);
  white-space: nowrap;
}

.directory-summary dd {
  margin: 0;
  color: var(--accent);
  font: 400 clamp(2.5rem, 3.2vw, 3.25rem)/1 Georgia, "Times New Roman", serif;
}

.category-index {
  position: sticky;
  top: 0;
  max-height: 100vh;
  padding: 2rem 1.5rem 2rem 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
}

.category-index h2 {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .5625rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.category-index ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: category;
}

.category-index li {
  counter-increment: category;
}

.category-index a {
  padding: .5rem .25rem;
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  gap: .35rem;
  color: var(--muted);
  font: 400 .75rem/1.35 var(--serif);
}

.category-index a::before {
  content: counter(category, decimal-leading-zero);
  color: var(--muted);
  font: 400 .65rem/1.6 Georgia, "Times New Roman", serif;
}

.category-index a:hover,
.category-index a:focus-visible {
  color: var(--accent);
}

.directory-content {
  min-width: 0;
}

.directory-section {
  padding: 2.5rem 0 2.75rem;
  border-top: 3px solid var(--ink);
  scroll-margin-top: 1rem;
}

.directory-section:first-child {
  border-top: 0;
}

.directory-section > header {
  min-height: 5rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.25rem;
}

.directory-section > header p {
  margin: .4rem 0 0;
  color: var(--muted);
  font: 400 .75rem var(--serif);
  white-space: nowrap;
}

.directory-section > header p:first-child {
  margin-top: 0;
  color: var(--accent);
  font: 400 clamp(1.9rem, 3vw, 3rem)/1 Georgia, "Times New Roman", serif;
}

.directory-section h2 {
  margin: 0;
  font: 600 clamp(1.8rem, 3vw, 3rem)/1.05 var(--serif);
  letter-spacing: -.04em;
}

.directory-section:target > header {
  color: var(--accent);
}

.link-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  columns: 2;
  column-gap: 2rem;
  list-style: none;
  counter-reset: bookmark;
}

.link-list li {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  break-inside: avoid;
  counter-increment: bookmark;
}

.link-list a {
  min-height: 3.35rem;
  padding: .7rem .7rem;
  display: grid;
  grid-template-columns: 2rem minmax(7rem, 1.3fr) minmax(5rem, .8fr) 1rem;
  align-items: center;
  gap: .65rem;
  transition: color .16s ease, background-color .16s ease;
}

.link-list a::before {
  content: counter(bookmark, decimal-leading-zero);
  color: var(--muted);
  font: 400 .65rem Georgia, "Times New Roman", serif;
}

.link-list a > span {
  min-width: 0;
  overflow: hidden;
  font: 600 .875rem/1.4 var(--serif);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-list small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .625rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-icon {
  width: .9rem;
  height: .9rem;
  justify-self: end;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.25;
}

.link-list a:hover,
.link-list a:focus-visible {
  color: var(--paper-light);
  background: var(--accent);
  outline: 0;
}

.link-list a:hover::before,
.link-list a:focus-visible::before,
.link-list a:hover small,
.link-list a:focus-visible small {
  color: rgba(250, 247, 240, .72);
}

.site-footer {
  min-height: 5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: .5625rem;
  letter-spacing: .08em;
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: max(1.5rem, calc((100vw - var(--page)) / 2));
  bottom: 1.5rem;
  z-index: 20;
  min-width: 6.5rem;
  min-height: 2.75rem;
  padding: .75rem 1rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 700;
  letter-spacing: .08em;
  transition: color .18s ease, background-color .18s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--accent);
  color: var(--paper);
}

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

@media (max-width: 62.5rem) {
  :root {
    --page: calc(100vw - 2.75rem);
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-navigation {
    display: none;
  }

  main {
    display: block;
  }

  .page-intro {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-areas:
      "description"
      "notice"
      "summary";
    align-items: start;
    row-gap: .75rem;
  }

  .directory-summary {
    justify-self: start;
    margin-top: 1rem;
  }

  .category-index {
    position: static;
    max-height: none;
    padding: 1.75rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .category-index ol {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-index a {
    min-height: 3.25rem;
    padding: .65rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .category-index li:nth-child(4n) a {
    border-right: 0;
  }
}

@media (max-width: 40rem) {
  :root {
    --page: calc(100vw - 1.75rem);
  }

  .site-header {
    min-height: 3.75rem;
    margin-top: .625rem;
  }

  .site-header::after {
    font-size: .5rem;
  }

  .page-intro {
    min-height: 0;
    padding: 2rem 0 1.5rem;
  }


  .page-intro h1 {
    font-size: clamp(3.5rem, 17vw, 5.5rem);
  }

  .page-description {
    max-width: 100%;
    font-size: 1rem;
  }

  .directory-summary {
    width: 100%;
    justify-self: stretch;
  }

  .directory-summary > div {
    min-width: 0;
    flex: 1;
    padding: 0 1.25rem;
  }

  .directory-summary dd {
    font-size: 2.5rem;
  }

  .category-index ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-index li:nth-child(4n) a {
    border-right: 1px solid var(--line);
  }

  .category-index li:nth-child(2n) a {
    border-right: 0;
  }

  .directory-section {
    padding: 2rem 0 2.25rem;
  }

  .directory-section > header {
    min-height: 4.25rem;
    gap: .75rem;
  }

  .directory-section > header p:first-child,
  .directory-section h2 {
    font-size: clamp(1.6rem, 8vw, 2.3rem);
  }

  .link-list {
    columns: 1;
  }

  .link-list a {
    grid-template-columns: 1.8rem minmax(0, 1fr) 1rem;
    padding-right: .5rem;
  }

  .link-list a > span {
    font-size: .9rem;
    white-space: normal;
  }

  .link-list small {
    display: none;
  }

  .site-footer {
    line-height: 1.8;
  }

  .back-to-top {
    right: .875rem;
    bottom: .875rem;
    min-width: 5.75rem;
    min-height: 2.625rem;
    padding: .65rem .75rem;
    font-size: .5625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
