:root {
  color-scheme: light;
  --tkf-accent: #6b7280;
  --tkf-accent-light: #f3f4f6;
  --tkf-border: #d1d5db;
  --tkf-bg-subtle: #fafafa;
  --tkf-text: #1f2937;
  --tkf-text-muted: #9ca3af;
}

body {
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--tkf-text);
}

/* Page layout */
tkf-page {
  display: block;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Page title */
tkf-title-div {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--tkf-accent);
}

tkf-note-title {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Links */
a {
  color: var(--tkf-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

tkf-transclusion[data-mode="title-link"] > a {
  display: block;
  color: inherit;
}

tkf-transclusion[data-mode="title-link"] > a:hover {
  text-decoration: none;
}

tkf-transclusion[data-mode="title-link"] > a:hover tkf-transclusion-title {
  text-decoration: underline;
}

/* Transclusion styles */
tkf-transclusion {
  display: block;
  margin: 1rem 0;
  border: 1px solid var(--tkf-border);
  border-radius: 4px;
  overflow: hidden;
}

tkf-transclusion-title-div {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--tkf-bg-subtle);
  border-bottom: 1px solid var(--tkf-border);
}

tkf-transclusion-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

tkf-transclusion-link {
  display: block;
  font-size: 0.8rem;
  color: var(--tkf-text-muted);
}

tkf-transclusion-inline {
  display: block;
  padding: 0.5rem 1rem;
}

/* Backlinks */
tkf-backlinks {
  display: block;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--tkf-border);
}

tkf-backlinks-header {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tkf-text-muted);
  margin-bottom: 0.5rem;
}

tkf-backlinks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

tkf-backlink-item {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--tkf-accent-light);
  border-radius: 9999px;
  font-size: 0.875rem;
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
}

li + li {
  margin-top: 0.25rem;
}

/* Code */
code {
  font-family: ui-monospace, monospace;
  font-size: 0.875em;
  background: var(--tkf-bg-subtle);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

/* Paragraphs */
p {
  margin: 0.75rem 0;
}
